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 = [ const other = [
{ name: "Support", path: "support", icon: <Support /> },
{ name: "Settings", path: "settings", icon: <Settings /> }, { name: "Settings", path: "settings", icon: <Settings /> },
{ name: "Support", path: "support", icon: <Support /> },
{ name: "Docs", path: "docs", icon: <Docs /> }, { name: "Docs", path: "docs", icon: <Docs /> },
{ name: "Changelog", path: "changelog", icon: <ChangeLog /> }, { 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 * @component
* Sidebar component serves as a sidebar containing a menu. * Sidebar component serves as a sidebar containing a menu.
@@ -502,34 +508,14 @@ function Sidebar() {
className={ className={
location.pathname.includes(item.path) ? "selected-path" : "" location.pathname.includes(item.path) ? "selected-path" : ""
} }
onClick={ onClick={() => {
() => { const url = URL_MAP[item.path];
if (item.path === "support") { if (url) {
window.open( window.open(url, "_blank", "noreferrer");
"https://github.com/bluewave-labs/bluewave-uptime/issues", } else {
"_blank", navigate(`/${item.path}`);
"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}`)
}
} }
} }}
sx={{ sx={{
gap: theme.spacing(4), gap: theme.spacing(4),
borderRadius: theme.shape.borderRadius, borderRadius: theme.shape.borderRadius,