Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
320ce0c
updated theme colors
dmvbnoob Mar 31, 2024
e30b315
updated theme typography
dmvbnoob Mar 31, 2024
799c9ad
updated theme breakpoints
dmvbnoob Mar 31, 2024
7258394
fixed theme breakpoints
dmvbnoob Mar 31, 2024
6e5306f
created Profile page
dmvbnoob Mar 31, 2024
469c133
update sidebar
dmvbnoob Mar 31, 2024
55cf78c
updated sidebar
dmvbnoob Mar 31, 2024
c2b2300
updated Profile
dmvbnoob Mar 31, 2024
939c540
finished profile layout
dmvbnoob Mar 31, 2024
1a16a4c
update folder name to account
dmvbnoob Mar 31, 2024
275301f
created UpdateInfo page
dmvbnoob Mar 31, 2024
227e818
finished UpdateInfo page for branch user
dmvbnoob Mar 31, 2024
021d0c4
update type style
dmvbnoob Mar 31, 2024
4de9017
finished Update page for admin user
dmvbnoob Mar 31, 2024
2f16803
created change password page
dmvbnoob Mar 31, 2024
0521bcf
finished layout for change password page
dmvbnoob Mar 31, 2024
bfcad0f
updated card style
dmvbnoob Mar 31, 2024
c70a7da
working signup
Mar 31, 2024
9809f6a
remove lock json to avoid errors from other devs when running npm i
Mar 31, 2024
87d6502
Merge branch 'release/projectpart-3' into jc/signup
Mar 31, 2024
842082b
implement authentication and login to dashboard
Mar 31, 2024
6a0b1c0
fix sidebar and missed commit from the signin
Apr 1, 2024
51a02ed
implement add item and remove unused sidebar file
Apr 1, 2024
017fcd5
implement CRUD for items
Apr 1, 2024
857e0cf
fix main router when user is not authenticated
Apr 1, 2024
adde949
fix price mapping in AddItem
Apr 1, 2024
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
139 changes: 132 additions & 7 deletions InventoryManagementApp/client/MainRouter.jsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,140 @@
import React from "react";
import { Route, Routes } from "react-router-dom";
import Home from "./src/components/pages/Home";
import Dashboard from "./src/components/pages/Dashboard";
import ViewItems from "./src/components/inventory/ViewItems";
import AddItem from "./src/components/inventory/AddItem";
import EditItem from "./src/components/inventory/EditItem";
import authHelper from "./src/helper/auth.helper";

import {
AppBar,
CssBaseline,
Box,
Toolbar,
Typography,
Drawer,
List,
ListItemText,
ListItem,
} from "@material-ui/core";
import { makeStyles } from "@material-ui/core/styles";
import { Link } from "react-router-dom";
import Footer from "./src/components/footer/Footer";

const useStyles = makeStyles((theme) => ({
drawer: {
width: drawerWidth,
flexShrink: 0,
},
drawerPaper: {
width: drawerWidth,
backgroundColor: theme.palette.customColorDarkBlue,
display: "flex",
flexDirection: "column",
justifyContent: "space-between",
height: "100%",
},
title: {
textAlign: "center",
marginTop: theme.spacing(2),
color: theme.palette.primary.contrastText,
},
listItem: {
color: theme.palette.primary.contrastText,
},
footer: {
justifyContent: "center",
},
}));

const drawerWidth = 300;

const MainRouter = () => {
const classes = useStyles();

if (!authHelper.isAuthenticated()) {
return (
<>
<Routes>
<Route exact path="/" element={<Home />} />
</Routes>
;
</>
);
}

return (
<div>
<Routes>
<Route exact path="/" element={<Home />} />
<Route exact path="/dashboard" element={<Dashboard />} />
</Routes>
</div>
<Box sx={{ display: "flex" }}>
<CssBaseline />
<AppBar
position="fixed"
sx={{ width: `calc(100% - ${drawerWidth}px)`, ml: `${drawerWidth}px` }}
>
<Toolbar>
<Typography variant="h6" noWrap component="div">
Permanent drawer
</Typography>
</Toolbar>
</AppBar>

<Drawer
className={classes.drawer}
variant="permanent"
classes={{
paper: classes.drawerPaper,
}}
>
<div>
<Typography variant="h5" className={classes.title}>
wdinv
</Typography>
<List>
{/* <Link to="/dashboard">
<ListItem button className={classes.listItem}>
<ListItemText primary="Dashboard" />
</ListItem>
</Link> */}
<Link to="/item/list">
<ListItem button className={classes.listItem}>
<ListItemText primary="View Items" />
</ListItem>
</Link>
<Link to="/item/add">
<ListItem button className={classes.listItem}>
<ListItemText primary="Create New Item" />
</ListItem>
</Link>
</List>
<Link to="/item/edit">
<ListItem button className={classes.listItem}>
<ListItemText primary="Edit Item" />
</ListItem>
</Link>
{/* <Link to="/item/delete">
<ListItem button className={classes.listItem}>
<ListItemText primary="Delete Item" />
</ListItem>
</Link> */}
</div>

<div className={classes.footer}>
<Footer />
</div>
</Drawer>
<Box
component="main"
sx={{ flexGrow: 1, bgcolor: "background.default", p: 3 }}
>
<Toolbar />
<Routes>
{/* <Route exact path="/dashboard" element={<Dashboard />} /> */}
<Route exact path="/item/list" element={<ViewItems />} />
<Route exact path="/item/add" element={<AddItem />} />
<Route exact path="/item/edit" element={<EditItem />} />
</Routes>
</Box>
</Box>

);
};
export default MainRouter;
Loading