diff --git a/services/frontend/src/app/(dashboard)/dashboard/view.tsx b/services/frontend/src/app/(dashboard)/dashboard/view.tsx index 38beb008..5b9cc553 100644 --- a/services/frontend/src/app/(dashboard)/dashboard/view.tsx +++ b/services/frontend/src/app/(dashboard)/dashboard/view.tsx @@ -13,7 +13,7 @@ import { Zap, } from "lucide-react"; import Link from "next/link"; -import { useEffect } from "react"; +import { useEffect, useState } from "react"; import { useAmbient } from "@/components/ambient/ambient-context"; import { AreaActivity, RadialGauge } from "@/components/charts"; import { GlassPanel } from "@/components/primitives"; @@ -28,7 +28,7 @@ import { } from "@/components/shared"; import { useActivity, useStats, useTopReactions } from "@/hooks"; import { useStaggerReveal } from "@/hooks/use-gsap-animation"; -import { formatNumber } from "@/lib/format"; +import { formatNumber, formatRelativeTime } from "@/lib/format"; import type { DashboardStats } from "@/lib/types"; import { staggerDelay } from "@/lib/utils"; @@ -65,6 +65,7 @@ export function DashboardView({ } = useStats(initialStats); const { data: activity } = useActivity(14, initialActivity); const { data: reactions } = useTopReactions(); + const [showAllReactions, setShowAllReactions] = useState(false); const ambient = useAmbient(); const hudRef = useStaggerReveal(".linear-tile", { @@ -359,44 +360,64 @@ export function DashboardView({ setShowAllReactions((v) => !v)} + className="font-mono text-[10px] text-ink-muted transition-colors hover:text-ink" + > + {showAllReactions + ? "SHOW TOP 4" + : `VIEW ALL ${reactions.length}`} + + } />
- {reactions.slice(0, 4).map((r) => ( -
-
- - {r.content || "[Media/Attachment]"} - - {r.username && ( - - @{r.username} - {r.channel_name && ` in #${r.channel_name}`} + {(showAllReactions ? reactions : reactions.slice(0, 4)).map( + (r) => ( +
+
+ + {r.content || "[Media/Attachment]"} - )} + + @{r.username || "unknown"} + {r.channel_name && ` in #${r.channel_name}`} + {r.created_at != null && ( + <> + {" "} + ·{" "} + + {formatRelativeTime(r.created_at)} + + + )} + +
+
+ + {formatNumber(r.reaction_count)} + + {r.top_emojis && r.top_emojis.length > 0 && ( +
+ {r.top_emojis.slice(0, 2).map((e) => ( + + {e.emoji} + + ))} +
+ )} +
-
- - {formatNumber(r.reaction_count)} - - {r.top_emojis && r.top_emojis.length > 0 && ( -
- {r.top_emojis.map((e) => ( - - {e.emoji} - - ))} -
- )} -
-
- ))} + ), + )}
)}