forked from molecule-ai/molecule-core
WorkspaceUsage now fetches GET /workspaces/:id/metrics on mount and on workspaceId change. Displays input_tokens and output_tokens formatted with toLocaleString, and estimated_cost_usd as $X.XXXXXX. Shows three zinc-700 skeleton rows while loading; surfaces error text on failure. Stale-fetch guard via ignore flag prevents state updates after unmount. Also fixes missing 'use client' in RevealToggle.tsx (#603) — the onClick handler requires client-side hydration. Tests updated: 12 tests covering loading skeleton, API call correctness, token formatting, cost formatting, error state, and workspaceId refetch. All 551 canvas tests pass; build clean. Closes #592 Closes #603 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> |
||
|---|---|---|
| .. | ||
| __tests__ | ||
| app | ||
| components | ||
| hooks | ||
| lib | ||
| store | ||
| stores | ||
| styles | ||
| types | ||
| middleware.ts | ||