-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpages_App.js.html
178 lines (148 loc) · 7.64 KB
/
pages_App.js.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>JSDoc: Source: pages/App.js</title>
<script src="scripts/prettify/prettify.js"> </script>
<script src="scripts/prettify/lang-css.js"> </script>
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
</head>
<body>
<div id="main">
<h1 class="page-title">Source: pages/App.js</h1>
<section>
<article>
<pre class="prettyprint source linenums"><code>import "../css/App.css";
import {
BrowserRouter,
Routes,
Route,
} from "react-router-dom";
import Cashier from "./cashier/Cashier";
import Manager from "./manager/Manager";
import Customer from "./customer/Customer";
import Menu from "./menu/Menu";
import CashierMeal from "./cashier/CashierMeal";
import Home from "./home/Home";
import { CurOrderContextProvider } from "../hooks/CurOrderContext";
import CashierDrink from "./cashier/CashierDrink";
import CustomerMeal from "./customer/CustomerMeal";
import CustomerDrink from "./customer/CustomerDrink";
import CustomerNew from "./customer/CustomerNew";
import CashierSeasonal from "./cashier/CashierSeasonal";
import { useLocalState } from "./util/useLocalStorage";
import PrivateRouteManager from "./PrivateRoute/privateManager";
import PrivateRouteCashier from "./PrivateRoute/privateCashier";
import Header from "../components/Header";
import CashierSauce from "./cashier/CashierSauce";
import { useEffect } from "react";
/**
A React component for the main App
@function
@returns {JSX.Element} - The App component's UI
*/
function App() {
/**
A custom hook that retrieves the user state from local storage and updates it when changed
@function
@param {string} initialValue - The initial value for the user state
@param {string} key - The key used to store the user state in local storage
@returns {Array} - An array containing the user state and a function to update it
*/
const [user, setUser] = useLocalState("", "user");
/**
A function that handles the user sign out event by resetting the user state and redirecting to the home page
@function
*/
function HandleSignOut() {
setUser({});
console.log(user);
window.location.href = "/";
}
/**
A React hook that runs once when the component mounts to the DOM, and logs the current window's hostname to the console
@function
*/
useEffect(() => {
console.log(window.location.hostname);
}, [])
return (
<div id="app">
<Header user={user} HandleSignOut={HandleSignOut} />
<CurOrderContextProvider>
<BrowserRouter>
<Routes>
<Route exact path="/" element={<Home user={user} setUser={setUser} HandleSignOut={HandleSignOut} />} />
<Route
path="/cashier"
element={
<PrivateRouteCashier>
<Cashier />
</PrivateRouteCashier>
}
/>
<Route path="/cashier/meal" element={<CashierMeal />} />
<Route
path="/cashier/drink"
element={<CashierDrink />}
/>
<Route
path="/cashier/sauce"
element={<CashierSauce />}
/>
<Route
path="/cashier/seasonal"
element={<CashierSeasonal />}
/>
<Route
path="/cashier/sauce"
element={<CashierSauce />}
/>
<Route
path="/manager"
element={
<PrivateRouteManager>
<Manager />
</PrivateRouteManager>
}
/>
<Route path="/menu" element={<Menu />} />
<Route path="/customer" element={<Customer />} />
<Route
path="/customer/drink"
element={<CustomerDrink />}
/>
<Route
path="/customer/meal"
element={<CustomerMeal />}
/>
<Route
path="/customer/seasonal"
element={<CustomerNew />}
/>
</Routes>
</BrowserRouter>
</CurOrderContextProvider>
</div>
);
}
export default App;
</code></pre>
</article>
</section>
</div>
<nav>
<h2><a href="index.html">Home</a></h2><h3>Global</h3><ul><li><a href="global.html#App">App</a></li><li><a href="global.html#Cashier">Cashier</a></li><li><a href="global.html#CashierDrink">CashierDrink</a></li><li><a href="global.html#CashierHeader">CashierHeader</a></li><li><a href="global.html#CashierMeal">CashierMeal</a></li><li><a href="global.html#CashierSauce">CashierSauce</a></li><li><a href="global.html#CashierSeasonal">CashierSeasonal</a></li><li><a href="global.html#Customer">Customer</a></li><li><a href="global.html#CustomerDrink">CustomerDrink</a></li><li><a href="global.html#ExcessReport">ExcessReport</a></li><li><a href="global.html#HOST">HOST</a></li><li><a href="global.html#Home">Home</a></li><li><a href="global.html#Inventory">Inventory</a></li><li><a href="global.html#Login">Login</a></li><li><a href="global.html#Logout">Logout</a></li><li><a href="global.html#Manager">Manager</a></li><li><a href="global.html#MenuAdder">MenuAdder</a></li><li><a href="global.html#MenuItems">MenuItems</a></li><li><a href="global.html#Orders">Orders</a></li><li><a href="global.html#PrivateRouteCashier">PrivateRouteCashier</a></li><li><a href="global.html#PrivateRouteManager">PrivateRouteManager</a></li><li><a href="global.html#UserInputLogger">UserInputLogger</a></li><li><a href="global.html#getMenuEffect">getMenuEffect</a></li><li><a href="global.html#getMenuPrice">getMenuPrice</a></li><li><a href="global.html#handleComplete">handleComplete</a></li><li><a href="global.html#handleIdChange">handleIdChange</a></li><li><a href="global.html#handleInventory">handleInventory</a></li><li><a href="global.html#handleNameChange">handleNameChange</a></li><li><a href="global.html#handleNewOrder">handleNewOrder</a></li><li><a href="global.html#handlePriceChange">handlePriceChange</a></li><li><a href="global.html#handleSubmit">handleSubmit</a></li><li><a href="global.html#local">local</a></li><li><a href="global.html#root">root</a></li><li><a href="global.html#useEffect">useEffect</a></li><li><a href="global.html#useGoogleSignIn">useGoogleSignIn</a></li><li><a href="global.html#useLocalState">useLocalState</a></li></ul>
</nav>
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 4.0.2</a> on Tue May 02 2023 22:48:22 GMT-0500 (Central Daylight Time)
</footer>
<script> prettyPrint(); </script>
<script src="scripts/linenumber.js"> </script>
</body>
</html>