Build a single-page Live Multi-Currency Settlement Dashboard widget as a self-contained…
- User
Build a single-page Live Multi-Currency Settlement Dashboard widget as a self-contained React + TypeScript component (one file, no external chart/table/DnD libraries — everything must be hand-rolled with SVG/DOM/CSS). Assume it will sit inside a payments back-office tool.
Data model ts type Currency = "USD" | "EUR" | "GBP" | "JPY" | "BHD";
interface Transaction { id: string; currency: Currency; amount: number; // can be negative (refunds/chargebacks) counterparty: string; timestamp: number; reconciled: boolean; }
Assume a mock async API layer already exists with these signatures (implement realistic mocked versions yourself, including simulated latency and a simulated failure rate):
ts fetchExchangeRates(): Promise<Record<Currency, number>> fetchTransactions(page: number, pageSize: number): Promise<Transaction[]> reconcileTransaction(id: string): Promise<{ success: boolean }> Functional requirements Exchange rate ticker — polls fetchExchangeRates every 3s. Each rate transitions to its new value with an animated digit-roll effect (like an odometer), not a plain re-render. Rate changes are also color-flashed green/red for up/down and fade back to neutral over 600ms. Currency exposure chart — a hand-rolled SVG donut chart (no canvas, no library) showing exposure per currency. When underlying data changes, arcs must tween from their old angles to new angles over 400ms ease-out — no remount, no snapping. Transaction table — must smoothly handle 10,000+ rows via windowed/virtualized rendering you implement yourself (no react-window). Sortable by any column, debounced text filter (300ms) across counterparty and currency, and each column's sort must be stable for ties. Reorder currency priority list — a list of the 5 currencies the user can reorder by drag, AND by keyboard (focus item, arrow up/down to move, with an aria-live announcement of the new position). Reordering must persist to component state and be fully undoable with a single "undo" action. Optimistic reconcile action — clicking "Reconcile" on a transaction row instantly marks it reconciled in the UI, calls reconcileTransaction, and rolls back with a visible inline error (not a toast) if the call fails, restoring the exact prior row state. Independent loading/empty/error states — the ticker, chart, and table each manage their own loading/empty/error UI independently. A failure in one section must never block or blank the others. Currency formatting — use Intl.NumberFormat as the base, but override decimal places per currency: JPY → 0 decimals, BHD → 3 decimals, all others → 2. Negative amounts render in accounting style (parentheses, red) rather than a leading minus sign. Theming — light/dark toggle via CSS custom properties only (no class-per-component theme switching). Both themes must meet WCAG AA contrast for all text against its background. Responsive behavior — at widths under 640px, the table's less-critical columns (counterparty, timestamp) collapse into an expandable row detail instead of horizontal scroll, and the donut chart shrinks and moves above the ticker instead of beside it. Constraints React + TypeScript, single file. No charting, table, virtualization, or drag-and-drop libraries — implement the mechanics directly. No global loading spinner that gates the whole UI. Must not use any. Include brief inline comments only where a reviewer would otherwise ask "why." Deliverable
Assistant
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.