Skip to content

Commit 40983a1

Browse files
committed
finalActivityLogDate
1 parent 6f4b9cd commit 40983a1

File tree

2 files changed

+24
-9
lines changed

2 files changed

+24
-9
lines changed

apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/groups/[groupSlug]/rewards/group-rewards.tsx

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import {
1111
useRewardSheet,
1212
} from "@/ui/partners/rewards/add-edit-reward-sheet";
1313
import { EventType } from "@dub/prisma/client";
14-
import { Button, useRouterStuff } from "@dub/ui";
14+
import { Button, TimestampTooltip, useRouterStuff } from "@dub/ui";
1515
import { cn, formatDate } from "@dub/utils";
1616
import Link from "next/link";
1717
import { useParams } from "next/navigation";
@@ -142,6 +142,7 @@ const RewardItem = ({
142142

143143
const {
144144
hasActivityLogs,
145+
finalActivityLogDate,
145146
rewardHistorySheet,
146147
setIsOpen: setHistoryOpen,
147148
} = useRewardHistorySheet({
@@ -184,15 +185,28 @@ const RewardItem = ({
184185
</div>
185186

186187
<div className="flex items-center gap-1 text-xs font-medium text-neutral-500">
187-
<span>
188-
{`Updated ${formatDate(reward.updatedAt, {
189-
month: "short",
190-
day: "numeric",
191-
year: "numeric",
192-
})}`}
193-
</span>
188+
<span>Last updated </span>
189+
{!finalActivityLogDate ? (
190+
<div className="h-3 w-16 animate-pulse rounded bg-neutral-100" />
191+
) : (
192+
<TimestampTooltip
193+
timestamp={finalActivityLogDate}
194+
side="left"
195+
rows={["local", "utc", "unix"]}
196+
>
197+
<span>
198+
{formatDate(finalActivityLogDate, {
199+
month: "short",
200+
day: "numeric",
201+
year: "numeric",
202+
})}
203+
</span>
204+
</TimestampTooltip>
205+
)}
194206

195-
{hasActivityLogs && (
207+
{!hasActivityLogs ? (
208+
<div className="ml-1 h-3 w-20 animate-pulse rounded bg-neutral-100" />
209+
) : (
196210
<>
197211
<span
198212
className="ml-1 size-1 shrink-0 rounded-full bg-neutral-400"

apps/web/ui/activity-logs/reward-history-sheet.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ export function useRewardHistorySheet({
7777

7878
return {
7979
hasActivityLogs: (activityLogs?.length ?? 0) > 0,
80+
finalActivityLogDate: activityLogs?.[0]?.createdAt,
8081
rewardHistorySheet: reward ? (
8182
<RewardHistorySheet
8283
reward={reward}

0 commit comments

Comments
 (0)