Files
EasyCLIProxyAPI/tests/fixtures/quota-layout.tsx
T
lzt404 1532bdb056 feat(quota): display all Codex reset credit expiry times
- List each expiry chronologically instead of showing only the earliest
- Update auth file panels, quota cards, and reset confirmation dialogs
- Preserve separate entries for credits with identical expiry times
- Add translations and regression coverage
2026-10-05 00:45:17 +08:00

38 lines
2.5 KiB
TypeScript

import React from 'react';
import { createRoot } from 'react-dom/client';
import { I18nProvider } from '../../src/i18n';
import { QuotaCard } from '../../src/pages/QuotaPage';
import { parseAnthropicResetGrantStatus } from '../../src/services/claudeResetGrants';
import { AuthFileQuotaPanel } from '../../src/components/AuthFileQuotaPanel';
import { quotaRowsFor } from '../../src/services/quotaService';
import '../../src/styles/index.css';
localStorage.setItem('easy-cli-proxy-api.locale', 'en');
const rows = quotaRowsFor('kimi', {
limits: [{ window: { duration: 5, timeUnit: 'TIME_UNIT_HOUR' }, detail: { limit: 100, remaining: 80 } }],
usage: { limit: 100, remaining: 60 },
});
const claudeFile = { name: 'claude.json', provider: 'claude', auth_index: 'claude-fixture' };
const claudeQuota = { status: 'success' as const, rows, resetCredits: 2, claudeResetGrants: parseAnthropicResetGrantStatus({ eligible: true, at_limit: true, grants: [{ id: 'reserve', resets_total: 2, resets_left: 2, usable_now: true }] })! };
createRoot(document.getElementById('root')!).render(
<I18nProvider>
<main className="content" style={{ width: 1100, padding: 0 }}>
<section className="page quota-page">
<div className="real-quota-grid">
{[1, 2, 3, 4, 5, 6].map((id) => <QuotaCard key={id} file={{ name: `kimi-${id}-long-credential-name@example.com.json`, provider: 'kimi' }} quota={{ status: 'success', rows }} onRefresh={() => {}} />)}
</div>
<div className="real-quota-grid">
<QuotaCard file={{ name: 'codex.json', provider: 'codex' }} quota={{ status: 'success', rows, resetCredits: 2, resetCreditsApplicable: 2, plan: 'team', subscriptionActiveUntil: '2030-10-17T13:58:00Z', resetCreditExpiries: ['2030-10-23T05:10:00Z', '2030-11-23T05:10:00Z'] }} onRefresh={() => {}} onReset={() => {}} />
<QuotaCard file={claudeFile} quota={claudeQuota} onRefresh={() => {}} onReset={() => {}} />
<QuotaCard file={{ name: 'failed.json', provider: 'kimi' }} quota={{ status: 'error', rows: [], error: 'Quota request failed' }} onRefresh={() => {}} />
<QuotaCard file={{ name: 'loading.json', provider: 'kimi' }} quota={{ status: 'loading', rows: [] }} onRefresh={() => {}} />
<QuotaCard file={{ name: 'idle.json', provider: 'kimi' }} quota={{ status: 'idle', rows: [] }} onRefresh={() => {}} />
</div>
<AuthFileQuotaPanel file={claudeFile} quota={claudeQuota} disabled={false} compact dense onRefresh={() => {}} onReset={() => {}} />
</section>
</main>
</I18nProvider>,
);