clean up unused js parts

This commit is contained in:
Johannes Kirschbauer
2023-10-03 10:39:49 +02:00
parent 7c1e04a7d6
commit b27dad1cc4
24 changed files with 135 additions and 201 deletions

View File

@@ -1,17 +1,14 @@
import {
Alert,
Divider,
Icon,
IconButton,
List,
ListItem,
ListItemButton,
ListItemIcon,
ListItemText,
Snackbar,
} from "@mui/material";
import Image from "next/image";
import { ReactNode, useState } from "react";
import { ReactNode } from "react";
import DashboardIcon from "@mui/icons-material/Dashboard";
import DevicesIcon from "@mui/icons-material/Devices";
@@ -29,7 +26,7 @@ type MenuEntry = {
icon: ReactNode;
label: string;
to: string;
missing: boolean;
disabled: boolean;
} & {
subMenuEntries?: MenuEntry[];
};
@@ -39,37 +36,37 @@ const menuEntries: MenuEntry[] = [
icon: <DashboardIcon />,
label: "Dashoard",
to: "/",
missing: false,
disabled: false,
},
{
icon: <DevicesIcon />,
label: "Machines",
to: "/machines",
missing: false,
disabled: false,
},
{
icon: <AppsIcon />,
label: "Applications",
to: "/applications",
missing: true,
disabled: true,
},
{
icon: <LanIcon />,
label: "Network",
to: "/network",
missing: true,
disabled: true,
},
{
icon: <DesignServicesIcon />,
label: "Templates",
to: "/templates",
missing: false,
disabled: false,
},
{
icon: <BackupIcon />,
label: "Backups",
to: "/backups",
missing: true,
disabled: true,
},
];
@@ -83,22 +80,6 @@ interface SidebarProps {
export function Sidebar(props: SidebarProps) {
const { show, onClose } = props;
const [open, setOpen] = React.useState(false);
const handleClick = () => {
setOpen(true);
};
const handleClose = (
event?: React.SyntheticEvent | Event,
reason?: string,
) => {
if (reason === "clickaway") {
return;
}
setOpen(false);
};
return (
<aside
className={tw`${
@@ -137,10 +118,8 @@ export function Sidebar(props: SidebarProps) {
<ListItemButton
className="justify-center lg:justify-normal"
LinkComponent={Link}
href={menuEntry.missing ? "" : menuEntry.to}
onClickCapture={
menuEntry.missing ? () => handleClick() : undefined
}
href={menuEntry.to}
disabled={menuEntry.disabled}
>
<ListItemIcon
color="inherit"
@@ -160,12 +139,6 @@ export function Sidebar(props: SidebarProps) {
);
})}
</List>
<Snackbar open={open} autoHideDuration={2000} onClose={handleClose}>
<Alert onClose={handleClose} severity="error" sx={{ width: "100%" }}>
Site does not exist yet
</Alert>
</Snackbar>
<Divider flexItem className="mx-8 my-10 hidden bg-zinc-600 lg:block" />
<div className="mx-auto mb-8 hidden w-full max-w-xs rounded-sm px-4 py-6 text-center align-bottom shadow-sm lg:block">
<h3 className="mb-2 w-full font-semibold text-white">