feat: delivery headers show relative time, exact date on hover

The Home thread's delivery header showed a bare wall-clock time ("7:33 PM"),
which answers the wrong question for messages that arrive while you're away:
what matters at a glance is how stale the delivery is. The header now renders
"12m ago" / "3h ago" / "2d ago" via the existing formatRelativeTimeLabel
scale, with the full time-and-date tooltip on hover. useNowMinute drives
re-renders so an open thread doesn't freeze at "1m ago" — the label's own
granularity is never finer than a minute, so a minute tick is exact.

Co-Authored-By: Claude Fable 5 <[email protected]>
This commit is contained in:
Ben DavisandClaude Fable 5 committed 2026-07-27 13:52:08 -07:00
1 parent 782ebb10f9
commit d1ebcff740
1 file changed
+18 -6
@@ -103,7 +103,12 @@ import {
import { cn } from "~/lib/utils";
import { useUiStateStore } from "~/uiStateStore";
import { type TimestampFormat } from "@t3tools/contracts/settings";
import { formatChatTimestampTooltip, formatShortTimestamp } from "../../timestampFormat";
import {
formatChatTimestampTooltip,
formatRelativeTimeLabel,
formatShortTimestamp,
} from "../../timestampFormat";
import { useNowMinute } from "../../hooks/useNowMinute";
import {
buildInlineTerminalContextText,
@@ -1027,17 +1032,24 @@ function TurnFoldTimelineRow({ row }: { row: Extract<TimelineRow, { kind: "turn-
* The timestamp is always visible here, unlike the hover-revealed one on an
* ordinary assistant message. A reply is dated by the act of asking for it —
* you were there. A delivery arrives while you are not, so "when" is part of
* reading it at all.
* reading it at all. And because "while you were not there" is the point, the
* default rendering is relative ("12m ago") — how stale a delivery is matters
* before which wall-clock minute it landed on. The exact date and time live in
* the tooltip. `useNowMinute` re-renders the label on minute boundaries so an
* open thread doesn't show a frozen "1m ago"; the label's own granularity is
* never finer than a minute, so a minute tick is exact, not approximate.
*/
function NotificationHeader({
badge,
timestamp,
deliveredAtIso,
timestampTooltip,
}: {
badge: NotificationBadgePresentation;
timestamp: string;
deliveredAtIso: string;
timestampTooltip: string;
}) {
useNowMinute();
const relativeLabel = formatRelativeTimeLabel(deliveredAtIso);
return (
<div
className="mb-2 flex items-baseline gap-2 border-b border-border/60 pb-1.5"
@@ -1056,7 +1068,7 @@ function NotificationHeader({
<TooltipTrigger
render={<p className="ml-auto shrink-0 text-xs tabular-nums text-muted-foreground/80" />}
>
{timestamp}
{relativeLabel}
</TooltipTrigger>
<TooltipPopup>{timestampTooltip}</TooltipPopup>
</Tooltip>
@@ -1082,7 +1094,7 @@ function AssistantTimelineRow({ row }: { row: Extract<TimelineRow, { kind: "mess
{notificationBadge ? (
<NotificationHeader
badge={notificationBadge}
timestamp={formatShortTimestamp(row.message.updatedAt, ctx.timestampFormat)}
deliveredAtIso={row.message.updatedAt}
timestampTooltip={formatChatTimestampTooltip(
row.message.updatedAt,
ctx.timestampFormat,