import { LayoutDashboard, Droplet, DollarSign, Package, TrendingUp, Bot, Heart, Bell, LogOut, Fish, ShoppingCart, Wheat, ShoppingBag, Scissors, ShieldUser, ListChecks, Cpu, Tractor, Pill, } from "lucide-react"; import { Button } from "./ui/button"; import { Avatar, AvatarFallback } from "./ui/avatar"; import { User } from "../types"; interface SidebarProps { currentPage: string; onPageChange: (page: string) => void; onLogout: () => void; user: User; notifications: any[]; allowedPages: string[]; moduleLabelMap: Record; } export default function Sidebar({ currentPage, onPageChange, onLogout, user, notifications, allowedPages, moduleLabelMap, }: SidebarProps) { const unreadCount = notifications.filter((n) => !n.read).length; const isTechnician = user.role.toLocaleLowerCase() === "technician"; const menuItems = [ { id: "dashboard", label: "Dashboard", icon: LayoutDashboard }, { id: "tanks", label: "Tank Management", icon: Droplet }, { id: "inventory", label: "Inventory", icon: Package }, { id: "harvest", label: "Harvest", icon: Scissors }, { id: "fish-types", label: "Fish Types", icon: Fish }, { id: "food-types", label: "Food Types", icon: Wheat }, { id: "medicine-types", label: "Medicine Types", icon: Pill }, { id: "health", label: "Health Library", icon: Heart }, { id: "ai-assistant", label: "AI Assistant", icon: Bot }, { id: "iot-management", label: "Sensors readings", icon: Cpu }, { id: "farms", label: "Farms", icon: Tractor }, { id: "users", label: "User Management", icon: ShieldUser }, { id: "tasks", label: "Tasks", icon: ListChecks }, { id: "notifications", label: "Notifications", icon: Bell, badge: unreadCount > 0 ? unreadCount : null, }, { id: "sales", label: "Sales", icon: ShoppingBag, comingSoon: true, }, { id: "accounting", label: "Accounting", icon: DollarSign, comingSoon: true, }, { id: "analytics", label: "Analytics", icon: TrendingUp, comingSoon: true, }, { id: "procurement", label: "Procurement", icon: ShoppingCart, comingSoon: true, }, ]; const visibleMenuItems = menuItems.filter( (item) => (allowedPages.includes(item.id) || item.comingSoon) && !(isTechnician && item.id === "tasks"), ); const getInitials = (name: string) => { return name .split(" ") .map((n) => n[0]) .join("") .toUpperCase(); }; return (
{/* Header */}

FishFarm360

{/* User Info */}
{getInitials(user.name)}

{user.name}

{/* Navigation */} {/* Logout */}
); }