Skip to content

Commit 99ab215

Browse files
committed
feat(gui): redesign provider accounts workspace with adaptive grid, collapsible rails, and quota controls
Summary of changes: - Redesign provider accounts workspace with responsive two-column grid layout and container query adaptation for narrow screens. - Introduce unified dropdown filter button with live counts for all accounts, Gemini/Claude active quotas, and exhausted states. - Implement intuitive 4-option sorting (more/less headroom, soonest 5-hour and 7-day reset) with automatic active model context. - Streamline quota windows to clean '5-Hour' and 'Weekly' metrics without repeating Gemini/Claude brand names or redundant percent badges. - Provide clean unmasked email login by default with optional hidden (***) and alias display modes, and one-click clipboard copy. - Add collapsible icon-only navigation sidebar (68px) and provider rail (58px) with smooth transitions and localStorage state persistence. - Stabilize accounts overview stats card with 2x2 responsive grid under 960px container width and anchored refresh controls. - Enhance account search bar with high-contrast surface background matching filter buttons and green focus glow. - Replace native browser confirm with branded dark modal dialog for account deletion. - Hydrate quota cache immediately on mount from disk and refresh in background to prevent blank cards on reload. - Persist selected provider, active tab, filter, sort, title mode, and view mode in localStorage across page reloads. - Add comprehensive test suite in tests/gui/account-quota-analysis.test.ts with full 9-locale parity.
1 parent 68f4bc6 commit 99ab215

26 files changed

Lines changed: 4008 additions & 265 deletions
469 KB
Loading

‎gui/src/App.tsx‎

Lines changed: 33 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { useEffect, useRef, useState } from "react";
1+
import { useCallback, useEffect, useRef, useState } from "react";
22
import { useKeyedClientResource } from "./client-resource";
33
import Dashboard from "./pages/Dashboard";
44
import Providers from "./pages/Providers";
@@ -157,6 +157,23 @@ export default function App() {
157157

158158
// Narrow screens: the sidebar becomes an off-canvas drawer behind a hamburger toggle.
159159
const [navOpen, setNavOpen] = useState(false);
160+
const [sidebarCollapsed, setSidebarCollapsed] = useState<boolean>(() => {
161+
try {
162+
return localStorage.getItem("ocx_sidebar_collapsed") === "true";
163+
} catch {
164+
return false;
165+
}
166+
});
167+
168+
const toggleSidebarCollapsed = useCallback(() => {
169+
setSidebarCollapsed(prev => {
170+
const next = !prev;
171+
try {
172+
localStorage.setItem("ocx_sidebar_collapsed", String(next));
173+
} catch { /* ignore */ }
174+
return next;
175+
});
176+
}, []);
160177
const menuBtnRef = useRef<HTMLButtonElement>(null);
161178
const sidebarRef = useRef<HTMLElement>(null);
162179
const navWasOpen = useRef(false);
@@ -284,7 +301,7 @@ export default function App() {
284301
);
285302

286303
return (
287-
<div className="app">
304+
<div className={`app${sidebarCollapsed ? " app--sidebar-collapsed" : ""}`}>
288305
{/* inert while the drawer is open: keeps focus and assistive tech inside the drawer */}
289306
<header className="mobile-topbar" inert={navOpen}>
290307
<button ref={menuBtnRef} type="button" className="menu-toggle" onClick={() => setNavOpen(o => !o)}
@@ -312,9 +329,18 @@ export default function App() {
312329
</div>
313330
</header>
314331
{navOpen && <div className="drawer-scrim" onClick={() => setNavOpen(false)} aria-hidden="true" />}
315-
<aside id="app-sidebar" className={`sidebar${navOpen ? " open" : ""}`} ref={sidebarRef} tabIndex={-1}>
332+
<aside id="app-sidebar" className={`sidebar${navOpen ? " open" : ""}${sidebarCollapsed ? " sidebar--collapsed" : ""}`} ref={sidebarRef} tabIndex={-1}>
316333
<div className="drawer-head">
317334
{brand}
335+
<button
336+
type="button"
337+
className="sidebar-collapse-toggle-btn"
338+
onClick={toggleSidebarCollapsed}
339+
title={t(sidebarCollapsed ? "nav.expandSidebar" : "nav.collapseSidebar")}
340+
aria-label={t(sidebarCollapsed ? "nav.expandSidebar" : "nav.collapseSidebar")}
341+
>
342+
{sidebarCollapsed ? "▶" : "◀"}
343+
</button>
318344
<button type="button" className="menu-toggle drawer-close" onClick={() => setNavOpen(false)}
319345
aria-label={t("nav.closeMenu")} title={t("nav.closeMenu")}>
320346
<IconX />
@@ -344,8 +370,10 @@ export default function App() {
344370
navigateToPage(id);
345371
setNavOpen(false);
346372
}}
373+
title={t(tkey)}
374+
aria-label={t(tkey)}
347375
aria-current={active ? "page" : undefined}>
348-
<Icon /> {t(tkey)}
376+
<Icon /> <span className="nav-item-text">{t(tkey)}</span>
349377
</button>
350378
</div>
351379
);
@@ -461,3 +489,4 @@ export default function App() {
461489
</div>
462490
);
463491
}
492+

0 commit comments

Comments
 (0)