feat: Add global toasts and annotation copy feedback

Create a reusable ToastHost/ToastGlobal rendered as an overlay, and use
it to show a toast after copying an annotation. Adjust modal backdrop
click handling so toasts don’t close the modal, add a simple color mix
helper for toast styling, and remove the unused task table priority
color helper.
This commit is contained in:
Ignacio Perez
2025-12-31 14:59:51 -03:00
parent 37760cda74
commit 7cf431d761
8 changed files with 196 additions and 28 deletions
+8
View File
@@ -3,6 +3,7 @@ use std::collections::HashMap;
use gpui::prelude::*;
use crate::{
components::toast::{ToastGlobal, ToastHost},
keymap::{Command, CommandDispatcher, ContextId, FocusTarget, KeyChord, KeymapStack},
models::{FilterState, ProjectTree},
task::{self, TaskOverview, TaskService, TaskSummary},
@@ -25,6 +26,7 @@ pub(super) struct App {
pub(super) status_bar: gpui::Entity<StatusBar>,
pub(super) task_table: gpui::Entity<TaskTable>,
pub(super) task_detail_modal: gpui::Entity<TaskDetailModal>,
pub(super) toast_host: gpui::Entity<ToastHost>,
pub(super) task_service: TaskService,
pub(super) tasks: Vec<TaskSummary>,
pub(super) focus_before_modal: FocusTarget,
@@ -71,6 +73,7 @@ impl gpui::Render for App {
self.sidebar.clone(),
self.task_table.clone(),
self.status_bar.clone(),
self.toast_host.clone(),
on_root_key_down,
on_sidebar_mouse_down,
on_table_mouse_down,
@@ -367,6 +370,10 @@ impl App {
.collect();
let status_bar = cx.new(|cx| StatusBar::new(cx));
let toast_host = cx.new(|cx| ToastHost::new(cx));
cx.set_global(ToastGlobal {
host: toast_host.clone(),
});
let sidebar =
cx.new(|cx| Sidebar::new(project_tree, tags, filter_state.clone(), cx));
@@ -396,6 +403,7 @@ impl App {
status_bar: status_bar.clone(),
task_table,
task_detail_modal,
toast_host,
task_service,
tasks: task_summaries,
focus_before_modal: FocusTarget::Table,