Skip to content

Commit cf8ffbb

Browse files
committed
Updated Modal.tsx
1 parent 3259a23 commit cf8ffbb

1 file changed

Lines changed: 2 additions & 11 deletions

File tree

‎src/components/modal/Modal.tsx‎

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,9 @@ const AUDIO_SRC = '/audio/nav.mp3';
2222

2323
export default function Modal() {
2424
const searchParams = useSearchParams();
25-
const modalParam = searchParams.get("modal");
25+
const modal = searchParams.get("modal");
2626
const router = useRouter();
2727
const mobileDetect = useMobileDetect();
28-
2928
const { play } = useAudio();
3029

3130
const [gamepadConnected, setGamepadConnected] = useState(false);
@@ -42,20 +41,12 @@ export default function Modal() {
4241
onB: onEsc,
4342
});
4443

45-
const [modal, setModal] = useState<string | null>(modalParam);
46-
4744
async function onEsc() {
4845
await play(AUDIO_SRC);
4946

5047
router.push('/');
5148
}
5249

53-
function onPathChanged(p: string, s: ReadonlyURLSearchParams, m: string | null) {
54-
setModal(m);
55-
}
56-
57-
useQuery({ onPathChanged: onPathChanged });
58-
5950
const actions = new Map<string, KeyPressAction>();
6051

6152
if (modal) {
@@ -109,7 +100,7 @@ export default function Modal() {
109100
<div className="grid justify-center">
110101
<span className="text-white mt-[1em] ml-[0.5em] text-center modal-action object-center mx-auto">
111102
{/* need to set the href so that the user can close modal by clicking on the buttton */}
112-
<Link href="/">
103+
<Link href="/" onClick={(e) => { e.preventDefault(); onEsc(); }}>
113104
{gamepadConnected && (
114105
<div className="text-xl items-center justify-items-center align-items-center inline-flex">
115106
<div className="relative max-w-10">

0 commit comments

Comments
 (0)