'use client'; import React, { useState } from 'react'; import { usePathname } from 'next/navigation'; import Link from 'next/link'; import { MagnifyingGlassIcon, ChevronRightIcon, HomeIcon } from '@heroicons/react/24/outline'; import CommandPalette from '@/components/ui/CommandPalette'; export const TopBar: React.FC = () => { const pathname = usePathname(); const [isCommandPaletteOpen, setIsCommandPaletteOpen] = useState(false); // Gerar breadcrumbs a partir do pathname const generateBreadcrumbs = () => { const paths = pathname?.split('/').filter(Boolean) || []; const breadcrumbs: Array<{ name: string; href: string; icon?: React.ComponentType<{ className?: string }> }> = [ { name: 'Home', href: '/superadmin', icon: HomeIcon } ]; let currentPath = ''; paths.forEach((path, index) => { currentPath += `/${path}`; // Mapeamento de nomes amigáveis const nameMap: Record = { 'superadmin': 'SuperAdmin', 'agencies': 'Agências', 'signup-templates': 'Templates', 'agency-templates': 'Templates Agência', 'settings': 'Configurações', 'new': 'Novo', }; if (index > 0) { // Pula 'superadmin' no breadcrumb breadcrumbs.push({ name: nameMap[path] || path.charAt(0).toUpperCase() + path.slice(1), href: currentPath, }); } }); return breadcrumbs; }; const breadcrumbs = generateBreadcrumbs(); return ( <>
{/* Breadcrumbs */} {/* Search Bar Trigger */}
); };