Files
tfm_ainventory/frontend/components/SearchErrorModal.tsx
2026-04-25 12:04:02 +03:00

40 lines
1.2 KiB
TypeScript

'use client';
interface SearchErrorModalProps {
isOpen: boolean;
error: string | null;
onRetry?: () => void;
onSkip?: () => void;
canRetry?: boolean;
}
export function SearchErrorModal({ isOpen, error, onRetry, onSkip, canRetry = true }: SearchErrorModalProps) {
if (!isOpen) return null;
return (
<div className="fixed inset-0 bg-black/50 flex items-center justify-center z-50">
<div className="bg-background p-6 max-w-md shadow-xl border border-outline/30">
<h2 className="text-xl font-normal mb-2 text-error">Search failed</h2>
<p className="text-sm text-secondary mb-4">{error || 'Unable to retrieve specs from the web'}</p>
<div className="flex gap-3">
{canRetry && (
<button
onClick={onRetry}
className="flex-1 px-4 py-2 bg-primary text-primary-foreground font-normal text-sm hover:bg-primary/90"
>
Retry
</button>
)}
<button
onClick={onSkip}
className="flex-1 px-4 py-2 border border-outline/30 font-normal text-sm hover:bg-surface-container text-foreground"
>
Skip
</button>
</div>
</div>
</div>
);
}