Skip to content

Commit 9ba3f04

Browse files
committed
fix(gui): sidecar 카드 좁은 폭 깨짐 수정 + Usage 스택 레이아웃 복원
대시보드 sidecar 카드(Web search/Vision)가 뷰포트 769~800px 부근에서 2컬럼을 유지한 채 카드당 ~190px으로 좁아져 제목이 조각나고 모델 select가 카드 밖으로 넘치던 문제 수정. - dash-sidecar-grid를 auto-fit + minmax(min(100%, 21rem), 1fr)로 전환해 콘텐츠가 감당 가능한 폭에서만 2컬럼 유지 (고정 768px 브레이크포인트 제거) - 카드 행에 flex-wrap을 줘서 공간이 모자라면 select가 제목 아래로 낮춰지도록 graceful degradation Usage는 PR #442의 rail+main 워크스페이스 대신 기존 스택 레이아웃이 낫다는 판단에 따라 복원. Overview/Models/Providers/Coverage를 한 화면에서 연속 스크롤로 본다. 패널 컴포넌트는 그대로라 회귀 위험은 워크스페이스 쉘 제거뿐. - UsageWorkspaceBody/UsageWorkspaceSection 제거, workspace 분기 회수 - styles-usage-workspace.css 삭제, i18n 6로케일 workspace 키 2종 회수 - usage-workspace.test.ts -> usage-layout.test.ts 재작성 검증: bun run typecheck, gui tests 138 pass, 전체 4098 pass, build:gui 통과. 브라우저 vw 775/1050/1250 스크린샷으로 겹침·넘침 없음 확인.
1 parent fe7ab34 commit 9ba3f04

12 files changed

Lines changed: 79 additions & 459 deletions

File tree

