mirror of
https://github.com/stoatchat/for-legacy-web.git
synced 2026-03-07 09:25:27 +00:00
chore: delete intermediate
This commit is contained in:
@@ -1,10 +1,13 @@
|
||||
import { observer } from "mobx-react-lite";
|
||||
import { Prompt, useHistory } from "react-router-dom";
|
||||
|
||||
import { useEffect } from "preact/hooks";
|
||||
|
||||
import { modalController } from "./ModalController";
|
||||
|
||||
export default observer(() => {
|
||||
const history = useHistory();
|
||||
|
||||
useEffect(() => {
|
||||
function keyUp(event: KeyboardEvent) {
|
||||
if (event.key === "Escape") {
|
||||
@@ -18,5 +21,22 @@ export default observer(() => {
|
||||
return () => document.removeEventListener("keyup", keyUp);
|
||||
}, []);
|
||||
|
||||
return modalController.rendered;
|
||||
return (
|
||||
<>
|
||||
{modalController.rendered}
|
||||
<Prompt
|
||||
when={modalController.isVisible}
|
||||
message={(_, action) => {
|
||||
if (action === "POP") {
|
||||
modalController.pop("close");
|
||||
setTimeout(() => history.push(history.location), 0);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user