Skip to content

Commit

Permalink
feat: implement bookmarked help popup
Browse files Browse the repository at this point in the history
Signed-off-by: OJarrisonn <j.h.m.t.v.10@gmail.com>
Reviewed-by: David Tadokoro <davidbtadokoro@usp.br>
Signed-off-by: David Tadokoro <davidbtadokoro@usp.br>
  • Loading branch information
OJarrisonn authored and davidbtadokoro committed Nov 27, 2024
1 parent e300f90 commit b73e85a
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
19 changes: 19 additions & 0 deletions src/handler/bookmarked.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ use std::ops::ControlFlow;
use crate::{
app::{screens::CurrentScreen, App},
loading_screen,
ui::popup::{help::HelpPopUpBuilder, PopUp},
};
use ratatui::{
crossterm::event::{KeyCode, KeyEvent},
Expand All @@ -19,6 +20,10 @@ where
B: Backend + Send + 'static,
{
match key.code {
KeyCode::Char('?') => {
let popup = generate_help_popup();
app.popup = Some(popup);
}
KeyCode::Esc => {
app.bookmarked_patchsets.patchset_index = 0;
app.set_current_screen(CurrentScreen::MailingListSelection);
Expand All @@ -42,3 +47,17 @@ where
}
Ok(ControlFlow::Continue(terminal))
}

pub fn generate_help_popup() -> Box<dyn PopUp> {
let popup = HelpPopUpBuilder::new()
.title("Bookmarked Patchsets")
.description("This screen shows all the patchsets you have bookmarked.\nThis is quite useful to keep track of patchsets you are interested in take a look later.")
.keybind("ESC", "Exit")
.keybind("ENTER", "See details of the selected patchset")
.keybind("?", "Show this help screen")
.keybind("j/🡇", "Down")
.keybind("k/🡅", "Up")
.build();

Box::new(popup)
}
2 changes: 1 addition & 1 deletion src/ui/bookmarked.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ pub fn mode_footer_text() -> Vec<Span<'static>> {

pub fn keys_hint() -> Span<'static> {
Span::styled(
"(ESC) to return | (ENTER) to select | ( j / 🡇 ) down | ( k / 🡅 ) up",
"(ESC) to return | (ENTER) to select | (?) help",
Style::default().fg(Color::Red),
)
}

0 comments on commit b73e85a

Please sign in to comment.