refactor(stream-utils): deduplicate time-ago helpers (FlowwStar/FlowStar#377)#393
Open
jdjioe5-cpu wants to merge 1 commit into
Open
refactor(stream-utils): deduplicate time-ago helpers (FlowwStar/FlowStar#377)#393jdjioe5-cpu wants to merge 1 commit into
jdjioe5-cpu wants to merge 1 commit into
Conversation
…#377) Closes FlowwStar#377. ### Extract - lib/stream-utils.ts: new shared `formatTimeAgo(timestampMs, nowMs?)` helper. Behavior matches the original activity-feed variant (60s, 60min, 24h, 7d thresholds; locale-formatted date past 7 days). ### Update - components/streams/activity-feed.tsx: relativeTime -> formatTimeAgo - components/layout/notification-bell.tsx: timeAgo -> formatTimeAgo - components/webhooks/webhook-settings.tsx: formatRelative -> formatTimeAgo Note: notification-bell's variant had a 60s/60min/24h boundary (no fallback for weeks); webhook-settings had a 24h cap. The single helper follows activity-feed's behavior (60s, 60min, 24h, 7d) which is the most permissive of the three. Difference vs. notification-bell default: only past-7-day messages now show a date instead of a 'd ago'. Difference vs. webhook-settings default: messages 7-30d old now show a date instead of 'Nd ago'. Both are UX improvements (date is more exact for older entries) but call them out in case the maintainer wants to revert. ### Tests - lib/__tests__/stream-utils.test.ts: 5 new vitest cases covering the just-now / minutes / hours / days / localized-date branches.
Author
|
Thanks for considering this PR. After I opened it I realized the scope is broader than my authoring budget right now (Boss overrode, scope filter: 1-2 files touching <50 LoC). This PR sits above that bar. I'm fine if maintainers close this as superseded; I won't keep pushing it. The Soroban skill-publish path still has #367 separately, and the typed-error refactor was a worthwhile exercise while it lasted. Closing as abandoned-for-now from my side — feel free to use any of the branch's commits if useful, or close it outright. |
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.
Closes #377.
Extract
formatTimeAgo(timestampMs, nowMs?)to lib/stream-utils.ts as the single source of truth; rewrite relativeTime/timeAgo/formatRelative in 3 call sites. Helper follows activity-feed's behavior (60s/60min/24h/7d then localized date) — most permissive of the three. Added 5 vitest cases.