diff --git a/src/components/Dashboard/PersonalDashboard.tsx b/src/components/Dashboard/PersonalDashboard.tsx index a6a8eb804..141dbf9bc 100644 --- a/src/components/Dashboard/PersonalDashboard.tsx +++ b/src/components/Dashboard/PersonalDashboard.tsx @@ -162,8 +162,6 @@ export function PersonalDashboard(props: PersonalDashboardProps) { ? `${import.meta.env.PUBLIC_AVATAR_BASE_URL}/${avatar}` : '/images/default-avatar.png'; - const currentPeriod = getCurrentPeriod(); - const allRoadmapsAndBestPractices = [ ...builtInRoleRoadmaps, ...builtInSkillRoadmaps, @@ -221,7 +219,7 @@ export function PersonalDashboard(props: PersonalDashboardProps) {
) : (

- Hi {name}, good {currentPeriod}! + Hi {name}, good {getCurrentPeriod()}!

)} @@ -235,23 +233,12 @@ export function PersonalDashboard(props: PersonalDashboardProps) { ) : ( <> - -
- {name} -
- -
-

{name}

-

Setup your profile

-
-
+ /> + ; + icon?: JSXElementConstructor; + imgUrl?: string; title: string; description: string; href: string; }; function DashboardCard(props: DashboardCardProps) { - const { icon: Icon, title, description, href } = props; + const { icon: Icon, imgUrl, title, description, href } = props; return ( -
- -
+ {Icon && ( +
+ +
+ )} + + {imgUrl && ( +
+ {title} +
+ )}

{title}

diff --git a/src/components/Dashboard/ProgressStack.tsx b/src/components/Dashboard/ProgressStack.tsx index 90b869f86..56ee0357b 100644 --- a/src/components/Dashboard/ProgressStack.tsx +++ b/src/components/Dashboard/ProgressStack.tsx @@ -23,6 +23,57 @@ const MAX_PROGRESS_TO_SHOW = 5; const MAX_PROJECTS_TO_SHOW = 8; const MAX_BOOKMARKS_TO_SHOW = 8; +type ProgressLaneProps = { + title: string; + linkText?: string; + linkHref?: string; + isLoading?: boolean; + loadingSkeletonCount?: number; + loadingSkeletonClassName?: string; + children: React.ReactNode; +}; + +function ProgressLane(props: ProgressLaneProps) { + const { + title, + linkText, + linkHref, + isLoading = false, + loadingSkeletonCount = 4, + loadingSkeletonClassName = '', + children, + } = props; + + return ( +
+ + +
+ {isLoading && ( + <> + {Array.from({ length: loadingSkeletonCount }).map((_, index) => ( + + ))} + + )} + {!isLoading && children} +
+
+ ); +} + export function ProgressStack(props: ProgressStackProps) { const { progresses, projects, isLoading, accountStreak, topicDoneToday } = props; @@ -77,31 +128,23 @@ export function ProgressStack(props: ProgressStackProps) {
-
-

Your Progress

- -
- {isLoading ? ( - <> - - - - - - - ) : ( - <> - {userProgressesToShow.map((progress) => { - return ( - - ); - })} - - )} -
+ + {userProgressesToShow.length > 0 && ( + <> + {userProgressesToShow.map((progress) => { + return ( + + ); + })} + + )} {userProgresses.length > MAX_PROGRESS_TO_SHOW && ( )} -
- -
-

Projects

+ -
- {isLoading ? ( - <> - - - - - - - - - - ) : ( - <> - {projectsToShow.map((project) => { - return ( - - ); - })} - - )} -
+ + {projectsToShow.map((project) => { + return ( + + ); + })} {projects.length > MAX_PROJECTS_TO_SHOW && ( )} -
- -
-
-

Bookmarks

- - - - Explore - -
- -
- {isLoading ? ( - <> - - - - - - - - - - ) : ( - <> - {bookmarksToShow.map((progress) => { - return ( - - ); - })} - - )} -
+ + + {bookmarksToShow.map((progress) => { + return ( + + ); + })} {bookmarkedProgresses.length > MAX_BOOKMARKS_TO_SHOW && ( )} -
+
); @@ -260,7 +263,7 @@ function StatsCard(props: StatsCardProps) { return (
-

{title}

+

{title}

{isLoading ? ( ) : (