diff --git a/ui/src/components/contacts/contact_list.rs b/ui/src/components/contacts/contact_list.rs index 728fd87d7..9ee5731d4 100644 --- a/ui/src/components/contacts/contact_list.rs +++ b/ui/src/components/contacts/contact_list.rs @@ -8,6 +8,7 @@ const MAX_COLS: usize = 500; enum ViewMode { List, View(CardId), + Close(Uuid), } #[derive(Debug)] @@ -88,6 +89,14 @@ impl ContactList { impl Component for ContactList { fn draw(&mut self, grid: &mut CellBuffer, area: Area, context: &mut Context) { + if let ViewMode::Close(u) = self.mode { + context.replies.push_back(UIEvent { + id: 0, + event_type: UIEventType::Action(Tab(Kill(u))), + }); + return; + } + if let Some(mgr) = self.view.as_mut() { mgr.draw(grid, area, context); return; @@ -189,4 +198,8 @@ impl Component for ContactList { }; self.dirty = true; } + + fn kill(&mut self, uuid: Uuid) { + self.mode = ViewMode::Close(uuid); + } }