- Update icons etc
This commit is contained in:
1 parent
b275bdc8ef
commit
35a981abb0
2 files changed
+15
-5
No files matched your search
@@ -56,8 +56,8 @@ const menu = [
|
|||||||
name: "Status pages",
|
name: "Status pages",
|
||||||
icon: <StatusPages />,
|
icon: <StatusPages />,
|
||||||
nested: [
|
nested: [
|
||||||
{ name: "General Settings", path: "status/general-settings", icon: <UserSvg /> },
|
{ name: "General Settings", path: "status/general-settings", icon: <Settings /> },
|
||||||
{ name: "Contents", path: "status/contents", icon: <LockSvg /> },
|
{ name: "Contents", path: "status/contents", icon: <Settings /> },
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{ name: "Maintenance", path: "maintenance", icon: <Maintenance /> },
|
{ name: "Maintenance", path: "maintenance", icon: <Maintenance /> },
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import PropTypes from "prop-types";
|
import PropTypes from "prop-types";
|
||||||
import { useNavigate } from "react-router";
|
import { useNavigate } from "react-router";
|
||||||
|
import { useEffect, useState } from "react";
|
||||||
import { Box, Tab, useTheme } from "@mui/material";
|
import { Box, Tab, useTheme } from "@mui/material";
|
||||||
import TabContext from "@mui/lab/TabContext";
|
import TabContext from "@mui/lab/TabContext";
|
||||||
import TabList from "@mui/lab/TabList";
|
import TabList from "@mui/lab/TabList";
|
||||||
@@ -9,6 +9,7 @@ import {
|
|||||||
capitalizeFirstLetter,
|
capitalizeFirstLetter,
|
||||||
toLowerCaseFirstLetter,
|
toLowerCaseFirstLetter,
|
||||||
} from "../../../Utils/stringUtils";
|
} from "../../../Utils/stringUtils";
|
||||||
|
import ContentPanel from "../../../Components/TabPanels/Status/ContentPanel";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* CreateStatus page renders a page with tabs for general settings and contents.
|
* CreateStatus page renders a page with tabs for general settings and contents.
|
||||||
@@ -19,16 +20,25 @@ import {
|
|||||||
const CreateStatus = ({ open = "general-settings" }) => {
|
const CreateStatus = ({ open = "general-settings" }) => {
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
let tabList = ["General Settings", "Contents"];
|
||||||
const tab = open
|
const tab = open
|
||||||
.split("-")
|
.split("-")
|
||||||
.map((a) => capitalizeFirstLetter(a))
|
.map((a) => capitalizeFirstLetter(a))
|
||||||
.join(" ");
|
.join(" ");
|
||||||
|
|
||||||
|
const [tabIdx, setTabIdx] = useState(tabList.indexOf(tab));
|
||||||
|
|
||||||
const handleTabChange = (event, newTab) => {
|
const handleTabChange = (event, newTab) => {
|
||||||
let toNavString = newTab.split(" ").map((a) => toLowerCaseFirstLetter(a));
|
let toNavString = newTab.split(" ").map((a) => toLowerCaseFirstLetter(a));
|
||||||
|
setTabIdx(tabList.indexOf(newTab));
|
||||||
toNavString = toNavString.join("-");
|
toNavString = toNavString.join("-");
|
||||||
navigate(`/status/${toNavString}`);
|
navigate(`/status/${toNavString}`);
|
||||||
};
|
};
|
||||||
let tabList = ["General Settings", "Contents"];
|
|
||||||
|
useEffect(() => {
|
||||||
|
setTabIdx(tabList.indexOf(tab));
|
||||||
|
}, [tab]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Box
|
<Box
|
||||||
className="status"
|
className="status"
|
||||||
@@ -74,7 +84,7 @@ const CreateStatus = ({ open = "general-settings" }) => {
|
|||||||
))}
|
))}
|
||||||
</TabList>
|
</TabList>
|
||||||
</Box>
|
</Box>
|
||||||
<GeneralSettingsPanel />
|
{tabIdx == 0 ? <GeneralSettingsPanel /> : <ContentPanel />}
|
||||||
</TabContext>
|
</TabContext>
|
||||||
</Box>
|
</Box>
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in new issue
Block a user