diff --git a/src/components/layout/sidebar-nav.tsx b/src/components/layout/sidebar-nav.tsx index e16d6584b..cb19b9167 100644 --- a/src/components/layout/sidebar-nav.tsx +++ b/src/components/layout/sidebar-nav.tsx @@ -15,6 +15,7 @@ import { MoreVertical, Pill, Settings, + Shield, Sun, Target, Trophy, @@ -27,6 +28,7 @@ import { Logo } from "@/components/ui/logo"; import { useAuth, useLogout } from "@/hooks/use-auth"; import { useTheme } from "@/components/providers"; import { useTranslations } from "@/lib/i18n/context"; +import { ADMIN_SECTIONS } from "@/components/admin/admin-shell"; import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar"; import { Tooltip, @@ -212,6 +214,9 @@ function SidebarUserSection({ collapsed }: { collapsed: boolean }) { export function SidebarNav() { const pathname = usePathname(); const { t } = useTranslations(); + const { user } = useAuth(); + const isAdmin = user?.role === "ADMIN"; + const onAdminPage = pathname.startsWith("/admin"); const [collapsed, setCollapsed] = useState(() => { if (typeof window === "undefined") return false; try { @@ -387,6 +392,27 @@ export function SidebarNav() { {t("nav.bugreport")} + {isAdmin && ( + + + + + + + + {t("nav.admin")} + + + )} {t("nav.bugreport")} + {isAdmin && ( + <> + + + {t("nav.admin")} + + {/* Expandable section list — only visible while + navigating inside `/admin/*`. Mirrors the in-shell + sidebar so the user can jump between sections from + the global nav too. */} + {onAdminPage && ( +
    + {ADMIN_SECTIONS.map((section) => { + const sectionPath = `/admin/${section.slug}`; + const isActive = pathname.startsWith(sectionPath); + const Icon = section.icon; + return ( +
  • + + + {t(section.titleKey)} + +
  • + ); + })} +
+ )} + + )}