From fb099724383574da2d065fabba9f56a57b263406 Mon Sep 17 00:00:00 2001 From: Alex-Emmet Date: Sun, 8 Feb 2026 18:48:38 +0100 Subject: [PATCH] [Add] Performance graphs won't show if UI is small --- src/data/communication.rs | 6 ++++ src/gui/tui.rs | 64 +++++++++++++++++++++++++-------------- 2 files changed, 47 insertions(+), 23 deletions(-) diff --git a/src/data/communication.rs b/src/data/communication.rs index f6b2fe3..99229f5 100644 --- a/src/data/communication.rs +++ b/src/data/communication.rs @@ -35,6 +35,7 @@ pub enum DataTypes { denied_profiles, content, messages, + notifications, send_time, get_time, get_variant, @@ -142,6 +143,11 @@ pub enum CommunicationType { message_other_iota, message_chunk, messages_get, + + push_notification, + read_notification, + get_notifications, + change_confirm, confirm_receive, confirm_read, diff --git a/src/gui/tui.rs b/src/gui/tui.rs index 5136681..3e4b0d6 100644 --- a/src/gui/tui.rs +++ b/src/gui/tui.rs @@ -54,52 +54,70 @@ pub async fn render_tui() { let mut terminal = TERMINAL.lock().await; let _ = terminal.draw(|f| { let area = f.area(); - let chunks = Layout::default() - .direction(Direction::Horizontal) - .constraints([ - Constraint::Percentage(40), - Constraint::Percentage(60), - Constraint::Min(40), - ]) - .split(area); + + let is_horizontal = area.width >= 120; + let chunks = if is_horizontal { + Layout::default() + .direction(Direction::Horizontal) + .constraints([ + Constraint::Percentage(40), + Constraint::Percentage(60), + Constraint::Min(40), + ]) + .split(area) + } else { + Layout::default() + .direction(Direction::Vertical) + .constraints([Constraint::Percentage(40), Constraint::Percentage(60)]) + .split(area) + }; let state = APP_STATE.lock().unwrap().clone(); // LOGS PANEL { + let borders = if is_horizontal { + Borders::LEFT.union(Borders::TOP).union(Borders::BOTTOM) + } else { + Borders::LEFT.union(Borders::RIGHT).union(Borders::TOP) + }; let items: Vec = state .logs .iter() .rev() .map(|s| ListItem::new(s.clone())) .collect(); - let list = List::new(items).block( - Block::default() - .title("Logs") - .borders(Borders::LEFT.union(Borders::TOP).union(Borders::BOTTOM)), - ); + let list = List::new(items).block(Block::default().title("Logs").borders(borders)); f.render_widget(list, chunks[0]); } // SETTINGS PANEL { + let borders = if is_horizontal { + Borders::LEFT.union(Borders::TOP).union(Borders::BOTTOM) + } else { + Borders::ALL + }; settings_panel::draw( f, chunks[1], - Block::default() - .title("Settings") - .borders(Borders::LEFT.union(Borders::TOP).union(Borders::BOTTOM)), + Block::default().title("Settings").borders(borders), password, state.clone(), ); - draw_block_joins( - f, - chunks[1], - Borders::TOP.union(Borders::LEFT).union(Borders::BOTTOM), - Borders::LEFT, - ); + if is_horizontal { + draw_block_joins( + f, + chunks[1], + Borders::TOP.union(Borders::LEFT).union(Borders::BOTTOM), + Borders::LEFT, + ); + } else { + draw_block_joins(f, chunks[1], Borders::ALL, Borders::TOP); + } } + // PERFORMANCE GRAPHS - { + if is_horizontal { let stack = Layout::default() .direction(Direction::Vertical) .constraints([