import { Link } from '@tanstack/react-router'; import { usePipelineHealth, useIngestionSummary, useRecommendations, useCompanies, useCoverageGaps } from '../api/hooks'; import { LoadingSpinner, Card } from '../components/ui'; import { Building2, FileText, TrendingUp, Lightbulb, ShoppingCart, Wallet, ShieldCheck, Activity, Download, Cpu, Radar, Terminal, LayoutDashboard, AlertTriangle, } from 'lucide-react'; const quickNav = [ { to: '/companies', label: 'Companies', icon: , color: 'text-blue-400' }, { to: '/documents', label: 'Documents', icon: , color: 'text-green-400' }, { to: '/trends', label: 'Trends', icon: , color: 'text-purple-400' }, { to: '/recommendations', label: 'Recommendations', icon: , color: 'text-yellow-400' }, { to: '/orders', label: 'Orders', icon: , color: 'text-orange-400' }, { to: '/positions', label: 'Positions', icon: , color: 'text-cyan-400' }, { to: '/trading', label: 'Trading', icon: , color: 'text-red-400' }, { to: '/ops/pipeline', label: 'Pipeline', icon: , color: 'text-emerald-400' }, { to: '/ops/ingestion', label: 'Ingestion', icon: , color: 'text-teal-400' }, { to: '/ops/model', label: 'Model Perf', icon: , color: 'text-indigo-400' }, { to: '/ops/coverage', label: 'Coverage', icon: , color: 'text-pink-400' }, { to: '/analytics/query', label: 'SQL Explorer', icon: , color: 'text-amber-400' }, { to: '/analytics/dashboards', label: 'Dashboards', icon: , color: 'text-violet-400' }, ]; export function HomePage() { const { data: pipeline, isLoading: pLoading } = usePipelineHealth(24); const { data: ingestion } = useIngestionSummary(24); const { data: recs } = useRecommendations({ limit: 5 }); const { data: companies } = useCompanies(); const { data: gaps } = useCoverageGaps(); if (pLoading) return ; const ing = (ingestion ?? {}) as Record; const staleCount = (gaps?.stale_sources?.length ?? 0) + (gaps?.missing_source_types?.length ?? 0); return (

Stonks Oracle

{/* Alert banner */} {staleCount > 0 && (
{staleCount} coverage issue{staleCount > 1 ? 's' : ''} detected — check{' '} Source Coverage
)} {/* Key metrics */}
{/* Pipeline status */} {pipeline && (

Pipeline Status (24h)

{((pipeline.document_stages ?? []) as Array<{ status: string; doc_count: number }>).map((s) => (
{s.doc_count}
{s.status}
))}
)} {/* Recent activity */} {recs && recs.length > 0 && (

Recent Recommendations

{recs.map((r) => (
{r.ticker} {r.action} {r.thesis}
{new Date(r.generated_at).toLocaleString()} ))}
)} {/* Quick nav */}
{quickNav.map((item) => ( {item.icon} {item.label} ))}
); } function MetricCard({ label, value }: { label: string; value: unknown }) { return (
{value != null ? String(value) : '—'}
{label}
); }