diff --git a/src/app/(admin)/admin/rounds/[id]/page.tsx b/src/app/(admin)/admin/rounds/[id]/page.tsx
index 7897b9d..2f329f2 100644
--- a/src/app/(admin)/admin/rounds/[id]/page.tsx
+++ b/src/app/(admin)/admin/rounds/[id]/page.tsx
@@ -16,6 +16,17 @@ import { Badge } from '@/components/ui/badge'
import { Skeleton } from '@/components/ui/skeleton'
import { Progress } from '@/components/ui/progress'
import { Separator } from '@/components/ui/separator'
+import {
+ AlertDialog,
+ AlertDialogAction,
+ AlertDialogCancel,
+ AlertDialogContent,
+ AlertDialogDescription,
+ AlertDialogFooter,
+ AlertDialogHeader,
+ AlertDialogTitle,
+ AlertDialogTrigger,
+} from '@/components/ui/alert-dialog'
import {
ArrowLeft,
Edit,
@@ -31,7 +42,10 @@ import {
BarChart3,
Upload,
Filter,
+ Trash2,
+ Loader2,
} from 'lucide-react'
+import { toast } from 'sonner'
import { format, formatDistanceToNow, isPast, isFuture } from 'date-fns'
interface PageProps {
@@ -50,6 +64,15 @@ function RoundDetailContent({ roundId }: { roundId: string }) {
utils.round.get.invalidate({ id: roundId })
},
})
+ const deleteRound = trpc.round.delete.useMutation({
+ onSuccess: () => {
+ toast.success('Round deleted')
+ router.push('/admin/rounds')
+ },
+ onError: () => {
+ toast.error('Failed to delete round')
+ },
+ })
if (isLoading) {
return
@@ -162,6 +185,43 @@ function RoundDetailContent({ roundId }: { roundId: string }) {
Close Round
)}
+ {round.status === 'DRAFT' && (
+
+
+
+
+
+
+ Delete Round
+
+ This will permanently delete “{round.name}” and all
+ associated projects, assignments, and evaluations. This action
+ cannot be undone.
+
+
+
+ Cancel
+ deleteRound.mutate({ id: round.id })}
+ disabled={deleteRound.isPending}
+ className="bg-destructive text-destructive-foreground hover:bg-destructive/90"
+ >
+ {deleteRound.isPending ? (
+ <>
+
+ Deleting...
+ >
+ ) : (
+ 'Delete Round'
+ )}
+
+
+
+
+ )}