import { Link, useLocation } from "wouter"; import { useAuth } from "@/hooks/useAuth"; import { useTranslation } from "react-i18next"; import { cn } from "@/lib/utils"; import { Badge } from "@/components/ui/badge"; import { Button } from "@/components/ui/button"; import { ScrollArea } from "@/components/ui/scroll-area"; import { Separator } from "@/components/ui/separator"; import { Calendar, DollarSign, LayoutDashboard, Mic, Brain, Settings, Users, BarChart3, Shield, Zap, Monitor, UserCheck } from "lucide-react"; interface SidebarProps { className?: string; } const getNavigation = (t: any) => [ { name: t('navigation.dashboard'), href: "/dashboard", icon: LayoutDashboard, }, { name: t('navigation.tasks'), href: "/tasks", icon: Calendar, badge: "3", // This would come from task count }, { name: t('navigation.finances'), href: "/finances", icon: DollarSign, }, { name: t('navigation.professionals'), href: "/professionals", icon: UserCheck, }, { name: t('navigation.voice'), href: "/voice", icon: Mic, }, { name: t('navigation.ai'), href: "/ai", icon: Brain, }, ]; const getManagementNavigation = (t: any) => [ { name: t('navigation.analytics'), href: "/analytics", icon: BarChart3, roles: ["pro", "admin"], }, { name: t('navigation.monitoring'), href: "/monitoring", icon: Monitor, roles: ["pro", "admin"], }, { name: t('navigation.settings'), href: "/settings", icon: Settings, }, ]; const adminNavigation = [ { name: "User Management", href: "/admin/users", icon: Users, roles: ["admin"], }, { name: "System Status", href: "/admin/system", icon: Shield, roles: ["admin"], }, { name: "Model Management", href: "/admin/models", icon: Zap, roles: ["admin"], }, ]; export default function Sidebar({ className }: SidebarProps) { const [location] = useLocation(); const { user } = useAuth(); const { t } = useTranslation(); const navigation = getNavigation(t); const managementNavigation = getManagementNavigation(t); const isActive = (href: string) => { if (href === "/dashboard") { return location === "/" || location === "/dashboard"; } return location.startsWith(href); }; const canAccess = (roles?: string[]) => { if (!roles) return true; return user && roles.includes(user.role); }; return (