fix(desktop): corrige inicializacao do estado minimizado do chat
- Inicializa isMinimized baseado na altura real da janela - Usa h-full em vez de h-screen para layout correto - Evita inconsistencia entre estado React e tamanho da janela 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
c51b08f127
commit
1986bf286a
2 changed files with 5 additions and 3 deletions
|
|
@ -17,7 +17,8 @@ import { useMachineSessions, type MachineSession } from "./useConvexMachineQueri
|
||||||
* Ao clicar em uma sessao, abre/foca a janela de chat daquele ticket
|
* Ao clicar em uma sessao, abre/foca a janela de chat daquele ticket
|
||||||
*/
|
*/
|
||||||
export function ChatHubWidget() {
|
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
|
// Convex subscription reativa
|
||||||
const { sessions = [], isLoading, hasToken } = useMachineSessions()
|
const { sessions = [], isLoading, hasToken } = useMachineSessions()
|
||||||
|
|
|
||||||
|
|
@ -245,7 +245,8 @@ export function ChatWidget({ ticketId, ticketRef }: ChatWidgetProps) {
|
||||||
const [isSending, setIsSending] = useState(false)
|
const [isSending, setIsSending] = useState(false)
|
||||||
const [isUploading, setIsUploading] = useState(false)
|
const [isUploading, setIsUploading] = useState(false)
|
||||||
const [pendingAttachments, setPendingAttachments] = useState<UploadedAttachment[]>([])
|
const [pendingAttachments, setPendingAttachments] = useState<UploadedAttachment[]>([])
|
||||||
const [isMinimized, setIsMinimized] = useState(true)
|
// Inicializa baseado na altura real da janela (< 100px = minimizado)
|
||||||
|
const [isMinimized, setIsMinimized] = useState(() => window.innerHeight < 100)
|
||||||
|
|
||||||
// Convex hooks
|
// Convex hooks
|
||||||
const { apiBaseUrl, machineToken } = useConvexMachine()
|
const { apiBaseUrl, machineToken } = useConvexMachine()
|
||||||
|
|
@ -596,7 +597,7 @@ export function ChatWidget({ ticketId, ticketRef }: ChatWidgetProps) {
|
||||||
|
|
||||||
// Expandido
|
// Expandido
|
||||||
return (
|
return (
|
||||||
<div className="flex h-screen flex-col overflow-hidden rounded-2xl bg-white shadow-xl">
|
<div className="flex h-full flex-col overflow-hidden rounded-2xl bg-white shadow-xl">
|
||||||
{/* Header */}
|
{/* Header */}
|
||||||
<div
|
<div
|
||||||
data-tauri-drag-region
|
data-tauri-drag-region
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue