Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions src/App.jsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import React, { useState } from 'react';
import { Routes, Route, BrowserRouter } from 'react-router-dom';
import { NavBar, Footer, ProtectedRoutes } from './components';
import { NavBar, ProtectedRoutes } from './components';
import {
Landing, Login, NotFound404, Signup, Dashboard, Profile, Messanger, ToDoList, ChatView,
Login, NotFound404, Signup, Dashboard, Profile, Messanger, ToDoList, ChatView
} from './pages';

const App = () => {
Expand All @@ -14,19 +14,18 @@ const App = () => {
<BrowserRouter>
<NavBar toggleMenu={toggleMenu} />
<Routes>
<Route exact path="/" element={<Landing />} />
<Route exact path="/login" element={<Login />} />
<Route exact path="/signup" element={<Signup />} />
<Route path="*" element={<NotFound404 />} />
<Route element={<ProtectedRoutes open={open} setOpen={setOpen} toggleMenu={toggleMenu} />}>
<Route exact path="/" element={<Dashboard />} />
<Route exact path="/dashboard" element={<Dashboard />} />
<Route exact path="/profile" element={<Profile />} />
<Route exact path="/messanger" element={<Messanger />} />
<Route exact path="/messanger/1" element={<ChatView />} />
<Route exact path="/todo" element={<ToDoList />} />
</Route>
</Routes>
<Footer />
</BrowserRouter>
</div>
);
Expand Down
4 changes: 2 additions & 2 deletions src/components/NavBar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ const NavBar = ({ toggleMenu }) => {
const { pathname } = useLocation();

const isOnApp = () => {
const appPaths = ['/dashboard', '/profile', '/messanger', '/messanger/1', '/todo'];
if (!appPaths.includes(pathname)) {
const appPaths = ['/login', '/signup'];
if (appPaths.includes(pathname)) {
return true;
} else {
return false;
Expand Down