feat: add topics done today count

feat/dashboard
Arik Chakma 3 months ago
parent 445bb3ad2a
commit 2ec69636c2
  1. 2
      src/components/Dashboard/PersonalDashboard.tsx
  2. 9
      src/components/Dashboard/ProgressStack.tsx

@ -19,6 +19,7 @@ type UserDashboardResponse = {
username: string; username: string;
progresses: UserProgress[]; progresses: UserProgress[];
projects: ProjectStatusDocument[]; projects: ProjectStatusDocument[];
topicDoneToday: number;
}; };
export type BuiltInRoadmap = { export type BuiltInRoadmap = {
@ -276,6 +277,7 @@ export function PersonalDashboard(props: PersonalDashboardProps) {
projects={enrichedProjects || []} projects={enrichedProjects || []}
isLoading={isLoading} isLoading={isLoading}
accountStreak={accountStreak} accountStreak={accountStreak}
topicDoneToday={personalDashboardDetails?.topicDoneToday || 0}
/> />
<ListDashboardCustomProgress <ListDashboardCustomProgress

@ -16,6 +16,7 @@ type ProgressStackProps = {
})[]; })[];
accountStreak?: StreakResponse; accountStreak?: StreakResponse;
isLoading: boolean; isLoading: boolean;
topicDoneToday: number;
}; };
const MAX_PROGRESS_TO_SHOW = 5; const MAX_PROGRESS_TO_SHOW = 5;
@ -23,7 +24,8 @@ const MAX_PROJECTS_TO_SHOW = 8;
const MAX_BOOKMARKS_TO_SHOW = 8; const MAX_BOOKMARKS_TO_SHOW = 8;
export function ProgressStack(props: ProgressStackProps) { export function ProgressStack(props: ProgressStackProps) {
const { progresses, projects, isLoading, accountStreak } = props; const { progresses, projects, isLoading, accountStreak, topicDoneToday } =
props;
const bookmarkedProgresses = progresses.filter( const bookmarkedProgresses = progresses.filter(
(progress) => (progress) =>
@ -62,6 +64,11 @@ export function ProgressStack(props: ProgressStackProps) {
value={accountStreak?.count || 0} value={accountStreak?.count || 0}
isLoading={isLoading} isLoading={isLoading}
/> />
<StatsCard
title="Topics Done Today"
value={topicDoneToday}
isLoading={isLoading}
/>
<StatsCard <StatsCard
title="Projects Finished" title="Projects Finished"
value={totalProjectFinished} value={totalProjectFinished}

Loading…
Cancel
Save