From 3c3223c3b41411639ff19ebd58df569cf17999ca Mon Sep 17 00:00:00 2001 From: ilyayudovin Date: Sun, 14 Jun 2020 15:56:29 +0300 Subject: divide src into Pages and Components directories --- src/index.tsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/index.tsx') diff --git a/src/index.tsx b/src/index.tsx index 0855038..ec31728 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -9,11 +9,11 @@ import { CssBaseline } from '@material-ui/core'; import teal from '@material-ui/core/colors/teal'; import 'typeface-roboto'; -import Header from './Header/Header'; -import Feed from './Feed/Feed'; -import ProfileInfo from './ProfileInfo/ProfileInfo'; +import Header from './Components/Header/Header'; +import Feed from './Components/Feed/Feed'; +import ProfileInfo from './Pages/ProfilePage/ProfileInfo/ProfileInfo'; -import SignInForm from './Form/SignInForm'; +import SignInForm from './Pages/ProfilePage/Form/SignInForm'; import { User } from './types'; import { get } from './requests'; -- cgit v1.2.3 From 657c340ea9e244b7f1041bac5be240d428d758e5 Mon Sep 17 00:00:00 2001 From: ilyayudovin Date: Sun, 14 Jun 2020 17:28:24 +0300 Subject: feat: add profilePage to render ProfileInfo and SignInForm --- src/index.tsx | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) (limited to 'src/index.tsx') diff --git a/src/index.tsx b/src/index.tsx index ec31728..a5e1168 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -11,9 +11,9 @@ import 'typeface-roboto'; import Header from './Components/Header/Header'; import Feed from './Components/Feed/Feed'; -import ProfileInfo from './Pages/ProfilePage/ProfileInfo/ProfileInfo'; - -import SignInForm from './Pages/ProfilePage/Form/SignInForm'; +import ProfileInfo from './Pages/ProfilePage/ProfileInfo'; +import ProfilePage from './Pages/ProfilePage/ProfilePage'; +import SignInForm from './Pages/ProfilePage/SignInForm'; import { User } from './types'; import { get } from './requests'; @@ -53,18 +53,7 @@ const App: React.FC = () => {
{ - page === 'profile' - ? ( - user - ? ( - <> - - - - ) - : - ) - : + page === 'profile' ? : }
-- cgit v1.2.3 From a579341f91700a9ef3baecdd4d1e77535da7188e Mon Sep 17 00:00:00 2001 From: ilyayudovin Date: Sun, 14 Jun 2020 17:37:56 +0300 Subject: fix: clear all eslint errors --- src/index.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/index.tsx') diff --git a/src/index.tsx b/src/index.tsx index a5e1168..88eb87d 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -11,9 +11,7 @@ import 'typeface-roboto'; import Header from './Components/Header/Header'; import Feed from './Components/Feed/Feed'; -import ProfileInfo from './Pages/ProfilePage/ProfileInfo'; import ProfilePage from './Pages/ProfilePage/ProfilePage'; -import SignInForm from './Pages/ProfilePage/SignInForm'; import { User } from './types'; import { get } from './requests'; @@ -53,7 +51,9 @@ const App: React.FC = () => {
{ - page === 'profile' ? : + page === 'profile' + ? + : }
-- cgit v1.2.3 From fabc53130685f70078343a6fd96d9a597b22008f Mon Sep 17 00:00:00 2001 From: ilyayudovin Date: Sun, 14 Jun 2020 19:49:10 +0300 Subject: fix: clear eslint errors --- src/index.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/index.tsx') diff --git a/src/index.tsx b/src/index.tsx index 88eb87d..5888170 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -9,9 +9,9 @@ import { CssBaseline } from '@material-ui/core'; import teal from '@material-ui/core/colors/teal'; import 'typeface-roboto'; -import Header from './Components/Header/Header'; -import Feed from './Components/Feed/Feed'; -import ProfilePage from './Pages/ProfilePage/ProfilePage'; +import Header from './components/Header/Header'; +import Feed from './components/Feed/Feed'; +import ProfilePage from './pages/ProfilePage/ProfilePage'; import { User } from './types'; import { get } from './requests'; -- cgit v1.2.3 From 61a424debfbfa98570e070fbf25d03aa9c56d679 Mon Sep 17 00:00:00 2001 From: eug-vs Date: Sun, 14 Jun 2020 20:39:16 +0300 Subject: refactor: structurize pages --- src/index.tsx | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'src/index.tsx') diff --git a/src/index.tsx b/src/index.tsx index 5888170..5ab1910 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -10,8 +10,9 @@ import teal from '@material-ui/core/colors/teal'; import 'typeface-roboto'; import Header from './components/Header/Header'; -import Feed from './components/Feed/Feed'; import ProfilePage from './pages/ProfilePage/ProfilePage'; +import FeedPage from './pages/FeedPage/FeedPage'; +import AuthPage from './pages/AuthPage/AuthPage'; import { User } from './types'; import { get } from './requests'; @@ -36,6 +37,12 @@ const App: React.FC = () => { const [user, setUser] = React.useState(); const classes = useStyles(); + const logOut = () => { + localStorage.removeItem('userId'); + setUser(undefined); + }; + + useEffect(() => { const userId = localStorage.getItem('userId'); if (userId) { @@ -52,8 +59,12 @@ const App: React.FC = () => {
{ page === 'profile' - ? - : + ? ( + user + ? + : + ) + : }
-- cgit v1.2.3 From fbe489c83e9ef4c03b87624a4dec66de61af364a Mon Sep 17 00:00:00 2001 From: eug-vs Date: Sun, 14 Jun 2020 20:43:05 +0300 Subject: style: fix eslint errors --- src/index.tsx | 1 - 1 file changed, 1 deletion(-) (limited to 'src/index.tsx') diff --git a/src/index.tsx b/src/index.tsx index 5ab1910..55bf773 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -42,7 +42,6 @@ const App: React.FC = () => { setUser(undefined); }; - useEffect(() => { const userId = localStorage.getItem('userId'); if (userId) { -- cgit v1.2.3