@devries-cameron20 / t3code Mirror · read-only / commits / 32e3b90f38
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 22, 23:15 UTC

fix(web): limit bars with many accounts no longer clip names to one letter (#19964)

Co-authored-by: Julius Marminge <julius0216@outlook.com>

Josh Robertson committed Oct 20, 2026 at 00:22 UTC 32e3b90f3866053e5299c8627c4c3fa7a32434ed
1 file changed +47 -8
apps/web/src/components/usage/UsageLimitsPooled.tsx
+47 -8
@@ -29,6 +29,7 @@ import {
29
30 import { ensureLocalApi } from "../../localApi";
31 import { usePrimarySettings } from "../../hooks/useSettings";
32 +import { observeResize } from "../../lib/observeResize";
33 import { cn } from "../../lib/utils";
34 import { formatUpcomingTimestamp } from "../../timestampFormat";
35 import { ProviderInstanceIcon } from "../chat/ProviderInstanceIcon";
@@ -285,6 +286,7 @@ function PoolSegment({
286 readonly color: string;
287 readonly now: number;
288 readonly index: number;
289 + readonly labeled: boolean;
290 readonly showAccountName: boolean;
291 }) {
292 return account.redeem ? (
@@ -330,12 +332,14 @@ function SegmentTriggers({
332 color,
333 now,
334 index,
335 + labeled,
336 showAccountName,
337 }: SegmentPayload & {
338 readonly refillPercent: number;
339 readonly color: string;
340 readonly now: number;
341 readonly index: number;
342 + readonly labeled: boolean;
343 readonly showAccountName: boolean;
344 }) {
345 const popover = use(SegmentPopoverContext) ?? undefined;
@@ -355,7 +359,10 @@ function SegmentTriggers({
359 type="button"
360 style={{ gridColumn: index, gridRow: 1 }}
361 aria-label={`${account.displayName ?? (account.email ? accountInitials(account.email) : account.driver)}: ${remaining}% left${resetsIn ? `, ${resetsIn}` : ""}${timeLeft === null ? "" : `, ${timeLeft}% of the window left`}${credits ? `, ${credits} reset ${credits === 1 ? "credit" : "credits"} banked` : ""}`}
358 - className="relative h-5 min-w-0 cursor-pointer rounded-md bg-muted text-start outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background data-[popup-open]:ring-1 data-[popup-open]:ring-inset data-[popup-open]:ring-border @2xl/pool:h-8"
362 + className={cn(
363 + "relative min-w-0 cursor-pointer rounded-md bg-muted text-start outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background data-[popup-open]:ring-1 data-[popup-open]:ring-inset data-[popup-open]:ring-border",
364 + labeled ? "h-8" : "h-5",
365 + )}
366 />
367 }
368 >
@@ -385,11 +392,19 @@ function SegmentTriggers({
392 ) : null}
393 <span
394 aria-hidden
388 - className="absolute inset-0 flex items-center justify-center overflow-hidden rounded-md text-3xs leading-none font-semibold text-foreground/80 tabular-nums @2xl/pool:hidden"
395 + className={cn(
396 + "absolute inset-0 flex items-center justify-center overflow-hidden rounded-md text-3xs leading-none font-semibold text-foreground/80 tabular-nums",
397 + labeled && "hidden",
398 + )}
399 >
400 {index}
401 </span>
392 - <div className="relative hidden h-full min-w-0 items-center gap-1.5 overflow-hidden rounded-md px-2 text-xs @2xl/pool:flex">
402 + <div
403 + className={cn(
404 + "relative h-full min-w-0 items-center gap-1.5 overflow-hidden rounded-md px-2 text-xs",
405 + labeled ? "flex" : "hidden",
406 + )}
407 + >
408 {showAccountName ? (
409 <AccountName
410 account={account}
@@ -417,7 +432,7 @@ function SegmentTriggers({
432 ) : null}
433 </div>
434 </PopoverTrigger>
420 - <LegendRow payload={payload} color={color} now={now} index={index} />
435 + {labeled ? null : <LegendRow payload={payload} color={color} now={now} index={index} />}
436 </>
437 );
438 }
@@ -444,7 +459,7 @@ function LegendRow({
459 payload={payload}
460 style={{ gridColumn: "1 / -1", gridRow: index + 1 }}
461 render={<Button variant="ghost" size="compact" />}
447 - className="min-w-0 @2xl/pool:hidden"
462 + className="min-w-0"
463 >
464 <span className="relative inline-flex size-4 shrink-0 items-center justify-center rounded-sm text-3xs leading-none font-semibold text-foreground/80 tabular-nums">
465 <span
@@ -479,6 +494,8 @@ function LegendRow({
494 );
495 }
496
497 +const LABELED_SEGMENT_MIN_WIDTH = 224;
498 +
499 function PoolBar({
500 pool,
501 color,
@@ -489,11 +506,32 @@ function PoolBar({
506 readonly now: number;
507 }) {
508 const restores = new Map(pool.resets.map((reset) => [reset.member.account.key, reset]));
509 + const columns = pool.columns.length;
510 + const [dimensions, setDimensions] = useState({ width: 0, gap: 0 });
511 + const probeRef = useRef<HTMLDivElement>(null);
512 + const gridRef = useRef<HTMLDivElement>(null);
513 + useLayoutEffect(() => {
514 + const probe = probeRef.current;
515 + const grid = gridRef.current;
516 + if (!probe || !grid) return;
517 + return observeResize(probe, ([entry]) => {
518 + if (!entry) return;
519 + setDimensions({
520 + width: entry.contentRect.width,
521 + gap: Number.parseFloat(getComputedStyle(grid).columnGap) || 0,
522 + });
523 + });
524 + }, []);
525 + const labeled =
526 + (dimensions.width - dimensions.gap * (columns - 1)) / columns >= LABELED_SEGMENT_MIN_WIDTH;
527 return (
493 - <div className="@container/pool min-w-0">
528 + <div className="min-w-0">
529 + {/* A height-independent probe keeps legend changes from triggering resize feedback. */}
530 + <div ref={probeRef} />
531 <div
532 + ref={gridRef}
533 className="grid gap-x-1 gap-y-1"
496 - style={{ gridTemplateColumns: `repeat(${pool.columns.length}, minmax(0, 1fr))` }}
534 + style={{ gridTemplateColumns: `repeat(${columns}, minmax(0, 1fr))` }}
535 >
536 {pool.columns.map((member, position) =>
537 member.window ? (
@@ -506,7 +544,8 @@ function PoolBar({
544 color={color}
545 now={now}
546 index={position + 1}
509 - showAccountName={pool.columns.length > 1}
547 + labeled={labeled}
548 + showAccountName={columns > 1}
549 />
550 ) : null,
551 )}