import { Link, useLocation } from "wouter"; import { cn } from "@/lib/utils"; import { ThemeToggle } from "@/components/shared/theme-toggle"; import { OrganizationSelector } from "@/components/shared/organization-selector"; import { useAuth } from "@/hooks/use-auth"; import { LayoutDashboard, Home, Globe, BarChart2, FileEdit, Key, Users, Settings, CreditCard, LogOut, } from "lucide-react"; import { Button } from "@/components/ui/button"; export function Sidebar() { const [location] = useLocation(); const { user, logoutMutation } = useAuth(); // Define navigation items const navItems = [ { title: "Dashboard", href: "/", icon: , }, { title: "Organizations", href: "/organizations", icon: , }, { title: "Domains", href: "/domains", icon: , }, { title: "DNS Records", href: "/dns-records", icon: , }, { title: "Metrics", href: "/metrics", icon: , }, { title: "History", href: "/history", icon: , }, { title: "API Tokens", href: "/api-tokens", icon: , }, ]; // Define admin navigation items const adminNavItems = [ { title: "Users & Roles", href: "/users-roles", icon: , roles: ["admin"], }, { title: "Providers", href: "/providers", icon: , roles: ["admin", "manager"], }, { title: "Settings", href: "/settings", icon: , roles: ["admin", "manager"], }, ]; // Filter admin items based on user role const filteredAdminItems = adminNavItems.filter( item => !item.roles || (user && item.roles.includes(user.role)) ); return ( ); }