diff --git a/src/components/Dashboard/DashboardBookmarkCard.tsx b/src/components/Dashboard/DashboardBookmarkCard.tsx index 3a7bafbb9..10bd984b6 100644 --- a/src/components/Dashboard/DashboardBookmarkCard.tsx +++ b/src/components/Dashboard/DashboardBookmarkCard.tsx @@ -27,9 +27,9 @@ export function DashboardBookmarkCard(props: DashboardBookmarkCardProps) { - +

{resourceTitle}

); diff --git a/src/components/Dashboard/EmptyStackMessage.tsx b/src/components/Dashboard/EmptyStackMessage.tsx new file mode 100644 index 000000000..c0fc65567 --- /dev/null +++ b/src/components/Dashboard/EmptyStackMessage.tsx @@ -0,0 +1,32 @@ +type EmptyStackMessageProps = { + number: number; + title: string; + description: string; + buttonText: string; + buttonLink: string; +}; + +export function EmptyStackMessage(props: EmptyStackMessageProps) { + const { number, title, description, buttonText, buttonLink } = props; + + return ( +
+
+ + {number} + +
+

{title}

+

{description}

+
+ + + {buttonText} + +
+
+ ); +} diff --git a/src/components/Dashboard/ProgressStack.tsx b/src/components/Dashboard/ProgressStack.tsx index 4c0d9faef..29a16137a 100644 --- a/src/components/Dashboard/ProgressStack.tsx +++ b/src/components/Dashboard/ProgressStack.tsx @@ -14,6 +14,7 @@ import { cn } from '../../lib/classname'; import { DashboardProgressCard } from './DashboardProgressCard'; import { useStore } from '@nanostores/react'; import { $accountStreak, type StreakResponse } from '../../stores/streak'; +import { EmptyStackMessage } from './EmptyStackMessage.tsx'; type ProgressStackProps = { progresses: UserProgress[]; @@ -26,8 +27,8 @@ type ProgressStackProps = { }; const MAX_PROGRESS_TO_SHOW = 5; +const MAX_BOOKMARKS_TO_SHOW = 5; const MAX_PROJECTS_TO_SHOW = 8; -const MAX_BOOKMARKS_TO_SHOW = 8; type ProgressLaneProps = { title: string; @@ -74,7 +75,7 @@ function ProgressLane(props: ProgressLaneProps) { {linkText && linkHref && ( {linkText} @@ -83,7 +84,7 @@ function ProgressLane(props: ProgressLaneProps) { )} -
+
{isLoading && ( <> {Array.from({ length: loadingSkeletonCount }).map((_, index) => ( @@ -166,98 +167,139 @@ export function ProgressStack(props: ProgressStackProps) {
- - {userProgressesToShow.length > 0 && ( - <> - {userProgressesToShow.map((progress) => { - return ( - - ); - })} - - )} - - {userProgresses.length > MAX_PROGRESS_TO_SHOW && ( - + {!isLoading && bookmarksToShow.length === 0 && ( + )} - - - {projectsToShow.map((project) => { - return ( - - ); - })} - - {projects.length > MAX_PROJECTS_TO_SHOW && ( - + {bookmarksToShow.map((progress) => { + return ( + + ); + })} + {bookmarkedProgresses.length > MAX_BOOKMARKS_TO_SHOW && ( + + )} + +
+ +
+ {!isLoading && userProgressesToShow.length === 0 && ( + )} - + + {userProgressesToShow.length > 0 && ( + <> + {userProgressesToShow.map((progress) => { + return ( + + ); + })} + + )} - - {bookmarksToShow.map((progress) => { - return ( - MAX_PROGRESS_TO_SHOW && ( + - ); - })} - {bookmarkedProgresses.length > MAX_BOOKMARKS_TO_SHOW && ( - - )} - + )} + +
+ +
+ + {!isLoading && projectsToShow.length === 0 && ( + + )} + + {projectsToShow.map((project) => { + return ( + + ); + })} + + {projects.length > MAX_PROJECTS_TO_SHOW && ( + + )} + +
);