diff --git a/apps/web/src/App.tsx b/apps/web/src/App.tsx index 0a99724..e675a49 100644 --- a/apps/web/src/App.tsx +++ b/apps/web/src/App.tsx @@ -708,14 +708,14 @@ function Dashboard() {
- + Usage metrics CodexDash extracts numeric leaf nodes from the aggregated usage payload for quick overview cards. - + {metricCards.length === 0 ? (
No usage data yet. Connect an OpenAI account and complete the sign-in flow to start refreshing. @@ -725,9 +725,9 @@ function Dashboard() { {metricCards.map((metric) => (
-
+
{titleizeMetric(metric.label)}
diff --git a/apps/web/src/components/json-viewer.tsx b/apps/web/src/components/json-viewer.tsx index 4d5b4e2..57ead20 100644 --- a/apps/web/src/components/json-viewer.tsx +++ b/apps/web/src/components/json-viewer.tsx @@ -2,15 +2,17 @@ import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/com export function JsonViewer({ title, description, value }: { title: string; description: string; value: unknown }) { return ( - + {title} {description} - -
-          {JSON.stringify(value, null, 2)}
-        
+ +
+
+            {JSON.stringify(value, null, 2)}
+          
+
); diff --git a/apps/web/test/mobile-overflow-guards.test.js b/apps/web/test/mobile-overflow-guards.test.js new file mode 100644 index 0000000..9766e11 --- /dev/null +++ b/apps/web/test/mobile-overflow-guards.test.js @@ -0,0 +1,24 @@ +import { describe, expect, test } from 'bun:test'; +import { readFileSync } from 'node:fs'; +import { join } from 'node:path'; + +const appSource = readFileSync(join(import.meta.dir, '../src/App.tsx'), 'utf8'); +const jsonViewerSource = readFileSync( + join(import.meta.dir, '../src/components/json-viewer.tsx'), + 'utf8', +); + +describe('mobile overflow guards', () => { + test('usage metrics cards allow long metric labels to wrap on mobile', () => { + expect(appSource).toContain('className="grid gap-3 sm:grid-cols-2"'); + expect(appSource).toContain('className="min-w-0 rounded-2xl border border-white/10 bg-white/4 p-4"'); + expect(appSource).toContain('className="text-sm text-slate-400 break-words"'); + }); + + test('merged payload viewer constrains JSON horizontally inside the card', () => { + expect(jsonViewerSource).toContain('className="min-w-0"'); + expect(jsonViewerSource).toContain('overflow-x-auto'); + expect(jsonViewerSource).toContain('whitespace-pre-wrap'); + expect(jsonViewerSource).toContain('break-all'); + }); +});