Radish alpha
r
Radicle terminal user interface
Radicle
Git (anonymous pull)
Log in to clone via SSH
issue: Add missing actions
Erik Kundt committed 2 years ago
commit e2c75514309dccc02d28308293ca18eee3a53678
parent ee743f7edbde6b13ead7903bf1e032829a3cba10
1 file changed +40 -1
modified bin/commands/issue/flux/select/ui.rs
@@ -98,6 +98,39 @@ impl Widget<IssuesState, Action> for ListPage {
                    });
                }
            }
+
            Key::Char('c') => {
+
                if let Some(selected) = &self.props.selected {
+
                    let _ = self.action_tx.send(Action::Exit {
+
                        selection: Some(Selection {
+
                            operation: Some(IssueOperation::Comment.to_string()),
+
                            ids: vec![selected.id],
+
                            args: vec![],
+
                        }),
+
                    });
+
                }
+
            }
+
            Key::Char('e') => {
+
                if let Some(selected) = &self.props.selected {
+
                    let _ = self.action_tx.send(Action::Exit {
+
                        selection: Some(Selection {
+
                            operation: Some(IssueOperation::Edit.to_string()),
+
                            ids: vec![selected.id],
+
                            args: vec![],
+
                        }),
+
                    });
+
                }
+
            }
+
            Key::Char('d') => {
+
                if let Some(selected) = &self.props.selected {
+
                    let _ = self.action_tx.send(Action::Exit {
+
                        selection: Some(Selection {
+
                            operation: Some(IssueOperation::Delete.to_string()),
+
                            ids: vec![selected.id],
+
                            args: vec![],
+
                        }),
+
                    });
+
                }
+
            }
            _ => {
                <Issues as Widget<IssuesState, Action>>::handle_key_event(&mut self.issues, key);
            }
@@ -112,7 +145,13 @@ impl Render<()> for ListPage {

        let shortcuts = match self.props.mode {
            Mode::Id => vec![Shortcut::new("enter", "select"), Shortcut::new("q", "quit")],
-
            Mode::Operation => vec![Shortcut::new("enter", "show"), Shortcut::new("q", "quit")],
+
            Mode::Operation => vec![
+
                Shortcut::new("enter", "show"),
+
                Shortcut::new("c", "comment"),
+
                Shortcut::new("e", "edit"),
+
                Shortcut::new("d", "delete"),
+
                Shortcut::new("q", "quit"),
+
            ],
        };

        self.issues.render::<B>(frame, layout.component, ());