'use client'; import React from 'react'; import Link from 'next/link'; import { usePathname } from 'next/navigation'; import { HomeIcon, UserPlusIcon, RectangleStackIcon, UsersIcon, ListBulletIcon } from '@heroicons/react/24/outline'; import { HomeIcon as HomeIconSolid, UserPlusIcon as UserPlusIconSolid, RectangleStackIcon as RectangleStackIconSolid, UsersIcon as UsersIconSolid, ListBulletIcon as ListBulletIconSolid } from '@heroicons/react/24/solid'; import { MenuItem } from './SidebarRail'; interface MobileBottomBarProps { menuItems?: MenuItem[]; } export const MobileBottomBar: React.FC = ({ menuItems }) => { const pathname = usePathname(); const isActive = (path: string) => { if (path === '/dashboard' || path === '/cliente/dashboard') { return pathname === path; } return pathname.startsWith(path); }; // Mapeamento de ícones sólidos para os itens do menu const getSolidIcon = (label: string, defaultIcon: any) => { const map: Record = { 'Dashboard': HomeIconSolid, 'Leads': UserPlusIconSolid, 'Listas': RectangleStackIconSolid, 'CRM': UsersIconSolid, 'Meus Leads': UserPlusIconSolid, 'Meu Perfil': UserPlusIconSolid, }; return map[label] || defaultIcon; }; const navItems = menuItems ? menuItems.reduce((acc: any[], item) => { if (item.href !== '#') { acc.push({ label: item.label, path: item.href, icon: item.icon, iconSolid: getSolidIcon(item.label, item.icon) }); } else if (item.subItems) { // Adiciona subitens importantes se o item pai for '#' item.subItems.forEach(sub => { acc.push({ label: sub.label, path: sub.href, icon: item.icon, // Usa o ícone do pai iconSolid: getSolidIcon(sub.label, item.icon) }); }); } return acc; }, []).slice(0, 4) // Limita a 4 itens no mobile : [ { label: 'Dashboard', path: '/dashboard', icon: HomeIcon, iconSolid: HomeIconSolid }, { label: 'Leads', path: '/crm/leads', icon: UserPlusIcon, iconSolid: UserPlusIconSolid }, { label: 'Listas', path: '/crm/listas', icon: RectangleStackIcon, iconSolid: RectangleStackIconSolid } ]; return ( <> {/* Bottom Navigation - Mobile Only */} ); };