diff --git a/src/components/Projects/ListProjectSolutions.tsx b/src/components/Projects/ListProjectSolutions.tsx index 994096ee8..7e10ebd8a 100644 --- a/src/components/Projects/ListProjectSolutions.tsx +++ b/src/components/Projects/ListProjectSolutions.tsx @@ -17,6 +17,7 @@ import { SelectLanguages } from './SelectLanguages.tsx'; import type { ProjectFrontmatter } from '../../lib/project.ts'; import { ProjectSolutionModal } from './ProjectSolutionModal.tsx'; import { SortProjects } from './SortProjects.tsx'; +import { ProjectSolutionRow } from './ProjectSolutionRow'; export interface ProjectStatusDocument { _id?: string; @@ -72,30 +73,6 @@ type ListProjectSolutionsProps = { projectId: string; }; -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', -]; - export function ListProjectSolutions(props: ListProjectSolutionsProps) { const { projectId, project: projectData } = props; @@ -276,73 +253,15 @@ export function ListProjectSolutions(props: ListProjectSolutionsProps) { ) : ( <>
{projectDescription}
++ {projectDescription} +
Submitted their solution{' '} {getRelativeTimeString(solution?.submittedAt!)} diff --git a/src/components/Projects/ProjectSolutionRow.tsx b/src/components/Projects/ProjectSolutionRow.tsx new file mode 100644 index 000000000..45934cd8e --- /dev/null +++ b/src/components/Projects/ProjectSolutionRow.tsx @@ -0,0 +1,111 @@ +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; +}; + +export function ProjectSolutionRow(props: ProjectSolutionRowProps) { + const { solution, counter, onVote, onVisitSolution } = props; + + const avatar = solution.user.avatar || ''; + + return ( +