diff --git a/src/App.js b/src/App.js
index 743b1d9..fa90edc 100644
--- a/src/App.js
+++ b/src/App.js
@@ -2,22 +2,25 @@ import React, { useReducer } from 'react';
import logo from './logo.svg';
import './App.css';
import { reducer, initialState } from './hooks/reducer';
-import { BrowserRouter, Routes, Route } from 'react-router-dom';
+import { BrowserRouter, Routes, Route, Navigate} from 'react-router-dom';
import Pokemon from './components/pages/pokemon';
import Details from './components/pages/details';
import SignIn from './components/pages/login';
+import {checkLogin} from './utils'
function App() {
const [state, dispatch] = useReducer(reducer, initialState);
+ const loggedIn = checkLogin()
+
return (
- } />
- } />
- } />
+ : } />
+ : } />
+ : } />
} />
diff --git a/src/components/bottombar.jsx b/src/components/bottombar.jsx
index eb2ecd1..1ba66cc 100644
--- a/src/components/bottombar.jsx
+++ b/src/components/bottombar.jsx
@@ -7,10 +7,12 @@ import Paper from '@mui/material/Paper';
import CatchingPokemonIcon from '@mui/icons-material/CatchingPokemon';
import StarIcon from '@mui/icons-material/Star';
import ExitToAppIcon from '@mui/icons-material/ExitToApp';
-import { useNavigate } from 'react-router-dom';
+import { useNavigate, useLocation } from 'react-router-dom';
export default function FixedBottomNavigation() {
const navigateTo = useNavigate();
+ let location = useLocation();
+ /* console.log('Location', location) */
return (
@@ -23,14 +25,33 @@ export default function FixedBottomNavigation() {
} else if (newValue === '1') {
navigateTo('/favorites');
} else if (newValue === '2') {
- /* navigateTo('/login') */
- console.log(newValue);
+ localStorage.removeItem('user')
+ localStorage.removeItem('pass')
+ navigateTo('/login')
+ // console.log(newValue);
+
}
}}
>
-
} />
-
} />
-
} />
+ {(()=>{
+ if (location.pathname === '/') {
+ return (
+
} />
+ )
+ } else {
+ return (
} />)
+ }
+ })()}
+ {(()=>{
+ if (location.pathname === '/favorites') {
+ return (
+
} />
+ )
+ } else {
+ return (
} /> )
+ }
+ })()}
+
} />
diff --git a/src/components/filterbar.jsx b/src/components/filterbar.jsx
index eb8a1bf..c699835 100644
--- a/src/components/filterbar.jsx
+++ b/src/components/filterbar.jsx
@@ -17,7 +17,7 @@ export default function BasicMenu({ currentType, dispatch }) {
};
const handleActionClose = (e) => {
- // console.log(e.target.getAttribute("value"))
+ console.log(e.target.getAttribute("value"))
dispatch({ type: "filterType", value: e.target.getAttribute("value") })
return handleClose(e)
}
@@ -33,6 +33,7 @@ export default function BasicMenu({ currentType, dispatch }) {
aria-haspopup="true"
aria-expanded={open ? 'true' : undefined}
onClick={handleClick}
+ sx={{color: 'white'}}
>
diff --git a/src/components/layout.jsx b/src/components/layout.jsx
new file mode 100644
index 0000000..0d282d1
--- /dev/null
+++ b/src/components/layout.jsx
@@ -0,0 +1,13 @@
+import { Outlet } from "react-router-dom";
+import FixedBottomNavigation from "./bottombar";
+import ResponsiveAppBar from "./navbar";
+
+function Layout() {
+ return(
+ <>
+
+
+
+ >
+ )
+}
\ No newline at end of file
diff --git a/src/components/navbar.jsx b/src/components/navbar.jsx
index 4e6e2cf..db3de46 100644
--- a/src/components/navbar.jsx
+++ b/src/components/navbar.jsx
@@ -55,15 +55,23 @@ const ResponsiveAppBar = ({currentType, dispatch}) => {
};
const handleCloseUserMenu = () => {
- navigateTo('/');
+ navigateTo('/');
setAnchorElUser(null);
};
+ const handleCloseUserMenuLogout = () => {
+ localStorage.removeItem('user')
+ localStorage.removeItem('pass')
+ navigateTo('/login');
+ setAnchorElUser(null);
+ };
+
+
return (
-
+
navigateTo('/')}/>
{
>
- {/*
-
-
-
-
-
- */}
{pages.map((page, i) => (
-
+
@@ -151,7 +122,7 @@ const ResponsiveAppBar = ({currentType, dispatch}) => {
onClose={handleCloseUserMenu}
>
{settings.map((setting) => (
-