# All files / src/components/layout Sidebar.tsx

0% Statements 0/5
0% Branches 0/2
0% Functions 0/3
0% Lines 0/5

Press n or j to go to the next uncovered block, b, p or k for the previous block.

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40

     import { NavLink } from 'react-router-dom';
    import { User, BarChart3, Gauge, Key, Settings, CreditCard } from 'lucide-react';
    import { useTranslation } from 'react-i18next';

    function Sidebar() {
      const { t } = useTranslation();
      const navItems = [
        { path: '/user', icon: User, label: t('userCenter.tabs.profile') },
        { path: '/user/stats', icon: BarChart3, label: t('userCenter.tabs.stats') },
        { path: '/user/quota', icon: Gauge, label: t('userCenter.tabs.quota') },
        { path: '/user/subscription', icon: CreditCard, label: t('userCenter.tabs.subscription') },
        { path: '/user/api-keys', icon: Key, label: 'API Keys' },
        { path: '/user/preferences', icon: Settings, label: t('userCenter.tabs.preferences') },
      ];

      return (
        <nav className="flex flex-col gap-1">
          {navItems.map(item => (
            <NavLink
              key={item.path}
              to={item.path}
              end={item.path === '/user'}
              className={({ isActive }) =>
                `flex items-center gap-3 px-3 py-2 rounded-button text-[13px] transition-colors ${
                  isActive
                    ? 'bg-accent/10 text-accent font-medium'
                    : 'text-text-secondary hover:bg-surface-secondary'
                }`
              }
            >
              <item.icon className="w-4 h-4" />
              {item.label}
            </NavLink>
          ))}
        </nav>
      );
    }

    export { Sidebar };