• Application restart confirmation dialog

    Renders a controlled dialog that prompts the user to either restart the application immediately or defer the restart until later. The dialog is shown only when settings changes require an application restart.

    The dialog explains why a restart is necessary and provides clear options for the user to proceed. The restart action is visually emphasized as the recommended action.

    Parameters

    • props: RestartDialogProps

      Component properties

      Props for the RestartDialog component

      • showRestartDialog: boolean

        Boolean controlling dialog visibility

      • setShowRestartDialog: (show: boolean) => void

        Function to toggle dialog visibility

      • onRestart: () => Promise<void>

        Callback function to trigger application restart

    Returns Element

    React component with restart confirmation dialog

    export function RestartDialog({
    showRestartDialog,
    setShowRestartDialog,
    onRestart,
    }: RestartDialogProps) {
    return (
    <AlertDialog open={showRestartDialog} onOpenChange={setShowRestartDialog}>
    <AlertDialogContent className="max-w-md">
    <AlertDialogHeader>
    <AlertDialogTitle className="flex items-center text-xl">
    <RefreshCw className="text-primary mr-2 h-5 w-5" />
    Restart Required
    </AlertDialogTitle>
    <AlertDialogDescription className="text-base">
    The changes you made require an application restart to take effect.
    Do you want to restart now?
    </AlertDialogDescription>
    </AlertDialogHeader>
    <AlertDialogFooter className="gap-2">
    <AlertDialogCancel className="mt-0">Later</AlertDialogCancel>
    <AlertDialogAction
    onClick={onRestart}
    className="bg-primary hover:bg-primary/90"
    >
    <RefreshCw className="mr-2 h-4 w-4" />
    Restart Now
    </AlertDialogAction>
    </AlertDialogFooter>
    </AlertDialogContent>
    </AlertDialog>
    );
    }