Skip to content

feat(inbox): show relative timestamp on signal cards#2240

Merged
oliverb123 merged 1 commit into
mainfrom
posthog-code/signal-card-relative-timestamp
May 20, 2026
Merged

feat(inbox): show relative timestamp on signal cards#2240
oliverb123 merged 1 commit into
mainfrom
posthog-code/signal-card-relative-timestamp

Conversation

@oliverb123
Copy link
Copy Markdown
Contributor

Summary

  • Adds a reusable RelativeTimestamp component in components/ui/ that renders relative time (e.g. "1 hour ago") with the exact locale datetime in a hover tooltip.
  • Renders it in SignalCardHeader so every signal in the inbox report detail view shows its timestamp at the top right of the card, alongside the existing Verified badge.
  • Removes the now-redundant duplicate timestamp from the bottom of GenericSignalCard.

Test plan

  • Open a report in the signals inbox with mixed signal types (GitHub, Zendesk, error tracking, session problem, generic) and confirm each card shows the relative timestamp top-right.
  • Hover the timestamp and confirm the full locale datetime appears in a tooltip.
  • Confirm the generic fallback card no longer renders the duplicate timestamp below the body.
  • Confirm cards with missing/invalid timestamps don't render an empty slot or "Invalid Date" text.

Created with PostHog Code

Adds a reusable RelativeTimestamp component (relative "n ago" text with
the exact locale datetime in a hover tooltip) and renders it in the
signal card header so every signal in the report detail view shows when
it was created.

Generated-By: PostHog Code
Task-Id: 7f669e63-b71c-4b2d-b7ba-c6178112ad57
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented May 20, 2026

Prompt To Fix All With AI
Fix the following 2 code review issues. Work through them one at a time, proposing concise fixes.

---

### Issue 1 of 2
apps/code/src/renderer/components/ui/RelativeTimestamp.tsx:28
Trailing space in className when `className` prop is omitted. The template `"... ${className ?? ""}"` produces a trailing space when no className is provided. This is a minor spacing issue per the project's template string conventions. Using a conditional insertion is cleaner.

```suggestion
        className={`shrink-0 text-(--gray-10) text-[11px]${className ? ` ${className}` : ""}`}
```

### Issue 2 of 2
apps/code/src/renderer/components/ui/RelativeTimestamp.tsx:30
**Stale relative time display**

`formatRelativeTimeLong` is called once at render time and computes `Date.now() - date.getTime()`, but the component has no mechanism to re-run as wall-clock time advances. A user who leaves the inbox view open will see the label freeze (e.g. "1 minute ago" stays forever). Consider driving a periodic re-render with a `useState` + `useEffect`/`setInterval` that ticks every minute, or using a shared time-tick context.

Reviews (1): Last reviewed commit: "feat(inbox): show relative timestamp on ..." | Re-trigger Greptile

Comment thread apps/code/src/renderer/components/ui/RelativeTimestamp.tsx
Comment thread apps/code/src/renderer/components/ui/RelativeTimestamp.tsx
@oliverb123 oliverb123 merged commit b0e9c06 into main May 20, 2026
15 checks passed
@oliverb123 oliverb123 deleted the posthog-code/signal-card-relative-timestamp branch May 20, 2026 10:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants