import type { Blocker } from "react-router";
import {
AlertDialog,
AlertDialogAction,
AlertDialogCancel,
AlertDialogContent,
AlertDialogDescription,
AlertDialogFooter,
AlertDialogHeader,
AlertDialogTitle,
} from "~/components/ui/alert-dialog";
export function LeaveSettingsDialog({ blocker }: { blocker: Blocker }) {
if (blocker.state !== "blocked") return null;
return (
Leave without saving?
You have unsaved settings changes. If you leave this page, those changes will be lost.
blocker.reset?.()}>
Stay
blocker.proceed?.()}>
Leave without saving
);
}
export function SwitchSettingsSectionDialog({
open,
onOpenChange,
onStay,
onDiscard,
}: {
open: boolean;
onOpenChange: (open: boolean) => void;
onStay: () => void;
onDiscard: () => void;
}) {
return (
Switch sections without saving?
You have unsaved settings changes. Save before switching sections, or discard your edits to continue.
Stay
Discard changes
);
}