fix(desktop): restore custom chat window header

Revert to frameless window with custom header containing
minimize/close buttons and drag region.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
esdrasrenan 2025-12-07 13:20:35 -03:00
parent c217a40030
commit fd0e29514a
2 changed files with 43 additions and 16 deletions

View file

@ -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, Loader2, Headphones, Paperclip, FileText, Image as ImageIcon, File } from "lucide-react"
import { Send, X, Minus, Loader2, Headphones, Paperclip, FileText, Image as ImageIcon, File } from "lucide-react"
import type { ChatMessage, ChatMessagesResponse, SendMessageResponse } from "./types"
const STORE_FILENAME = "machine-agent.json"
@ -291,6 +291,14 @@ export function ChatWidget({ ticketId }: ChatWidgetProps) {
}
}
const handleMinimize = () => {
invoke("minimize_chat_window", { ticketId })
}
const handleClose = () => {
invoke("close_chat_window", { ticketId })
}
const handleKeyDown = (e: React.KeyboardEvent) => {
if (e.key === "Enter" && !e.shiftKey) {
e.preventDefault()
@ -325,20 +333,39 @@ export function ChatWidget({ ticketId }: ChatWidgetProps) {
return (
<div className="flex h-screen flex-col bg-white">
{/* Header */}
<div className="flex items-center gap-3 border-b border-slate-200 bg-slate-50 px-4 py-3">
<div className="flex size-10 items-center justify-center rounded-full bg-black text-white">
<Headphones className="size-5" />
</div>
<div>
<p className="text-sm font-semibold text-slate-900">
{ticketInfo?.agentName ?? "Suporte"}
</p>
{ticketInfo && (
<p className="text-xs text-slate-500">
Chamado #{ticketInfo.ref}
{/* Header - arrastavel */}
<div
data-tauri-drag-region
className="flex items-center justify-between border-b border-slate-200 bg-slate-50 px-4 py-3"
>
<div className="flex items-center gap-3">
<div className="flex size-10 items-center justify-center rounded-full bg-black text-white">
<Headphones className="size-5" />
</div>
<div>
<p className="text-sm font-semibold text-slate-900">
{ticketInfo?.agentName ?? "Suporte"}
</p>
)}
{ticketInfo && (
<p className="text-xs text-slate-500">
Chamado #{ticketInfo.ref}
</p>
)}
</div>
</div>
<div className="flex items-center gap-1">
<button
onClick={handleMinimize}
className="rounded p-1.5 text-slate-400 hover:bg-slate-200 hover:text-slate-600"
>
<Minus className="size-4" />
</button>
<button
onClick={handleClose}
className="rounded p-1.5 text-slate-400 hover:bg-slate-200 hover:text-slate-600"
>
<X className="size-4" />
</button>
</div>
</div>