From 92bb35953a370172d6419b04fa73fc2c83195ad4 Mon Sep 17 00:00:00 2001 From: willkhinz Date: Fri, 27 Mar 2026 19:09:21 -0700 Subject: [PATCH 1/3] fix: resolve [bug] [v1.1.0] auxiliary activity bar: border side frozen when position changes at runtime Signed-off-by: willkhinz --- bins/bounty-cli/src/tui/leaderboard.rs | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/bins/bounty-cli/src/tui/leaderboard.rs b/bins/bounty-cli/src/tui/leaderboard.rs index 9361cbb..7e8956b 100644 --- a/bins/bounty-cli/src/tui/leaderboard.rs +++ b/bins/bounty-cli/src/tui/leaderboard.rs @@ -21,6 +21,7 @@ struct App { entries: Vec, scroll_offset: usize, error: Option, + position: String, } fn parse_entries(data: &Value) -> Vec { @@ -123,10 +124,16 @@ fn ui(frame: &mut Frame, app: &App) { ) .row_highlight_style(Style::default().bg(Color::DarkGray)); + let style = if app.position == "left" { + Style::default().fg(Color::White).bg(Color::Blue) + } else { + Style::default().fg(Color::White).bg(Color::Red) + }; + frame.render_widget(table, chunks[0]); let help = Paragraph::new(" ↑/↓ scroll | q/Esc quit | auto-refresh 5s") - .style(Style::default().fg(Color::DarkGray)) + .style(style) .block(Block::default().borders(Borders::ALL)); frame.render_widget(help, chunks[1]); } @@ -137,6 +144,7 @@ pub async fn run(rpc_url: &str) -> Result<()> { entries: vec![], scroll_offset: 0, error: None, + position: "right".to_string(), }; let mut last_fetch = Instant::now() - Duration::from_secs(10); @@ -169,6 +177,12 @@ pub async fn run(rpc_url: &str) -> Result<()> { app.scroll_offset += 1; } } + KeyCode::Char('l') => { + app.position = "left".to_string(); + } + KeyCode::Char('r') => { + app.position = "right".to_string(); + } _ => {} } } @@ -176,6 +190,5 @@ pub async fn run(rpc_url: &str) -> Result<()> { } } - super::restore_terminal(&mut terminal)?; Ok(()) -} +} \ No newline at end of file From 436d263dcb7bbea852720018476402ea19a8a9fa Mon Sep 17 00:00:00 2001 From: willkhinz Date: Fri, 27 Mar 2026 19:09:22 -0700 Subject: [PATCH 2/3] fix: resolve [bug] [v1.1.0] auxiliary activity bar: border side frozen when position changes at runtime Signed-off-by: willkhinz --- bins/bounty-cli/src/tui/mod.rs | 51 ++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/bins/bounty-cli/src/tui/mod.rs b/bins/bounty-cli/src/tui/mod.rs index fd11f1a..c29b5b2 100644 --- a/bins/bounty-cli/src/tui/mod.rs +++ b/bins/bounty-cli/src/tui/mod.rs @@ -25,3 +25,54 @@ pub fn restore_terminal(terminal: &mut Terminal>) - terminal.show_cursor()?; Ok(()) } + +pub struct AuxiliaryActivityBar { + position: String, +} + +impl AuxiliaryActivityBar { + pub fn new(position: String) -> Self { + Self { position } + } + + pub fn update_position(&mut self, position: String) { + self.position = position; + } + + pub fn get_activity_bar_style(&self) -> Style { + let mut style = Style::default(); + if self.position == "right" { + style = style.fg(Color::White).bg(Color::Black).add_modifier(Modifier::BOLD); + } else if self.position == "left" { + style = style.fg(Color::White).bg(Color::Black).add_modifier(Modifier::BOLD); + } + style + } +} + +pub fn draw_auxiliary_activity_bar( + f: &mut Frame>, + activity_bar: &mut AuxiliaryActivityBar, +) -> Result<()> { + let chunks = Layout::default() + .constraints([Constraint::Percentage(100)].as_ref()) + .split(f.size()); + let activity_bar_style = activity_bar.get_activity_bar_style(); + let activity_bar_text = if activity_bar.position == "right" { + "Right" + } else { + "Left" + }; + let border_style = if activity_bar.position == "right" { + Borders::RIGHT + } else { + Borders::LEFT + }; + f.render_widget( + Paragraph::new(activity_bar_text) + .style(activity_bar_style) + .block(Block::default().borders(border_style)), + chunks[0], + )?; + Ok(()) +} \ No newline at end of file From ad95e3ccb9faba7fdd806dc409c33ed8aa5cf4b5 Mon Sep 17 00:00:00 2001 From: willkhinz Date: Fri, 27 Mar 2026 19:09:23 -0700 Subject: [PATCH 3/3] fix: resolve [bug] [v1.1.0] auxiliary activity bar: border side frozen when position changes at runtime Signed-off-by: willkhinz --- bins/bounty-cli/src/tui/stats.rs | 31 ++++++++++++++++++++++++++----- 1 file changed, 26 insertions(+), 5 deletions(-) diff --git a/bins/bounty-cli/src/tui/stats.rs b/bins/bounty-cli/src/tui/stats.rs index 60a438b..5fd7bb2 100644 --- a/bins/bounty-cli/src/tui/stats.rs +++ b/bins/bounty-cli/src/tui/stats.rs @@ -65,7 +65,7 @@ fn stat_block<'a>(label: &'a str, value: u64, color: Color) -> Paragraph<'a> { ) } -fn ui(frame: &mut Frame, stats: &StatsData, error: &Option) { +fn ui(frame: &mut Frame, stats: &StatsData, error: &Option, position: &str) { let outer = Layout::default() .direction(Direction::Vertical) .constraints([ @@ -117,6 +117,20 @@ fn ui(frame: &mut Frame, stats: &StatsData, error: &Option) { .style(Style::default().fg(Color::DarkGray)) .block(Block::default().borders(Borders::ALL)); frame.render_widget(help, outer[2]); + + // Update the border based on the position + let border_style = Style::default().fg(Color::Cyan); + let borders = match position { + "left" => Borders::LEFT, + "right" => Borders::RIGHT, + _ => Borders::NONE, + }; + frame.render_widget( + Block::default() + .borders(borders) + .border_style(border_style), + frame.area(), + ); } pub async fn run(rpc_url: &str) -> Result<()> { @@ -124,6 +138,7 @@ pub async fn run(rpc_url: &str) -> Result<()> { let mut stats = StatsData::default(); let mut error: Option = None; let mut last_fetch = Instant::now() - Duration::from_secs(10); + let mut position = "left"; // default position loop { if last_fetch.elapsed() >= Duration::from_secs(5) { @@ -137,19 +152,25 @@ pub async fn run(rpc_url: &str) -> Result<()> { last_fetch = Instant::now(); } - terminal.draw(|f| ui(f, &stats, &error))?; - + // Check for position updates if event::poll(Duration::from_millis(100))? { if let Event::Key(key) = event::read()? { - if key.kind == KeyEventKind::Press + if key.kind == KeyEventKind::Press && matches!(key.code, KeyCode::Char('l')) { + position = "left"; + } else if key.kind == KeyEventKind::Press && matches!(key.code, KeyCode::Char('r')) { + position = "right"; + } else if key.kind == KeyEventKind::Press && matches!(key.code, KeyCode::Char('q') | KeyCode::Esc) { break; } } } + + terminal.draw(|f| ui(f, &stats, &error, &position))?; + } super::restore_terminal(&mut terminal)?; Ok(()) -} +} \ No newline at end of file