From d3b20b12774be3545f2cbc219653cb2cced00c6b Mon Sep 17 00:00:00 2001 From: Kamran Ahmed Date: Mon, 7 Oct 2024 12:47:15 +0100 Subject: [PATCH] Add team activity dashboard --- .../Dashboard/DashboardTeamRoadmaps.tsx | 7 ++- src/components/Dashboard/TeamDashboard.tsx | 12 +++-- .../TeamActivity/TeamActivityItem.tsx | 2 +- .../TeamActivity/TeamActivityPage.tsx | 53 +++++++++++++++---- 4 files changed, 57 insertions(+), 17 deletions(-) diff --git a/src/components/Dashboard/DashboardTeamRoadmaps.tsx b/src/components/Dashboard/DashboardTeamRoadmaps.tsx index ca2d1a481..3b7cb7439 100644 --- a/src/components/Dashboard/DashboardTeamRoadmaps.tsx +++ b/src/components/Dashboard/DashboardTeamRoadmaps.tsx @@ -13,6 +13,7 @@ import { useToast } from '../../hooks/use-toast'; import type { TeamResourceConfig } from '../CreateTeam/RoadmapSelector'; import { pageProgressMessage } from '../../stores/page'; import type { BuiltInRoadmap } from './PersonalDashboard'; +import { MapIcon, Users2 } from 'lucide-react'; type DashboardTeamRoadmapsProps = { isLoading: boolean; @@ -205,12 +206,14 @@ export function DashboardTeamRoadmaps(props: DashboardTeamRoadmapsProps) { const roadmapHeading = (

Roadmaps

+ {canManageCurrentTeam && ( - Manage Roadmaps + + Roadmaps )}
diff --git a/src/components/Dashboard/TeamDashboard.tsx b/src/components/Dashboard/TeamDashboard.tsx index c6fbc265d..8315c3668 100644 --- a/src/components/Dashboard/TeamDashboard.tsx +++ b/src/components/Dashboard/TeamDashboard.tsx @@ -9,6 +9,7 @@ import { Tooltip } from '../Tooltip'; import { DashboardTeamRoadmaps } from './DashboardTeamRoadmaps'; import type { BuiltInRoadmap } from './PersonalDashboard'; import { InviteMemberPopup } from '../TeamMembers/InviteMemberPopup'; +import { Users, Users2 } from 'lucide-react'; type TeamDashboardProps = { builtInRoleRoadmaps: BuiltInRoadmap[]; @@ -110,12 +111,14 @@ export function TeamDashboard(props: TeamDashboardProps) {

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

@@ -162,7 +165,10 @@ export function TeamDashboard(props: TeamDashboardProps) { )} - + ); } diff --git a/src/components/TeamActivity/TeamActivityItem.tsx b/src/components/TeamActivity/TeamActivityItem.tsx index 6e21c662e..1a35410e8 100644 --- a/src/components/TeamActivity/TeamActivityItem.tsx +++ b/src/components/TeamActivity/TeamActivityItem.tsx @@ -158,7 +158,7 @@ export function TeamActivityItem(props: TeamActivityItemProps) { const activityLimit = showAll ? activities.length : 5; return ( -
  • +
  • {username} has {activities.length} updates in {uniqueResourcesCount}  resource(s) diff --git a/src/components/TeamActivity/TeamActivityPage.tsx b/src/components/TeamActivity/TeamActivityPage.tsx index 41470767c..e655536c1 100644 --- a/src/components/TeamActivity/TeamActivityPage.tsx +++ b/src/components/TeamActivity/TeamActivityPage.tsx @@ -9,6 +9,12 @@ import { TeamActivityItem } from './TeamActivityItem'; import { TeamActivityTopicsModal } from './TeamActivityTopicsModal'; import { TeamEmptyStream } from './TeamEmptyStream'; import { Pagination } from '../Pagination/Pagination'; +import { + ChartNoAxesGantt, + CircleDashed, + Flag, + LoaderCircle, +} from 'lucide-react'; export type TeamStreamActivity = { _id?: string; @@ -51,10 +57,11 @@ type GetTeamActivityResponse = { type TeamActivityPageProps = { teamId?: string; + canManageCurrentTeam?: boolean; }; export function TeamActivityPage(props: TeamActivityPageProps) { - const { teamId: defaultTeamId } = props; + const { teamId: defaultTeamId, canManageCurrentTeam = false } = props; const { t: teamId = defaultTeamId } = getUrlParams(); const toast = useToast(); @@ -182,6 +189,38 @@ export function TeamActivityPage(props: TeamActivityPageProps) { return enrichedUsers; }, [users, activities]); + const sectionHeading = ( +

    + Team Activity + + {canManageCurrentTeam && ( + + + Progresses + + )} +

    + ); + + if (isLoading) { + return ( + <> + {sectionHeading} +
    + {Array.from({ length: 4 }).map((_, index) => ( +
    + ))} +
    + + ); + } + if (!teamId) { if (typeof window !== 'undefined') { window.location.href = '/'; @@ -190,10 +229,6 @@ export function TeamActivityPage(props: TeamActivityPageProps) { } } - if (isLoading) { - return null; - } - return ( <> {selectedActivity && ( @@ -205,9 +240,7 @@ export function TeamActivityPage(props: TeamActivityPageProps) { {usersWithActivities.length > 0 ? ( <> -

    - Team Activity -

    + {sectionHeading}
      {usersWithActivities.map((user, index) => { return ( @@ -237,9 +270,7 @@ export function TeamActivityPage(props: TeamActivityPageProps) { ) : ( <> -

      - Team Activity -

      + {sectionHeading}