mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-21 15:51:13 -05:00
74 lines
2.4 KiB
TypeScript
74 lines
2.4 KiB
TypeScript
import { AlertTriangle } from 'lucide-react';
|
|
import {
|
|
AlertDialog,
|
|
AlertDialogAction,
|
|
AlertDialogCancel,
|
|
AlertDialogContent,
|
|
AlertDialogDescription,
|
|
AlertDialogFooter,
|
|
AlertDialogHeader,
|
|
AlertDialogTitle,
|
|
} from '@/components/ui/alert-dialog';
|
|
import { Alert, AlertDescription } from '@/components/ui/alert';
|
|
import { ValidationError } from '@/lib/entityValidationSchemas';
|
|
|
|
interface WarningConfirmDialogProps {
|
|
open: boolean;
|
|
onClose: () => void;
|
|
onProceed: () => void;
|
|
warnings: ValidationError[];
|
|
itemNames: string[];
|
|
}
|
|
|
|
export function WarningConfirmDialog({
|
|
open,
|
|
onClose,
|
|
onProceed,
|
|
warnings,
|
|
itemNames,
|
|
}: WarningConfirmDialogProps) {
|
|
return (
|
|
<AlertDialog open={open} onOpenChange={onClose}>
|
|
<AlertDialogContent>
|
|
<AlertDialogHeader>
|
|
<AlertDialogTitle className="flex items-center gap-2 text-yellow-800 dark:text-yellow-300">
|
|
<AlertTriangle className="w-5 h-5" />
|
|
Validation Warnings
|
|
</AlertDialogTitle>
|
|
<AlertDialogDescription>
|
|
The following items have validation warnings. You can proceed with approval, but fixing these issues will improve content quality:
|
|
</AlertDialogDescription>
|
|
</AlertDialogHeader>
|
|
|
|
<div className="space-y-3 my-4">
|
|
{itemNames.map((name, index) => (
|
|
<div key={index} className="space-y-2">
|
|
<div className="font-medium text-sm">{name}</div>
|
|
<Alert className="border-yellow-300 dark:border-yellow-700 bg-yellow-50 dark:bg-yellow-900/20">
|
|
<AlertDescription className="space-y-1 text-yellow-800 dark:text-yellow-300">
|
|
{warnings
|
|
.filter((_, i) => i === index || itemNames.length === 1)
|
|
.map((warning, warnIndex) => (
|
|
<div key={warnIndex} className="text-sm">
|
|
• <span className="font-medium">{warning.field}:</span> {warning.message}
|
|
</div>
|
|
))}
|
|
</AlertDescription>
|
|
</Alert>
|
|
</div>
|
|
))}
|
|
</div>
|
|
|
|
<AlertDialogFooter>
|
|
<AlertDialogCancel onClick={onClose}>
|
|
Go Back to Edit
|
|
</AlertDialogCancel>
|
|
<AlertDialogAction onClick={onProceed}>
|
|
Proceed with Approval
|
|
</AlertDialogAction>
|
|
</AlertDialogFooter>
|
|
</AlertDialogContent>
|
|
</AlertDialog>
|
|
);
|
|
}
|