refractor code

This commit is contained in:
Abhimanue committed 2024-10-13 10:36:00 +05:30
1 parent a7a4542a11
commit bb5a1959d0
1 file changed
+14 -28
+14 -28
View File
@@ -71,12 +71,18 @@ const menu = [
];
const other = [
{ name: "Support", path: "support", icon: <Support /> },
{ name: "Settings", path: "settings", icon: <Settings /> },
{ name: "Support", path: "support", icon: <Support /> },
{ name: "Docs", path: "docs", icon: <Docs /> },
{ name: "Changelog", path: "changelog", icon: <ChangeLog /> },
];
const URL_MAP = {
support: "https://github.com/bluewave-labs/bluewave-uptime/issues",
docs: "https://bluewavelabs.gitbook.io/uptime-manager",
changelog: "https://github.com/bluewave-labs/bluewave-uptime/releases",
};
/**
* @component
* Sidebar component serves as a sidebar containing a menu.
@@ -502,34 +508,14 @@ function Sidebar() {
className={
location.pathname.includes(item.path) ? "selected-path" : ""
}
onClick={
() => {
if (item.path === "support") {
window.open(
"https://github.com/bluewave-labs/bluewave-uptime/issues",
"_blank",
"noreferrer"
);
}
else if(item.path === "docs"){
window.open(
"https://bluewavelabs.gitbook.io/uptime-manager",
"_blank",
"noreferrer"
)
}
else if(item.path === "changelog"){
window.open(
"https://github.com/bluewave-labs/bluewave-uptime/releases",
"_blank",
"noreferrer"
)
}
else{
navigate(`/${item.path}`)
}
onClick={() => {
const url = URL_MAP[item.path];
if (url) {
window.open(url, "_blank", "noreferrer");
} else {
navigate(`/${item.path}`);
}
}
}}
sx={{
gap: theme.spacing(4),
borderRadius: theme.shape.borderRadius,