import { Pressable, Text, View } from "react-native"; import { RecurringDeleteMode } from "@calchat/shared"; import { useThemeStore } from "../stores/ThemeStore"; import { ModalBase } from "./ModalBase"; type DeleteEventModalProps = { visible: boolean; eventTitle: string; isRecurring: boolean; onConfirm: (mode: RecurringDeleteMode) => void; onCancel: () => void; }; type DeleteOption = { mode: RecurringDeleteMode; label: string; }; const RECURRING_DELETE_OPTIONS: DeleteOption[] = [ { mode: "single", label: "Nur dieses Vorkommen", }, { mode: "future", label: "Dieses und zukünftige", }, { mode: "all", label: "Alle Vorkommen", }, ]; export const DeleteEventModal = ({ visible, eventTitle, isRecurring, onConfirm, onCancel, }: DeleteEventModalProps) => { const { theme } = useThemeStore(); const title = isRecurring ? "Wiederkehrenden Termin löschen" : "Termin loeschen"; return ( {isRecurring ? ( // Recurring event: show three options RECURRING_DELETE_OPTIONS.map((option) => ( onConfirm(option.mode)} className="py-3 px-4 rounded-lg mb-2" style={{ backgroundColor: theme.secondaryBg, borderWidth: 1, borderColor: theme.borderPrimary, }} > {option.label} )) ) : ( // Non-recurring event: simple confirmation Moechtest du diesen Termin wirklich loeschen? onConfirm("all")} className="py-3 px-4 rounded-lg" style={{ backgroundColor: theme.rejectButton, }} > Loeschen )} ); };