diff --git a/apps/desktop/src/chat/ChatWidget.tsx b/apps/desktop/src/chat/ChatWidget.tsx index f155629..4a28c11 100644 --- a/apps/desktop/src/chat/ChatWidget.tsx +++ b/apps/desktop/src/chat/ChatWidget.tsx @@ -4,7 +4,7 @@ import { listen } from "@tauri-apps/api/event" import { Store } from "@tauri-apps/plugin-store" import { appLocalDataDir, join } from "@tauri-apps/api/path" import { open } from "@tauri-apps/plugin-dialog" -import { Send, X, Minus, Loader2, Headphones, Paperclip, FileText, Image as ImageIcon, File } from "lucide-react" +import { Send, X, Minus, Loader2, Headphones, Paperclip, FileText, Image as ImageIcon, File, User } from "lucide-react" import type { ChatMessage, ChatMessagesResponse, SendMessageResponse } from "./types" const STORE_FILENAME = "machine-agent.json" @@ -381,58 +381,71 @@ export function ChatWidget({ ticketId }: ChatWidgetProps) {

) : ( -
- {messages.map((msg) => ( -
+
+ {messages.map((msg) => { + // No desktop: isFromMachine=true significa mensagem do cliente (maquina) + // Layout igual à web: cliente à esquerda, agente à direita + const isAgent = !msg.isFromMachine + return (
- {!msg.isFromMachine && ( -

- {msg.authorName} -

- )} -

{msg.body}

- {/* Anexos */} - {msg.attachments && msg.attachments.length > 0 && ( -
- {msg.attachments.map((att) => ( -
- {getFileIcon(att.name)} - {att.name} - {att.size && ( - - ({Math.round(att.size / 1024)}KB) - - )} -
- ))} -
- )} -

- {formatTime(msg.createdAt)} -

+ {isAgent ? : } +
+ + {/* Bubble */} +
+ {!isAgent && ( +

+ {msg.authorName} +

+ )} +

{msg.body}

+ {/* Anexos */} + {msg.attachments && msg.attachments.length > 0 && ( +
+ {msg.attachments.map((att) => ( +
+ {getFileIcon(att.name)} + {att.name} + {att.size && ( + + ({Math.round(att.size / 1024)}KB) + + )} +
+ ))} +
+ )} +

+ {formatTime(msg.createdAt)} +

+
-
- ))} + ) + })}
)}