import { Badge } from '../Badge.tsx'; import { Users } from 'lucide-react'; import { formatCommaNumber } from '../../lib/number.ts'; import { cn } from '../../lib/classname.ts'; import type { AllowedOfficialProjectDifficulty, OfficialProjectDocument, } from '../../queries/official-project.ts'; type ProjectCardProps = { project: OfficialProjectDocument; userCount?: number; status?: 'completed' | 'started' | 'none'; }; const badgeVariants: Record = { beginner: 'yellow', intermediate: 'green', advanced: 'blue', }; export function ProjectCard(props: ProjectCardProps) { const { project, userCount = 0, status } = props; const { difficulty, title, description, slug, topics = [] } = project; const isLoadingStatus = status === undefined; const userStartedCount = status !== 'none' && userCount === 0 ? userCount + 1 : userCount; return ( {topics?.map((topic) => )} {title} {description} {isLoadingStatus ? ( <> {' '} {' '} ) : ( <> {userStartedCount > 0 ? ( <>{formatCommaNumber(userStartedCount)} Started ) : ( <>Be the first to solve! )} {status !== 'none' && ( {status} )} )} ); }