diff --git a/src/view.rs b/src/view.rs index af13629..0fa41ab 100644 --- a/src/view.rs +++ b/src/view.rs @@ -9,6 +9,10 @@ impl Taggart { pub(crate) const BG_BROWSE: Color = Color::Rgb(0, 0, 0); pub(crate) const BG_EDIT: Color = Color::Rgb(48, 128, 0); pub(crate) const FG_EDIT: Color = Color::Rgb(255, 255, 255); + pub(crate) const BG_SAVE: Color = Color::Rgb(192, 96, 0); + pub(crate) const FG_SAVE: Color = Color::Rgb(255, 255, 255); + pub(crate) const BG_QUIT: Color = Color::Rgb(128, 0, 0); + pub(crate) const FG_QUIT: Color = Color::Rgb(255, 255, 255); } impl Content for Taggart { @@ -55,22 +59,23 @@ impl Taggart { ) } fn mode_bar (&self, size: String) -> impl Content { + let mode = match self.mode { + Some(Mode::Save { .. }) => Tui::bg(Self::BG_SAVE, Tui::fg(Self::FG_SAVE, " SAVE ")), + Some(Mode::Quit { .. }) => Tui::bg(Self::BG_QUIT, Tui::fg(Self::FG_QUIT, " QUIT ")), + Some(Mode::Edit { .. }) => Tui::bg(Self::BG_EDIT, Tui::fg(Self::FG_EDIT, " EDIT ")), + _ => Tui::bg(Self::BG_BROWSE, Tui::fg(Self::FG_BROWSE, " BROWSE ")) + }; + let help = match self.mode { + Some(Mode::Save { .. }) => " Esc: cancel, Arrows: select, Enter: confirm", + Some(Mode::Quit { .. }) => " Esc: cancel, Arrows: select, Enter: confirm", + Some(Mode::Edit { .. }) => " Esc: cancel, Enter: set value", + _ => " Q: exit, W: save, Arrows: select, Space: open, Enter: edit", + }; status_bar( Color::Rgb(0, 0, 0), Color::Rgb(192, 192, 192), Fill::x(Bsp::a( - Fill::x(Align::w(Tui::bold(true, match self.mode { - Some(Mode::Edit { .. }) => { - Bsp::e( - Tui::bg(Self::BG_EDIT, Tui::fg(Self::FG_EDIT, " EDIT ")), - " Esc: cancel, Enter: set value" - ) - }, - _ => Bsp::e( - Tui::bg(Self::BG_BROWSE, Tui::fg(Self::FG_BROWSE, " BROWSE ")), - " Q: exit, Arrows: select, Space: open, Enter: edit" - ) - }))), + Fill::x(Align::w(Tui::bold(true, Bsp::e(mode, help)))), Fill::x(Align::e(size)), )) )