Skip to content

Commit 37a7bae

Browse files
committed
fix(web): 按可用宽度切换用量页筛选控件
- 根据标题栏容器而非视口宽度切换紧凑控件及日期标签,避免宽侧栏下覆盖面包屑。 - 保持筛选控件宽度;隔离客户端验证最窄、阈值两侧及宽布局,确认指标和周期选择不丢失。 - 变更范围的格式、lint、未使用代码和类型检查通过;前后截图单独上传。
1 parent eb1510d commit 37a7bae

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

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

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,7 @@ export function UsagePage() {
364364
? `${formatDateTimeShort(shownWindow.sinceTime, shownWindow.timeZone, hour12)} to ${formatDateTimeShort(shownWindow.untilTime, shownWindow.timeZone, hour12)}`
365365
: `${formatDayShort(shownWindow.sinceDay)} to ${formatDayShort(shownWindow.untilDay)}`;
366366
const topbarContent = (
367-
<div className="grid w-full min-w-0 grid-cols-[minmax(0,1fr)_auto] items-center gap-x-3 py-2 xl:flex">
367+
<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">
368368
<WorkspaceBreadcrumb ariaLabel="Usage breadcrumb" className="min-w-0">
369369
<WorkspaceBreadcrumbItem>
370370
<h1>Usage</h1>
@@ -393,11 +393,11 @@ export function UsagePage() {
393393
</WorkspaceBreadcrumbItem>
394394
</WorkspaceBreadcrumb>
395395
{!showingLimits ? (
396-
<span className="hidden min-w-0 truncate text-xs text-muted-foreground 2xl:block">
396+
<span className="hidden min-w-0 truncate text-xs text-muted-foreground @7xl/usage-header:block">
397397
{windowLabel}
398398
</span>
399399
) : null}
400-
<div className="ms-auto hidden min-w-0 items-center justify-end gap-2 xl:flex">
400+
<div className="ms-auto hidden shrink-0 items-center justify-end gap-2 @4xl/usage-header:flex">
401401
<ToggleGroup
402402
aria-label="Usage metric"
403403
variant="segmented"
@@ -440,7 +440,7 @@ export function UsagePage() {
440440
<RefreshIcon size="sm" refreshing={isRefreshing} />
441441
</Button>
442442
</div>
443-
<div className="ms-auto flex min-w-0 items-center justify-end gap-1 xl:hidden">
443+
<div className="ms-auto flex shrink-0 items-center justify-end gap-1 @4xl/usage-header:hidden">
444444
<Select
445445
value={metric}
446446
onValueChange={(value) => {
@@ -509,7 +509,9 @@ export function UsagePage() {
509509
return (
510510
<SidebarInset className="h-dvh min-h-0 overflow-hidden overscroll-y-none isolate">
511511
<div className="flex min-h-0 min-w-0 flex-1 flex-col bg-background text-foreground">
512-
<WorkspacePageHeader electron={isElectron}>{topbarContent}</WorkspacePageHeader>
512+
<WorkspacePageHeader electron={isElectron} className="@container/usage-header">
513+
{topbarContent}
514+
</WorkspacePageHeader>
513515

514516
<ScrollArea className="min-h-0 flex-1">
515517
<WorkspacePageContainer width="wide">

0 commit comments

Comments
 (0)