feat(inbox): prioriza nome da agenda + ícone Secretária na ThinSidebar

- Nome exibido: contact.name (agenda) → verifiedName/notify (nome do WhatsApp)
  → pushName da última msg, em vez de cair direto no número quando não há
  nome salvo na agenda.
- ThinSidebar: ícone (BrainCircuit) que direciona para /secretaria.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
VPS 4 Deploy Agent
2026-06-28 06:32:58 +02:00
parent 8d35fa1fdf
commit fdae8beb06
2 changed files with 17 additions and 1 deletions
@@ -4,6 +4,7 @@ import {
Megaphone,
Users,
Settings,
BrainCircuit,
} from 'lucide-react';
import { getAvatarProxyUrl } from '../utils/inboxUtils';
import { useRouter } from 'next/router';
@@ -52,6 +53,14 @@ export default function ThinSidebar({ activeTab, setActiveTab, activeInstance }:
{renderIcon('chats', MessageCircle, 'Conversas')}
{renderIcon('broadcasts', Megaphone, 'Transmissões')}
{renderIcon('groups', Users, 'Sessões')}
{/* Secretária IA — abre a tela de configuração da secretária virtual */}
<button
title="Secretária IA"
onClick={() => router.push('/secretaria')}
className="w-10 h-10 mb-2 rounded-full flex items-center justify-center transition-colors hover:bg-[#d9dbdf]/60"
>
<BrainCircuit className="w-6 h-6 text-[#54656f]" />
</button>
</div>
{/* Bottom Icons */}
@@ -22,7 +22,14 @@ function mapBackendChat(raw: any): Chat {
createdAt: raw.createdAt ?? null,
isPinned: raw.isPinned ?? false,
isArchived: raw.isArchived ?? false,
contactName: raw.contact?.name ?? raw.contactName ?? null,
// Prioridade do nome: agenda (contact.name) → nome do WhatsApp
// (verifiedName de Business → notify/pushName) → pushName da última msg.
contactName: raw.contact?.name
?? raw.contact?.verifiedName
?? raw.contact?.notify
?? raw.contactName
?? raw.lastMessage?.pushName
?? null,
contactAvatarUrl: raw.contact?.avatarUrl ?? raw.contactAvatarUrl ?? null,
contactAvatarVersion: raw.contact?.avatarVersion ?? raw.contactAvatarVersion ?? null,
contactPhone: raw.contact?.phone ?? raw.contactPhone ?? null,