'use client'; import { AlertTriangle, X, RefreshCw, SkipForward } from 'lucide-react'; interface ItemComparisonModalProps { show: boolean; existingItem: any; newItem: any; onUpdate: () => Promise; onSkip: () => void; loading?: boolean; } export default function ItemComparisonModal({ show, existingItem, newItem, onUpdate, onSkip, loading = false }: ItemComparisonModalProps) { if (!show) return null; const fields = [ { key: 'name', label: 'Name' }, { key: 'type', label: 'Type' }, { key: 'description', label: 'Description' }, { key: 'category', label: 'Category' }, { key: 'connector', label: 'Connector' }, { key: 'size', label: 'Size' }, { key: 'color', label: 'Color' }, { key: 'part_number', label: 'Part Number' }, { key: 'ocr_text', label: 'OCR Key' }, ]; const isDifferent = (key: string) => { const existing = String(existingItem?.[key] || '').trim(); const newVal = String(newItem?.[key] || '').trim(); return existing !== newVal && newVal !== ''; }; const hasChanges = fields.some(f => isDifferent(f.key)); return (

Part Number Already Exists

Compare the versions below

{/* Comparison Table */}
Field
Current (ID: {existingItem?.id})
New (Import)
{fields.map(field => { const existing = String(existingItem?.[field.key] || '').trim() || '—'; const newVal = String(newItem?.[field.key] || '').trim() || '—'; const different = isDifferent(field.key); return (
{field.label}
{existing}
{newVal}
); })}
{!hasChanges && (

✓ Items are identical. No update needed.

)} {/* Action Buttons */}
{hasChanges && ( )}
); }