From 44a7a01e3cd03c26687080a941946aec610e5233 Mon Sep 17 00:00:00 2001 From: Kamran Ahmed Date: Thu, 12 Sep 2024 12:45:46 +0100 Subject: [PATCH] Update UI for projects --- .../Dashboard/PersonalDashboard.tsx | 2 +- src/components/Dashboard/ProgressStack.tsx | 2 +- src/components/FeatureAnnouncement.tsx | 2 +- src/components/NavigationDropdown.tsx | 2 +- src/components/Projects/ProjectsPage.tsx | 32 +++++++++++++++---- 5 files changed, 29 insertions(+), 11 deletions(-) diff --git a/src/components/Dashboard/PersonalDashboard.tsx b/src/components/Dashboard/PersonalDashboard.tsx index c52a48ebd..5a57bd409 100644 --- a/src/components/Dashboard/PersonalDashboard.tsx +++ b/src/components/Dashboard/PersonalDashboard.tsx @@ -258,7 +258,7 @@ export function PersonalDashboard(props: PersonalDashboardProps) { icon={ConstructionEmoji} title="Build Projects" description="Practice what you learn" - href="/backend/projects" + href="/projects" /> {projectsToShow.map((project) => { return ( diff --git a/src/components/FeatureAnnouncement.tsx b/src/components/FeatureAnnouncement.tsx index dfdb4d86c..97b68a411 100644 --- a/src/components/FeatureAnnouncement.tsx +++ b/src/components/FeatureAnnouncement.tsx @@ -23,7 +23,7 @@ export function FeatureAnnouncement(props: FeatureAnnouncementProps) { Projects are live on the{' '} backend roadmap diff --git a/src/components/NavigationDropdown.tsx b/src/components/NavigationDropdown.tsx index cf608a10f..4f2dc56bc 100644 --- a/src/components/NavigationDropdown.tsx +++ b/src/components/NavigationDropdown.tsx @@ -25,7 +25,7 @@ const links = [ Icon: Waypoints, }, { - link: '/backend/projects', + link: '/projects', label: 'Projects', description: 'Skill-up with real-world projects', Icon: FolderKanban, diff --git a/src/components/Projects/ProjectsPage.tsx b/src/components/Projects/ProjectsPage.tsx index d1304c32d..8bdf6ae69 100644 --- a/src/components/Projects/ProjectsPage.tsx +++ b/src/components/Projects/ProjectsPage.tsx @@ -1,6 +1,6 @@ import { useEffect, useMemo, useRef, useState } from 'react'; import { cn } from '../../lib/classname.ts'; -import { Filter, X } from 'lucide-react'; +import {Box, Filter, Group, X} from 'lucide-react'; import { deleteUrlParam, getUrlParams, @@ -13,12 +13,14 @@ import { } from '../../lib/project.ts'; import { ProjectCard } from './ProjectCard.tsx'; +type ProjectGroup = { + id: string; + title: string; + projects: ProjectFileType[]; +}; + type ProjectsPageProps = { - roadmapsProjects: { - id: string; - title: string; - projects: ProjectFileType[]; - }[]; + roadmapsProjects: ProjectGroup[]; userCounts: Record; }; @@ -75,6 +77,10 @@ export function ProjectsPage(props: ProjectsPageProps) { [visibleProjects], ); + const activeGroupDetail = roadmapsProjects.find( + (group) => group.id === activeGroup, + ); + return (
-
+
+
+

+ + {activeGroupDetail + ? `Projects in ${activeGroupDetail?.title}` + : 'All Projects'} +

+

+ Matches found ({sortedVisibleProjects.length}) +

+
+
{sortedVisibleProjects.map((project) => (