import { useState } from 'react'; import { Dialog, DialogContent, DialogHeader, DialogTitle, DialogDescription, DialogFooter } from '@/components/ui/dialog'; import { Button } from '@/components/ui/button'; import { RadioGroup, RadioGroupItem } from '@/components/ui/radio-group'; import { Label } from '@/components/ui/label'; import { Alert, AlertDescription } from '@/components/ui/alert'; import { AlertCircle } from 'lucide-react'; import { type DependencyConflict, type SubmissionItemWithDeps } from '@/lib/submissionItemsService'; interface ConflictResolutionDialogProps { open: boolean; onOpenChange: (open: boolean) => void; conflicts: DependencyConflict[]; items: SubmissionItemWithDeps[]; onResolve: () => void; } export function ConflictResolutionDialog({ open, onOpenChange, conflicts, items, onResolve, }: ConflictResolutionDialogProps) { const [resolutions, setResolutions] = useState>({}); const handleResolutionChange = (itemId: string, action: string) => { setResolutions(prev => ({ ...prev, [itemId]: action })); }; const allConflictsResolved = conflicts.every( conflict => resolutions[conflict.itemId] ); const handleApply = () => { // TODO: Apply resolutions onResolve(); onOpenChange(false); }; return ( Resolve Dependency Conflicts {conflicts.length} conflict(s) found. Choose how to resolve each one.
{conflicts.map((conflict) => { const item = items.find(i => i.id === conflict.itemId); return (

{item?.item_type.replace('_', ' ').toUpperCase()}: {item?.item_data.name}

{conflict.message}

handleResolutionChange(conflict.itemId, value)} > {conflict.suggestions.map((suggestion, idx) => (
))}
); })}
); }