import { useState } from 'react'; import { NavLink } from 'react-router-dom'; import { Users, LayoutDashboard, X, PanelLeftClose, PanelLeftOpen, PanelRightClose, PanelRightOpen, Briefcase, Clock3, Tags, } from 'lucide-react'; import { useTranslation } from '../hooks/useTranslation'; type SidebarProps = { mobileOpen?: boolean; onMobileClose?: () => void; }; export const Sidebar = ({ mobileOpen = false, onMobileClose }: SidebarProps) => { const [isCollapsed, setIsCollapsed] = useState(false); const { t, lang } = useTranslation(); const isRtl = lang === 'fa'; const ToggleIcon = isRtl ? (isCollapsed ? PanelRightOpen : PanelRightClose) : (isCollapsed ? PanelLeftOpen : PanelLeftClose); const navItems = [ { path: '/timesheet', icon: Clock3, label: t.sidebar?.timesheet || 'Timesheet' }, { path: '/tags', icon: Tags, label: t.sidebar?.tags || 'Tags' }, { path: '/workspaces', icon: LayoutDashboard, label: t.sidebar?.workspaces || 'Workspaces' }, { path: '/clients', icon: Users, label: t.sidebar?.clients || 'Clients' }, { path: '/projects', icon: Briefcase, label: t.sidebar?.projects || 'Projects' }, ]; const renderNavItems = (mobile = false) => navItems.map((item) => { const Icon = item.icon; return ( { if (mobile) onMobileClose?.(); }} className={({ isActive }) => `flex items-center rounded-lg text-sm font-medium transition-colors ${ mobile ? 'gap-3 px-4 py-3' : isCollapsed ? 'justify-center px-0 py-2.5' : 'gap-3 px-3 py-2.5' } ${ isActive ? 'bg-blue-50 text-blue-600 dark:bg-blue-500/10 dark:text-blue-400' : 'text-slate-600 hover:bg-slate-100 dark:text-slate-400 dark:hover:bg-slate-900/50' }` } > {(mobile || !isCollapsed) && ( {item.label} )} ); }); return ( <>
); };