diff --git a/k-tv-frontend/app/(main)/dashboard/components/channel-card.tsx b/k-tv-frontend/app/(main)/dashboard/components/channel-card.tsx
index 1b99564..5ea1803 100644
--- a/k-tv-frontend/app/(main)/dashboard/components/channel-card.tsx
+++ b/k-tv-frontend/app/(main)/dashboard/components/channel-card.tsx
@@ -1,5 +1,6 @@
"use client";
+import { useState } from "react";
import Link from "next/link";
import {
Pencil,
@@ -14,6 +15,7 @@ import {
import { Button } from "@/components/ui/button";
import { useActiveSchedule } from "@/hooks/use-channels";
import type { ChannelResponse } from "@/lib/types";
+import { ConfirmDialog } from "./confirm-dialog";
interface ChannelCardProps {
channel: ChannelResponse;
@@ -65,6 +67,7 @@ export function ChannelCard({
onMoveUp,
onMoveDown,
}: ChannelCardProps) {
+ const [confirmOpen, setConfirmOpen] = useState(false);
const blockCount = channel.schedule_config.blocks.length;
const { status, label } = useScheduleStatus(channel.id);
@@ -155,7 +158,13 @@ export function ChannelCard({
+
+ {channel.name}
+ {" "}already has an active schedule. Generating a new one will overwrite it immediately.
+ >
+ }
+ confirmLabel="Regenerate"
+ onConfirm={() => {
+ setConfirmOpen(false);
+ onGenerateSchedule();
+ }}
+ />
);
}
diff --git a/k-tv-frontend/app/(main)/dashboard/components/confirm-dialog.tsx b/k-tv-frontend/app/(main)/dashboard/components/confirm-dialog.tsx
new file mode 100644
index 0000000..e25784e
--- /dev/null
+++ b/k-tv-frontend/app/(main)/dashboard/components/confirm-dialog.tsx
@@ -0,0 +1,67 @@
+"use client";
+
+import React from "react";
+import {
+ AlertDialog,
+ AlertDialogContent,
+ AlertDialogHeader,
+ AlertDialogTitle,
+ AlertDialogDescription,
+ AlertDialogFooter,
+ AlertDialogCancel,
+ AlertDialogAction,
+} from "@/components/ui/alert-dialog";
+
+interface ConfirmDialogProps {
+ open: boolean;
+ onOpenChange: (open: boolean) => void;
+ title: string;
+ description: React.ReactNode;
+ confirmLabel?: string;
+ cancelLabel?: string;
+ onConfirm: () => void;
+ isPending?: boolean;
+ destructive?: boolean;
+}
+
+export function ConfirmDialog({
+ open,
+ onOpenChange,
+ title,
+ description,
+ confirmLabel = "Confirm",
+ cancelLabel = "Cancel",
+ onConfirm,
+ isPending,
+ destructive,
+}: ConfirmDialogProps) {
+ return (
+
+
+
+ {title}
+
+ {description}
+
+
+
+
+ {cancelLabel}
+
+
+ {confirmLabel}
+
+
+
+
+ );
+}