refactor: task detail modal into its own component

Move task detail modal logic from App into a dedicated TaskDetailModal
component. The modal now manages its own state (open/closed, loading,
error states) and handles its own focus and scroll. App delegates modal
operations to the component and reacts to its events.
This commit is contained in:
Ignacio Perez
2025-12-30 21:16:12 -03:00
parent f0ffa033b0
commit 125456e50a
3 changed files with 206 additions and 97 deletions
+16 -2
View File
@@ -3,6 +3,20 @@ use crate::{
keymap::{Command, CommandDispatcher, FocusTarget},
};
impl App {
fn close_task_detail(&mut self, cx: &mut gpui::Context<Self>) {
self.task_detail_modal.update(cx, |modal, cx| {
modal.close(cx);
});
}
fn scroll_task_detail(&self, delta: i32, cx: &mut gpui::Context<Self>) {
self.task_detail_modal.update(cx, |modal, cx| {
modal.scroll(delta, cx);
});
}
}
impl CommandDispatcher for App {
fn dispatch(&mut self, command: Command, cx: &mut gpui::Context<Self>) -> bool {
match command {
@@ -94,11 +108,11 @@ impl CommandDispatcher for App {
true
}
Command::CloseModal => {
self.close_task_detail(None, cx);
self.close_task_detail(cx);
true
}
Command::SaveModal => {
self.close_task_detail(None, cx);
self.close_task_detail(cx);
true
}
Command::ModalScrollUp => {