"use client"; import { useState, useId } from "react"; import { useTranslations } from "next-intl"; import { useFocusTrap } from "@/hooks/use-focus-trap"; import { Button } from "@/components/ui/button"; import { Repeat, Trash2 } from "lucide-react"; export type RecurrenceEditScope = "this" | "this_and_future" | "all"; interface RecurrenceScopeDialogProps { isOpen: boolean; actionType: "edit" | "delete"; onSelect: (scope: RecurrenceEditScope) => void; onClose: () => void; } export function RecurrenceScopeDialog({ isOpen, actionType, onSelect, onClose, }: RecurrenceScopeDialogProps) { const t = useTranslations("calendar.recurrence_scope"); const id = useId(); const [selected, setSelected] = useState("this"); const dialogRef = useFocusTrap({ isActive: isOpen, onEscape: onClose, restoreFocus: true, }); if (!isOpen) return null; const isDelete = actionType === "delete"; const options: { value: RecurrenceEditScope; label: string }[] = [ { value: "this", label: t("this_event") }, { value: "this_and_future", label: t("this_and_future") }, { value: "all", label: t("all_events") }, ]; return (
{isDelete ? ( ) : ( )}

{isDelete ? t("delete_title") : t("edit_title")}

{t("description")}

{options.map((option) => ( ))}
); }