diff --git a/src/components/Dashboard/DashboardAiRoadmaps.tsx b/src/components/Dashboard/DashboardAiRoadmaps.tsx new file mode 100644 index 000000000..5da40545f --- /dev/null +++ b/src/components/Dashboard/DashboardAiRoadmaps.tsx @@ -0,0 +1,78 @@ +import type { UserProgress } from '../TeamProgress/TeamProgressPage'; +import { DashboardCustomProgressCard } from './DashboardCustomProgressCard'; +import { DashboardCardLink } from './DashboardCardLink'; +import { useState } from 'react'; +import { CreateRoadmapModal } from '../CustomRoadmap/CreateRoadmap/CreateRoadmapModal'; +import { Simulate } from 'react-dom/test-utils'; +import { Bot, BrainCircuit, Map, PencilRuler } from 'lucide-react'; + +type DashboardAiRoadmapsProps = { + roadmaps: { + id: string; + title: string; + slug: string; + }[]; + isLoading?: boolean; +}; + +export function DashboardAiRoadmaps(props: DashboardAiRoadmapsProps) { + const { roadmaps, isLoading = false } = props; + + return ( + <> +

+ AI Generated Roadmaps +

+ + {!isLoading && roadmaps.length === 0 && ( + + )} + +
+ {isLoading && ( + <> + {Array.from({ length: 9 }).map((_, index) => ( + + ))} + + )} + + {!isLoading && roadmaps.length > 0 && ( + <> + {roadmaps.map((roadmap) => ( + + {roadmap.title} + + ))} + + + + Generate New + + + )} +
+ + ); +} + +type CustomProgressCardSkeletonProps = {}; + +function RoadmapCardSkeleton( + props: CustomProgressCardSkeletonProps, +) { + return ( +
+ ); +} diff --git a/src/components/Dashboard/DashboardCustomProgressCard.tsx b/src/components/Dashboard/DashboardCustomProgressCard.tsx index b84b3d3a6..9464d5a73 100644 --- a/src/components/Dashboard/DashboardCustomProgressCard.tsx +++ b/src/components/Dashboard/DashboardCustomProgressCard.tsx @@ -36,7 +36,7 @@ export function DashboardCustomProgressCard(props: DashboardCustomProgressCardPr return (

{resourceTitle}

diff --git a/src/components/Dashboard/PersonalDashboard.tsx b/src/components/Dashboard/PersonalDashboard.tsx index 1436893e5..c52a48ebd 100644 --- a/src/components/Dashboard/PersonalDashboard.tsx +++ b/src/components/Dashboard/PersonalDashboard.tsx @@ -13,6 +13,7 @@ import { $accountStreak, type StreakResponse } from '../../stores/streak'; import { CheckEmoji } from '../ReactIcons/CheckEmoji.tsx'; import { ConstructionEmoji } from '../ReactIcons/ConstructionEmoji.tsx'; import { BookEmoji } from '../ReactIcons/BookEmoji.tsx'; +import { DashboardAiRoadmaps } from './DashboardAiRoadmaps.tsx'; type UserDashboardResponse = { name: string; @@ -22,6 +23,11 @@ type UserDashboardResponse = { username: string; progresses: UserProgress[]; projects: ProjectStatusDocument[]; + aiRoadmaps: { + id: string; + title: string; + slug: string; + }[]; topicDoneToday: number; }; @@ -142,6 +148,7 @@ export function PersonalDashboard(props: PersonalDashboardProps) { return updatedAtB.getTime() - updatedAtA.getTime(); }); + const aiGeneratedRoadmaps = personalDashboardDetails?.aiRoadmaps || []; const customRoadmaps = (personalDashboardDetails?.progresses || []) .filter((progress) => progress.isCustomResource) .sort((a, b) => { @@ -150,13 +157,6 @@ export function PersonalDashboard(props: PersonalDashboardProps) { return updatedAtB.getTime() - updatedAtA.getTime(); }); - const aiGeneratedRoadmaps = customRoadmaps.filter( - (progress) => progress?.aiRoadmapId, - ); - const customRoadmapsToShow = customRoadmaps.filter( - (progress) => !progress?.aiRoadmapId, - ); - const { avatar, name } = personalDashboardDetails || {}; const avatarLink = avatar ? `${import.meta.env.PUBLIC_AVATAR_BASE_URL}/${avatar}` @@ -182,7 +182,14 @@ export function PersonalDashboard(props: PersonalDashboardProps) { const recommendedRoadmapIds = new Set( relatedRoadmapIds.length === 0 - ? ['frontend', 'backend', 'devops', 'ai-data-scientist', 'full-stack', 'api-design'] + ? [ + 'frontend', + 'backend', + 'devops', + 'ai-data-scientist', + 'full-stack', + 'api-design', + ] : relatedRoadmapIds, ); @@ -272,14 +279,13 @@ export function PersonalDashboard(props: PersonalDashboardProps) { /> - {title}