diff --git a/src/components/Dashboard/PersonalDashboard.tsx b/src/components/Dashboard/PersonalDashboard.tsx index a6ca134b2..2d8286682 100644 --- a/src/components/Dashboard/PersonalDashboard.tsx +++ b/src/components/Dashboard/PersonalDashboard.tsx @@ -274,12 +274,6 @@ export function PersonalDashboard(props: PersonalDashboardProps) { ? `${import.meta.env.PUBLIC_AVATAR_BASE_URL}/${avatar}` : '/images/default-avatar.png'; - const allRoadmapsAndBestPractices = [ - ...builtInRoleRoadmaps, - ...builtInSkillRoadmaps, - ...builtInBestPractices, - ]; - const enrichedProjects = personalDashboardDetails?.projects .map((project) => { const projectDetail = projectDetails.find( diff --git a/src/components/HeroSection/FavoriteRoadmaps.tsx b/src/components/HeroSection/FavoriteRoadmaps.tsx index 95b9c631f..a824b458f 100644 --- a/src/components/HeroSection/FavoriteRoadmaps.tsx +++ b/src/components/HeroSection/FavoriteRoadmaps.tsx @@ -7,14 +7,13 @@ import { EyeOff, } from 'lucide-react'; import { useState } from 'react'; -import { cn } from '../../lib/classname.ts'; import type { ProjectStatusDocument } from '../Projects/ListProjectSolutions.tsx'; import { CheckIcon } from '../ReactIcons/CheckIcon.tsx'; import type { UserProgress } from '../TeamProgress/TeamProgressPage.tsx'; import { HeroProject } from './HeroProject'; import { HeroRoadmap } from './HeroRoadmap'; -import { HeroTitle } from './HeroTitle'; import { CreateRoadmapButton } from '../CustomRoadmap/CreateRoadmap/CreateRoadmapButton.tsx'; +import { HeroItemsGroup } from './HeroItemsGroup'; export type AIRoadmapType = { id: string; @@ -58,169 +57,120 @@ export function FavoriteRoadmaps(props: FavoriteRoadmapsProps) { return (
-
} + isLoading={isLoading} + title="Your progress and bookmarks" + isAllCollapsed={isAllCollapsed} > -
- - ) as any + {progress.map((resource) => ( + - {!isLoading && progress.length > 0 && !isAllCollapsed && ( -
- {progress.map((resource) => ( - - ))} - -
- )} -
-
+ ))} + + -
} + isLoading={isLoading} + title="Your custom roadmaps" + isAllCollapsed={isAllCollapsed} > -
- ) as any} - isLoading={isLoading} - title="Your custom roadmaps" + {customRoadmaps.map((customRoadmap) => ( + - {!isLoading && customRoadmaps.length > 0 && !isAllCollapsed && ( -
- {customRoadmaps.map((customRoadmap) => ( - - ))} - -
- )} -
-
+ ))} + + -
} + isLoading={isLoading} + title="Your AI roadmaps" + isAllCollapsed={isAllCollapsed} > -
- ) as any} - isLoading={isLoading} - title="Your AI roadmaps" + {aiRoadmaps.map((aiRoadmap) => ( + - {!isLoading && aiRoadmaps.length > 0 && !isAllCollapsed && ( -
- {aiRoadmaps.map((aiRoadmap) => ( - - ))} + ))} - - - Generate New - -
- )} -
-
+ + + Generate New + + -
} + isLoading={isLoading} + title="Your active projects" + isAllCollapsed={isAllCollapsed} + rightContent={ + completedProjects.length > 0 && ( + + ) + } + className="border-b-0" > -
- ) as any - } - isLoading={isLoading} - title="Your active projects" - rightContent={ - completedProjects.length > 0 && ( - - ) - } - /> - {!isLoading && projectsToShow.length > 0 && !isAllCollapsed && ( -
- {projectsToShow.map((project) => ( - - ))} + {projectsToShow.map((project) => ( + + ))} - - - Start a new project - -
- )} -
-
+ + + Start a new project + +
); } diff --git a/src/components/HeroSection/HeroItemsGroup.tsx b/src/components/HeroSection/HeroItemsGroup.tsx new file mode 100644 index 000000000..45e27887d --- /dev/null +++ b/src/components/HeroSection/HeroItemsGroup.tsx @@ -0,0 +1,54 @@ +import type { ReactNode } from 'react'; +import { cn } from '../../lib/classname'; +import { HeroTitle } from './HeroTitle'; + +type HeroItemsGroupProps = { + icon: any; + isLoading?: boolean; + title: string | ReactNode; + rightContent?: ReactNode; + isAllCollapsed?: boolean; + children?: ReactNode; + className?: string; +}; + +export function HeroItemsGroup(props: HeroItemsGroupProps) { + const { + icon, + isLoading = false, + title, + rightContent, + isAllCollapsed = false, + children, + className, + } = props; + + const isCollapsed = isAllCollapsed || isLoading; + + return ( +
+
+ + {!isLoading && !isAllCollapsed && ( +
+ {children} +
+ )} +
+
+ ); +}