diff --git a/src/components/Projects/ProjectCard.tsx b/src/components/Projects/ProjectCard.tsx index 07337e392..057740ab8 100644 --- a/src/components/Projects/ProjectCard.tsx +++ b/src/components/Projects/ProjectCard.tsx @@ -21,9 +21,12 @@ const badgeVariants: Record = { export function ProjectCard(props: ProjectCardProps) { const { project, userCount = 0, status } = props; - const { frontmatter, id } = project; + const isLoadingStatus = status === undefined; + const userStartedCount = + status && status !== 'none' ? userCount + 1 : userCount; + return ( - + {frontmatter.title} {frontmatter.description} - - - {userCount > 0 ? ( - <>{formatCommaNumber(userCount)} Started - ) : ( - <>Be the first to solve! - )} + + + + {userCount > 0 ? ( + <>{formatCommaNumber(userCount)} Started + ) : ( + <>Be the first to solve! + )} + {status !== 'none' && ( <> - · + + {status} diff --git a/src/components/Projects/ProjectsList.tsx b/src/components/Projects/ProjectsList.tsx index e7158f40f..2b5a783bf 100644 --- a/src/components/Projects/ProjectsList.tsx +++ b/src/components/Projects/ProjectsList.tsx @@ -58,7 +58,7 @@ export function ProjectsList(props: ProjectsListProps) { ProjectDifficultyType | undefined >(urlDifficulty); const [projectStatuses, setProjectStatuses] = - useState({}); + useState(); const loadProjectStatuses = async () => { const projectIds = projects.map((project) => project.id); @@ -112,6 +112,7 @@ export function ProjectsList(props: ProjectsListProps) {
{projectDifficulties.map((projectDifficulty) => ( { setDifficulty(projectDifficulty); setUrlParams({ difficulty: projectDifficulty }); @@ -166,9 +167,14 @@ export function ProjectsList(props: ProjectsListProps) { const count = userCounts[matchingProject?.id] || 0; return ( ); })}