/** * @file Outdated schema modal component warning about incompatible save data. * @copyright nhcarrigan * @license Naomi's Public License * @author Naomi Carrigan */ import { type JSX, useState } from "react"; import { useGame } from "../../context/gameContext.js"; interface OutdatedSchemaModalProperties { readonly onDismiss: ()=> void; } /** * Renders the outdated schema modal prompting the user to reset or continue. * @param props - The modal properties. * @param props.onDismiss - Callback to dismiss the modal without resetting. * @returns The JSX element. */ const OutdatedSchemaModal = ({ onDismiss, }: OutdatedSchemaModalProperties): JSX.Element => { const { resetProgress } = useGame(); const [ isResetting, setIsResetting ] = useState(false); async function handleReset(): Promise { setIsResetting(true); await resetProgress(); setIsResetting(false); } function handleResetClick(): void { void handleReset(); } return (

{"⚠️ Outdated Save Data"}

{"Your save data is from an older version of Elysium and may cause" + " bugs or unexpected behaviour. Cloud saves are "} {"disabled"} {" until you reset your progress."}

{"Resetting will start you fresh — all progress will be lost."}

); }; export { OutdatedSchemaModal };