import { ThumbsDown, ThumbsUp } from 'lucide-react'; import { getRelativeTimeString } from '../../lib/date'; import { VoteButton } from './VoteButton'; import { GitHubIcon } from '../ReactIcons/GitHubIcon'; import type { AllowedVoteType, ProjectStatusDocument, } from './ListProjectSolutions'; export const submittedAlternatives = [ 'submitted their solution', 'got it done', 'submitted their take', 'finished the project', 'submitted their work', 'completed the project', 'got it done', 'delivered their project', 'handed in their solution', 'provided their deliverables', 'submitted their approach', 'sent in their project', 'presented their take', 'shared their completed task', 'submitted their approach', 'completed it', 'finalized their solution', 'delivered their approach', 'turned in their project', 'submitted their final draft', 'delivered their solution', ]; type ProjectSolutionRowProps = { solution: ProjectStatusDocument & { user: { id: string; name: string; avatar: string; }; voteType?: AllowedVoteType | 'none'; }; counter: number; onVote: (solutionId: string, voteType: AllowedVoteType) => void; onVisitSolution: (solution: ProjectSolutionRowProps['solution']) => void; onLanguageClick?: (language: string) => void; }; export function ProjectSolutionRow(props: ProjectSolutionRowProps) { const { solution, counter, onVote, onVisitSolution, onLanguageClick } = props; const avatar = solution.user.avatar || ''; return (
{solution.user.name}
{solution.user.name} {submittedAlternatives[counter % submittedAlternatives.length] || 'submitted their solution'} ยท {getRelativeTimeString(solution?.submittedAt!)}
{ onVote(solution._id!, 'upvote'); }} /> { onVote(solution._id!, 'downvote'); }} />
{solution.languages && solution.languages.length > 0 && (
{solution.languages.slice(0, 2).map((lang) => ( ))}
)}
); }