@devries-cameron20 / t3code Mirror · read-only / commits / 573d376e4c
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, 22:00 UTC

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

Co-authored-by: Julius Marminge <julius@marminge.se>

Julius Marminge committed Oct 20, 2026 at 09:44 UTC 573d376e4c2f621d2147d06ea83310f531e17bb1
1 file changed +8 -47
apps/web/src/components/usage/UsageLimitsPooled.tsx
+8 -47
@@ -29,7 +29,6 @@ import {
29
30 import { ensureLocalApi } from "../../localApi";
31 import { usePrimarySettings } from "../../hooks/useSettings";
32 -import { observeResize } from "../../lib/observeResize";
32 import { cn } from "../../lib/utils";
33 import { formatUpcomingTimestamp } from "../../timestampFormat";
34 import { ProviderInstanceIcon } from "../chat/ProviderInstanceIcon";
@@ -286,7 +285,6 @@ function PoolSegment({
285 readonly color: string;
286 readonly now: number;
287 readonly index: number;
289 - readonly labeled: boolean;
288 readonly showAccountName: boolean;
289 }) {
290 return account.redeem ? (
@@ -332,14 +330,12 @@ function SegmentTriggers({
330 color,
331 now,
332 index,
335 - labeled,
333 showAccountName,
334 }: SegmentPayload & {
335 readonly refillPercent: number;
336 readonly color: string;
337 readonly now: number;
338 readonly index: number;
342 - readonly labeled: boolean;
339 readonly showAccountName: boolean;
340 }) {
341 const popover = use(SegmentPopoverContext) ?? undefined;
@@ -359,10 +355,7 @@ function SegmentTriggers({
355 type="button"
356 style={{ gridColumn: index, gridRow: 1 }}
357 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` : ""}`}
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 - )}
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"
359 />
360 }
361 >
@@ -392,19 +385,11 @@ function SegmentTriggers({
385 ) : null}
386 <span
387 aria-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 - )}
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"
389 >
390 {index}
391 </span>
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 - >
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">
393 {showAccountName ? (
394 <AccountName
395 account={account}
@@ -432,7 +417,7 @@ function SegmentTriggers({
417 ) : null}
418 </div>
419 </PopoverTrigger>
435 - {labeled ? null : <LegendRow payload={payload} color={color} now={now} index={index} />}
420 + <LegendRow payload={payload} color={color} now={now} index={index} />
421 </>
422 );
423 }
@@ -459,7 +444,7 @@ function LegendRow({
444 payload={payload}
445 style={{ gridColumn: "1 / -1", gridRow: index + 1 }}
446 render={<Button variant="ghost" size="compact" />}
462 - className="min-w-0"
447 + className="min-w-0 @2xl/pool:hidden"
448 >
449 <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">
450 <span
@@ -494,8 +479,6 @@ function LegendRow({
479 );
480 }
481
497 -const LABELED_SEGMENT_MIN_WIDTH = 224;
498 -
482 function PoolBar({
483 pool,
484 color,
@@ -506,32 +489,11 @@ function PoolBar({
489 readonly now: number;
490 }) {
491 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;
492 return (
528 - <div className="min-w-0">
529 - {/* A height-independent probe keeps legend changes from triggering resize feedback. */}
530 - <div ref={probeRef} />
493 + <div className="@container/pool min-w-0">
494 <div
532 - ref={gridRef}
495 className="grid gap-x-1 gap-y-1"
534 - style={{ gridTemplateColumns: `repeat(${columns}, minmax(0, 1fr))` }}
496 + style={{ gridTemplateColumns: `repeat(${pool.columns.length}, minmax(0, 1fr))` }}
497 >
498 {pool.columns.map((member, position) =>
499 member.window ? (
@@ -544,8 +506,7 @@ function PoolBar({
506 color={color}
507 now={now}
508 index={position + 1}
547 - labeled={labeled}
548 - showAccountName={columns > 1}
509 + showAccountName={pool.columns.length > 1}
510 />
511 ) : null,
512 )}