// File: app/components/layout/Sidebar.tsx "use client"; import Link from "next/link"; // FIX: Import getStoredUser so the sidebar reads the authenticated user's // name and role from localStorage instead of showing hardcoded placeholders. import { getStoredUser } from "../../../lib/auth"; const navItems = [ { href: "/dashboard", label: "Dashboard", permission: "read-dashboard" }, { href: "/users", label: "Users", permission: "read-user" }, { href: "/cars", label: "Cars", permission: "read-car" }, { href: "/drivers", label: "Drivers", permission: "read-driver" }, { href: "/clients", label: "Clients", permission: "read-client" }, { href: "/orders", label: "Orders", permission: "read-order" }, { href: "/trips", label: "Trips", permission: "read-trip" }, { href: "/branches", label: "Branches", permission: "read-branch" }, { href: "/roles", label: "Roles", permission: "read-role" }, { href: "/audit", label: "Audit", permission: "read-audit" }, ]; export function Sidebar() { // FIX: Read the stored user on render. suppressHydrationWarning handles // the SSR/CSR mismatch since localStorage is browser-only. const user = getStoredUser(); const permissions = user?.permissions ?? navItems.map((i) => i.permission); return ( ); }