diff --git a/web/src/components/inventory/ItemRow.tsx b/web/src/components/inventory/ItemRow.tsx index e19cf62..26de11b 100644 --- a/web/src/components/inventory/ItemRow.tsx +++ b/web/src/components/inventory/ItemRow.tsx @@ -14,7 +14,7 @@ const STATUS_COLOR: Record = { export function ItemRow({ item }: { item: InventoryItem }) { const netboxUrl = `http://netbox.local/dcim/devices/${item.id}/` - const dot = STATUS_COLOR[item.catalog_status] ?? 'bg-charcoal' + const dot = STATUS_COLOR[item.catalog_status ?? 'draft'] ?? 'bg-charcoal' return ( = { type BadgeVariant = 'default' | 'indexed' | 'draft' | 'needs_research' | 'researched' | 'complete' | 'destructive' -export function StatusBadge({ status }: { status: string }) { - const variant = (status in STATUS_LABELS ? status : 'draft') as BadgeVariant - return {STATUS_LABELS[status] ?? status} +export function StatusBadge({ status }: { status: string | null }) { + const key = status ?? 'draft' + const variant = (key in STATUS_LABELS ? key : 'draft') as BadgeVariant + return {STATUS_LABELS[key] ?? key} } diff --git a/web/src/lib/api.ts b/web/src/lib/api.ts index 6bbd153..10723ed 100644 --- a/web/src/lib/api.ts +++ b/web/src/lib/api.ts @@ -31,19 +31,19 @@ export const fetchInventory = (): Promise => export const fetchInventoryItem = (id: number): Promise => fetchJSON(`${BASE}/inventory/${id}`) -// Intake submission — added by Plan 03-04 +// Intake submission — matches IntakeResult in store/intake.ts export interface IntakeResponse { hw_id: string - device_id: number - catalog_status: string - confidence: number - name: string - manufacturer: string model: string - serial_number: string + manufacturer: string category: string - tags: string[] + specs: Record + suggested_tags: string[] ai_notes: string + confidence: number + catalog_status: string + netbox_id: number + queued: boolean } export async function submitIntake(photos: File[], quickAdd = false): Promise { diff --git a/web/src/pages/ItemDetailPage.tsx b/web/src/pages/ItemDetailPage.tsx index 33721cd..2b8f378 100644 --- a/web/src/pages/ItemDetailPage.tsx +++ b/web/src/pages/ItemDetailPage.tsx @@ -6,7 +6,7 @@ import { Button } from '@/components/ui/button' import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card' import { useInventoryItem } from '@/hooks/useInventory' -function FieldRow({ label, value }: { label: string; value?: string }) { +function FieldRow({ label, value }: { label: string; value?: string | null }) { if (!value) return null return (