Skip to content

A cross-platform desktop All-in-One assistant for Claude Code, Codex, OpenCode,DeepSeek Harness and more. Only official website: ccswitch.io

fix(agy): refine card quota column layout, dropdown alignment, and drop GPT label (#10169)

Allen Xuf40122a26fe2
diff --git a/src/components/SubscriptionQuotaFooter.tsx b/src/components/SubscriptionQuotaFooter.tsx
index dc024c58b..03cb73db5 100644
--- a/src/components/SubscriptionQuotaFooter.tsx
+++ b/src/components/SubscriptionQuotaFooter.tsx
@@ -94,12 +94,50 @@ const INLINE_TIER_GROUPS: Record<string, string> = {
kimi_monthly_code: "subscription.monthly",
};
+/**
+ * Antigravity 卡片按组合并后,使用各语言的短档名(`subscription.short.agy*`,
+ * 如中文「Gemini 每周 85%」「Claude 5 小时 100%」,英文「Gemini Wk 85%」「Claude 5h 100%」),
+ * 省掉「剩余」二字,既跟其他 App 保持 locale 一致,又能一眼分清窗口且不拉宽额度列。
+ */
+const AGY_COMPACT_INLINE_TIERS = new Set([
+ "agy_gemini_five_hour",
+ "agy_gemini_weekly",
+ "agy_gemini_argon_weekly",
+ "agy_third_party_five_hour",
+ "agy_third_party_weekly",
+]);
+
+/**
+ * 卡片按组折叠时优先保留的档位:Antigravity 卡片固定展示 5 小时档(每周 / Argon 放在下拉明细里),
+ * 避免两行在「5 小时」和「每周」之间来回跳动;若某组缺失 5 小时档则回退到组内剩余最少的一档。
+ */
+const PREFERRED_INLINE_GROUP_TIERS: Record<string, string> = {
+ "subscription.agyGemini": "agy_gemini_five_hour",
+ "subscription.agyThirdParty": "agy_third_party_five_hour",
+};
+
export function collapseInlineGroups(tiers: QuotaTier[]): QuotaTier[] {
const kept = new Map<string, QuotaTier>();
for (const tier of tiers) {
const group = INLINE_TIER_GROUPS[tier.name] ?? tier.name;
+ const preferred = PREFERRED_INLINE_GROUP_TIERS[group];
const current = kept.get(group);
- if (!current || tier.utilization > current.utilization) {
+ if (!current) {
+ kept.set(group, tier);
+ continue;
+ }
+ if (preferred) {
+ if (tier.name === preferred) {
+ kept.set(group, tier);
+ } else if (
+ current.name !== preferred &&
+ tier.utilization > current.utilization
+ ) {
+ kept.set(group, tier);
+ }
+ continue;
+ }
+ if (tier.utilization > current.utilization) {
kept.set(group, tier);
}
}
@@ -165,13 +203,19 @@ export function tierLines(
.filter((tier) => tier.name in TIER_I18N_KEYS)
.filter((tier) => !inline || !HIDDEN_INLINE_TIERS.has(tier.name));
return (inline ? collapseInlineGroups(known) : known).map((tier) => {
+ const compact = inline && AGY_COMPACT_INLINE_TIERS.has(tier.name);
const group = inline ? INLINE_TIER_GROUPS[tier.name] : undefined;
- const label = group ? t(group) : tierLabel(t, tier.name);
+ const label = compact
+ ? tierShortLabel(t, tier.name)
+ : group
+ ? t(group)
+ : tierLabel(t, tier.name);
return {
label,
line: tierLine(t, tier, label, {
- short: group ? label : tierShortLabel(t, tier.name),
+ short: compact ? label : group ? label : tierShortLabel(t, tier.name),
display,
+ compact,
}),
};
});
diff --git a/src/components/providers/ProviderCard.tsx b/src/components/providers/ProviderCard.tsx
index ed059178d..43094aed2 100644
--- a/src/components/providers/ProviderCard.tsx
+++ b/src/components/providers/ProviderCard.tsx
@@ -628,8 +628,8 @@ export function ProviderCard({
</div>
<div className="flex shrink-0 items-center gap-3">
- {/* 额度列 136 宽,带重置倒计时时 194 宽(见 QuotaLines) */}
- <div className="max-w-[208px] text-end">
+ {/* 额度列宽度随密度变化(见 QuotaLines 与 --w-quota-*) */}
+ <div className="max-w-[calc(var(--w-quota-text,136px)+var(--w-quota-reset,52px)+20px)] text-end">
<div className="flex items-center justify-end gap-1">
{copilotCliQuotaEnabled ? (
<CopilotCliQuotaFooter
diff --git a/src/components/quota/QuotaBreakdown.tsx b/src/components/quota/QuotaBreakdown.tsx
index e7f026cbc..8bc65a357 100644
--- a/src/components/quota/QuotaBreakdown.tsx
+++ b/src/components/quota/QuotaBreakdown.tsx
@@ -44,7 +44,7 @@ export function QuotaBreakdownRow({
onClick={(event) => event.stopPropagation()}
className={cn(
className,
- "group/breakdown -mx-1 rounded-control px-1 text-start transition-colors hover:bg-subtle focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring data-[state=open]:bg-subtle",
+ "group/breakdown -mx-1 rounded-control px-1 text-start transition-colors hover:bg-black/[0.05] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring data-[state=open]:bg-black/[0.05] dark:hover:bg-white/[0.08] dark:data-[state=open]:bg-white/[0.08]",
)}
>
{children}
@@ -54,7 +54,7 @@ export function QuotaBreakdownRow({
align={align}
sideOffset={6}
aria-label={breakdown.title}
- className="w-[236px] rounded-panel border-border bg-surface p-3 shadow-v7-md"
+ className="w-max min-w-[236px] max-w-[320px] rounded-panel border-border bg-surface p-3 shadow-v7-md"
>
<div className="mb-2 flex items-baseline justify-between gap-3 text-caption">
<span className="font-medium text-fg-1">{breakdown.title}</span>
@@ -95,9 +95,17 @@ function BreakdownItems({
className?: string;
}) {
return (
- <ul className={cn("flex flex-col gap-1 text-caption", className)}>
+ <ul
+ className={cn(
+ "grid grid-cols-[auto_minmax(0,1fr)_auto] gap-x-3 gap-y-1 text-caption",
+ className,
+ )}
+ >
{items.map((item) => (
- <li key={item.key} className="flex items-center gap-2">
+ <li
+ key={item.key}
+ className="col-span-3 grid grid-cols-subgrid items-center"
+ >
<span
className={cn(
"whitespace-nowrap",
@@ -106,7 +114,9 @@ function BreakdownItems({
>
{item.label}
</span>
- <span className="min-w-0 flex-1 truncate text-fg-3">{item.hint}</span>
+ <span className="min-w-0 truncate whitespace-nowrap text-end font-mono tabular-nums text-fg-3">
+ {item.hint}
+ </span>
<span className="whitespace-nowrap text-end tabular-nums text-fg-2">
{item.value}
</span>
diff --git a/src/components/quota/QuotaLines.tsx b/src/components/quota/QuotaLines.tsx
index e8f7b47f5..f0fdabd38 100644
--- a/src/components/quota/QuotaLines.tsx
+++ b/src/components/quota/QuotaLines.tsx
@@ -98,7 +98,7 @@ export function ResetSlot({
return (
<span
className={cn(
- "inline-flex w-[52px] shrink-0 items-center gap-0.5 text-fg-3",
+ "inline-flex w-[var(--w-quota-reset,52px)] shrink-0 items-center gap-0.5 text-fg-3",
className,
)}
>
@@ -108,7 +108,9 @@ export function ResetSlot({
<span className="sr-only">
{t("subscription.resetsIn", { time: countdown })}
</span>
- <span aria-hidden>{countdown}</span>
+ <span aria-hidden className="font-mono">
+ {countdown}
+ </span>
</>
)}
</span>
@@ -271,9 +273,14 @@ export function QuotaLines({
const className = cn(
"flex shrink-0 flex-col items-end text-caption leading-[18px] tabular-nums whitespace-nowrap",
- // 文字仍是 136 宽,倒计时那格(52 + 间距)另加;整列下拉的 ⌄ 那格(14)也另加
- showReset ? "w-[194px]" : "w-[136px]",
- breakdown && (showReset ? "w-[208px]" : "w-[150px]"),
+ // 文字占 --w-quota-text(紧凑 136 / 舒适 148),倒计时那格(--w-quota-reset + 6px)与整列下拉的 ⌄(14px)另加
+ breakdown
+ ? showReset
+ ? "w-[calc(var(--w-quota-text,136px)+var(--w-quota-reset,52px)+20px)]"
+ : "w-[calc(var(--w-quota-text,136px)+14px)]"
+ : showReset
+ ? "w-[calc(var(--w-quota-text,136px)+var(--w-quota-reset,52px)+6px)]"
+ : "w-[var(--w-quota-text,136px)]",
loading && !spinning && "opacity-60",
);
@@ -423,12 +430,12 @@ function DropdownQuotaColumn({
onMouseLeave={refreshProps.onMouseLeave}
>
<span className="relative flex min-w-0">
- {/* 绝对定位贴在下拉左边、不占宽度:↻ 出现 / 消失时文字不被挤动 */}
+ {/* 绝对定位贴在下拉左边、不占宽度:me-1 对齐下拉的 -mx-1 左缘(无悬停断层),pe-1 给 ↻ 留出 4px 视觉间距 */}
<button
type="button"
title={title}
aria-label={t("quota.clickToRefresh")}
- className="group absolute end-full top-0 me-1 flex h-[18px] items-center rounded-control focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"
+ className="group absolute end-full top-0 me-1 flex h-[18px] items-center rounded-control pe-1 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"
{...refreshProps}
// 悬停交给整列:移出这个小按钮、还在列上时 ↻ 不能消失
onMouseEnter={undefined}
@@ -457,10 +464,10 @@ function DropdownQuotaColumn({
</span>
))}
</span>
+ {resetSlot(row)}
<span className="ms-0.5 flex w-3 shrink-0">
{rowIndex === 0 && <QuotaBreakdownChevron />}
</span>
- {resetSlot(row)}
</span>
))}
</QuotaBreakdownRow>
@@ -560,8 +567,10 @@ function SplitQuotaColumn({
<QuotaBreakdownChevron />
)}
</QuotaBreakdownRow>
- {/* 和上一行的「ms-1.5 + 52 宽倒计时格」等宽:gap-0.5 + ms-1 + ⌄ 12 + 40 */}
- {chevronInSlot && <span className="w-10" />}
+ {/* 和上一行的「ms-1.5 + 倒计时格」等宽:gap-0.5 + ms-1 + ⌄ 12 + (--w-quota-reset - 12) */}
+ {chevronInSlot && (
+ <span className="w-[calc(var(--w-quota-reset,52px)-12px)]" />
+ )}
</span>
);
}
diff --git a/src/components/quota/quotaRules.ts b/src/components/quota/quotaRules.ts
index 424ce18ac..895529a8a 100644
--- a/src/components/quota/quotaRules.ts
+++ b/src/components/quota/quotaRules.ts
@@ -87,8 +87,9 @@ export function countdownStr(
if (!Number.isFinite(diffMs) || diffMs <= 0) return null;
const hours = Math.floor(diffMs / (1000 * 60 * 60));
const minutes = Math.floor((diffMs % (1000 * 60 * 60)) / (1000 * 60));
- if (hours > 24) return `${Math.floor(hours / 24)}d${hours % 24}h`;
- if (hours > 0) return `${hours}h${minutes}m`;
+ const pad = (n: number) => String(n).padStart(2, "0");
+ if (hours > 24) return `${Math.floor(hours / 24)}d${pad(hours % 24)}h`;
+ if (hours > 0) return `${hours}h${pad(minutes)}m`;
return `${minutes}m`;
}
@@ -123,7 +124,11 @@ export function tierLine(
t: TFunction,
tier: Pick<QuotaTier, "name" | "utilization" | "resetsAt">,
label: string,
- { short, display = "left" }: { short?: string; display?: QuotaDisplay } = {},
+ {
+ short,
+ display = "left",
+ compact = false,
+ }: { short?: string; display?: QuotaDisplay; compact?: boolean } = {},
): QuotaLine {
const left = Math.max(0, Math.round(100 - (tier.utilization ?? 0)));
const used = display === "used";
@@ -138,10 +143,12 @@ export function tierLine(
text:
left <= 0
? t("quota.tierUsedUp", params)
- : t(used ? "quota.tierUsed" : "quota.tierLeft", {
- ...params,
- value: shown,
- }),
+ : compact
+ ? t("quota.tierShort", { label, value: shown })
+ : t(used ? "quota.tierUsed" : "quota.tierLeft", {
+ ...params,
+ value: shown,
+ }),
value:
left <= 0
? t("quota.usedUp")
diff --git a/src/i18n/locales/de.json b/src/i18n/locales/de.json
index 7d57cedf9..a0106a3b2 100644
--- a/src/i18n/locales/de.json
+++ b/src/i18n/locales/de.json
@@ -4474,12 +4474,12 @@
"geminiFlash": "Flash",
"geminiFlashLite": "Flash Lite",
"agyGemini": "Gemini",
- "agyThirdParty": "Claude/GPT",
+ "agyThirdParty": "Claude",
"agyGeminiFiveHour": "Gemini 5 Stunden",
"agyGeminiWeekly": "Gemini wöchentlich",
"agyGeminiArgonWeekly": "Argon wöchentlich",
- "agyThirdPartyFiveHour": "Claude/GPT 5 Stunden",
- "agyThirdPartyWeekly": "Claude/GPT wöchentlich",
+ "agyThirdPartyFiveHour": "Claude 5 Stunden",
+ "agyThirdPartyWeekly": "Claude wöchentlich",
"weeklyLimit": "Woche",
"monthly": "Monat",
"kimiMonthlyTotal": "Monat gesamt",
diff --git a/src/i18n/locales/en.json b/src/i18n/locales/en.json
index facc24a15..e6e2ad8fd 100644
--- a/src/i18n/locales/en.json
+++ b/src/i18n/locales/en.json
@@ -4474,12 +4474,12 @@
"geminiFlash": "Flash",
"geminiFlashLite": "Flash Lite",
"agyGemini": "Gemini",
- "agyThirdParty": "Claude/GPT",
+ "agyThirdParty": "Claude",
"agyGeminiFiveHour": "Gemini 5-hour",
"agyGeminiWeekly": "Gemini weekly",
"agyGeminiArgonWeekly": "Argon weekly",
- "agyThirdPartyFiveHour": "Claude/GPT 5-hour",
- "agyThirdPartyWeekly": "Claude/GPT weekly",
+ "agyThirdPartyFiveHour": "Claude 5-hour",
+ "agyThirdPartyWeekly": "Claude weekly",
"weeklyLimit": "Weekly",
"monthly": "Monthly",
"kimiMonthlyTotal": "Monthly total",
diff --git a/src/i18n/locales/ja.json b/src/i18n/locales/ja.json
index 2ce7ebc70..0521eab2e 100644
--- a/src/i18n/locales/ja.json
+++ b/src/i18n/locales/ja.json
@@ -4474,12 +4474,12 @@
"geminiFlash": "Flash",
"geminiFlashLite": "Flash Lite",
"agyGemini": "Gemini",
- "agyThirdParty": "Claude/GPT",
+ "agyThirdParty": "Claude",
"agyGeminiFiveHour": "Gemini 5時間",
"agyGeminiWeekly": "Gemini 週間",
"agyGeminiArgonWeekly": "Argon 週間",
- "agyThirdPartyFiveHour": "Claude/GPT 5時間",
- "agyThirdPartyWeekly": "Claude/GPT 週間",
+ "agyThirdPartyFiveHour": "Claude 5時間",
+ "agyThirdPartyWeekly": "Claude 週間",
"weeklyLimit": "週間",
"monthly": "月間",
"kimiMonthlyTotal": "月間合計",
diff --git a/src/i18n/locales/ko.json b/src/i18n/locales/ko.json
index 45edd73c4..44b451bbe 100644
--- a/src/i18n/locales/ko.json
+++ b/src/i18n/locales/ko.json
@@ -4474,12 +4474,12 @@
"geminiFlash": "Flash",
"geminiFlashLite": "Flash Lite",
"agyGemini": "Gemini",
- "agyThirdParty": "Claude/GPT",
+ "agyThirdParty": "Claude",
"agyGeminiFiveHour": "Gemini 5시간",
"agyGeminiWeekly": "Gemini 주간",
"agyGeminiArgonWeekly": "Argon 주간",
- "agyThirdPartyFiveHour": "Claude/GPT 5시간",
- "agyThirdPartyWeekly": "Claude/GPT 주간",
+ "agyThirdPartyFiveHour": "Claude 5시간",
+ "agyThirdPartyWeekly": "Claude 주간",
"weeklyLimit": "주간",
"monthly": "월간",
"kimiMonthlyTotal": "월간 총 사용량",
diff --git a/src/i18n/locales/ru.json b/src/i18n/locales/ru.json
index 7af0c9268..1c66d26b0 100644
--- a/src/i18n/locales/ru.json
+++ b/src/i18n/locales/ru.json
@@ -4472,12 +4472,12 @@
"geminiFlash": "Flash",
"geminiFlashLite": "Flash Lite",
"agyGemini": "Gemini",
- "agyThirdParty": "Claude/GPT",
+ "agyThirdParty": "Claude",
"agyGeminiFiveHour": "Gemini, 5 часов",
"agyGeminiWeekly": "Gemini, неделя",
"agyGeminiArgonWeekly": "Argon, неделя",
- "agyThirdPartyFiveHour": "Claude/GPT, 5 часов",
- "agyThirdPartyWeekly": "Claude/GPT, неделя",
+ "agyThirdPartyFiveHour": "Claude, 5 часов",
+ "agyThirdPartyWeekly": "Claude, неделя",
"weeklyLimit": "Еженедельно",
"monthly": "Ежемесячно",
"kimiMonthlyTotal": "Всего за месяц",
diff --git a/src/i18n/locales/tr.json b/src/i18n/locales/tr.json
index c75416b19..6160562bd 100644
--- a/src/i18n/locales/tr.json
+++ b/src/i18n/locales/tr.json
@@ -4403,12 +4403,12 @@
"geminiFlash": "Flash",
"geminiFlashLite": "Flash Lite",
"agyGemini": "Gemini",
- "agyThirdParty": "Claude/GPT",
+ "agyThirdParty": "Claude",
"agyGeminiFiveHour": "Gemini 5 saatlik",
"agyGeminiWeekly": "Gemini haftalık",
"agyGeminiArgonWeekly": "Argon haftalık",
- "agyThirdPartyFiveHour": "Claude/GPT 5 saatlik",
- "agyThirdPartyWeekly": "Claude/GPT haftalık",
+ "agyThirdPartyFiveHour": "Claude 5 saatlik",
+ "agyThirdPartyWeekly": "Claude haftalık",
"weeklyLimit": "Haftalık",
"monthly": "Aylık",
"kimiMonthlyTotal": "Aylık toplam",
diff --git a/src/i18n/locales/zh-TW.json b/src/i18n/locales/zh-TW.json
index b94e270b9..b7737eb96 100644
--- a/src/i18n/locales/zh-TW.json
+++ b/src/i18n/locales/zh-TW.json
@@ -4474,12 +4474,12 @@
"geminiFlash": "Flash",
"geminiFlashLite": "Flash Lite",
"agyGemini": "Gemini",
- "agyThirdParty": "Claude/GPT",
+ "agyThirdParty": "Claude",
"agyGeminiFiveHour": "Gemini 5 小時",
"agyGeminiWeekly": "Gemini 每週",
"agyGeminiArgonWeekly": "Argon 每週",
- "agyThirdPartyFiveHour": "Claude/GPT 5 小時",
- "agyThirdPartyWeekly": "Claude/GPT 每週",
+ "agyThirdPartyFiveHour": "Claude 5 小時",
+ "agyThirdPartyWeekly": "Claude 每週",
"weeklyLimit": "每週",
"monthly": "每月",
"kimiMonthlyTotal": "月總額度",
diff --git a/src/i18n/locales/zh.json b/src/i18n/locales/zh.json
index 6129635aa..0b1755de2 100644
--- a/src/i18n/locales/zh.json
+++ b/src/i18n/locales/zh.json
@@ -4474,12 +4474,12 @@
"geminiFlash": "Flash",
"geminiFlashLite": "Flash Lite",
"agyGemini": "Gemini",
- "agyThirdParty": "Claude/GPT",
+ "agyThirdParty": "Claude",
"agyGeminiFiveHour": "Gemini 5 小时",
"agyGeminiWeekly": "Gemini 每周",
"agyGeminiArgonWeekly": "Argon 每周",
- "agyThirdPartyFiveHour": "Claude/GPT 5 小时",
- "agyThirdPartyWeekly": "Claude/GPT 每周",
+ "agyThirdPartyFiveHour": "Claude 5 小时",
+ "agyThirdPartyWeekly": "Claude 每周",
"weeklyLimit": "每周",
"monthly": "每月",
"kimiMonthlyTotal": "月总额度",
diff --git a/src/index.css b/src/index.css
index 144a592fe..5995156f4 100644
--- a/src/index.css
+++ b/src/index.css
@@ -404,6 +404,8 @@
--h-card: 58px;
--card-py: 10px;
--w-sidebar-rail-item: 36px;
+ --w-quota-text: 136px;
+ --w-quota-reset: 52px;
}
html[data-density="comfortable"] {
@@ -428,6 +430,8 @@ html[data-density="comfortable"] {
--h-control-sm: 32px;
--h-nav-row: 34px;
--h-card: 68px;
+ --w-quota-text: 148px;
+ --w-quota-reset: 56px;
--card-py: 14px;
--w-sidebar-rail-item: 40px;
}
diff --git a/tests/components/QuotaLines.test.tsx b/tests/components/QuotaLines.test.tsx
index 18986e1a4..67b2f98c9 100644
--- a/tests/components/QuotaLines.test.tsx
+++ b/tests/components/QuotaLines.test.tsx
@@ -228,7 +228,9 @@ describe("reset countdown on the card", () => {
it("only widens the column when some tier has a reset time", () => {
vi.setSystemTime(new Date("2026-10-04T10:00:00Z"));
const { container, rerender } = render(<QuotaLines lines={lines} />);
- expect(container.firstElementChild).toHaveClass("w-[136px]");
+ expect(container.firstElementChild).toHaveClass(
+ "w-[var(--w-quota-text,136px)]",
+ );
expect(container.querySelector("svg")).toBeNull();
rerender(
@@ -236,7 +238,31 @@ describe("reset countdown on the card", () => {
lines={[{ ...lines[0], resetsAt: "2026-10-04T12:30:00Z" }]}
/>,
);
- expect(container.firstElementChild).toHaveClass("w-[194px]");
+ expect(container.firstElementChild).toHaveClass(
+ "w-[calc(var(--w-quota-text,136px)+var(--w-quota-reset,52px)+6px)]",
+ );
expect(screen.getByText("2h30m")).toBeInTheDocument();
});
+
+ it("adds chevron room and clears the -mx-1 hover pill when breakdown is set", () => {
+ vi.setSystemTime(new Date("2026-10-04T10:00:00Z"));
+ const { container } = render(
+ <QuotaLines
+ lines={[{ ...lines[0], resetsAt: "2026-10-04T12:30:00Z" }]}
+ onRefresh={vi.fn()}
+ breakdown={{
+ title: "Quota",
+ openLabel: "Show all",
+ items: [{ key: "a", label: "5h", value: "80%", tone: "normal" }],
+ }}
+ />,
+ );
+ expect(container.firstElementChild).toHaveClass(
+ "w-[calc(var(--w-quota-text,136px)+var(--w-quota-reset,52px)+20px)]",
+ );
+ const refreshButton = screen.getByRole("button", {
+ name: "quota.clickToRefresh",
+ });
+ expect(refreshButton).toHaveClass("me-1", "pe-1");
+ });
});
diff --git a/tests/components/SubscriptionQuotaFooter.test.tsx b/tests/components/SubscriptionQuotaFooter.test.tsx
index 527bb0625..caabf57eb 100644
--- a/tests/components/SubscriptionQuotaFooter.test.tsx
+++ b/tests/components/SubscriptionQuotaFooter.test.tsx
@@ -319,18 +319,18 @@ describe("Antigravity quota groups", () => {
{ name: "agy_third_party_weekly", utilization: 20, resetsAt: null },
];
- it("keeps one line per group on the card: the window with the least left", () => {
+ it("keeps the 5-hour window per group on the card even when weekly is tighter", () => {
renderQuota(agyTiers);
const lines = screen.getByRole("button", { name: "查看各档额度" }).children;
expect(lines).toHaveLength(2);
- expect(lines[0]).toHaveTextContent("Gemini 剩余 60%");
- expect(lines[1]).toHaveTextContent("Claude/GPT 剩余 5%");
- // 倒计时跟着留下的那档(Gemini 每周)
- expect(screen.getByText("2d12h")).toBeInTheDocument();
+ expect(lines[0]).toHaveTextContent("Gemini 5 小时 90%");
+ expect(lines[1]).toHaveTextContent("Claude 5 小时 5%");
+ // 5 小时档没有重置时间,卡片不显示每周那档的 2d12h
+ expect(screen.queryByText("2d12h")).not.toBeInTheDocument();
});
- it("counts the Argon weekly window in the Gemini line, so the card stays two rows", () => {
- // 按后端排好的顺序:Argon 在 Gemini 每周之后、Claude/GPT 之前
+ it("keeps the Gemini 5-hour line even when Argon weekly is tighter, so the card stays two rows", () => {
+ // 按后端排好的顺序:Argon 在 Gemini 每周之后、Claude 之前
renderQuota([
...agyTiers.slice(0, 2),
{ name: "agy_gemini_argon_weekly", utilization: 70, resetsAt: null },
@@ -338,8 +338,8 @@ describe("Antigravity quota groups", () => {
]);
const lines = screen.getByRole("button", { name: "查看各档额度" }).children;
expect(lines).toHaveLength(2);
- expect(lines[0]).toHaveTextContent("Gemini 剩余 30%");
- expect(lines[1]).toHaveTextContent("Claude/GPT 剩余 5%");
+ expect(lines[0]).toHaveTextContent("Gemini 5 小时 90%");
+ expect(lines[1]).toHaveTextContent("Claude 5 小时 5%");
});
it("opens one dropdown listing all four windows; ↻ still refreshes", async () => {
@@ -355,8 +355,8 @@ describe("Antigravity quota groups", () => {
).toEqual([
"Gemini 5 小时剩余 90%",
"Gemini 每周2d12h后重置剩余 60%",
- "Claude/GPT 5 小时剩余 5%",
- "Claude/GPT 每周剩余 80%",
+ "Claude 5 小时剩余 5%",
+ "Claude 每周剩余 80%",
]);
fireEvent.click(screen.getByRole("button", { name: "点击重新查询" }));
@@ -375,8 +375,8 @@ describe("Antigravity quota groups", () => {
for (const name of [
"Gemini 5 小时: 剩余 90%",
"Gemini 每周: 剩余 60%",
- "Claude/GPT 5 小时: 剩余 5%",
- "Claude/GPT 每周: 剩余 80%",
+ "Claude 5 小时: 剩余 5%",
+ "Claude 每周: 剩余 80%",
]) {
expect(screen.getByRole("meter", { name })).toBeInTheDocument();
}
diff --git a/tests/components/quotaRules.test.ts b/tests/components/quotaRules.test.ts
index fc33d9477..64fe325c2 100644
--- a/tests/components/quotaRules.test.ts
+++ b/tests/components/quotaRules.test.ts
@@ -266,8 +266,8 @@ describe("saved limit resets", () => {
expect(
breakdown?.items.map(({ hint, value, tone }) => [hint, value, tone]),
).toEqual([
- ["2d0h后", "2 次", "warning"],
- ["20d0h后", "1 次", "normal"],
+ ["2d00h后", "2 次", "warning"],
+ ["20d00h后", "1 次", "normal"],
[undefined, "1 次", "normal"],
]);
expect(breakdown?.items[2].label).toBe("不会过期");