|
1 | | -import React from 'react'; |
2 | | -import { useEffect } from 'react'; |
3 | | -import { useLocation, Routes, Route } from 'react-router-dom'; |
4 | | -import Header from './header'; |
5 | | -import Footer from './footer'; |
6 | | -import Home from '../views/home'; |
7 | | -import About from '../views/about'; |
8 | | -import Register from '../views/register'; |
9 | | -import Login from '../views/login'; |
10 | | -import Logout from '../views/logout'; |
11 | | -import Menu from '../views/menu'; |
12 | | -import Delivery from '../views/delivery'; |
13 | | -import FranchiseDashboard from '../views/franchiseDashboard'; |
14 | | -import History from '../views/history'; |
15 | | -import AdminDashboard from '../views/adminDashboard'; |
16 | | -import DinerDashboard from '../views/dinerDashboard'; |
17 | | -import CreateStore from '../views/createStore'; |
18 | | -import CreateFranchise from '../views/createFranchise'; |
19 | | -import CloseFranchise from '../views/closeFranchise'; |
20 | | -import CloseStore from '../views/closeStore'; |
21 | | -import Payment from '../views/payment'; |
22 | | -import NotFound from '../views/notFound'; |
23 | | -import Docs from '../views/docs'; |
24 | | -import Breadcrumb from '../components/breadcrumb'; |
25 | | -import { pizzaService } from '../service/service'; |
26 | | -import { Role, User } from '../service/pizzaService'; |
27 | | -import 'preline/preline'; |
| 1 | +import React from "react"; |
| 2 | +import { useEffect } from "react"; |
| 3 | +import { useLocation, Routes, Route } from "react-router-dom"; |
| 4 | +import Header from "./header"; |
| 5 | +import Footer from "./footer"; |
| 6 | +import Home from "../views/home"; |
| 7 | +import About from "../views/about"; |
| 8 | +import Register from "../views/register"; |
| 9 | +import Login from "../views/login"; |
| 10 | +import Logout from "../views/logout"; |
| 11 | +import Menu from "../views/menu"; |
| 12 | +import Delivery from "../views/delivery"; |
| 13 | +import FranchiseDashboard from "../views/franchiseDashboard"; |
| 14 | +import History from "../views/history"; |
| 15 | +import AdminDashboard from "../views/adminDashboard"; |
| 16 | +import DinerDashboard from "../views/dinerDashboard"; |
| 17 | +import CreateStore from "../views/createStore"; |
| 18 | +import CreateFranchise from "../views/createFranchise"; |
| 19 | +import CloseFranchise from "../views/closeFranchise"; |
| 20 | +import CloseStore from "../views/closeStore"; |
| 21 | +import Payment from "../views/payment"; |
| 22 | +import NotFound from "../views/notFound"; |
| 23 | +import Docs from "../views/docs"; |
| 24 | +import Breadcrumb from "../components/breadcrumb"; |
| 25 | +import { pizzaService } from "../service/service"; |
| 26 | +import { Role, User } from "../service/pizzaService"; |
| 27 | +import "preline/preline"; |
28 | 28 |
|
29 | 29 | declare global { |
30 | 30 | interface Window { |
@@ -62,36 +62,95 @@ export default function App() { |
62 | 62 | } |
63 | 63 |
|
64 | 64 | const navItems = [ |
65 | | - { title: 'Home', to: '/', component: <Home />, display: [] }, |
66 | | - { title: 'Diner', to: '/diner-dashboard', component: <DinerDashboard user={user} />, display: [] }, |
67 | | - { title: 'Order', to: '/menu', component: <Menu />, display: ['nav'] }, |
| 65 | + { title: "Home", to: "/", component: <Home />, display: [] }, |
68 | 66 | { |
69 | | - title: 'Franchise', |
70 | | - to: '/franchise-dashboard', |
| 67 | + title: "Diner", |
| 68 | + to: "/diner-dashboard", |
| 69 | + component: <DinerDashboard user={user} setUser={setUser} />, |
| 70 | + display: [], |
| 71 | + }, |
| 72 | + { title: "Order", to: "/menu", component: <Menu />, display: ["nav"] }, |
| 73 | + { |
| 74 | + title: "Franchise", |
| 75 | + to: "/franchise-dashboard", |
71 | 76 | component: <FranchiseDashboard user={user} />, |
72 | 77 | constraints: [isNotAdmin], |
73 | | - display: ['nav', 'footer'], |
| 78 | + display: ["nav", "footer"], |
| 79 | + }, |
| 80 | + { title: "About", to: "/about", component: <About />, display: ["footer"] }, |
| 81 | + { |
| 82 | + title: "History", |
| 83 | + to: "/history", |
| 84 | + component: <History />, |
| 85 | + display: ["footer"], |
| 86 | + }, |
| 87 | + { |
| 88 | + title: "Admin", |
| 89 | + to: "/admin-dashboard", |
| 90 | + component: <AdminDashboard user={user} />, |
| 91 | + constraints: [isAdmin], |
| 92 | + display: ["nav"], |
| 93 | + }, |
| 94 | + { |
| 95 | + title: "Create franchise", |
| 96 | + to: "/:subPath?/create-franchise", |
| 97 | + component: <CreateFranchise />, |
| 98 | + display: [], |
| 99 | + }, |
| 100 | + { |
| 101 | + title: "Close franchise", |
| 102 | + to: "/:subPath?/close-franchise", |
| 103 | + component: <CloseFranchise />, |
| 104 | + display: [], |
| 105 | + }, |
| 106 | + { |
| 107 | + title: "Create store", |
| 108 | + to: "/:subPath?/create-store", |
| 109 | + component: <CreateStore />, |
| 110 | + display: [], |
| 111 | + }, |
| 112 | + { |
| 113 | + title: "Close store", |
| 114 | + to: "/:subPath?/close-store", |
| 115 | + component: <CloseStore />, |
| 116 | + display: [], |
| 117 | + }, |
| 118 | + { title: "Payment", to: "/payment", component: <Payment />, display: [] }, |
| 119 | + { |
| 120 | + title: "Delivery", |
| 121 | + to: "/delivery", |
| 122 | + component: <Delivery />, |
| 123 | + display: [], |
| 124 | + }, |
| 125 | + { |
| 126 | + title: "Login", |
| 127 | + to: "/:subPath?/login", |
| 128 | + component: <Login setUser={setUser} />, |
| 129 | + constraints: [loggedOut], |
| 130 | + display: ["nav"], |
| 131 | + }, |
| 132 | + { |
| 133 | + title: "Register", |
| 134 | + to: "/:subPath?/register", |
| 135 | + component: <Register setUser={setUser} />, |
| 136 | + constraints: [loggedOut], |
| 137 | + display: ["nav"], |
| 138 | + }, |
| 139 | + { |
| 140 | + title: "Logout", |
| 141 | + to: "/:subPath?/logout", |
| 142 | + component: <Logout setUser={setUser} />, |
| 143 | + constraints: [loggedIn], |
| 144 | + display: ["nav"], |
74 | 145 | }, |
75 | | - { title: 'About', to: '/about', component: <About />, display: ['footer'] }, |
76 | | - { title: 'History', to: '/history', component: <History />, display: ['footer'] }, |
77 | | - { title: 'Admin', to: '/admin-dashboard', component: <AdminDashboard user={user} />, constraints: [isAdmin], display: ['nav'] }, |
78 | | - { title: 'Create franchise', to: '/:subPath?/create-franchise', component: <CreateFranchise />, display: [] }, |
79 | | - { title: 'Close franchise', to: '/:subPath?/close-franchise', component: <CloseFranchise />, display: [] }, |
80 | | - { title: 'Create store', to: '/:subPath?/create-store', component: <CreateStore />, display: [] }, |
81 | | - { title: 'Close store', to: '/:subPath?/close-store', component: <CloseStore />, display: [] }, |
82 | | - { title: 'Payment', to: '/payment', component: <Payment />, display: [] }, |
83 | | - { title: 'Delivery', to: '/delivery', component: <Delivery />, display: [] }, |
84 | | - { title: 'Login', to: '/:subPath?/login', component: <Login setUser={setUser} />, constraints: [loggedOut], display: ['nav'] }, |
85 | | - { title: 'Register', to: '/:subPath?/register', component: <Register setUser={setUser} />, constraints: [loggedOut], display: ['nav'] }, |
86 | | - { title: 'Logout', to: '/:subPath?/logout', component: <Logout setUser={setUser} />, constraints: [loggedIn], display: ['nav'] }, |
87 | | - { title: 'Docs', to: '/docs/:docType?', component: <Docs />, display: [] }, |
88 | | - { title: 'Opps', to: '*', component: <NotFound />, display: [] }, |
| 146 | + { title: "Docs", to: "/docs/:docType?", component: <Docs />, display: [] }, |
| 147 | + { title: "Opps", to: "*", component: <NotFound />, display: [] }, |
89 | 148 | ]; |
90 | 149 |
|
91 | 150 | return ( |
92 | 151 | <div className="bg-gray-800"> |
93 | 152 | <Header user={user} navItems={navItems} /> |
94 | | - <Breadcrumb location={location.pathname.replace('/', '')} /> |
| 153 | + <Breadcrumb location={location.pathname.replace("/", "")} /> |
95 | 154 |
|
96 | 155 | <main className="size-full"> |
97 | 156 | <Routes> |
|
0 commit comments