From cadd27ef895477ea1f7d554be31e9f4904bc086e Mon Sep 17 00:00:00 2001 From: arthursvpb Date: Fri, 2 Sep 2022 22:09:07 -0300 Subject: [PATCH] add logic to dont render siderbar when user is logged in --- web/src/App.jsx | 16 ++++-- .../components/FormRegisterSession/index.jsx | 6 ++- web/src/components/Page/index.jsx | 54 ++++++++++--------- web/src/pages/signup/index.jsx | 3 ++ 4 files changed, 48 insertions(+), 31 deletions(-) create mode 100644 web/src/pages/signup/index.jsx diff --git a/web/src/App.jsx b/web/src/App.jsx index 15a7826..3a47578 100644 --- a/web/src/App.jsx +++ b/web/src/App.jsx @@ -1,20 +1,28 @@ -import { Route, Routes } from 'react-router-dom'; +import { useState } from 'react'; + +import { Navigate, Route, Routes } from 'react-router-dom'; import { Page } from './components/Page'; import { Dashboard } from './pages/dahsboard'; import { Login } from './pages/login'; import { Patients } from './pages/patients'; import { Sessions } from './pages/sessions'; +import { Signup } from './pages/signup'; export const App = () => { + // Logic to set the user currently logged in + const [user, setUser] = useState(false); + return ( - + - } /> } /> + } /> + + } /> } /> } /> - {/* } /> */} + } /> ); diff --git a/web/src/components/FormRegisterSession/index.jsx b/web/src/components/FormRegisterSession/index.jsx index 6a0e26d..1931116 100644 --- a/web/src/components/FormRegisterSession/index.jsx +++ b/web/src/components/FormRegisterSession/index.jsx @@ -4,7 +4,11 @@ export const FormRegisterSession = () => { return ( <> - +
diff --git a/web/src/components/Page/index.jsx b/web/src/components/Page/index.jsx index fe54913..d3c8cb0 100644 --- a/web/src/components/Page/index.jsx +++ b/web/src/components/Page/index.jsx @@ -5,36 +5,38 @@ const { Content } = Layout; import { Sidebar } from '../Sidebar'; -export function Page({ children }) { +export function Page({ children, user }) { return ( - - - - - + + {user && } + + -
- {children} -
-
+ +
+ {children} +
+
+
- + ); } diff --git a/web/src/pages/signup/index.jsx b/web/src/pages/signup/index.jsx new file mode 100644 index 0000000..ca2d6bc --- /dev/null +++ b/web/src/pages/signup/index.jsx @@ -0,0 +1,3 @@ +export const Signup = () => { + return

Signup

; +};