diff --git a/private/Notes.txt b/private/Notes.txt
index d470bf8..88f4a96 100644
--- a/private/Notes.txt
+++ b/private/Notes.txt
@@ -6,7 +6,6 @@ Theming:
https://v4.mui.com/customization/palette/ (Dark theme)
Add in settings:
-- reset cache
- ping interval
- notifications
- test notification mechanism
diff --git a/src/components/layout/Sidebar.js b/src/components/layout/Sidebar.js
index 635fe17..038eba2 100644
--- a/src/components/layout/Sidebar.js
+++ b/src/components/layout/Sidebar.js
@@ -1,4 +1,4 @@
-import React from "react";
+import React, { useState } from "react";
import PropTypes from "prop-types";
import clsx from "clsx";
import { makeStyles, useTheme } from "@material-ui/core/styles";
@@ -25,12 +25,83 @@ import styles from "./styles";
const useStyles = makeStyles(styles);
+const menu = [
+ {
+ order: 0,
+ items: [
+ {
+ code: "dashboard",
+ name: "Menu.Dashboard",
+ route: "/dashboard",
+ icon: ,
+ order: 0
+ },
+ {
+ code: "machines",
+ name: "Menu.Machines",
+ route: "/machines",
+ icon: ,
+ order: 1
+ },
+ {
+ code: "system",
+ name: "Menu.System",
+ route: "/system",
+ icon: ,
+ order: 2
+ }
+ ]
+ },
+ {
+ order: 1,
+ items: [
+ {
+ code: "administration",
+ name: "Menu.Administration",
+ route: "/administration",
+ icon: ,
+ order: 0
+ },
+ {
+ code: "settings",
+ name: "Menu.Settings",
+ route: "/settings",
+ icon: ,
+ order: 1
+ }
+ ]
+ },
+ {
+ order: 2,
+ items: [
+ {
+ code: "about",
+ name: "Menu.About",
+ route: "/about",
+ icon: ,
+ order: 0
+ }
+ ]
+ }
+];
+
+const sortedMenu = menu.sort((i1, i2) => i1 - i2);
+
const Sidebar = ({ open, handleDrawerClose }) => {
+ const [selected, setSelected] = useState(null);
+
const classes = useStyles();
const theme = useTheme();
const history = useHistory();
const { t } = useTranslation();
+ const handleClick = route => () => {
+ setSelected(route);
+ history.push(route);
+ };
+
+ const isSelected = key => selected === key;
+
return (
{
-
- history.push("/dashboard")}
- >
-
-
-
-
-
- history.push("/machines")}
- >
-
-
-
-
-
- history.push("/system")}>
-
-
-
-
-
-
-
-
- history.push("/administration")}
- >
-
-
-
-
-
- history.push("/settings")}
- >
-
-
-
-
-
-
-
-
- history.push("/about")}>
-
-
-
-
-
-
+
+ {sortedMenu.map((menu, index) => {
+ const isLast = index === sortedMenu.length - 1;
+ return (
+
+
+ {menu.items
+ .sort((i1, i2) => i1 - i2)
+ .map(item => (
+
+ {item.icon}
+
+
+ ))}
+
+ {!isLast && }
+
+ );
+ })}
);
};