mirror of
https://github.com/router-for-me/Cli-Proxy-API-Management-Center.git
synced 2026-08-29 08:59:16 +08:00
ddabc99e24
Relative time goes stale on its own — nothing re-renders when a minute passes, so a long-lived tab silently lies. The naive fix is a timer per component, which on the quota page means one per card body. Adds one app-wide clock instead, started on the first subscriber and cleared on the last, exposed through useNow(). QuotaTimeline drops its private interval and joins it, so the chart and the cards above it tick in lockstep. Also extracts the timeline's private relative-time formatter into a shared, testable one. It is now signed: the old version clamped with Math.max(0, …), so a credit that expired last week read "in 1 minute". Duration constants and the MM-DD HH:mm shape are deduplicated into utils/time/durations.ts and formatInstantShort, which the existing formatQuotaResetTime / formatUnixSeconds now delegate to.