Skip to content
TypeScript

fix(web): size Usage header controls to the available width (#24123)

Yukun Shan97be291eb156
diff --git a/apps/web/src/components/usage/UsagePage.tsx b/apps/web/src/components/usage/UsagePage.tsx
index fd61b63af4b..6552e10c41b 100644
--- a/apps/web/src/components/usage/UsagePage.tsx
+++ b/apps/web/src/components/usage/UsagePage.tsx
@@ -364,7 +364,7 @@ export function UsagePage() {
? `${formatDateTimeShort(shownWindow.sinceTime, shownWindow.timeZone, hour12)} to ${formatDateTimeShort(shownWindow.untilTime, shownWindow.timeZone, hour12)}`
: `${formatDayShort(shownWindow.sinceDay)} to ${formatDayShort(shownWindow.untilDay)}`;
const topbarContent = (
- <div className="grid w-full min-w-0 grid-cols-[minmax(0,1fr)_auto] items-center gap-x-3 py-2 xl:flex">
+ <div className="grid w-full min-w-0 grid-cols-[minmax(0,1fr)_auto] items-center gap-x-3 py-2 @4xl/usage-header:flex">
<WorkspaceBreadcrumb ariaLabel="Usage breadcrumb" className="min-w-0">
<WorkspaceBreadcrumbItem>
<h1>Usage</h1>
@@ -393,11 +393,11 @@ export function UsagePage() {
</WorkspaceBreadcrumbItem>
</WorkspaceBreadcrumb>
{!showingLimits ? (
- <span className="hidden min-w-0 truncate text-xs text-muted-foreground 2xl:block">
+ <span className="hidden min-w-0 truncate text-xs text-muted-foreground @7xl/usage-header:block">
{windowLabel}
</span>
) : null}
- <div className="ms-auto hidden min-w-0 items-center justify-end gap-2 xl:flex">
+ <div className="ms-auto hidden shrink-0 items-center justify-end gap-2 @4xl/usage-header:flex">
<ToggleGroup
aria-label="Usage metric"
variant="segmented"
@@ -440,7 +440,7 @@ export function UsagePage() {
<RefreshIcon size="sm" refreshing={isRefreshing} />
</Button>
</div>
- <div className="ms-auto flex min-w-0 items-center justify-end gap-1 xl:hidden">
+ <div className="ms-auto flex shrink-0 items-center justify-end gap-1 @4xl/usage-header:hidden">
<Select
value={metric}
onValueChange={(value) => {
@@ -509,7 +509,9 @@ export function UsagePage() {
return (
<SidebarInset className="h-dvh min-h-0 overflow-hidden overscroll-y-none isolate">
<div className="flex min-h-0 min-w-0 flex-1 flex-col bg-background text-foreground">
- <WorkspacePageHeader electron={isElectron}>{topbarContent}</WorkspacePageHeader>
+ <WorkspacePageHeader electron={isElectron} className="@container/usage-header">
+ {topbarContent}
+ </WorkspacePageHeader>
<ScrollArea className="min-h-0 flex-1">
<WorkspacePageContainer width="wide">