From b76a1f9aeda13c4cd3354b9b63a58f0ab1fa0eef Mon Sep 17 00:00:00 2001 From: Klesti Selimaj Date: Thu, 23 Jul 2026 00:30:57 +0200 Subject: [PATCH] Fix market overview --- src/terminal/formatting.rs | 11 +++++++++-- src/terminal/main.rs | 17 ++++++++--------- 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/src/terminal/formatting.rs b/src/terminal/formatting.rs index 9dfef94..dd431b2 100644 --- a/src/terminal/formatting.rs +++ b/src/terminal/formatting.rs @@ -137,7 +137,7 @@ struct Property(&'static str, String); impl Formatted for MarketOverview { fn get_formatted(&self) -> Vec { - vec![ + let mut o = vec![ Property("TREND", format!("{}", self.trend)), Property("VOLATILITY", format!("{}", self.volatility)), Property( @@ -149,7 +149,14 @@ impl Formatted for MarketOverview { }, ), ] - .get_formatted() + .get_formatted(); + + o.push(format!( + "\n{}", + apply_padding(self.alerts.get_formatted()).join("\n") + )); + + o } } diff --git a/src/terminal/main.rs b/src/terminal/main.rs index 848bf9f..3dfc51c 100644 --- a/src/terminal/main.rs +++ b/src/terminal/main.rs @@ -226,14 +226,13 @@ impl App for PulseTradeApp { .await, ), ), - (LayoutItem::Widget(Size::Flex(1)), { - let mo = self.market_overview.lock().await; - Box::new(format!( - " MARKET OVERVIEW\n{}\n\n{}", - apply_padding(mo.get_formatted()).join("\n"), - apply_padding(mo.alerts.get_formatted()).join("\n") - )) - }), + ( + LayoutItem::Widget(Size::Flex(1)), + Box::new( + advanced_draw(&self.scroll, 2, "MARKET OVERVIEW", &self.market_overview) + .await, + ), + ), ]), ); @@ -312,7 +311,7 @@ pub async fn advanced_draw( scroll.scroll( index, - format!("{}{title}\x1b[0m", scroll.get_selected(index)), + format!(" {}{title}\x1b[0m", scroll.get_selected(index)), apply_padding(state.lock().await.get_formatted()).join("\n"), ) }