Melhora UX do chat no desktop
All checks were successful
All checks were successful
This commit is contained in:
parent
9142446f06
commit
0a0f722bd8
4 changed files with 82 additions and 7 deletions
|
|
@ -1060,6 +1060,21 @@ async fn process_chat_update(
|
|||
// Serializa operacoes de janela para evitar race/deadlock no Windows (winit/WebView2).
|
||||
static WINDOW_OP_LOCK: Lazy<Mutex<()>> = Lazy::new(|| Mutex::new(()));
|
||||
|
||||
fn hide_other_chat_windows(app: &tauri::AppHandle, active_label: &str) {
|
||||
for (label, window) in app.webview_windows() {
|
||||
if !label.starts_with("chat-") {
|
||||
continue;
|
||||
}
|
||||
if label == active_label {
|
||||
continue;
|
||||
}
|
||||
let _ = window.hide();
|
||||
}
|
||||
if let Some(hub) = app.get_webview_window(HUB_WINDOW_LABEL) {
|
||||
let _ = hub.hide();
|
||||
}
|
||||
}
|
||||
|
||||
fn resolve_chat_window_position(
|
||||
app: &tauri::AppHandle,
|
||||
window: Option<&tauri::WebviewWindow>,
|
||||
|
|
@ -1115,6 +1130,10 @@ fn open_chat_window_with_state(app: &tauri::AppHandle, ticket_id: &str, ticket_r
|
|||
start_minimized
|
||||
);
|
||||
|
||||
if !start_minimized {
|
||||
hide_other_chat_windows(app, &label);
|
||||
}
|
||||
|
||||
// Verificar se ja existe
|
||||
if let Some(window) = app.get_webview_window(&label) {
|
||||
let _ = window.set_ignore_cursor_events(false);
|
||||
|
|
@ -1221,6 +1240,10 @@ fn set_chat_minimized_unlocked(app: &tauri::AppHandle, ticket_id: &str, minimize
|
|||
let label = format!("chat-{}", ticket_id);
|
||||
let window = app.get_webview_window(&label).ok_or("Janela não encontrada")?;
|
||||
|
||||
if minimized {
|
||||
hide_other_chat_windows(app, &label);
|
||||
}
|
||||
|
||||
// Tamanhos - chip minimizado com margem extra para badge (absolute -top-1 -right-1)
|
||||
let (width, height) = if minimized {
|
||||
(240.0, 52.0) // Tamanho com folga para "Ticket #XXX" e badge
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue