From 0e787b49c6f013e796a9f7200280f98dadfd9979 Mon Sep 17 00:00:00 2001 From: Kamran Ahmed Date: Mon, 7 Oct 2024 12:11:15 +0100 Subject: [PATCH] UI changes for team dashboard --- .astro/settings.json | 2 +- src/components/Activity/ActivityStream.tsx | 8 ++- src/components/Activity/EmptyActivity.tsx | 2 +- src/components/Activity/EmptyStream.tsx | 21 +----- .../Dashboard/DashboardTeamRoadmaps.tsx | 67 ++++++++++++------- src/components/Dashboard/TeamDashboard.tsx | 17 +++-- .../TeamActivity/TeamActivityItem.tsx | 2 +- .../TeamActivity/TeamActivityPage.tsx | 16 ++++- .../TeamActivity/TeamEmptyStream.tsx | 2 +- .../TeamMemberDetails/TeamMemberEmptyPage.tsx | 11 +-- .../TeamRoadmapsList/TeamRoadmaps.tsx | 6 +- src/data/projects/log-analyser.md | 48 +++++++++++++ 12 files changed, 131 insertions(+), 71 deletions(-) create mode 100644 src/data/projects/log-analyser.md diff --git a/.astro/settings.json b/.astro/settings.json index b81828642..ceb2ed8a8 100644 --- a/.astro/settings.json +++ b/.astro/settings.json @@ -3,6 +3,6 @@ "enabled": false }, "_variables": { - "lastUpdateCheck": 1727095669945 + "lastUpdateCheck": 1728296475293 } } \ No newline at end of file diff --git a/src/components/Activity/ActivityStream.tsx b/src/components/Activity/ActivityStream.tsx index 7817d72bb..3de1c1e1a 100644 --- a/src/components/Activity/ActivityStream.tsx +++ b/src/components/Activity/ActivityStream.tsx @@ -56,9 +56,11 @@ export function ActivityStream(props: ActivityStreamProps) { return (
-

- Learning Activity -

+ {activities.length > 0 && ( +

+ Learning Activity +

+ )} {selectedActivity && (
- +

No Progress

diff --git a/src/components/Activity/EmptyStream.tsx b/src/components/Activity/EmptyStream.tsx index ca57f2c2c..94b037937 100644 --- a/src/components/Activity/EmptyStream.tsx +++ b/src/components/Activity/EmptyStream.tsx @@ -4,26 +4,11 @@ export function EmptyStream() { return (

- + -

No Activities

+

No Activity

- Activities will appear here as you start tracking your  - - Roadmaps - - ,  - - Best Practices - -  or  - - Questions - -  progress. + Activities will appear here as you start tracking your progress.

diff --git a/src/components/Dashboard/DashboardTeamRoadmaps.tsx b/src/components/Dashboard/DashboardTeamRoadmaps.tsx index 735782c98..ca2d1a481 100644 --- a/src/components/Dashboard/DashboardTeamRoadmaps.tsx +++ b/src/components/Dashboard/DashboardTeamRoadmaps.tsx @@ -202,32 +202,49 @@ export function DashboardTeamRoadmaps(props: DashboardTeamRoadmapsProps) { /> ); + const roadmapHeading = ( +
+

Roadmaps

+ {canManageCurrentTeam && ( + + Manage Roadmaps + + )} +
+ ); + if (!isLoading && learningRoadmapsToShow.length === 0) { return ( -
- {pickRoadmapOptionModal} - {addRoadmapModal} - {createRoadmapModal} - {confirmationContentIdModal} - - - -

No roadmaps

-

- {canManageCurrentTeam - ? 'Add a roadmap to start tracking your team' - : 'Ask your team admin to add some roadmaps'} -

- - {canManageCurrentTeam && ( - - )} -
+ <> + {roadmapHeading} +
+ {pickRoadmapOptionModal} + {addRoadmapModal} + {createRoadmapModal} + {confirmationContentIdModal} + + + +

No roadmaps

+

+ {canManageCurrentTeam + ? 'Add a roadmap to start tracking your team' + : 'Ask your team admin to add some roadmaps'} +

+ + {canManageCurrentTeam && ( + + )} +
+ ); } @@ -238,7 +255,7 @@ export function DashboardTeamRoadmaps(props: DashboardTeamRoadmapsProps) { {createRoadmapModal} {confirmationContentIdModal} -

Roadmaps

+ {roadmapHeading} {isLoading && } {!isLoading && learningRoadmapsToShow.length > 0 && (
diff --git a/src/components/Dashboard/TeamDashboard.tsx b/src/components/Dashboard/TeamDashboard.tsx index 3f502b9ce..c6fbc265d 100644 --- a/src/components/Dashboard/TeamDashboard.tsx +++ b/src/components/Dashboard/TeamDashboard.tsx @@ -3,13 +3,9 @@ import type { TeamMember } from '../TeamProgress/TeamProgressPage'; import { httpGet } from '../../lib/http'; import { useToast } from '../../hooks/use-toast'; import { getUser } from '../../lib/jwt'; -import { LoadingProgress } from './LoadingProgress'; -import { ResourceProgress } from '../Activity/ResourceProgress'; import { TeamActivityPage } from '../TeamActivity/TeamActivityPage'; import { cn } from '../../lib/classname'; import { Tooltip } from '../Tooltip'; -import { DashboardCardLink } from './DashboardCardLink'; -import { PencilRuler } from 'lucide-react'; import { DashboardTeamRoadmaps } from './DashboardTeamRoadmaps'; import type { BuiltInRoadmap } from './PersonalDashboard'; import { InviteMemberPopup } from '../TeamMembers/InviteMemberPopup'; @@ -34,6 +30,7 @@ export function TeamDashboard(props: TeamDashboardProps) { const { response, error } = await httpGet( `${import.meta.env.PUBLIC_API_URL}/v1-get-team-progress/${teamId}`, ); + if (error || !response) { toast.error(error?.message || 'Failed to get team progress'); return; @@ -111,8 +108,16 @@ export function TeamDashboard(props: TeamDashboardProps) { builtInSkillRoadmaps={builtInSkillRoadmaps} /> -

+

Team Members + {canManageCurrentTeam && ( + + Manage Members + + )}

{isLoading && } {!isLoading && ( @@ -157,7 +162,7 @@ export function TeamDashboard(props: TeamDashboardProps) {
)} - {!isLoading && } + ); } diff --git a/src/components/TeamActivity/TeamActivityItem.tsx b/src/components/TeamActivity/TeamActivityItem.tsx index f0e287ee6..6e21c662e 100644 --- a/src/components/TeamActivity/TeamActivityItem.tsx +++ b/src/components/TeamActivity/TeamActivityItem.tsx @@ -102,7 +102,7 @@ export function TeamActivityItem(props: TeamActivityItemProps) { return (
  • {actionType === 'in_progress' && ( <> diff --git a/src/components/TeamActivity/TeamActivityPage.tsx b/src/components/TeamActivity/TeamActivityPage.tsx index 5fe64182d..41470767c 100644 --- a/src/components/TeamActivity/TeamActivityPage.tsx +++ b/src/components/TeamActivity/TeamActivityPage.tsx @@ -183,8 +183,11 @@ export function TeamActivityPage(props: TeamActivityPageProps) { }, [users, activities]); if (!teamId) { - window.location.href = '/'; - return; + if (typeof window !== 'undefined') { + window.location.href = '/'; + } else { + return null; + } } if (isLoading) { @@ -233,7 +236,14 @@ export function TeamActivityPage(props: TeamActivityPageProps) { /> ) : ( - + <> +

    + Team Activity +

    +
    + +
    + )} ); diff --git a/src/components/TeamActivity/TeamEmptyStream.tsx b/src/components/TeamActivity/TeamEmptyStream.tsx index 9fa63487b..25823c291 100644 --- a/src/components/TeamActivity/TeamEmptyStream.tsx +++ b/src/components/TeamActivity/TeamEmptyStream.tsx @@ -10,7 +10,7 @@ export function TeamEmptyStream(props: TeamActivityItemProps) { return (
    - +

    No Activity

    diff --git a/src/components/TeamMemberDetails/TeamMemberEmptyPage.tsx b/src/components/TeamMemberDetails/TeamMemberEmptyPage.tsx index b3537c34d..4de37f834 100644 --- a/src/components/TeamMemberDetails/TeamMemberEmptyPage.tsx +++ b/src/components/TeamMemberDetails/TeamMemberEmptyPage.tsx @@ -10,18 +10,11 @@ export function TeamMemberEmptyPage(props: TeamMemberEmptyPageProps) { return (

    - +

    No Progress

    - Progress will appear here as they start tracking their{' '} - - Roadmaps - {' '} - progress. + Progress will appear here as they start tracking their roadmaps.

    diff --git a/src/components/TeamRoadmapsList/TeamRoadmaps.tsx b/src/components/TeamRoadmapsList/TeamRoadmaps.tsx index 980a9dadf..a33156a19 100644 --- a/src/components/TeamRoadmapsList/TeamRoadmaps.tsx +++ b/src/components/TeamRoadmapsList/TeamRoadmaps.tsx @@ -309,9 +309,9 @@ export function TeamRoadmaps() { {createRoadmapModal} {confirmationContentIdModal} - + -

    No roadmaps

    +

    No roadmaps

    {canManageCurrentTeam ? 'Add a roadmap to start tracking your team' @@ -320,7 +320,7 @@ export function TeamRoadmaps() { {canManageCurrentTeam && (