featur eflags

This commit is contained in:
Alex Holliday committed 2025-11-18 23:11:25 +00:00
1 parent bab99059c5
commit 986e8b926a
7 files changed
+88 -30

No files matched your search

+52 -24
View File
@@ -10,35 +10,63 @@ import {
LifeBuoy,
MessageSquare,
FileText,
ScrollText
ScrollText,
} from "lucide-react";
import type { IUser } from "@/types/user";
export const getMenu = (t: Function) => [
{ name: t("menu.uptime"), path: "uptime", icon: <Monitor size={20} strokeWidth={1.5} /> },
{ name: t("menu.pagespeed"), path: "pagespeed", icon: <Gauge size={20} strokeWidth={1.5} /> },
export const getMenu = (t: Function, user: IUser) => {
const userOrgPermissions = user?.org?.permissions || [];
const hasDiagnostics = userOrgPermissions.includes("master");
{
name: t("menu.infrastructure"),
path: "infrastructure",
icon: <Server size={20} strokeWidth={1.5} />,
},
{
name: t("menu.notifications"),
path: "notification-channels",
icon: <Bell size={20} strokeWidth={1.5} />,
},
{ name: t("menu.incidents"), path: "incidents", icon: <AlertTriangle size={20} strokeWidth={1.5} /> },
return [
{
name: t("menu.uptime"),
path: "uptime",
icon: <Monitor size={20} strokeWidth={1.5} />,
},
{
name: t("menu.pagespeed"),
path: "pagespeed",
icon: <Gauge size={20} strokeWidth={1.5} />,
},
{ name: t("menu.statusPages"), path: "status-pages", icon: <LayoutList size={20} strokeWidth={1.5} /> },
{ name: t("menu.maintenance"), path: "maintenance", icon: <Wrench size={20} strokeWidth={1.5} /> },
{ name: t("menu.diagnostics"), path: "diagnostics", icon: <Activity size={20} strokeWidth={1.5} /> },
{
name: t("menu.infrastructure"),
path: "infrastructure",
icon: <Server size={20} strokeWidth={1.5} />,
},
{
name: t("menu.notifications"),
path: "notification-channels",
icon: <Bell size={20} strokeWidth={1.5} />,
},
{
name: t("menu.incidents"),
path: "incidents",
icon: <AlertTriangle size={20} strokeWidth={1.5} />,
},
// {
// name: t("menu.settings"),
// icon: <Settings />,
// path: "settings",
// },
];
{
name: t("menu.statusPages"),
path: "status-pages",
icon: <LayoutList size={20} strokeWidth={1.5} />,
},
{
name: t("menu.maintenance"),
path: "maintenance",
icon: <Wrench size={20} strokeWidth={1.5} />,
},
...(hasDiagnostics
? [
{
name: t("menu.diagnostics"),
path: "diagnostics",
icon: <Activity size={20} strokeWidth={1.5} />,
},
]
: []),
];
};
export const getBottomMenu = (t: Function) => [
{
@@ -22,10 +22,12 @@ export const SideBar = () => {
const theme = useTheme();
const isSmall = useMediaQuery(theme.breakpoints.down("md"));
const sideBarOpen = useAppSelector((state) => state.ui.sidebarOpen);
const user = useAppSelector((state) => state.auth.user);
const { t } = useTranslation();
const navigate = useNavigate();
const location = useLocation();
const menu = getMenu(t);
const menu = getMenu(t, user);
const bottomMenu = getBottomMenu(t);
const dispatch = useAppDispatch();
useEffect(() => {