Skip to content

Commit a382330

Browse files
t3dotggclaude
andcommitted
fix(web): limits reset text no longer wraps
Drop the fixed column widths (nowrap instead) and the redundant countdown suffix; the reset line is just 'resets 8/15 13:34'. Co-Authored-By: Claude Fable 5 <[email protected]>
1 parent a3e58c6 commit a382330

2 files changed

Lines changed: 6 additions & 21 deletions

File tree

‎apps/web/src/components/usage/AccountLimits.tsx‎

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import { useEffect, useState } from "react";
1515

1616
import { cn } from "../../lib/utils";
1717
import { useAccountLimits } from "../../state/accountLimits";
18-
import { formatAgo, formatResetAt, formatResetIn } from "../../usage/limitsFormat";
18+
import { formatAgo, formatResetAt } from "../../usage/limitsFormat";
1919
import { PROVIDER_COLOR, PROVIDER_LABEL, PROVIDER_MARK, PROVIDER_ORDER } from "./usageProviders";
2020

2121
/** Age past which a snapshot stops being "current" and earns a caption. */
@@ -103,13 +103,13 @@ export function AccountLimitsHoverCard() {
103103
<LimitMeter window={window} color={PROVIDER_COLOR[provider]} />
104104
<span
105105
className={cn(
106-
"w-15 shrink-0 text-right text-[11px] tabular-nums text-foreground",
106+
"shrink-0 whitespace-nowrap text-right text-[11px] tabular-nums text-foreground",
107107
usageTone(window.usedPercent),
108108
)}
109109
>
110110
{Math.round(window.usedPercent)}% used
111111
</span>
112-
<span className="w-13 shrink-0 text-right text-[10px] tabular-nums text-muted-foreground">
112+
<span className="shrink-0 whitespace-nowrap text-right text-[10px] tabular-nums text-muted-foreground">
113113
{formatResetAt(window.resetsAt, nowMs) ?? ""}
114114
</span>
115115
</div>
@@ -158,7 +158,6 @@ export function AccountLimitsSection() {
158158
) : (
159159
snapshot.windows.map((window) => {
160160
const resetAt = formatResetAt(window.resetsAt, nowMs);
161-
const resetIn = formatResetIn(window.resetsAt, nowMs);
162161
return (
163162
<div key={window.id} className="flex items-center gap-3">
164163
<span className="w-10 shrink-0 text-xs text-muted-foreground">
@@ -167,16 +166,14 @@ export function AccountLimitsSection() {
167166
<LimitMeter window={window} color={PROVIDER_COLOR[provider]} />
168167
<span
169168
className={cn(
170-
"w-18 shrink-0 text-right text-xs font-medium tabular-nums text-foreground",
169+
"shrink-0 whitespace-nowrap text-right text-xs font-medium tabular-nums text-foreground",
171170
usageTone(window.usedPercent),
172171
)}
173172
>
174173
{Math.round(window.usedPercent)}% used
175174
</span>
176-
<span className="w-32 shrink-0 text-right text-xs tabular-nums text-muted-foreground">
177-
{resetAt === null
178-
? ""
179-
: `resets ${resetAt}${resetIn === null ? "" : ` · ${resetIn}`}`}
175+
<span className="shrink-0 whitespace-nowrap text-right text-xs tabular-nums text-muted-foreground">
176+
{resetAt === null ? "" : `resets ${resetAt}`}
180177
</span>
181178
</div>
182179
);

‎apps/web/src/usage/limitsFormat.ts‎

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -31,18 +31,6 @@ export function formatResetAt(resetsAt: string | null, nowMs: number): string |
3131
return DATE_TIME.format(at).replace(", ", " ");
3232
}
3333

34-
/** Coarse time-until-reset: `in 45m`, `in 2h`, `in 3d`. */
35-
export function formatResetIn(resetsAt: string | null, nowMs: number): string | null {
36-
if (resetsAt === null) return null;
37-
const at = Date.parse(resetsAt);
38-
if (Number.isNaN(at) || at <= nowMs) return null;
39-
const minutes = Math.round((at - nowMs) / 60_000);
40-
if (minutes < 60) return `in ${Math.max(1, minutes)}m`;
41-
const hours = Math.round(minutes / 60);
42-
if (hours < 48) return `in ${hours}h`;
43-
return `in ${Math.round(hours / 24)}d`;
44-
}
45-
4634
/** Age of a snapshot: `just now`, `5m ago`, `6h ago`, `3d ago`. */
4735
export function formatAgo(asOf: string, nowMs: number): string {
4836
const at = Date.parse(asOf);

0 commit comments

Comments
 (0)