mirror of
https://seed.radicle.dev/rad:z39mP9rQAaGmERfUMPULfPUi473tY.git
synced 2026-11-16 00:10:38 +08:00
Switch shortcuts on issue page
This commit is contained in:
+1
-1
@@ -161,7 +161,7 @@ impl App {
|
||||
let repo = self.context.repository();
|
||||
|
||||
if let Some(issue) = cob::issue::find(repo, &id)? {
|
||||
let view = Box::new(IssuePage::new(theme.clone(), (id, issue)));
|
||||
let view = Box::new(IssuePage::new(&self.context, theme, (id, issue)));
|
||||
self.pages.push(view, app, &self.context, theme)?;
|
||||
|
||||
Ok(())
|
||||
|
||||
+1
-1
@@ -79,7 +79,7 @@ impl tuirealm::Component<Message, NoUserEvent> for Widget<issue::LargeList> {
|
||||
code: Key::Enter, ..
|
||||
}) => Some(Message::Issue(IssueMessage::Focus(IssueCid::Details))),
|
||||
Event::Keyboard(KeyEvent {
|
||||
code: Key::Char('o'), ..
|
||||
code: Key::Char('n'), ..
|
||||
}) => {
|
||||
Some(Message::Issue(IssueMessage::OpenPopup(IssueCid::NewForm)))
|
||||
}
|
||||
|
||||
+21
-5
@@ -1,6 +1,6 @@
|
||||
use std::collections::HashMap;
|
||||
|
||||
use anyhow::{Ok, Result};
|
||||
use anyhow::Result;
|
||||
|
||||
use radicle::cob::issue::{Issue, IssueId};
|
||||
use radicle::cob::patch::{Patch, PatchId};
|
||||
@@ -281,8 +281,8 @@ pub struct IssuePage {
|
||||
}
|
||||
|
||||
impl IssuePage {
|
||||
pub fn new(theme: Theme, issue: (IssueId, Issue)) -> Self {
|
||||
let shortcuts = Self::build_shortcuts(&theme);
|
||||
pub fn new(_context: &Context, theme: &Theme, issue: (IssueId, Issue)) -> Self {
|
||||
let shortcuts = Self::build_shortcuts(theme);
|
||||
let active_component = IssueCid::List;
|
||||
|
||||
Self {
|
||||
@@ -313,6 +313,7 @@ impl IssuePage {
|
||||
widget::common::shortcut(theme, "esc", "back"),
|
||||
widget::common::shortcut(theme, "↑/↓", "navigate"),
|
||||
widget::common::shortcut(theme, "enter", "show"),
|
||||
widget::common::shortcut(theme, "n", "new issue"),
|
||||
widget::common::shortcut(theme, "q", "quit"),
|
||||
],
|
||||
),
|
||||
@@ -328,6 +329,17 @@ impl IssuePage {
|
||||
],
|
||||
),
|
||||
),
|
||||
(
|
||||
IssueCid::NewForm,
|
||||
widget::common::shortcuts(
|
||||
theme,
|
||||
vec![
|
||||
widget::common::shortcut(theme, "esc", "back"),
|
||||
widget::common::shortcut(theme, "shift + tab / tab", "navigate"),
|
||||
widget::common::shortcut(theme, "alt + s", "submit"),
|
||||
],
|
||||
),
|
||||
),
|
||||
]
|
||||
.iter()
|
||||
.cloned()
|
||||
@@ -461,13 +473,17 @@ impl ViewPage for IssuePage {
|
||||
Message::Issue(IssueMessage::OpenPopup(cid)) => {
|
||||
if cid == IssueCid::NewForm {
|
||||
let new_form = widget::issue::new_form(context, theme).to_boxed();
|
||||
app.remount(Cid::Issue(IssueCid::NewForm), new_form, vec![])?;
|
||||
app.active(&Cid::Issue(IssueCid::NewForm))?;
|
||||
app.remount(Cid::Issue(cid.clone()), new_form, vec![])?;
|
||||
app.active(&Cid::Issue(cid.clone()))?;
|
||||
|
||||
self.update_shortcuts(app, cid)?;
|
||||
}
|
||||
}
|
||||
Message::Issue(IssueMessage::ClosePopup(cid)) => {
|
||||
app.blur()?;
|
||||
app.umount(&Cid::Issue(cid))?;
|
||||
|
||||
self.update_shortcuts(app, IssueCid::List)?;
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user