diff --git a/apps/desktop/src/chat/ChatHubWidget.tsx b/apps/desktop/src/chat/ChatHubWidget.tsx index e8f91d5..924ab69 100644 --- a/apps/desktop/src/chat/ChatHubWidget.tsx +++ b/apps/desktop/src/chat/ChatHubWidget.tsx @@ -17,7 +17,8 @@ import { useMachineSessions, type MachineSession } from "./useConvexMachineQueri * Ao clicar em uma sessao, abre/foca a janela de chat daquele ticket */ export function ChatHubWidget() { - const [isMinimized, setIsMinimized] = useState(true) + // Inicializa baseado na altura real da janela (< 100px = minimizado) + const [isMinimized, setIsMinimized] = useState(() => window.innerHeight < 100) // Convex subscription reativa const { sessions = [], isLoading, hasToken } = useMachineSessions() diff --git a/apps/desktop/src/chat/ChatWidget.tsx b/apps/desktop/src/chat/ChatWidget.tsx index ad20ed9..bdc4050 100644 --- a/apps/desktop/src/chat/ChatWidget.tsx +++ b/apps/desktop/src/chat/ChatWidget.tsx @@ -245,7 +245,8 @@ export function ChatWidget({ ticketId, ticketRef }: ChatWidgetProps) { const [isSending, setIsSending] = useState(false) const [isUploading, setIsUploading] = useState(false) const [pendingAttachments, setPendingAttachments] = useState([]) - const [isMinimized, setIsMinimized] = useState(true) + // Inicializa baseado na altura real da janela (< 100px = minimizado) + const [isMinimized, setIsMinimized] = useState(() => window.innerHeight < 100) // Convex hooks const { apiBaseUrl, machineToken } = useConvexMachine() @@ -596,7 +597,7 @@ export function ChatWidget({ ticketId, ticketRef }: ChatWidgetProps) { // Expandido return ( -
+
{/* Header */}