‎gui/src/i18n/de.ts‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -542,8 +542,6 @@ export const de = {
542542
"usage.section.models": "Modelle",
543543
"usage.section.providers": "Anbieter",
544544
"usage.section.coverage": "Abdeckungs-Aufschlüsselung",
545-
"usage.workspace.sections": "Nutzungsabschnitte",
546-
"usage.workspace.report": "Nutzungsbericht",
547545
"usage.coverage.measured": "Gemessen",
548546
"usage.coverage.reported": "Anbieter gemeldet",
549547
"usage.coverage.estimated": "Geschätzt",

‎gui/src/i18n/en.ts‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -565,8 +565,6 @@ export const en = {
565565
"usage.section.models": "Models",
566566
"usage.section.providers": "Providers",
567567
"usage.section.coverage": "Coverage breakdown",
568-
"usage.workspace.sections": "Usage sections",
569-
"usage.workspace.report": "Usage report",
570568
"usage.coverage.measured": "Measured",
571569
"usage.coverage.reported": "Provider reported",
572570
"usage.coverage.estimated": "Estimated",

‎gui/src/i18n/ja.ts‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -530,8 +530,6 @@ export const ja: Record<TKey, string> = {
530530
"usage.section.models": "モデル",
531531
"usage.section.providers": "プロバイダー",
532532
"usage.section.coverage": "カバレッジ内訳",
533-
"usage.workspace.sections": "使用量セクション",
534-
"usage.workspace.report": "使用量レポート",
535533
"usage.coverage.measured": "計測",
536534
"usage.coverage.reported": "プロバイダー報告",
537535
"usage.coverage.estimated": "推定",

‎gui/src/i18n/ko.ts‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -559,8 +559,6 @@ export const ko: Record<TKey, string> = {
559559
"usage.section.models": "모델",
560560
"usage.section.providers": "프로바이더",
561561
"usage.section.coverage": "커버리지 상세",
562-
"usage.workspace.sections": "사용량 섹션",
563-
"usage.workspace.report": "사용량 보고서",
564562
"usage.coverage.measured": "측정됨",
565563
"usage.coverage.reported": "제공자 보고",
566564
"usage.coverage.estimated": "추정",

‎gui/src/i18n/ru.ts‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -565,8 +565,6 @@ export const ru: Record<TKey, string> = {
565565
"usage.section.models": "Модели",
566566
"usage.section.providers": "Провайдеры",
567567
"usage.section.coverage": "Детализация покрытия",
568-
"usage.workspace.sections": "Разделы использования",
569-
"usage.workspace.report": "Отчёт об использовании",
570568
"usage.coverage.measured": "Измерено",
571569
"usage.coverage.reported": "Сообщено провайдером",
572570
"usage.coverage.estimated": "Оценено",

‎gui/src/i18n/zh.ts‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -559,8 +559,6 @@ export const zh: Record<TKey, string> = {
559559
"usage.section.models": "模型",
560560
"usage.section.providers": "提供方",
561561
"usage.section.coverage": "覆盖率明细",
562-
"usage.workspace.sections": "用量分区",
563-
"usage.workspace.report": "用量报告",
564562
"usage.coverage.measured": "已计量",
565563
"usage.coverage.reported": "提供方上报",
566564
"usage.coverage.estimated": "估算",

‎gui/src/pages/Usage.tsx‎

Lines changed: 14 additions & 179 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { useCallback, useEffect, useMemo, useRef, useState, type ReactNode } from "react";
1+
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
22
import { useI18n, type TFn, type Locale } from "../i18n/shared";
33
import { formatTokens } from "../format-tokens";
44
import { EmptyState, Notice } from "../ui";
@@ -449,14 +449,12 @@ function UsageModelsTable({
449449
onModelQuery,
450450
locale,
451451
t,
452-
workspace = false,
453452
}: {
454453
models: UsageModel[];
455454
modelQuery: string;
456455
onModelQuery: (query: string) => void;
457456
locale: Locale;
458457
t: TFn;
459-
workspace?: boolean;
460458
}) {
461459
const searchLabel = t("usage.search.models");
462460
const sectionLabel = t("usage.section.models");
@@ -499,15 +497,6 @@ function UsageModelsTable({
499497
</div>
500498
);
501499

502-
if (workspace) {
503-
return (
504-
<UsageWorkspaceSection title={sectionLabel} titleId={titleId}>
505-
<div className="usw-section-toolbar">{searchInput}</div>
506-
{table}
507-
</UsageWorkspaceSection>
508-
);
509-
}
510-
511500
return (
512501
<section className="panel" style={{ marginTop: 16 }} aria-labelledby={titleId}>
513502
<div className="panel-head">
@@ -523,12 +512,10 @@ function UsageProvidersTable({
523512
providers,
524513
locale,
525514
t,
526-
workspace = false,
527515
}: {
528516
providers: UsageProvider[];
529517
locale: Locale;
530518
t: TFn;
531-
workspace?: boolean;
532519
}) {
533520
const sectionLabel = t("usage.section.providers");
534521
const titleId = "usage-providers-title";
@@ -559,14 +546,6 @@ function UsageProvidersTable({
559546
</div>
560547
);
561548

562-
if (workspace) {
563-
return (
564-
<UsageWorkspaceSection title={sectionLabel} titleId={titleId}>
565-
{table}
566-
</UsageWorkspaceSection>
567-
);
568-
}
569-
570549
return (
571550
<section className="panel" style={{ marginTop: 16 }} aria-labelledby={titleId}>
572551
<h3 id={titleId} className="panel-title">{sectionLabel}</h3>
@@ -578,11 +557,9 @@ function UsageProvidersTable({
578557
function UsageCoveragePanel({
579558
summary,
580559
t,
581-
workspace = false,
582560
}: {
583561
summary: UsageSummaryTotals;
584562
t: TFn;
585-
workspace?: boolean;
586563
}) {
587564
const sectionLabel = t("usage.section.coverage");
588565
const titleId = "usage-coverage-title";
@@ -599,14 +576,6 @@ function UsageCoveragePanel({
599576
</>
600577
);
601578

602-
if (workspace) {
603-
return (
604-
<UsageWorkspaceSection title={sectionLabel} titleId={titleId}>
605-
{body}
606-
</UsageWorkspaceSection>
607-
);
608-
}
609-
610579
return (
611580
<section className="panel" style={{ marginTop: 16 }} aria-labelledby={titleId}>
612581
<h3 id={titleId} className="panel-title">{sectionLabel}</h3>
@@ -615,134 +584,6 @@ function UsageCoveragePanel({
615584
);
616585
}
617586

618-
function UsageWorkspaceSection({
619-
title,
620-
titleId,
621-
children,
622-
}: {
623-
title: string;
624-
titleId: string;
625-
children: ReactNode;
626-
}) {
627-
return (
628-
<section className="usw-section" aria-labelledby={titleId}>
629-
<h3 id={titleId} className="h-section">{title}</h3>
630-
{children}
631-
</section>
632-
);
633-
}
634-
635-
/**
636-
* Workspace layout for the Usage tab: a left rail lists the report sections
637-
* (Overview, Models, Providers, Coverage) and the main pane renders the selected
638-
* one. Section bodies reuse the same panel components as the classic stacked view.
639-
* The shell mounts immediately (including while loading/empty) so workspace mode
640-
* never flashes the classic EmptyState first.
641-
*/
642-
function UsageWorkspaceBody({
643-
data,
644-
loading,
645-
heatmap,
646-
weekBars,
647-
activeDays,
648-
filteredModels,
649-
modelQuery,
650-
onModelQuery,
651-
sortedProviders,
652-
range,
653-
selectedSection,
654-
onSelectSection,
655-
locale,
656-
t,
657-
}: {
658-
data: UsageResponse | null;
659-
loading: boolean;
660-
heatmap: ReturnType<typeof buildHeatmap>;
661-
weekBars: UsageDay[];
662-
activeDays: number;
663-
filteredModels: UsageModel[];
664-
modelQuery: string;
665-
onModelQuery: (query: string) => void;
666-
sortedProviders: UsageProvider[];
667-
range: Range;
668-
selectedSection: string;
669-
onSelectSection: (id: string) => void;
670-
locale: Locale;
671-
t: TFn;
672-
}) {
673-
const empty = !!data && data.summary.requests === 0;
674-
const sections = [
675-
{
676-
id: "overview",
677-
label: t("usage.section.overview"),
678-
meta: data ? `${data.summary.requests}` : "—",
679-
body: data ? (
680-
<>
681-
<UsageSummaryCards summary={data.summary} activeDays={activeDays} locale={locale} t={t} />
682-
<UsageHeatmapPanel range={range} heatmap={heatmap} weekBars={weekBars} locale={locale} t={t} />
683-
</>
684-
) : null,
685-
},
686-
{
687-
id: "models",
688-
label: t("usage.section.models"),
689-
meta: data ? `${data.models.length}` : "—",
690-
body: data
691-
? <UsageModelsTable models={filteredModels} modelQuery={modelQuery} onModelQuery={onModelQuery} locale={locale} t={t} workspace />
692-
: null,
693-
},
694-
{
695-
id: "providers",
696-
label: t("usage.section.providers"),
697-
meta: data ? `${data.providers.length}` : "—",
698-
body: data
699-
? <UsageProvidersTable providers={sortedProviders} locale={locale} t={t} workspace />
700-
: null,
701-
},
702-
{
703-
id: "coverage",
704-
label: t("usage.section.coverage"),
705-
meta: data ? formatPct(data.summary.coverageRatio) : "—",
706-
body: data ? <UsageCoveragePanel summary={data.summary} t={t} workspace /> : null,
707-
},
708-
];
709-
const selected = sections.find(s => s.id === selectedSection) ?? sections[0];
710-
const mainBody = loading && !data
711-
? <EmptyState title={t("usage.loading")} />
712-
: empty
713-
? <EmptyState title={t("usage.empty")} />
714-
: selected.body;
715-
716-
return (
717-
<div className="usage-workspace-shell">
718-
<div className="usage-workspace-root">
719-
<aside className="usage-workspace-rail" aria-label={t("usage.workspace.sections")}>
720-
<div className="usage-workspace-rail-header">
721-
<span className="usage-workspace-rail-title">{t("usage.title")}</span>
722-
</div>
723-
<div className="usage-workspace-rail-list">
724-
{sections.map(s => (
725-
<button
726-
key={s.id}
727-
type="button"
728-
className={`usage-workspace-rail-row${selectedSection === s.id ? " usage-workspace-rail-row--selected" : ""}`}
729-
onClick={() => onSelectSection(s.id)}
730-
aria-current={selectedSection === s.id ? "true" : undefined}
731-
>
732-
<span className="usage-workspace-rail-name">{s.label}</span>
733-
<span className="usage-workspace-rail-meta">{s.meta}</span>
734-
</button>
735-
))}
736-
</div>
737-
</aside>
738-
<section className="usage-workspace-main" aria-label={t("usage.workspace.report")}>
739-
<div className="usw-body">{mainBody}</div>
740-
</section>
741-
</div>
742-
</div>
743-
);
744-
}
745-
746587
export default function Usage({ apiBase }: { apiBase: string }) {
747588
const { t, locale } = useI18n();
748589
const [range, setRange] = useState<Range>("30d");
@@ -751,7 +592,6 @@ export default function Usage({ apiBase }: { apiBase: string }) {
751592
const [loading, setLoading] = useState(true);
752593
const [error, setError] = useState<string | null>(null);
753594
const [modelQuery, setModelQuery] = useState("");
754-
const [selectedSection, setSelectedSection] = useState("overview");
755595

756596
const fetchUsage = useCallback(async (nextRange: Range, nextSurface: UsageSurface, signal: AbortSignal) => {
757597
setLoading(true);
@@ -823,24 +663,19 @@ export default function Usage({ apiBase }: { apiBase: string }) {
823663
{t("common.retry")}
824664
</button>
825665
</Notice>
826-
) : (
827-
<UsageWorkspaceBody
828-
data={data}
829-
loading={loading}
830-
heatmap={heatmap}
831-
weekBars={weekBars}
832-
activeDays={activeDays}
833-
filteredModels={filteredModels}
834-
modelQuery={modelQuery}
835-
onModelQuery={setModelQuery}
836-
sortedProviders={sortedProviders}
837-
range={range}
838-
selectedSection={selectedSection}
839-
onSelectSection={setSelectedSection}
840-
locale={locale}
841-
t={t}
842-
/>
843-
)}
666+
) : loading && !data ? (
667+
<EmptyState title={t("usage.loading")} />
668+
) : data?.summary.requests === 0 ? (
669+
<EmptyState title={t("usage.empty")} />
670+
) : data ? (
671+
<>
672+
<UsageSummaryCards summary={data.summary} activeDays={activeDays} locale={locale} t={t} />
673+
<UsageHeatmapPanel range={range} heatmap={heatmap} weekBars={weekBars} locale={locale} t={t} />
674+
<UsageModelsTable models={filteredModels} modelQuery={modelQuery} onModelQuery={setModelQuery} locale={locale} t={t} />
675+
<UsageProvidersTable providers={sortedProviders} locale={locale} t={t} />
676+
<UsageCoveragePanel summary={data.summary} t={t} />
677+
</>
678+
) : null}
844679
</>
845680
);
846681
}

‎gui/src/styles-dashboard-workspace.css‎

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,13 @@
4545
gap: var(--space-4);
4646
}
4747

48-
/* Sidecar settings: two panels side by side, gap matches --space-4 */
48+
/* Sidecar settings: two panels side by side, gap matches --space-4.
49+
auto-fit collapses to one column before two columns get too narrow for the
50+
title + model select row (~21rem per card), so the select never overlaps or
51+
overflows the card between the old 768px breakpoint and desktop widths. */
4952
.dash-sidecar-grid {
5053
display: grid;
51-
grid-template-columns: repeat(2, minmax(0, 1fr));
54+
grid-template-columns: repeat(auto-fit, minmax(min(100%, 21rem), 1fr));
5255
gap: var(--space-4);
5356
align-items: start;
5457
}
@@ -66,6 +69,7 @@
6669
display: flex;
6770
align-items: center;
6871
justify-content: space-between;
72+
flex-wrap: wrap;
6973
gap: 12px;
7074
min-width: 0;
7175
}
@@ -160,9 +164,3 @@
160164
color: var(--text);
161165
white-space: nowrap;
162166
}
163-
164-
@media (max-width: 768px) {
165-
.dash-sidecar-grid {
166-
grid-template-columns: 1fr;
167-
}
168-
}

0 commit comments

Comments
 (0)