diff --git a/frontend/src/components/common/QualityFlag.tsx b/frontend/src/components/common/QualityFlag.tsx index 5ab35db..11c3d87 100644 --- a/frontend/src/components/common/QualityFlag.tsx +++ b/frontend/src/components/common/QualityFlag.tsx @@ -1,5 +1,6 @@ import { AlertTriangle, CheckCircle2, FileWarning, Hash, Image, PenLine, Table } from "lucide-react"; import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip"; +import type { QualityFlags as QualityFlagsDomain } from "@/services/types"; import { cn } from "@/lib/utils"; const FLAGS: Record< @@ -15,16 +16,23 @@ const FLAGS: Record< needs_manual_review: { label: "Needs manual review", icon: AlertTriangle, tone: "text-warning" }, }; +export type FlagInput = + | QualityFlagsDomain + | Record + | null + | undefined; + export function QualityFlags({ flags, compact = false, className, }: { - flags: Record | null | undefined; + flags: FlagInput; compact?: boolean; className?: string; }) { - const active = Object.entries(flags ?? {}) + const flagMap = (flags ?? {}) as Record; + const active = Object.entries(flagMap) .filter(([k, v]) => v && FLAGS[k]) .map(([k]) => k); diff --git a/frontend/src/pages/DashboardPage.tsx b/frontend/src/pages/DashboardPage.tsx index ee1f54f..f3c70ae 100644 --- a/frontend/src/pages/DashboardPage.tsx +++ b/frontend/src/pages/DashboardPage.tsx @@ -1,5 +1,6 @@ import { FileText, Layers, ShieldAlert, Sparkles, Cpu, Database } from "lucide-react"; +import type { DashboardStats } from "@/services/types"; import { PageHeader } from "@/components/common/PageHeader"; import { Button } from "@/components/ui/button"; import { KpiCard } from "@/widgets/KpiCard"; @@ -39,7 +40,7 @@ export function DashboardPage() { delta={4.2} icon={} tone="primary" - trend={data?.daily_ingest.slice(-12).map((d) => d.ingested) ?? []} + trend={data?.daily_ingest.slice(-12).map((d: DashboardStats["daily_ingest"][number]) => d.ingested) ?? []} /> } tone="success" - trend={data?.ocr_distribution.map((d) => d.count) ?? []} + trend={data?.ocr_distribution.map((d: DashboardStats["ocr_distribution"][number]) => d.count) ?? []} /> + +interface ImportMetaEnv { + readonly VITE_API_BASE_URL?: string; + readonly VITE_USE_MOCK?: string; + readonly VITE_APP_NAME?: string; +} + +interface ImportMeta { + readonly env: ImportMetaEnv; +}