From b605a4c50796d7f8a642e415634f2a0e33988a47 Mon Sep 17 00:00:00 2001 From: Rafael Lopes Date: Wed, 20 May 2026 11:37:29 -0300 Subject: [PATCH] FEAT: Adicionado funcionalidade de perfil de contato e notas do agente MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Adicionado Perfil de Contato para visualização e edição dos detalhes do contato. - Implementada serviço de perfil de contato para busca e salvamento de informações do contato. - Introduzido serviço de notas do agente para gerenciamento das notas (listar, criar, excluir). - Atualizado ChatConversationList para exibir rótulos de contatos salvos e indicadores de última mensagem. - Aprimorado ChatWindow para mostrar notas de transferência e melhorar o tratamento de mensagens. - Modificado hook useChat para gerenciar o status da última mensagem e notas de transferência. - Improved MessagesWorkspace to handle suggested replies and agent notes. --- .../chat/components/ChatConversationList.jsx | 50 ++++- src/modules/chat/components/ChatWindow.jsx | 48 ++++- .../chat/components/ContactProfilePanel.jsx | 197 ++++++++++++++++++ src/modules/chat/hooks/useChat.js | 173 ++++++++++----- src/modules/chat/pages/ChatPage.jsx | 77 +++++-- .../chat/services/contactProfileService.js | 17 ++ .../home/components/MessagesWorkspace.jsx | 178 +++++++++++++--- src/modules/home/pages/HomePage.jsx | 7 + .../home/services/agentNotesService.js | 27 +++ 9 files changed, 655 insertions(+), 119 deletions(-) create mode 100644 src/modules/chat/components/ContactProfilePanel.jsx create mode 100644 src/modules/chat/services/contactProfileService.js create mode 100644 src/modules/home/services/agentNotesService.js diff --git a/src/modules/chat/components/ChatConversationList.jsx b/src/modules/chat/components/ChatConversationList.jsx index 4c435cc..f1f3929 100644 --- a/src/modules/chat/components/ChatConversationList.jsx +++ b/src/modules/chat/components/ChatConversationList.jsx @@ -23,12 +23,14 @@ function ChannelBadge({ channel }) { ); } -function ActivityDot({ status }) { - const color = status === 'away' ? '#e5a22a' : '#dc2626'; +function LastMessageDot({ fromMe }) { + const color = fromMe ? '#e5a22a' : '#00a4b7'; + const label = fromMe ? 'Última mensagem enviada pelo atendimento' : 'Última mensagem enviada pelo cliente'; return ( + ); +} export function ChatConversationList({ contacts, activeContactId, onSelectContact, + onOpenContact, isMobile = false, }) { return ( @@ -83,16 +105,16 @@ export function ChatConversationList({ display: 'grid', gridTemplateRows: 'auto minmax(0, 1fr)', gap: '0.85rem', - height: isMobile ? 'auto' : CHAT_LIST_HEIGHT, - maxHeight: isMobile ? 'none' : CHAT_LIST_HEIGHT, - alignSelf: 'start', + height: isMobile ? 'auto' : '100%', + maxHeight: isMobile ? 'none' : '100%', + alignSelf: isMobile ? 'start' : 'stretch', minHeight: 0, }} >
Conversas ativas - WhatsApp, SMS e email em uma fila visual. + WhatsApp, SMS e e-mail em uma fila visual.
@@ -116,6 +138,11 @@ export function ChatConversationList({ key={contact.id} type="button" onClick={() => onSelectContact(contact.id)} + onContextMenu={(event) => { + event.preventDefault(); + onSelectContact(contact.id); + onOpenContact?.(contact); + }} style={{ border: '1px solid', borderColor: isActive ? 'rgba(0, 164, 183, 0.26)' : 'var(--color-border)', @@ -129,7 +156,7 @@ export function ChatConversationList({ >
- + {contact.name} @@ -139,7 +166,10 @@ export function ChatConversationList({
- + + + +
{contact.preview} diff --git a/src/modules/chat/components/ChatWindow.jsx b/src/modules/chat/components/ChatWindow.jsx index 34ce0c2..956ca66 100644 --- a/src/modules/chat/components/ChatWindow.jsx +++ b/src/modules/chat/components/ChatWindow.jsx @@ -254,6 +254,7 @@ export function ChatWindow({ canAssumeChat = false, canReply = true, assignmentLabel, + transferNote, isReplying, isMobile = false, }) { @@ -334,7 +335,7 @@ export function ChatWindow({ {canAssumeChat ? ( + {transferNote ? ( +
+ + Observacao da transferencia + + {transferNote} +
+ ) : null}
- {canAssumeChat - ? 'Este atendimento esta na fila. Assuma para responder, ou envie uma mensagem para assumir automaticamente.' - : assignmentLabel || 'Este atendimento esta atribuido a outro usuario.'} + + {canAssumeChat + ? 'Este atendimento esta na fila. Assuma para responder ou transferir.' + : assignmentLabel || 'Este atendimento esta atribuido a outro usuario.'} + + {transferNote ? ( + + Obs: {transferNote} + + ) : null}
) : null}
+
+ + + + + + + +