import { useCallback } from "react"; import { useNavigate } from "react-router"; import { useJsonRpc } from "@hooks/useJsonRpc"; import { Button } from "@components/Button"; import { m } from "@localizations/messages.js"; import { sleep } from "@/utils"; export default function SettingsGeneralRebootRoute() { const navigate = useNavigate(); const { send } = useJsonRpc(); const onClose = useCallback(async () => { navigate(".."); // back to the devices.$id.settings page // Add 1s delay between navigation and calling reload() to prevent reload from interrupting the navigation. await sleep(1000); window.location.reload(); // force a full reload to ensure the current device/cloud UI version is loaded }, [navigate]); const onConfirmUpdate = useCallback(() => { send("reboot", { force: true}); }, [send]); return ; } export function Dialog({ onClose, onConfirmUpdate, }: Readonly<{ onClose: () => void; onConfirmUpdate: () => void; }>) { return (
); } function ConfirmationBox({ onYes, onNo, }: { onYes: () => void; onNo: () => void; }) { return (

{m.general_reboot_title()}

{m.general_reboot_description()}

); }