mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-22 05:51:12 -05:00
Refactor code structure and remove redundant changes
This commit is contained in:
73
src-old/components/moderation/WarningConfirmDialog.tsx
Normal file
73
src-old/components/moderation/WarningConfirmDialog.tsx
Normal file
@@ -0,0 +1,73 @@
|
||||
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>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user