feat: versão 1.5 - CRM Beta com leads, funis, campanhas e portal do cliente

This commit is contained in:
Erik Silva
2025-12-24 17:36:52 -03:00
parent 99d828869a
commit dfb91c8ba5
98 changed files with 18255 additions and 1465 deletions

View File

@@ -6,12 +6,16 @@ import Link from 'next/link';
import { MagnifyingGlassIcon, ChevronRightIcon, HomeIcon, BellIcon, Cog6ToothIcon } from '@heroicons/react/24/outline';
import CommandPalette from '@/components/ui/CommandPalette';
import { getUser } from '@/lib/auth';
import { CRMCustomerFilter } from '@/components/crm/CRMCustomerFilter';
export const TopBar: React.FC = () => {
const pathname = usePathname();
const [isCommandPaletteOpen, setIsCommandPaletteOpen] = useState(false);
const [user, setUser] = useState<any>(null);
// Verifica se está em uma rota do CRM
const isInCRM = pathname?.startsWith('/crm') || false;
useEffect(() => {
const userData = getUser();
setUser(userData);
@@ -19,8 +23,11 @@ export const TopBar: React.FC = () => {
const generateBreadcrumbs = () => {
const paths = pathname?.split('/').filter(Boolean) || [];
const isCustomer = pathname?.startsWith('/cliente');
const homePath = isCustomer ? '/cliente/dashboard' : '/dashboard';
const breadcrumbs: Array<{ name: string; href: string; icon?: React.ComponentType<{ className?: string }> }> = [
{ name: 'Home', href: '/dashboard', icon: HomeIcon }
{ name: 'Home', href: homePath, icon: HomeIcon }
];
let currentPath = '';
paths.forEach((path, index) => {
@@ -34,9 +41,12 @@ export const TopBar: React.FC = () => {
'financeiro': 'Financeiro',
'configuracoes': 'Configurações',
'novo': 'Novo',
'cliente': 'Portal',
'leads': 'Leads',
'listas': 'Listas',
};
if (path !== 'dashboard') { // Evita duplicar Home/Dashboard se a rota for /dashboard
if (path !== 'dashboard' && !(isCustomer && path === 'cliente')) { // Evita duplicar Home/Dashboard ou Portal
breadcrumbs.push({
name: nameMap[path] || path.charAt(0).toUpperCase() + path.slice(1),
href: currentPath,
@@ -48,12 +58,14 @@ export const TopBar: React.FC = () => {
};
const breadcrumbs = generateBreadcrumbs();
const isCustomer = pathname?.startsWith('/cliente');
const homePath = isCustomer ? '/cliente/dashboard' : '/dashboard';
return (
<>
<div className="bg-white dark:bg-zinc-900 border-b border-gray-200 dark:border-zinc-800 px-4 md:px-6 py-3 flex items-center justify-between transition-colors">
{/* Logo Mobile */}
<Link href="/dashboard" className="md:hidden flex items-center gap-2">
<Link href={homePath} className="md:hidden flex items-center gap-2">
<div className="w-8 h-8 rounded-lg flex items-center justify-center text-white font-bold shrink-0 shadow-md overflow-hidden bg-brand-500">
{user?.logoUrl ? (
<img src={user.logoUrl} alt={user?.company || 'Logo'} className="w-full h-full object-cover" />
@@ -93,6 +105,13 @@ export const TopBar: React.FC = () => {
})}
</nav>
{/* CRM Customer Filter - aparece apenas em rotas CRM */}
{isInCRM && (
<div className="hidden lg:flex">
<CRMCustomerFilter />
</div>
)}
{/* Search Bar Trigger */}
<div className="flex items-center gap-2 md:gap-4">
<button
@@ -111,7 +130,7 @@ export const TopBar: React.FC = () => {
<span className="absolute top-2 right-2 w-2 h-2 bg-red-500 rounded-full border-2 border-white dark:border-zinc-900"></span>
</button>
<Link
href="/configuracoes"
href={isCustomer ? "/cliente/perfil" : "/configuracoes"}
className="flex p-2 text-gray-500 dark:text-zinc-400 hover:bg-gray-100 dark:hover:bg-zinc-800 rounded-lg transition-colors"
>
<Cog6ToothIcon className="w-5 h-5" />