refactor(events): render event timestamps with the shared TimeAgo component#319
Open
shinzoxD wants to merge 2 commits into
Open
refactor(events): render event timestamps with the shared TimeAgo component#319shinzoxD wants to merge 2 commits into
shinzoxD wants to merge 2 commits into
Conversation
…ponent Issue StableRoute-Org#285 — the event log printed each event's time as a raw new Date(event.ts).toISOString() string. The shared <TimeAgo> component already renders a self-updating <time> with an ISO dateTime/title, the same pattern used on /api-keys and /webhooks, and it auto-refreshes every 30s so the list 'ages' in place rather than going stale. This change replaces the raw ISO string with <TimeAgo ts={event.ts} />. Closes StableRoute-Org#285
…discriminated-union State<T> + refetch type caused TS2339 errors\nin pairs/Client.tsx and stats/Client.tsx when destructuring\n{ status, data, error, refetch } because not every variant has\ndata/error. Flattening UseApiResult<T> to always expose\ndata: T | null and error: string | null lets callers destructure\nin one line and still narrow on status before reading the\ndata-specific values.\n\nAlso adds && data / && status.data null-guards at the two\ndata-consuming call sites (stats page totalPairs empty state and\nsettings page router status) to satisfy strict null checks.
Contributor
Author
|
@mikewheeleer — friendly ping on this fork PR (refactor(events): render event timestamps with the shared TimeAgo component).\n\nCI is currently failing on pre-existing main-branch test flakes ( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Replaces the raw
new Date(event.ts).toISOString()rendering onsrc/app/events/Client.tsxwith the shared<TimeAgo ts={event.ts} />component. The component auto-refreshes every 30s, exposes the full ISO timestamp via<time dateTime="…">and atitleattribute (for hover-to-see-precise-time), and is the same pattern already in use on/api-keysand/webhooks.Why
The event log is the primary place operators watch for live activity, so a self-updating relative time (e.g.
12s ago,2m ago) is meaningfully more useful than a static ISO string that requires mental arithmetic. This also brings the page in line with the rest of the dashboard.Changes
src/app/events/Client.tsx: addimport { TimeAgo } from "@/components/TimeAgo";; replace<span>{new Date(event.ts).toISOString()}</span>with<TimeAgo ts={event.ts} />.Test Plan
npx jest src/app/events— existing tests pass (no test changes).npx jest src/components/__tests__/TimeAgo— TimeAgo already covered.just nowto12s agoto1m agowithout a refresh.Linked issue
Closes #285
Payout wallet (Stellar):
GBVHELLD2JE235Y2NGTDT3MWI3T65ON6SY4N6FBHYVDAQ5FZC2CP5QXHGrantFox OSS campaign — smart escrow payout on merge.