'use client' import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card' import { Button } from '@/components/ui/button' import { Input } from '@/components/ui/input' import { Label } from '@/components/ui/label' import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@/components/ui/select' import { Plus, Trash2 } from 'lucide-react' type WizardJuryGroup = { tempId: string name: string slug: string defaultMaxAssignments: number defaultCapMode: string sortOrder: number } type JuryGroupsSectionProps = { juryGroups: WizardJuryGroup[] onChange: (groups: WizardJuryGroup[]) => void } export function JuryGroupsSection({ juryGroups, onChange }: JuryGroupsSectionProps) { const handleAddGroup = () => { const newGroup: WizardJuryGroup = { tempId: crypto.randomUUID(), name: '', slug: '', defaultMaxAssignments: 5, defaultCapMode: 'SOFT', sortOrder: juryGroups.length, } onChange([...juryGroups, newGroup]) } const handleRemoveGroup = (tempId: string) => { const updated = juryGroups.filter((g) => g.tempId !== tempId) const reordered = updated.map((g, index) => ({ ...g, sortOrder: index })) onChange(reordered) } const handleUpdateGroup = (tempId: string, updates: Partial) => { const updated = juryGroups.map((g) => g.tempId === tempId ? { ...g, ...updates } : g ) onChange(updated) } return (
Jury Groups

Create jury groups for evaluation rounds (optional)

{juryGroups.length === 0 ? (
No jury groups yet. Add groups to assign evaluators to rounds.
) : ( juryGroups.map((group, index) => (
{index + 1}
{ const name = e.target.value const slug = name.toLowerCase().replace(/\s+/g, '-').replace(/[^a-z0-9-]/g, '') handleUpdateGroup(group.tempId, { name, slug }) }} />
handleUpdateGroup(group.tempId, { slug: e.target.value })} />
handleUpdateGroup(group.tempId, { defaultMaxAssignments: parseInt(e.target.value, 10), }) } />
)) )}
) }