mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-25 05:11:13 -05:00
feat: Implement enhanced moderation system
This commit is contained in:
93
src/components/moderation/EscalationDialog.tsx
Normal file
93
src/components/moderation/EscalationDialog.tsx
Normal file
@@ -0,0 +1,93 @@
|
||||
import { useState } from 'react';
|
||||
import { Dialog, DialogContent, DialogHeader, DialogTitle, DialogDescription, DialogFooter } from '@/components/ui/dialog';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Textarea } from '@/components/ui/textarea';
|
||||
import { Label } from '@/components/ui/label';
|
||||
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@/components/ui/select';
|
||||
|
||||
interface EscalationDialogProps {
|
||||
open: boolean;
|
||||
onOpenChange: (open: boolean) => void;
|
||||
onEscalate: (reason: string) => void;
|
||||
}
|
||||
|
||||
const escalationReasons = [
|
||||
'Complex dependency issue',
|
||||
'Potential policy violation',
|
||||
'Unclear submission content',
|
||||
'Requires admin judgment',
|
||||
'Technical issue',
|
||||
'Other',
|
||||
];
|
||||
|
||||
export function EscalationDialog({
|
||||
open,
|
||||
onOpenChange,
|
||||
onEscalate,
|
||||
}: EscalationDialogProps) {
|
||||
const [selectedReason, setSelectedReason] = useState('');
|
||||
const [additionalNotes, setAdditionalNotes] = useState('');
|
||||
|
||||
const handleEscalate = () => {
|
||||
const reason = selectedReason === 'Other'
|
||||
? additionalNotes
|
||||
: `${selectedReason}${additionalNotes ? ': ' + additionalNotes : ''}`;
|
||||
|
||||
onEscalate(reason);
|
||||
onOpenChange(false);
|
||||
|
||||
// Reset form
|
||||
setSelectedReason('');
|
||||
setAdditionalNotes('');
|
||||
};
|
||||
|
||||
return (
|
||||
<Dialog open={open} onOpenChange={onOpenChange}>
|
||||
<DialogContent>
|
||||
<DialogHeader>
|
||||
<DialogTitle>Escalate to Admin</DialogTitle>
|
||||
<DialogDescription>
|
||||
This submission will be flagged for admin review. Please provide a reason.
|
||||
</DialogDescription>
|
||||
</DialogHeader>
|
||||
|
||||
<div className="space-y-4 py-4">
|
||||
<div className="space-y-2">
|
||||
<Label>Escalation Reason</Label>
|
||||
<Select value={selectedReason} onValueChange={setSelectedReason}>
|
||||
<SelectTrigger>
|
||||
<SelectValue placeholder="Select a reason" />
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
{escalationReasons.map((reason) => (
|
||||
<SelectItem key={reason} value={reason}>
|
||||
{reason}
|
||||
</SelectItem>
|
||||
))}
|
||||
</SelectContent>
|
||||
</Select>
|
||||
</div>
|
||||
|
||||
<div className="space-y-2">
|
||||
<Label>Additional Notes</Label>
|
||||
<Textarea
|
||||
value={additionalNotes}
|
||||
onChange={(e) => setAdditionalNotes(e.target.value)}
|
||||
placeholder="Provide any additional context..."
|
||||
rows={4}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<DialogFooter>
|
||||
<Button variant="outline" onClick={() => onOpenChange(false)}>
|
||||
Cancel
|
||||
</Button>
|
||||
<Button onClick={handleEscalate} disabled={!selectedReason}>
|
||||
Escalate
|
||||
</Button>
|
||||
</DialogFooter>
|
||||
</DialogContent>
|
||||
</Dialog>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user