diff --git a/src/App.tsx b/src/App.tsx
index fd311b4..99de8d2 100644
--- a/src/App.tsx
+++ b/src/App.tsx
@@ -15,7 +15,12 @@ function App() {
}}
/>
) : (
-
+ {
+ setCurrentSave(null);
+ }}
+ />
)}
);
diff --git a/src/views/Patcher.tsx b/src/views/Patcher.tsx
index 3f51b8b..2fd68b4 100644
--- a/src/views/Patcher.tsx
+++ b/src/views/Patcher.tsx
@@ -3,16 +3,26 @@ import { useEffect, useState } from "preact/hooks";
interface PatcherProps {
className?: string;
path: string;
+ onComplete?: () => void;
}
-export default function Patcher({ path }: PatcherProps) {
+export default function Patcher({ onComplete, path }: PatcherProps) {
const [filename, setFilename] = useState(null);
async function setup() {
const filename = path.split("\\").pop();
if (filename) setFilename(filename.split(".")[0]);
}
+ useEffect(() => {
+ const handleKeyPress = (event: KeyboardEvent) => {
+ if (event.key === "Escape") onComplete?.();
+ };
+ window.addEventListener("keydown", handleKeyPress);
+ return () => {
+ window.removeEventListener("keydown", handleKeyPress);
+ };
+ }, []);
async function teardown() {}
useEffect(() => {
@@ -23,13 +33,21 @@ export default function Patcher({ path }: PatcherProps) {
}, []);
return (
-