Skip to content

Commit

Permalink
Update ratatui to 0.28.1 to fix build issue
Browse files Browse the repository at this point in the history
  • Loading branch information
pavlus committed Sep 1, 2024
1 parent 247dba7 commit 9663f3b
Show file tree
Hide file tree
Showing 8 changed files with 614 additions and 435 deletions.
1,019 changes: 599 additions & 420 deletions Cargo.lock

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ hexyl = "0.13.0"
lazy_static = "1.4.0"
regex = "1.8.4"
tokio = { version = "1.28", features = ["full", "tracing"] }
tracing = "0.1.37"
tracing-appender = "0.2.2"
tracing = "0.1.40"
tracing-appender = "0.2.3"
tracing-subscriber = "0.3.18"
tui = { package = "ratatui", version = "0.21.0" }
tui = { package = "ratatui", version = "0.28.1" }
uuid = "1.3.4"

[build-dependencies]
Expand Down
2 changes: 1 addition & 1 deletion src/tui/connection_view.rs
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ impl AppRoute for ConnectionView {
&mut self,
area: tui::layout::Rect,
route_active: bool,
f: &mut tui::Frame<super::TerminalBackend>,
f: &mut tui::Frame,
) -> crate::error::Result<()> {
let active_route = self.ctx.active_route.read()?;
let (_, characteristic, history, historical_view_index) =
Expand Down
6 changes: 3 additions & 3 deletions src/tui/error_popup.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::{
error,
tui::{ui::BlendrBlock, AppRoute, HandleKeydownResult, TerminalBackend},
tui::{ui::BlendrBlock, AppRoute, HandleKeydownResult},
Ctx,
};
use crossterm::event::KeyCode;
Expand Down Expand Up @@ -71,7 +71,7 @@ impl AppRoute for ErrorView {
&mut self,
_area: Rect,
_is_active: bool,
f: &mut Frame<TerminalBackend>,
f: &mut Frame,
) -> error::Result<()> {
let global_error_lock = self.ctx.global_error.lock().unwrap();
let error = if let Some(error) = global_error_lock.deref() {
Expand All @@ -80,7 +80,7 @@ impl AppRoute for ErrorView {
return Ok(());
};

let area = centered_rect(60, 20, f.size());
let area = centered_rect(60, 20, f.area());
f.render_widget(Clear, area); //this clears out the background

let paragraph = Paragraph::new(vec![Line::from(""), Line::from(format!("{error}"))]).block(
Expand Down
8 changes: 4 additions & 4 deletions src/tui/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ trait AppRoute {
where
Self: Sized;
fn handle_input(&mut self, key: &KeyEvent) -> HandleKeydownResult;
fn render(&mut self, area: Rect, is_active: bool, f: &mut Frame<TerminalBackend>)
fn render(&mut self, area: Rect, is_active: bool, f: &mut Frame)
-> Result<()>;
}

Expand Down Expand Up @@ -217,9 +217,9 @@ fn tui_loop(
}
}

fn ui(f: &mut Frame<TerminalBackend>, app: &mut App) {
fn ui(f: &mut Frame, app: &mut App) {
// Create two chunks with equal horizontal screen space
let active_blocks = app.get_active_blocks(f.size().width);
let active_blocks = app.get_active_blocks(f.area().width);
let chunks = Layout::default()
.direction(Direction::Horizontal)
.constraints(
Expand All @@ -228,7 +228,7 @@ fn ui(f: &mut Frame<TerminalBackend>, app: &mut App) {
.map(|_| Constraint::Ratio(1, active_blocks.len() as u32))
.collect::<Vec<_>>(),
)
.split(f.size());
.split(f.area());

for (i, block) in active_blocks.into_iter().enumerate() {
let is_active = matches!(block, BlockVariant::Primary(_));
Expand Down
2 changes: 1 addition & 1 deletion src/tui/peripheral_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ impl AppRoute for PeripheralList {
&mut self,
area: Rect,
route_active: bool,
f: &mut Frame<super::TerminalBackend>,
f: &mut Frame,
) -> Result<()> {
let scan = self.ctx.latest_scan.read();
let BleScan {
Expand Down
2 changes: 1 addition & 1 deletion src/tui/peripheral_view.rs
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ impl AppRoute for PeripheralView {
&mut self,
area: tui::layout::Rect,
route_active: bool,
f: &mut tui::Frame<super::TerminalBackend>,
f: &mut tui::Frame,
) -> crate::error::Result<()> {
let active_route = self.ctx.get_active_route();

Expand Down
4 changes: 2 additions & 2 deletions src/tui/welcome.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use tui::{
widgets::{Block, Borders, Paragraph, Wrap},
};

use crate::tui::{AppRoute, HandleKeydownResult, TerminalBackend};
use crate::tui::{AppRoute, HandleKeydownResult};

pub struct WelcomeBlock {}

Expand Down Expand Up @@ -100,7 +100,7 @@ impl AppRoute for WelcomeBlock {
&mut self,
area: tui::layout::Rect,
_is_active: bool,
f: &mut tui::Frame<TerminalBackend>,
f: &mut tui::Frame,
) -> crate::error::Result<()> {
if area.height > 25 {
let paragraph = Paragraph::new(Text::from(if area.height < 30 {
Expand Down

0 comments on commit 9663f3b

Please sign in to comment.