From 601470b89494955b189e34f5fe92fa29d2d8b60d Mon Sep 17 00:00:00 2001 From: Xiangzhe <32761048+xz-dev@users.noreply.github.com> Date: Mon, 20 Jul 2026 21:07:42 +0800 Subject: [PATCH] fix(dashboard): make quota cards container responsive (#7027) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix(dashboard): make quota cards container responsive * test(dashboard): assert #7072 mobile guard behaviorally, not by literal token The #7072 regression guard asserted the literal `grid-cols-1` class token, which only fits a breakpoint-driven grid. This PR switched the per-group card grid to a container-driven `auto-fit`/`minmax()` template, which the guard doesn't recognize even though it also guarantees a single column on mobile-width viewports. Rewrite the guard to assert the underlying behavior — single column on mobile — accepting either the breakpoint model (unprefixed grid-cols-1) or the auto-fit model (a minmax() track wide enough that two columns can't fit on a phone viewport). Reverting to the pre-#7072 forced grid-cols-2 still fails the guard. * fix(dashboard): keep stale quota rows during refresh Refreshing a quota card replaced its entire quota section with a loading placeholder. The card height collapsed and then grew back when data arrived, and each height change rebalanced the outer 2xl CSS multi-column layout, making provider groups visibly jump between columns (flash). Show the loading placeholder only on the initial load (nothing to display yet). During a refresh the stale rows stay rendered while the refresh button icon spins, and the UI swaps in new data once it arrives. Also keep the expand/collapse button visible during refresh so its row does not add another height change. --- .../ProviderLimits/QuotaCardGrid.tsx | 2 +- .../parts/QuotaCardExpanded.tsx | 21 +++++- ...-card-expanded-loading-placeholder.test.ts | 28 +++++++ .../quota-card-grid-horizontal-layout.test.ts | 31 ++++---- .../unit/quota-card-grid-mobile-7072.test.ts | 74 ++++++++++++++++--- 5 files changed, 128 insertions(+), 28 deletions(-) create mode 100644 tests/unit/quota-card-expanded-loading-placeholder.test.ts diff --git a/src/app/(dashboard)/dashboard/usage/components/ProviderLimits/QuotaCardGrid.tsx b/src/app/(dashboard)/dashboard/usage/components/ProviderLimits/QuotaCardGrid.tsx index dfdc46a9c7..a1ed6d9d6f 100644 --- a/src/app/(dashboard)/dashboard/usage/components/ProviderLimits/QuotaCardGrid.tsx +++ b/src/app/(dashboard)/dashboard/usage/components/ProviderLimits/QuotaCardGrid.tsx @@ -58,7 +58,7 @@ export default function QuotaCardGrid({ ({conns.length} account{conns.length !== 1 ? "s" : ""}) -
+
{conns.map((conn) => ( - {loading ? ( + {shouldShowLoadingPlaceholder(loading, sortedQuotas.length, message) ? (
progress_activity @@ -264,7 +281,7 @@ export default function QuotaCardExpanded({
)} - {!loading && !error && sortedQuotas.length > DEFAULT_VISIBLE_ROWS && ( + {!error && sortedQuotas.length > DEFAULT_VISIBLE_ROWS && (