diff --git a/src/Components/Charts/StatusPageBarChart/index.jsx b/src/Components/Charts/StatusPageBarChart/index.jsx
index 5acf4c3d6..e912934a0 100644
--- a/src/Components/Charts/StatusPageBarChart/index.jsx
+++ b/src/Components/Charts/StatusPageBarChart/index.jsx
@@ -3,6 +3,45 @@ import { Box, Stack, Tooltip, Typography } from "@mui/material";
import { formatDateWithTz } from "../../../Utils/timeUtils";
import { useEffect, useState } from "react";
import { useSelector } from "react-redux";
+import PropTypes from "prop-types";
+
+/**
+ * A customizable Bar component that renders a colored bar with optional children.
+ * @component
+ *
+ * @param {string} width The width of the bar (e.g., "100px").
+ * @param {string} height The height of the bar (e.g., "50px").
+ * @param {string} backgroundColor The background color of the bar (e.g., "#FF5733").
+ * @param {string} [borderRadius] Optional border radius for the bar (e.g., "8px").
+ * @param {node} children The content to be rendered inside the bar.
+ * @returns {JSX.Element} The Bar component.
+ */
+
+const Bar = ({ width, height, backgroundColor, borderRadius, children }) => {
+ const theme = useTheme();
+
+ return (
+
+ {children}
+
+ );
+};
+
+Bar.propTypes = {
+ width: PropTypes.string.isRequired,
+ height: PropTypes.string.isRequired,
+ backgroundColor: PropTypes.string.isRequired,
+ borderRadius: PropTypes.string,
+ children: PropTypes.node,
+};
/* TODO add prop validation and jsdocs */
const StatusPageBarChart = ({ checks = [] }) => {
@@ -10,6 +49,11 @@ const StatusPageBarChart = ({ checks = [] }) => {
const [animate, setAnimate] = useState(false);
const uiTimezone = useSelector((state) => state.ui.timezone);
+ const barWidth = {
+ xs: "calc(60% / 25)",
+ xl: "calc(40% / 25)",
+ };
+
useEffect(() => {
setAnimate(true);
}, []);
@@ -41,15 +85,11 @@ const StatusPageBarChart = ({ checks = [] }) => {
/* TODO what is the purpose of this box? */
// CAIO_REVIEW the purpose of this box is to make sure there are always at least 25 bars
// even if there are less than 25 checks
-
) : (
{
},
}}
>
-
{
transition: "height 600ms cubic-bezier(0.4, 0, 0.2, 1)",
}}
/>
-
+
)
)}
diff --git a/src/Components/Sidebar/index.jsx b/src/Components/Sidebar/index.jsx
index ee0071d4f..c82f2e5be 100644
--- a/src/Components/Sidebar/index.jsx
+++ b/src/Components/Sidebar/index.jsx
@@ -64,34 +64,28 @@ const menu = [
{ name: "Status pages", path: "status", icon: },
{ name: "Maintenance", path: "maintenance", icon: },
// { name: "Integrations", path: "integrations", icon: },
- {
- name: "Account",
- icon: ,
- nested: [
- { name: "Profile", path: "account/profile", icon: },
- { name: "Password", path: "account/password", icon: },
- { name: "Team", path: "account/team", icon: },
- ],
- },
{
name: "Settings",
icon: ,
path: "settings",
},
+];
+
+const otherMenuItems = [
+ { name: "Support", path: "support", icon: },
{
- name: "Other",
- icon: ,
- nested: [
- { name: "Support", path: "support", icon: },
- {
- name: "Discussions",
- path: "discussions",
- icon: ,
- },
- { name: "Docs", path: "docs", icon: },
- { name: "Changelog", path: "changelog", icon: },
- ],
+ name: "Discussions",
+ path: "discussions",
+ icon: ,
},
+ { name: "Docs", path: "docs", icon: },
+ { name: "Changelog", path: "changelog", icon: },
+];
+
+const accountMenuItems = [
+ { name: "Profile", path: "account/profile", icon: },
+ { name: "Password", path: "account/password", icon: },
+ { name: "Team", path: "account/team", icon: },
];
/* TODO this could be a key in nested Path would be the link */
@@ -133,12 +127,38 @@ function Sidebar() {
(state) => state.ui.distributedUptimeEnabled
);
- const accountMenuItem = menu.find((item) => item.name === "Account");
- if (user.role?.includes("demo") && accountMenuItem) {
- accountMenuItem.nested = accountMenuItem.nested.filter((item) => {
- return item.name !== "Password";
- });
- }
+ const renderAccountMenuItems = () => {
+ let filteredAccountMenuItems = [...accountMenuItems];
+
+ // If the user is in demo mode, remove the "Password" option
+ if (user.role?.includes("demo")) {
+ filteredAccountMenuItems = filteredAccountMenuItems.filter(
+ (item) => item.name !== "Password"
+ );
+ }
+
+ // If the user is NOT a superadmin, remove the "Team" option
+ if (user.role && !user.role.includes("superadmin")) {
+ filteredAccountMenuItems = filteredAccountMenuItems.filter(
+ (item) => item.name !== "Team"
+ );
+ }
+
+ return filteredAccountMenuItems.map((item) => (
+
+ ));
+ };
const openPopup = (event, id) => {
setAnchorEl(event.currentTarget);
@@ -260,7 +280,6 @@ function Sidebar() {
>
{collapsed ? : }
-
{/* TODO Alignment done using padding. Use single source of truth to that*/}
-
+
+ {otherMenuItems.map((item) => {
+ return item.path ? (
+
+ {
+ const url = URL_MAP[item.path];
+ if (url) {
+ window.open(url, "_blank", "noreferrer");
+ } else {
+ navigate(`/${item.path}`);
+ }
+ }}
+ sx={{
+ height: "37px",
+ gap: theme.spacing(4),
+ borderRadius: theme.shape.borderRadius,
+ px: theme.spacing(4),
+ }}
+ >
+ {item.icon}
+ {item.name} {" "}
+
+
+ ) : null;
+ })}
+
+
{collapsed && (