From 409da8afdab10393f729278c247cb172b433d3c8 Mon Sep 17 00:00:00 2001 From: esdrasrenan Date: Sun, 7 Dec 2025 14:37:28 -0300 Subject: [PATCH] Fix duration format and minimized chat layout MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Format duration as hours+minutes when > 60min (e.g., 2h 26min) - Change minimized chat to compact chip style (matching web) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- apps/desktop/src/chat/ChatWidget.tsx | 26 +++++++------------ .../tickets/ticket-chat-history.tsx | 14 +++++++++- 2 files changed, 22 insertions(+), 18 deletions(-) diff --git a/apps/desktop/src/chat/ChatWidget.tsx b/apps/desktop/src/chat/ChatWidget.tsx index bf4518e..56c5c96 100644 --- a/apps/desktop/src/chat/ChatWidget.tsx +++ b/apps/desktop/src/chat/ChatWidget.tsx @@ -332,28 +332,20 @@ export function ChatWidget({ ticketId }: ChatWidgetProps) { ) } - // Versao minimizada (recolhida) + // Versao minimizada (chip compacto igual web) if (isMinimized) { return ( -
+
) diff --git a/src/components/tickets/ticket-chat-history.tsx b/src/components/tickets/ticket-chat-history.tsx index abd9c26..1b66a06 100644 --- a/src/components/tickets/ticket-chat-history.tsx +++ b/src/components/tickets/ticket-chat-history.tsx @@ -54,6 +54,18 @@ type ChatSession = { const MESSAGES_PER_PAGE = 20 +function formatDuration(minutes: number): string { + if (minutes < 60) { + return `${minutes} min` + } + const hours = Math.floor(minutes / 60) + const mins = minutes % 60 + if (mins === 0) { + return `${hours}h` + } + return `${hours}h ${mins}min` +} + function MessageAttachmentPreview({ attachment }: { attachment: { storageId: string; name: string; type: string | null } }) { const getFileUrl = useAction(api.files.getUrl) const [loading, setLoading] = useState(false) @@ -147,7 +159,7 @@ function ChatSessionCard({ session, isExpanded, onToggle }: { session: ChatSessi - {session.messageCount} mensagens - - {duration} min + {formatDuration(duration)}