From 9624bb6d5aa9040a6fb58f34c7e3a71400c13d86 Mon Sep 17 00:00:00 2001 From: leafx54 Date: Wed, 27 Aug 2025 02:39:10 -0400 Subject: [PATCH] refactor: clean up code formatting for better readability in app and settings modal --- crates/agentic-tui/src/ui/app.rs | 36 ++++++++++++++------- crates/agentic-tui/src/ui/settings_modal.rs | 10 +++--- 2 files changed, 28 insertions(+), 18 deletions(-) diff --git a/crates/agentic-tui/src/ui/app.rs b/crates/agentic-tui/src/ui/app.rs index 926c831..0b37ecf 100644 --- a/crates/agentic-tui/src/ui/app.rs +++ b/crates/agentic-tui/src/ui/app.rs @@ -169,7 +169,7 @@ pub struct App { autocomplete_index: usize, ruixen_reaction_state: Option, // Temporary reaction state reaction_timer: Option, // When reaction started - last_api_call: Option, // Rate limiting protection + last_api_call: Option, // Rate limiting protection } impl App { @@ -515,10 +515,13 @@ impl App { modal_height, ); // Add subtle backdrop darkening for better modal focus - let backdrop = Block::default() - .style(self.theme.ratatui_style(Element::Background).bg(ratatui::style::Color::Rgb(20, 20, 20))); + let backdrop = Block::default().style( + self.theme + .ratatui_style(Element::Background) + .bg(ratatui::style::Color::Rgb(20, 20, 20)), + ); frame.render_widget(backdrop, size); - + frame.render_widget(Clear, modal_area); // clears the background if self.mode == AppMode::SelectingLocalModel { @@ -580,10 +583,13 @@ impl App { modal_height, ); // Add subtle backdrop darkening for better modal focus - let backdrop = Block::default() - .style(self.theme.ratatui_style(Element::Background).bg(ratatui::style::Color::Rgb(20, 20, 20))); + let backdrop = Block::default().style( + self.theme + .ratatui_style(Element::Background) + .bg(ratatui::style::Color::Rgb(20, 20, 20)), + ); frame.render_widget(backdrop, size); - + frame.render_widget(Clear, modal_area); self.render_synthesize_modal(frame, modal_area); } else if self.mode == AppMode::CoachingTip { @@ -602,10 +608,13 @@ impl App { modal_height, ); // Add subtle backdrop darkening for better modal focus - let backdrop = Block::default() - .style(self.theme.ratatui_style(Element::Background).bg(ratatui::style::Color::Rgb(20, 20, 20))); + let backdrop = Block::default().style( + self.theme + .ratatui_style(Element::Background) + .bg(ratatui::style::Color::Rgb(20, 20, 20)), + ); frame.render_widget(backdrop, size); - + frame.render_widget(Clear, modal_area); self.render_coaching_tip_modal(frame, modal_area); } else if self.mode == AppMode::Complete { @@ -1094,8 +1103,11 @@ impl App { // Synthesize - send proposal to cloud for synthesis // Rate limiting: only allow if not already processing and sufficient cooldown let can_make_request = self.agent_status != AgentStatus::Searching - && self.last_api_call.map(|t| t.elapsed().as_secs() >= 2).unwrap_or(true); - + && self + .last_api_call + .map(|t| t.elapsed().as_secs() >= 2) + .unwrap_or(true); + if can_make_request { if let Some(proposal) = self.proposals.get(self.current_proposal_index) diff --git a/crates/agentic-tui/src/ui/settings_modal.rs b/crates/agentic-tui/src/ui/settings_modal.rs index f2b26e0..6097744 100644 --- a/crates/agentic-tui/src/ui/settings_modal.rs +++ b/crates/agentic-tui/src/ui/settings_modal.rs @@ -50,12 +50,10 @@ pub fn render_settings_modal( if is_selected { // Selected: highlight background + bright text (full focus treatment) - Line::from(vec![ - Span::styled( - format!("{:<15}{}", label, display_value), - theme.highlight_style(), // Highlight background for entire row - ), - ]) + Line::from(vec![Span::styled( + format!("{:<15}{}", label, display_value), + theme.highlight_style(), // Highlight background for entire row + )]) } else { // Unselected: dim label + dim value (fades away) Line::from(vec![