From 4471fef74dfe312a8cf6a1440f5a703e897af136 Mon Sep 17 00:00:00 2001
From: eug-vs <eug-vs@keemail.me>
Date: Wed, 7 Oct 2020 23:25:52 +0300
Subject: feat: wire modal routes

---
 src/containers/Page/Page.tsx | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

(limited to 'src/containers/Page/Page.tsx')

diff --git a/src/containers/Page/Page.tsx b/src/containers/Page/Page.tsx
index 7df62cd..51b6d21 100644
--- a/src/containers/Page/Page.tsx
+++ b/src/containers/Page/Page.tsx
@@ -5,11 +5,14 @@ import { SnackbarProvider } from 'notistack';
 import { ErrorBoundary } from 'react-error-boundary';
 import { useHistory } from 'react-router-dom';
 
-import Router from './Router';
+import Router, { LocationState } from './Router';
 import DynoWaiter from './DynoWaiter';
 import Loading from '../../components/Loading/Loading';
 import EmptyState from '../../components/EmptyState/EmptyState';
 
+interface HistoryChange {
+  state?: LocationState | null;
+}
 
 const useStyles = makeStyles(theme => ({
   root: {
@@ -32,11 +35,13 @@ const Page: React.FC = () => {
   const history = useHistory();
   const isMobile = useMediaQuery(theme.breakpoints.down('sm'));
 
-  useEffect(() => {
-    return history.listen(() => {
+  useEffect(() => history.listen((update: HistoryChange) => {
+    console.log(update)
+    if (!update.state?.background) {
+      console.log('scrolling')
       window.scrollTo(0, 0);
-    });
-  }, [history]);
+    }
+  }), [history]);
 
   return (
     <SnackbarProvider
-- 
cgit v1.2.3


From a283d4310c11f03fe9ff889c6274798b70cf6a19 Mon Sep 17 00:00:00 2001
From: eug-vs <eug-vs@keemail.me>
Date: Wed, 7 Oct 2020 23:51:45 +0300
Subject: feat: create ModalScreen component

---
 src/containers/Page/Page.tsx | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

(limited to 'src/containers/Page/Page.tsx')

diff --git a/src/containers/Page/Page.tsx b/src/containers/Page/Page.tsx
index 51b6d21..b7e1938 100644
--- a/src/containers/Page/Page.tsx
+++ b/src/containers/Page/Page.tsx
@@ -36,11 +36,7 @@ const Page: React.FC = () => {
   const isMobile = useMediaQuery(theme.breakpoints.down('sm'));
 
   useEffect(() => history.listen((update: HistoryChange) => {
-    console.log(update)
-    if (!update.state?.background) {
-      console.log('scrolling')
-      window.scrollTo(0, 0);
-    }
+    if (!update.state?.background) window.scrollTo(0, 0);
   }), [history]);
 
   return (
-- 
cgit v1.2.3

