fix(03): resolve TypeScript type mismatches from merged plans

This commit is contained in:
Mikkel Georgsen 2026-04-10 06:27:11 +00:00
parent e2ac3b10aa
commit 021c82875e
4 changed files with 14 additions and 13 deletions

View file

@ -14,7 +14,7 @@ const STATUS_COLOR: Record<string, string> = {
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 (
<Link

View file

@ -10,7 +10,8 @@ const STATUS_LABELS: Record<string, string> = {
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 <Badge variant={variant}>{STATUS_LABELS[status] ?? status}</Badge>
export function StatusBadge({ status }: { status: string | null }) {
const key = status ?? 'draft'
const variant = (key in STATUS_LABELS ? key : 'draft') as BadgeVariant
return <Badge variant={variant}>{STATUS_LABELS[key] ?? key}</Badge>
}

View file

@ -31,19 +31,19 @@ export const fetchInventory = (): Promise<InventoryItem[]> =>
export const fetchInventoryItem = (id: number): Promise<InventoryItem> =>
fetchJSON<InventoryItem>(`${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<string, string>
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<IntakeResponse> {

View file

@ -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 (
<div className="flex gap-3 py-2 border-b border-charcoal/40 last:border-0">