"use client"; import { Mail, Calendar, BookUser, Settings } from "lucide-react"; import { usePathname, Link } from "@/i18n/navigation"; import { useTranslations } from "next-intl"; import { useCalendarStore } from "@/stores/calendar-store"; import { useEmailStore } from "@/stores/email-store"; import { cn } from "@/lib/utils"; interface NavItem { id: string; icon: typeof Mail; labelKey: string; href: string; hidden?: boolean; badge?: number; } interface NavigationRailProps { orientation?: "vertical" | "horizontal"; collapsed?: boolean; className?: string; } export function NavigationRail({ orientation = "vertical", collapsed = false, className, }: NavigationRailProps) { const t = useTranslations("sidebar"); const pathname = usePathname(); const { supportsCalendar } = useCalendarStore(); const { mailboxes } = useEmailStore(); const inboxUnread = mailboxes.find(m => m.role === "inbox")?.unreadEmails || 0; const navItems: NavItem[] = [ { id: "mail", icon: Mail, labelKey: "mail", href: "/", badge: inboxUnread }, { id: "calendar", icon: Calendar, labelKey: "calendar", href: "/calendar", hidden: !supportsCalendar }, { id: "contacts", icon: BookUser, labelKey: "contacts", href: "/contacts" }, { id: "settings", icon: Settings, labelKey: "settings", href: "/settings" }, ]; const visibleItems = navItems.filter((item) => !item.hidden); const getIsActive = (href: string) => { if (href === "/") { return pathname === "/" || pathname === ""; } return pathname.startsWith(href); }; if (orientation === "horizontal") { return ( ); } return ( ); }