From d9c74d25ab1f4e13cb980074e188ef6125d2d290 Mon Sep 17 00:00:00 2001
From: eug-vs <eug-vs@keemail.me>
Date: Fri, 7 Aug 2020 21:53:48 +0300
Subject: feat: setup initial routing

---
 src/pages/Page.tsx | 46 +++++++++++++++++++++++++++++++---------------
 1 file changed, 31 insertions(+), 15 deletions(-)

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

diff --git a/src/pages/Page.tsx b/src/pages/Page.tsx
index 56d7372..62b6b61 100644
--- a/src/pages/Page.tsx
+++ b/src/pages/Page.tsx
@@ -2,6 +2,7 @@ import React from 'react';
 import { makeStyles, useTheme } from '@material-ui/core/styles';
 import { useMediaQuery } from '@material-ui/core';
 import { SnackbarProvider } from 'notistack';
+import { BrowserRouter, Switch, Route } from 'react-router-dom';
 
 import ProfilePage from './ProfilePage/ProfilePage';
 import FeedPage from './FeedPage/FeedPage';
@@ -9,6 +10,7 @@ import AuthPage from './AuthPage/AuthPage';
 import HomePage from './HomePage/HomePage';
 import NotificationsPage from './NotificationsPage/NotificationsPage';
 import { useNavigate } from '../hooks/useNavigate';
