From efbd1d7f049fb383e2ce3da91226dc2edbea5645 Mon Sep 17 00:00:00 2001 From: Kamran Ahmed Date: Tue, 1 Oct 2024 14:44:55 +0100 Subject: [PATCH] Project card loading status --- src/components/Projects/ProjectCard.tsx | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/components/Projects/ProjectCard.tsx b/src/components/Projects/ProjectCard.tsx index 73dc4c2bb..abcbd20fe 100644 --- a/src/components/Projects/ProjectCard.tsx +++ b/src/components/Projects/ProjectCard.tsx @@ -6,6 +6,7 @@ import type { import { Users } from 'lucide-react'; import { formatCommaNumber } from '../../lib/number.ts'; import { cn } from '../../lib/classname.ts'; +import { isLoggedIn } from '../../lib/jwt.ts'; type ProjectCardProps = { project: ProjectFileType; @@ -23,7 +24,8 @@ export function ProjectCard(props: ProjectCardProps) { const { project, userCount = 0, status } = props; const { frontmatter, id } = project; - const isLoadingStatus = status === undefined; + const isAuthed = isLoggedIn(); + const isLoadingStatus = isAuthed && status === undefined; const userStartedCount = status && status !== 'none' ? userCount + 1 : userCount; @@ -53,14 +55,14 @@ export function ProjectCard(props: ProjectCardProps) { <> - {userCount > 0 ? ( - <>{formatCommaNumber(userCount)} Started + {userStartedCount > 0 ? ( + <>{formatCommaNumber(userStartedCount)} Started ) : ( <>Be the first to solve! )} - {status !== 'none' && ( + {status !== 'none' && isAuthed && (