Skip to content

Commit

Permalink
refractor code
Browse files Browse the repository at this point in the history
  • Loading branch information
Abhi-m-anue committed Oct 13, 2024
1 parent a7a4542 commit bb5a195
Showing 1 changed file with 14 additions and 28 deletions.
42 changes: 14 additions & 28 deletions Client/src/Components/Sidebar/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit bb5a195

Please sign in to comment.