diff --git a/src/components/Dashboard/DashboardAiRoadmaps.tsx b/src/components/Dashboard/DashboardAiRoadmaps.tsx index aa578665c..c3d96bbec 100644 --- a/src/components/Dashboard/DashboardAiRoadmaps.tsx +++ b/src/components/Dashboard/DashboardAiRoadmaps.tsx @@ -4,7 +4,13 @@ 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'; +import { + ArrowUpRight, + Bot, + BrainCircuit, + Map, + PencilRuler, +} from 'lucide-react'; type DashboardAiRoadmapsProps = { roadmaps: { @@ -20,9 +26,21 @@ export function DashboardAiRoadmaps(props: DashboardAiRoadmapsProps) { return ( <> -

- AI Generated Roadmaps -

+
+

+ AI Generated Roadmaps +

+ + {!isLoading && roadmaps.length !== 0 && ( + + + AI Generated Roadmaps + + )} +
{!isLoading && roadmaps.length === 0 && ( ( {roadmap.title} @@ -69,9 +87,7 @@ export function DashboardAiRoadmaps(props: DashboardAiRoadmapsProps) { type CustomProgressCardSkeletonProps = {}; -function RoadmapCardSkeleton( - props: CustomProgressCardSkeletonProps, -) { +function RoadmapCardSkeleton(props: CustomProgressCardSkeletonProps) { return (
); diff --git a/src/components/Dashboard/EmptyStackMessage.tsx b/src/components/Dashboard/EmptyStackMessage.tsx index c0fc65567..1552da99f 100644 --- a/src/components/Dashboard/EmptyStackMessage.tsx +++ b/src/components/Dashboard/EmptyStackMessage.tsx @@ -1,17 +1,26 @@ +import { cn } from '../../lib/classname'; + type EmptyStackMessageProps = { - number: number; + number: number | string; title: string; description: string; buttonText: string; buttonLink: string; + bodyClassName?: string; }; export function EmptyStackMessage(props: EmptyStackMessageProps) { - const { number, title, description, buttonText, buttonLink } = props; + const { number, title, description, buttonText, buttonLink, bodyClassName } = + props; return (
-
+
{number} diff --git a/src/components/Dashboard/ListDashboardCustomProgress.tsx b/src/components/Dashboard/ListDashboardCustomProgress.tsx index 8e552cbb1..3dbc47304 100644 --- a/src/components/Dashboard/ListDashboardCustomProgress.tsx +++ b/src/components/Dashboard/ListDashboardCustomProgress.tsx @@ -4,7 +4,13 @@ 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'; +import { + ArrowUpRight, + Bot, + BrainCircuit, + Map, + PencilRuler, +} from 'lucide-react'; type ListDashboardCustomProgressProps = { progresses: UserProgress[]; @@ -40,9 +46,21 @@ export function ListDashboardCustomProgress( <> {customRoadmapModal} -

- {isAIGeneratedRoadmaps ? 'AI Generated Roadmaps' : 'Custom Roadmaps'} -

+
+

+ {isAIGeneratedRoadmaps ? 'AI Generated Roadmaps' : 'Custom Roadmaps'} +

+ + {!isLoading && progresses.length !== 0 && ( + + + Community Roadmaps + + )} +
{!isLoading && progresses.length === 0 && isAIGeneratedRoadmaps && ( +
{isLoading && (
@@ -86,11 +94,13 @@ function ProgressLane(props: ProgressLaneProps) {
{isLoading && ( - <> +
{Array.from({ length: loadingSkeletonCount }).map((_, index) => ( ))} - +
)} {!isLoading && children} @@ -119,29 +129,27 @@ export function ProgressStack(props: ProgressStackProps) { const { progresses, projects, isLoading, accountStreak, topicDoneToday } = props; - const bookmarkedProgresses = progresses.filter( - (progress) => progress?.isFavorite, - ); + const [showAllProgresses, setShowAllProgresses] = useState(false); + const sortedProgresses = progresses.sort((a, b) => { + if (a.isFavorite && !b.isFavorite) { + return 1; + } - const userProgresses = progresses.filter( - (progress) => !progress?.isFavorite || progress?.done > 0, - ); + if (!a.isFavorite && b.isFavorite) { + return -1; + } - const [showAllProgresses, setShowAllProgresses] = useState(false); + return 0; + }); const userProgressesToShow = showAllProgresses - ? userProgresses - : userProgresses.slice(0, MAX_PROGRESS_TO_SHOW); + ? sortedProgresses + : sortedProgresses.slice(0, MAX_PROGRESS_TO_SHOW); const [showAllProjects, setShowAllProjects] = useState(false); const projectsToShow = showAllProjects ? projects : projects.slice(0, MAX_PROJECTS_TO_SHOW); - const [showAllBookmarks, setShowAllBookmarks] = useState(false); - const bookmarksToShow = showAllBookmarks - ? bookmarkedProgresses - : bookmarkedProgresses.slice(0, MAX_BOOKMARKS_TO_SHOW); - const totalProjectFinished = projects.filter( (project) => project.repositoryUrl, ).length; @@ -167,92 +175,70 @@ export function ProgressStack(props: ProgressStackProps) {
-
- {!isLoading && bookmarksToShow.length === 0 && ( +
+ {!isLoading && userProgressesToShow.length === 0 && ( )} - {bookmarksToShow.map((progress) => { - return ( - + {userProgressesToShow.length > 0 && ( + <> + {userProgressesToShow.map((progress) => { + const isFavorite = + progress.isFavorite && + !progress.done && + !progress.skipped; + + if (isFavorite) { + return ( + + ); + } + + return ( + + ); + })} + + )} + + {sortedProgresses.length > MAX_PROGRESS_TO_SHOW && ( + - ); - })} - {bookmarkedProgresses.length > MAX_BOOKMARKS_TO_SHOW && ( - - )} - -
- -
- {!isLoading && userProgressesToShow.length === 0 && ( - - )} - - {userProgressesToShow.length > 0 && ( - <> - {userProgressesToShow.map((progress) => { - return ( - - ); - })} - - )} - - {userProgresses.length > MAX_PROGRESS_TO_SHOW && ( - - )} + )} +
@@ -262,6 +248,7 @@ export function ProgressStack(props: ProgressStackProps) { linkHref={'/projects'} linkText={'Projects'} isLoading={isLoading} + loadingWrapperClassName="grid-cols-1" loadingSkeletonClassName={'h-5'} loadingSkeletonCount={8} isEmpty={projectsToShow.length === 0} @@ -272,7 +259,7 @@ export function ProgressStack(props: ProgressStackProps) { > {!isLoading && projectsToShow.length === 0 && ( - - + ); } @@ -341,7 +326,7 @@ function CardSkeleton(props: CardSkeletonProps) { return (