Added submenu for admin

This commit is contained in:
Mitchell Magro 2025-07-03 19:18:51 +02:00
parent 63f20869b4
commit 06d69c2cae
6 changed files with 161 additions and 28 deletions

View File

@ -0,0 +1,13 @@
// This ensures this component is rendered only on the client side
"use client";
import { Approve } from "@/app/features/Pages/Approve/Approve";
export default function BackOfficeUsersPage() {
return (
<div>
{/* This page will now be rendered on the client-side */}
<Approve />
</div>
);
}

View File

@ -0,0 +1,13 @@
// This ensures this component is rendered only on the client side
"use client";
import { Approve } from "@/app/features/Pages/Approve/Approve";
export default function BackOfficeUsersPage() {
return (
<div>
{/* This page will now be rendered on the client-side */}
hello
</div>
);
}

View File

@ -1,11 +1,19 @@
"use client";
import DashboardIcon from "@mui/icons-material/Dashboard";
import { useState } from "react";
import { PAGE_LINKS } from "@/app/features/dashboard/sidebar/SidebarLink.constants";
import PageLinks from "../../../components/PageLinks/PageLinks";
import "./sideBar.scss";
import clsx from "clsx";
const SideBar = () => {
const [openMenus, setOpenMenus] = useState<Record<string, boolean>>({});
const toggleMenu = (title: string) => {
setOpenMenus((prev) => ({ ...prev, [title]: !prev[title] }));
};
return (
<aside className="sidebar">
<div className="sidebar__header">
@ -14,14 +22,42 @@ const SideBar = () => {
<DashboardIcon fontSize="small" className="sidebar__icon-spacing" />
</span>
</div>
{PAGE_LINKS.map((link) => (
{PAGE_LINKS.map((link) =>
link.children ? (
<div key={link.title}>
<button
onClick={() => toggleMenu(link.title)}
className="sidebar__dropdown-button"
>
{link.icon && <link.icon />}
<span className="sidebar__text">{link.title}</span>
<span className="sidebar__arrow">
{openMenus[link.title] ? "▲" : "▼"}
</span>
</button>
{openMenus[link.title] && (
<div className="sidebar__submenu">
{link.children.map((child) => (
<PageLinks
key={child.path}
title={child.title}
path={child.path}
icon={child.icon}
/>
))}
</div>
)}
</div>
) : (
<PageLinks
key={link.path}
title={link.title}
path={link.path}
icon={link.icon}
/>
))}
)
)}
</aside>
);
};

View File

@ -8,6 +8,8 @@ import GavelIcon from "@mui/icons-material/Gavel";
import HubIcon from "@mui/icons-material/Hub";
import AdminPanelSettingsIcon from "@mui/icons-material/AdminPanelSettings";
import InsightsIcon from "@mui/icons-material/Insights";
import ListAltIcon from "@mui/icons-material/ListAlt";
import SettingsIcon from "@mui/icons-material/Settings";
import { ISidebarLink } from "@/app/features/dashboard/sidebar/SidebarLink.interfaces";
export const PAGE_LINKS: ISidebarLink[] = [
@ -28,7 +30,28 @@ export const PAGE_LINKS: ISidebarLink[] = [
// { title: 'Analytics', path: '/analytics', icon: BarChartIcon },
{ title: "Rules", path: "/dashboard/rules", icon: GavelIcon },
{ title: "Rules Hub", path: "/dashboard/rules-hub", icon: HubIcon },
{ title: "Admin", path: "/dashboard/admin", icon: AdminPanelSettingsIcon },
{
title: "Admin",
path: "/dashboard/admin",
icon: AdminPanelSettingsIcon,
children: [
{
title: "Manage Users",
path: "/admin/users",
icon: PeopleIcon,
},
{
title: "Transactions",
path: "/admin/transactions",
icon: ListAltIcon,
},
{
title: "Settings",
path: "/admin/settings",
icon: SettingsIcon,
},
],
},
{ title: "Account IQ", path: "/dashboard/account-iq", icon: InsightsIcon },
// { title: 'Documentation', path: '/documentation', icon: DescriptionIcon },
// { title: 'Support', path: '/support', icon: SupportAgentIcon },

View File

@ -4,4 +4,5 @@ export interface ISidebarLink {
title: string;
path: string;
icon?: ElementType;
children?: ISidebarLink[];
}

View File

@ -12,7 +12,7 @@
z-index: 1100;
border-right: 1px solid #333;
.sidebar__header {
&__header {
font-size: 20px;
font-weight: 600;
margin-bottom: 24px;
@ -20,8 +20,55 @@
align-items: center;
color: white;
.sidebar__icon-spacing {
&__icon-spacing {
margin-left: 8px;
}
}
&__dropdown-button {
padding: 10px 0;
background: none;
border: none;
color: white;
font-size: 16px;
text-align: left;
display: flex;
align-items: center;
width: 100%;
cursor: pointer;
transition: background-color 0.2s ease;
&:hover {
background-color: rgba(255, 255, 255, 0.08);
}
svg {
margin-right: 10px;
}
.sidebar__arrow {
margin-left: auto;
font-size: 12px;
}
}
&__submenu {
margin-left: 28px;
display: flex;
flex-direction: column;
border-left: 2px solid rgba(255, 255, 255, 0.1);
padding-left: 8px;
a {
color: white;
padding: 8px 0;
font-size: 14px;
text-decoration: none;
transition: color 0.2s ease;
&:hover {
color: var(--primary-color); // Define your highlight color in variables
}
}
}
}