import type { FindSocialCardQuery } from 'types/graphql' import type { CellSuccessProps, CellFailureProps } from '@redwoodjs/web' import Svg from 'src/components/Svg/Svg' import { Image as CloudinaryImage } from 'cloudinary-react' import Gravatar from 'src/components/Gravatar/Gravatar' import CadPackage from 'src/components/CadPackage/CadPackage' export const QUERY = gql` query FindSocialCardQuery($userName: String!, $projectTitle: String) { userProject: userName(userName: $userName) { userName image Project(projectTitle: $projectTitle) { id title description mainImage createdAt updatedAt userId cadPackage Reaction { emote } } } } ` export const Loading = () =>
Loading...
export const Empty = () =>
Empty
export const Failure = ({ error }: CellFailureProps) => (
Error: {error.message}
) interface SocialCardProps extends CellSuccessProps { children: React.ReactNode } export const Success = ({ userProject, variables: { image64 }, children, }: SocialCardProps) => { const image = userProject?.Project?.mainImage const gravatar = userProject?.image const truncatedDescription = userProject?.Project?.description?.length > 150 ? (userProject?.Project?.description || '').slice(0, 145) + ' . . .' : userProject?.Project?.description || '' return (
{gravatar && ( )}
{userProject?.userName}

{userProject?.Project?.title.replace(/-/g, ' ')}

{truncatedDescription}

{image64 ? (
) : (
)}
{children && (
{children}
)}
{[ { svg: 'reactions', title: 'Reactions', count: userProject?.Project?.Reaction?.length, }, { svg: 'fork-new', title: 'Forks', count: 0, }, ].map(({ svg, title, count }, index) => (
{count}
{title}
))}
{/* Because of how specific these styles are to this heading/logo and it doesn't need to be replicated else where as well as it's very precise with the placement of "pre-alpha" I think it's appropriate. */}

CadHub

) }