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

@ -718,9 +718,9 @@ fn open_chat_window_internal(app: &tauri::AppHandle, ticket_id: &str) -> Result<
.inner_size(380.0, 520.0) .inner_size(380.0, 520.0)
.min_inner_size(300.0, 400.0) .min_inner_size(300.0, 400.0)
.position(x, y) .position(x, y)
.decorations(true) // Usar decoracoes nativas do Windows .decorations(false) // Sem decoracoes nativas - usa header customizado
.always_on_top(true) .always_on_top(true)
.skip_taskbar(false) // Mostrar na taskbar .skip_taskbar(true)
.focused(true) .focused(true)
.visible(true) .visible(true)
.build() .build()

View file

@ -4,7 +4,7 @@ import { listen } from "@tauri-apps/api/event"
import { Store } from "@tauri-apps/plugin-store" import { Store } from "@tauri-apps/plugin-store"
import { appLocalDataDir, join } from "@tauri-apps/api/path" import { appLocalDataDir, join } from "@tauri-apps/api/path"
import { open } from "@tauri-apps/plugin-dialog" 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" import type { ChatMessage, ChatMessagesResponse, SendMessageResponse } from "./types"
const STORE_FILENAME = "machine-agent.json" 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) => { const handleKeyDown = (e: React.KeyboardEvent) => {
if (e.key === "Enter" && !e.shiftKey) { if (e.key === "Enter" && !e.shiftKey) {
e.preventDefault() e.preventDefault()
@ -325,8 +333,12 @@ export function ChatWidget({ ticketId }: ChatWidgetProps) {
return ( return (
<div className="flex h-screen flex-col bg-white"> <div className="flex h-screen flex-col bg-white">
{/* Header */} {/* Header - arrastavel */}
<div className="flex items-center gap-3 border-b border-slate-200 bg-slate-50 px-4 py-3"> <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"> <div className="flex size-10 items-center justify-center rounded-full bg-black text-white">
<Headphones className="size-5" /> <Headphones className="size-5" />
</div> </div>
@ -341,6 +353,21 @@ export function ChatWidget({ ticketId }: ChatWidgetProps) {
)} )}
</div> </div>
</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>
{/* Mensagens */} {/* Mensagens */}
<div className="flex-1 overflow-y-auto p-4"> <div className="flex-1 overflow-y-auto p-4">