diff --git a/src/components/HeroSection/FavoriteRoadmaps.tsx b/src/components/HeroSection/FavoriteRoadmaps.tsx index 1440e0ff8..2a7d629b1 100644 --- a/src/components/HeroSection/FavoriteRoadmaps.tsx +++ b/src/components/HeroSection/FavoriteRoadmaps.tsx @@ -1,4 +1,14 @@ -import { FolderKanban, MapIcon, Plus, Sparkle, ThumbsUp } from 'lucide-react'; +import { + FolderKanban, + MapIcon, + Plus, + Sparkle, + ThumbsUp, + ChevronDown, + ChevronUp, + Eye, + EyeOff, +} from 'lucide-react'; import type { ReactNode } from 'react'; import type { ResourceType } from '../../lib/resource-progress.ts'; import { CreateRoadmapButton } from '../CustomRoadmap/CreateRoadmap/CreateRoadmapButton.tsx'; @@ -8,6 +18,7 @@ import { Spinner } from '../ReactIcons/Spinner.tsx'; import type { UserProgress } from '../TeamProgress/TeamProgressPage.tsx'; import type { ProjectStatusDocument } from '../Projects/ListProjectSolutions.tsx'; import { getRelativeTimeString } from '../../lib/date'; +import { useState } from 'react'; export type AIRoadmapType = { id: string; @@ -66,21 +77,25 @@ type HeroTitleProps = { icon: any; isLoading?: boolean; title: string | ReactNode; + rightContent?: ReactNode; }; function HeroTitle(props: HeroTitleProps) { - const { isLoading = false, title, icon } = props; + const { isLoading = false, title, icon, rightContent } = props; return ( -

- {!isLoading && icon} - {isLoading && ( - - - - )} - {title} -

+
+

+ {!isLoading && icon} + {isLoading && ( + + + + )} + {title} +

+
{rightContent}
+
); } @@ -107,7 +122,7 @@ export function HeroProject({ project }: HeroProjectProps) { className="group relative flex flex-col justify-between gap-2 rounded-md border border-slate-800 bg-slate-900 p-4 hover:border-slate-600" >
-

+

{project.title}

{project.submittedAt && project.repositoryUrl ? 'Submitted' - : 'In Progress'} + : 'Started'}
- - - {project.upvotes} - + {project.submittedAt && project.repositoryUrl && ( + + + {project.upvotes} + + )} {project.startedAt && ( Started {getRelativeTimeString(project.startedAt)} )} @@ -142,6 +159,19 @@ export function HeroProject({ project }: HeroProjectProps) { export function FavoriteRoadmaps(props: FavoriteRoadmapsProps) { const { progress, isLoading, customRoadmaps, aiRoadmaps, projects } = props; + const [showCompleted, setShowCompleted] = useState(false); + + const completedProjects = projects.filter( + (project) => project.submittedAt && project.repositoryUrl, + ); + const inProgressProjects = projects.filter( + (project) => !project.submittedAt || !project.repositoryUrl, + ); + + const projectsToShow = [ + ...inProgressProjects, + ...(showCompleted ? completedProjects : []), + ]; return (
@@ -254,16 +284,31 @@ export function FavoriteRoadmaps(props: FavoriteRoadmapsProps) { } isLoading={isLoading} title="Your projects" + rightContent={ + completedProjects.length > 0 && ( + + ) + } /> - {!isLoading && projects.length > 0 && ( + {!isLoading && projectsToShow.length > 0 && (
- {projects.map((project) => ( + {projectsToShow.map((project) => ( ))} Start a new project