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 (