import { useState } from 'react'; import { useModelPerformance, useModelFailures } from '../api/hooks'; import { LoadingSpinner, DateRangeSelector, StatusBadge, Card } from '../components/ui'; export function OpsModelPage() { const [hours, setHours] = useState(24); const { data: perf, isLoading } = useModelPerformance(hours); const { data: failures } = useModelFailures(hours); if (isLoading) return ; const p = (perf ?? {}) as Record; return ( Model Performance {/* Key metrics */} {/* Recent Failures */} Recent Failures ({(failures as unknown[])?.length ?? 0}) {!(failures as unknown[])?.length ? ( No recent failures ) : ( {(failures as Array>).map((f, i) => ( {String(f.ticker)} {String(f.model_name)} {f.recorded_at ? new Date(String(f.recorded_at)).toLocaleString() : ''} {f.document_title ? String(f.document_title) : ''} ({String(f.document_type)}) {f.validation_errors ? ( {JSON.stringify(f.validation_errors) ?? ''} ) : null} ))} )} ); } function StatCard({ label, value, color = 'text-gray-100' }: { label: string; value: string; color?: string }) { return ( {value} {label} ); }
No recent failures