From 59695c2032250c8c7acb03332e5f2e7ea4edbb24 Mon Sep 17 00:00:00 2001 From: Kamran Ahmed Date: Wed, 1 May 2024 22:59:03 +0100 Subject: [PATCH] Team activity item dates --- .../TeamActivity/TeamActivityItem.tsx | 15 ++++++++------- .../TeamActivity/TeamActivityPage.tsx | 1 + src/lib/date.ts | 19 +++++++++++++++++-- 3 files changed, 26 insertions(+), 9 deletions(-) diff --git a/src/components/TeamActivity/TeamActivityItem.tsx b/src/components/TeamActivity/TeamActivityItem.tsx index f63c2def2..68a07c1ff 100644 --- a/src/components/TeamActivity/TeamActivityItem.tsx +++ b/src/components/TeamActivity/TeamActivityItem.tsx @@ -5,6 +5,7 @@ import { ChevronsDown, ChevronsUp } from 'lucide-react'; type TeamActivityItemProps = { onTopicClick?: (activity: TeamStreamActivity) => void; + teamId: string; user: { activities: TeamStreamActivity[]; _id: string; @@ -15,7 +16,7 @@ type TeamActivityItemProps = { }; export function TeamActivityItem(props: TeamActivityItemProps) { - const { user, onTopicClick } = props; + const { user, onTopicClick, teamId } = props; const { activities } = user; const [showAll, setShowAll] = useState(false); @@ -42,7 +43,7 @@ export function TeamActivityItem(props: TeamActivityItemProps) { {resourceTitle} @@ -51,7 +52,7 @@ export function TeamActivityItem(props: TeamActivityItemProps) { const timeAgo = (date: string | Date) => ( - {getRelativeTimeString(new Date(date).toISOString())} + {getRelativeTimeString(new Date(date).toISOString(), true)} ); const userAvatar = user.avatar @@ -77,7 +78,7 @@ export function TeamActivityItem(props: TeamActivityItemProps) { return (
  • {actionType === 'in_progress' && ( <> @@ -122,13 +123,13 @@ export function TeamActivityItem(props: TeamActivityItemProps) { const activityLimit = showAll ? activities.length : 5; return ( -
  • +
  • {username} has {activities.length} updates in {uniqueResourcesCount}{' '} resource(s)

    -
      +
        {activities.slice(0, activityLimit).map((activity) => { const { actionType, topicIds } = activity; const topicCount = topicIds?.length || 0; @@ -173,7 +174,7 @@ export function TeamActivityItem(props: TeamActivityItemProps) { {activities.length > 5 && (