|
|
@ -21,9 +21,12 @@ const badgeVariants: Record<ProjectDifficultyType, string> = { |
|
|
|
|
|
|
|
|
|
|
|
export function ProjectCard(props: ProjectCardProps) { |
|
|
|
export function ProjectCard(props: ProjectCardProps) { |
|
|
|
const { project, userCount = 0, status } = props; |
|
|
|
const { project, userCount = 0, status } = props; |
|
|
|
|
|
|
|
|
|
|
|
const { frontmatter, id } = project; |
|
|
|
const { frontmatter, id } = project; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const isLoadingStatus = status === undefined; |
|
|
|
|
|
|
|
const userStartedCount = |
|
|
|
|
|
|
|
status && status !== 'none' ? userCount + 1 : userCount; |
|
|
|
|
|
|
|
|
|
|
|
return ( |
|
|
|
return ( |
|
|
|
<a |
|
|
|
<a |
|
|
|
href={`/projects/${id}`} |
|
|
|
href={`/projects/${id}`} |
|
|
@ -36,28 +39,36 @@ export function ProjectCard(props: ProjectCardProps) { |
|
|
|
/> |
|
|
|
/> |
|
|
|
<Badge variant={'grey'} text={frontmatter.nature} /> |
|
|
|
<Badge variant={'grey'} text={frontmatter.nature} /> |
|
|
|
</span> |
|
|
|
</span> |
|
|
|
<span className="my-3 flex flex-col"> |
|
|
|
<span className="my-3 flex flex-col min-h-[100px]"> |
|
|
|
<span className="mb-1 font-medium">{frontmatter.title}</span> |
|
|
|
<span className="mb-1 font-medium">{frontmatter.title}</span> |
|
|
|
<span className="text-sm text-gray-500">{frontmatter.description}</span> |
|
|
|
<span className="text-sm text-gray-500">{frontmatter.description}</span> |
|
|
|
</span> |
|
|
|
</span> |
|
|
|
<span className="flex items-center gap-2 text-xs text-gray-400"> |
|
|
|
<span className="flex items-center justify-between gap-2 text-xs text-gray-400 min-h-[22px]"> |
|
|
|
<Users className="inline-block size-3.5" /> |
|
|
|
<span className="flex items-center gap-1.5"> |
|
|
|
{userCount > 0 ? ( |
|
|
|
<Users className="size-3.5" /> |
|
|
|
<>{formatCommaNumber(userCount)} Started</> |
|
|
|
{userCount > 0 ? ( |
|
|
|
) : ( |
|
|
|
<>{formatCommaNumber(userCount)} Started</> |
|
|
|
<>Be the first to solve!</> |
|
|
|
) : ( |
|
|
|
)} |
|
|
|
<>Be the first to solve!</> |
|
|
|
|
|
|
|
)} |
|
|
|
|
|
|
|
</span> |
|
|
|
|
|
|
|
|
|
|
|
{status !== 'none' && ( |
|
|
|
{status !== 'none' && ( |
|
|
|
<> |
|
|
|
<> |
|
|
|
<span>·</span> |
|
|
|
|
|
|
|
<span |
|
|
|
<span |
|
|
|
className={cn( |
|
|
|
className={cn( |
|
|
|
'capitalize', |
|
|
|
'flex items-center gap-1.5 capitalize border rounded-full px-2 py-0.5 border-current', |
|
|
|
status === 'completed' && 'text-green-500', |
|
|
|
status === 'completed' && 'text-green-500', |
|
|
|
status === 'started' && 'text-yellow-500', |
|
|
|
status === 'started' && 'text-yellow-500', |
|
|
|
)} |
|
|
|
)} |
|
|
|
> |
|
|
|
> |
|
|
|
|
|
|
|
<span |
|
|
|
|
|
|
|
className={cn('inline-block h-2 w-2 rounded-full', { |
|
|
|
|
|
|
|
'bg-green-500': status === 'completed', |
|
|
|
|
|
|
|
'bg-yellow-500': status === 'started', |
|
|
|
|
|
|
|
})} |
|
|
|
|
|
|
|
/> |
|
|
|
|
|
|
|
|
|
|
|
{status} |
|
|
|
{status} |
|
|
|
</span> |
|
|
|
</span> |
|
|
|
</> |
|
|
|
</> |
|
|
|