+import PrivateRoute from './PrivateRoute';
 
 
 const useStyles = makeStyles(theme => ({
@@ -22,6 +24,16 @@ const useStyles = makeStyles(theme => ({
   }
 }));
 
+
+const urls = {
+  home: '/',
+  login: '/login',
+  registration: '/registration',
+  profile: '/profile',
+  feed: '/feed',
+  notifications: '/notifications'
+};
+
 const Page: React.FC = () => {
   const { page } = useNavigate();
   const classes = useStyles();
@@ -29,21 +41,25 @@ const Page: React.FC = () => {
   const isMobile = useMediaQuery(theme.breakpoints.down('sm'));
 
   return (
-    <SnackbarProvider
-      maxSnack={3}
-      anchorOrigin={{
-        vertical: isMobile ? 'top' : 'bottom',
-        horizontal: 'right'
-      }}
-    >
-      <div className={classes.root}>
-        { page.prefix === 'home' && <HomePage />}
-        { page.prefix === 'profile' && <ProfilePage />}
-        { page.prefix === 'feed' && <FeedPage /> }
-        { page.prefix === 'auth' && <AuthPage /> }
-        { page.prefix === 'notifications' && <NotificationsPage /> }
-      </div>
-    </SnackbarProvider>
+    <BrowserRouter>
+      <SnackbarProvider
+        maxSnack={3}
+        anchorOrigin={{
+          vertical: isMobile ? 'top' : 'bottom',
+          horizontal: 'right'
+        }}
+      >
+        <div className={classes.root}>
+          <Switch>
+            <PrivateRoute exact path={urls.home} component={HomePage} />
+            <PrivateRoute exact path={urls.login} component={AuthPage} />
+            <PrivateRoute exact path={urls.registration} component={AuthPage} />
+            <PrivateRoute exact path={urls.feed} component={FeedPage} />
+            <PrivateRoute exact path={urls.notifications} component={NotificationsPage} />
+          </Switch>
+        </div>
+      </SnackbarProvider>
+    </BrowserRouter>
   );
 };
 
-- 
cgit v1.2.3


From 056ef91e36f86a3278dfbb2f369939534bffe7e2 Mon Sep 17 00:00:00 2001
From: eug-vs <eug-vs@keemail.me>
Date: Fri, 7 Aug 2020 21:58:31 +0300
Subject: refactor: move urls to separate file

---
 src/pages/Page.tsx | 12 +-----------
 1 file changed, 1 insertion(+), 11 deletions(-)

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

diff --git a/src/pages/Page.tsx b/src/pages/Page.tsx
index 62b6b61..85b351c 100644
--- a/src/pages/Page.tsx
+++ b/src/pages/Page.tsx
@@ -9,8 +9,8 @@ import FeedPage from './FeedPage/FeedPage';
 import AuthPage from './AuthPage/AuthPage';
 import HomePage from './HomePage/HomePage';
 import NotificationsPage from './NotificationsPage/NotificationsPage';
-import { useNavigate } from '../hooks/useNavigate';
 import PrivateRoute from './PrivateRoute';
+import urls from './urls';
 
 
 const useStyles = makeStyles(theme => ({
@@ -25,17 +25,7 @@ const useStyles = makeStyles(theme => ({
 }));
 
 
-const urls = {
-  home: '/',
-  login: '/login',
-  registration: '/registration',
-  profile: '/profile',
-  feed: '/feed',
-  notifications: '/notifications'
-};
-
 const Page: React.FC = () => {
-  const { page } = useNavigate();
   const classes = useStyles();
   const theme = useTheme();
   const isMobile = useMediaQuery(theme.breakpoints.down('sm'));
-- 
cgit v1.2.3


From 2d6ba7459fff67823b55cfc39342896873962714 Mon Sep 17 00:00:00 2001
From: eug-vs <eug-vs@keemail.me>
Date: Fri, 7 Aug 2020 22:25:20 +0300
Subject: refactor: simplify Route component

---
 src/pages/Page.tsx | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

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

diff --git a/src/pages/Page.tsx b/src/pages/Page.tsx
index 85b351c..29b9564 100644
--- a/src/pages/Page.tsx
+++ b/src/pages/Page.tsx
@@ -2,14 +2,14 @@ import React from 'react';
 import { makeStyles, useTheme } from '@material-ui/core/styles';
 import { useMediaQuery } from '@material-ui/core';
 import { SnackbarProvider } from 'notistack';
-import { BrowserRouter, Switch, Route } from 'react-router-dom';
+import { BrowserRouter, Switch } from 'react-router-dom';
 
 import ProfilePage from './ProfilePage/ProfilePage';
 import FeedPage from './FeedPage/FeedPage';
 import AuthPage from './AuthPage/AuthPage';
 import HomePage from './HomePage/HomePage';
 import NotificationsPage from './NotificationsPage/NotificationsPage';
-import PrivateRoute from './PrivateRoute';
+import Route from './Route';
 import urls from './urls';
 
 
@@ -41,11 +41,12 @@ const Page: React.FC = () => {
       >
         <div className={classes.root}>
           <Switch>
-            <PrivateRoute exact path={urls.home} component={HomePage} />
-            <PrivateRoute exact path={urls.login} component={AuthPage} />
-            <PrivateRoute exact path={urls.registration} component={AuthPage} />
-            <PrivateRoute exact path={urls.feed} component={FeedPage} />
-            <PrivateRoute exact path={urls.notifications} component={NotificationsPage} />
+            <Route exact path={urls.home} component={HomePage} />
+            <Route exact path={urls.login} component={AuthPage} />
+            <Route exact path={urls.registration} component={AuthPage} />
+            <Route exact path={urls.feed} component={FeedPage} />
+            <Route exact path={urls.notifications} component={NotificationsPage} />
+            <Route path={urls.profile} component={ProfilePage} />
           </Switch>
         </div>
       </SnackbarProvider>
-- 
cgit v1.2.3


From 5ba6455b2aa6c75c336628bda59e70b46e3b1d6b Mon Sep 17 00:00:00 2001
From: eug-vs <eug-vs@keemail.me>
Date: Fri, 7 Aug 2020 22:42:50 +0300
Subject: refactor: separate Auth pages

---
 src/pages/Page.tsx | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

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

diff --git a/src/pages/Page.tsx b/src/pages/Page.tsx
index 29b9564..47f5f50 100644
--- a/src/pages/Page.tsx
+++ b/src/pages/Page.tsx
@@ -6,7 +6,8 @@ import { BrowserRouter, Switch } from 'react-router-dom';
 
 import ProfilePage from './ProfilePage/ProfilePage';
 import FeedPage from './FeedPage/FeedPage';
-import AuthPage from './AuthPage/AuthPage';
+import LoginPage from './LoginPage/LoginPage';
+import RegistrationPage from './RegistrationPage/RegistrationPage';
 import HomePage from './HomePage/HomePage';
 import NotificationsPage from './NotificationsPage/NotificationsPage';
 import Route from './Route';
@@ -42,8 +43,8 @@ const Page: React.FC = () => {
         <div className={classes.root}>
           <Switch>
             <Route exact path={urls.home} component={HomePage} />
-            <Route exact path={urls.login} component={AuthPage} />
-            <Route exact path={urls.registration} component={AuthPage} />
+            <Route exact path={urls.login} component={LoginPage} />
+            <Route exact path={urls.registration} component={RegistrationPage} />
             <Route exact path={urls.feed} component={FeedPage} />
             <Route exact path={urls.notifications} component={NotificationsPage} />
             <Route path={urls.profile} component={ProfilePage} />
-- 
cgit v1.2.3


From b124be4d5067570a8f5db4813d45e1bf49d95f56 Mon Sep 17 00:00:00 2001
From: eug-vs <eug-vs@keemail.me>
Date: Fri, 7 Aug 2020 22:53:53 +0300
Subject: feat: support routing in Header

---
 src/pages/Page.tsx | 40 +++++++++++++++++++---------------------
 1 file changed, 19 insertions(+), 21 deletions(-)

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

diff --git a/src/pages/Page.tsx b/src/pages/Page.tsx
index 47f5f50..f5c975c 100644
--- a/src/pages/Page.tsx
+++ b/src/pages/Page.tsx
@@ -2,7 +2,7 @@ import React from 'react';
 import { makeStyles, useTheme } from '@material-ui/core/styles';
 import { useMediaQuery } from '@material-ui/core';
 import { SnackbarProvider } from 'notistack';
-import { BrowserRouter, Switch } from 'react-router-dom';
+import { Switch } from 'react-router-dom';
 
 import ProfilePage from './ProfilePage/ProfilePage';
 import FeedPage from './FeedPage/FeedPage';
@@ -32,26 +32,24 @@ const Page: React.FC = () => {
   const isMobile = useMediaQuery(theme.breakpoints.down('sm'));
 
   return (
-    <BrowserRouter>
-      <SnackbarProvider
-        maxSnack={3}
-        anchorOrigin={{
-          vertical: isMobile ? 'top' : 'bottom',
-          horizontal: 'right'
-        }}
-      >
-        <div className={classes.root}>
-          <Switch>
-            <Route exact path={urls.home} component={HomePage} />
-            <Route exact path={urls.login} component={LoginPage} />
-            <Route exact path={urls.registration} component={RegistrationPage} />
-            <Route exact path={urls.feed} component={FeedPage} />
-            <Route exact path={urls.notifications} component={NotificationsPage} />
-            <Route path={urls.profile} component={ProfilePage} />
-          </Switch>
-        </div>
-      </SnackbarProvider>
-    </BrowserRouter>
+    <SnackbarProvider
+      maxSnack={3}
+      anchorOrigin={{
+        vertical: isMobile ? 'top' : 'bottom',
+        horizontal: 'right'
+      }}
+    >
+      <div className={classes.root}>
+        <Switch>
+          <Route exact path={urls.home} component={HomePage} />
+          <Route exact path={urls.login} component={LoginPage} />
+          <Route exact path={urls.registration} component={RegistrationPage} />
+          <Route exact path={urls.feed} component={FeedPage} />
+          <Route exact path={urls.notifications} component={NotificationsPage} />
+          <Route path={urls.profile()} component={ProfilePage} />
+        </Switch>
+      </div>
+    </SnackbarProvider>
   );
 };
 
-- 
cgit v1.2.3


From 46e360a23969bde69f6d80b5ff27401a39169be6 Mon Sep 17 00:00:00 2001
From: eug-vs <eug-vs@keemail.me>
Date: Sat, 8 Aug 2020 09:07:08 +0300
Subject: feat: use router logic in ProfilePage

---
 src/pages/Page.tsx | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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

diff --git a/src/pages/Page.tsx b/src/pages/Page.tsx
index f5c975c..dd413bf 100644
--- a/src/pages/Page.tsx
+++ b/src/pages/Page.tsx
@@ -46,7 +46,7 @@ const Page: React.FC = () => {
           <Route exact path={urls.registration} component={RegistrationPage} />
           <Route exact path={urls.feed} component={FeedPage} />
           <Route exact path={urls.notifications} component={NotificationsPage} />
-          <Route path={urls.profile()} component={ProfilePage} />
+          <Route path={urls.profile(':username')} component={ProfilePage} />
         </Switch>
       </div>
     </SnackbarProvider>
-- 
cgit v1.2.3


From 10e146ef0215d41527f0466b0e139a6805b96540 Mon Sep 17 00:00:00 2001
From: eug-vs <eug-vs@keemail.me>
Date: Sat, 8 Aug 2020 09:33:45 +0300
Subject: refactor: remove urls file

---
 src/pages/Page.tsx | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

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

diff --git a/src/pages/Page.tsx b/src/pages/Page.tsx
index dd413bf..34a1046 100644
--- a/src/pages/Page.tsx
+++ b/src/pages/Page.tsx
@@ -11,7 +11,6 @@ import RegistrationPage from './RegistrationPage/RegistrationPage';
 import HomePage from './HomePage/HomePage';
 import NotificationsPage from './NotificationsPage/NotificationsPage';
 import Route from './Route';
-import urls from './urls';
 
 
 const useStyles = makeStyles(theme => ({
@@ -41,12 +40,12 @@ const Page: React.FC = () => {
     >
       <div className={classes.root}>
         <Switch>
-          <Route exact path={urls.home} component={HomePage} />
-          <Route exact path={urls.login} component={LoginPage} />
-          <Route exact path={urls.registration} component={RegistrationPage} />
-          <Route exact path={urls.feed} component={FeedPage} />
-          <Route exact path={urls.notifications} component={NotificationsPage} />
-          <Route path={urls.profile(':username')} component={ProfilePage} />
+          <Route exact path="/" component={HomePage} />
+          <Route exact path="/login" component={LoginPage} />
+          <Route exact path="/registration" component={RegistrationPage} />
+          <Route exact path="/feed" component={FeedPage} />
+          <Route exact path="/notifications" component={NotificationsPage} />
+          <Route path="/profile/:username" component={ProfilePage} />
         </Switch>
       </div>
     </SnackbarProvider>
-- 
cgit v1.2.3


From b446a83ff24ed5ea2233c544446557ee29f44364 Mon Sep 17 00:00:00 2001
From: eug-vs <eug-vs@keemail.me>
Date: Sat, 8 Aug 2020 09:49:38 +0300
Subject: refactor: use native Route component

---
 src/pages/Page.tsx | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

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

diff --git a/src/pages/Page.tsx b/src/pages/Page.tsx
index 34a1046..668b171 100644
--- a/src/pages/Page.tsx
+++ b/src/pages/Page.tsx
@@ -2,7 +2,7 @@ import React from 'react';
 import { makeStyles, useTheme } from '@material-ui/core/styles';
 import { useMediaQuery } from '@material-ui/core';
 import { SnackbarProvider } from 'notistack';
-import { Switch } from 'react-router-dom';
+import { Switch, Route } from 'react-router-dom';
 
 import ProfilePage from './ProfilePage/ProfilePage';
 import FeedPage from './FeedPage/FeedPage';
@@ -10,7 +10,6 @@ import LoginPage from './LoginPage/LoginPage';
 import RegistrationPage from './RegistrationPage/RegistrationPage';
 import HomePage from './HomePage/HomePage';
 import NotificationsPage from './NotificationsPage/NotificationsPage';
-import Route from './Route';
 
 
 const useStyles = makeStyles(theme => ({
-- 
cgit v1.2.3

