Skip to content

Commit 40c3338

Browse files
chore(deps): Update ratatui and tracing to fix cargo install issue (#25)
* chore(deps): Update ratatui and tracing to fix #12 * fix fmt --------- Co-authored-by: Dmitriy Kovalenko <[email protected]>
1 parent 247dba7 commit 40c3338

8 files changed

+614
-446
lines changed

Cargo.lock

+599-420
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+3-3
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@ hexyl = "0.13.0"
2525
lazy_static = "1.4.0"
2626
regex = "1.8.4"
2727
tokio = { version = "1.28", features = ["full", "tracing"] }
28-
tracing = "0.1.37"
29-
tracing-appender = "0.2.2"
28+
tracing = "0.1.40"
29+
tracing-appender = "0.2.3"
3030
tracing-subscriber = "0.3.18"
31-
tui = { package = "ratatui", version = "0.21.0" }
31+
tui = { package = "ratatui", version = "0.28.1" }
3232
uuid = "1.3.4"
3333

3434
[build-dependencies]

src/tui/connection_view.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ impl AppRoute for ConnectionView {
198198
&mut self,
199199
area: tui::layout::Rect,
200200
route_active: bool,
201-
f: &mut tui::Frame<super::TerminalBackend>,
201+
f: &mut tui::Frame,
202202
) -> crate::error::Result<()> {
203203
let active_route = self.ctx.active_route.read()?;
204204
let (_, characteristic, history, historical_view_index) =

src/tui/error_popup.rs

+3-8
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use crate::{
22
error,
3-
tui::{ui::BlendrBlock, AppRoute, HandleKeydownResult, TerminalBackend},
3+
tui::{ui::BlendrBlock, AppRoute, HandleKeydownResult},
44
Ctx,
55
};
66
use crossterm::event::KeyCode;
@@ -67,20 +67,15 @@ impl AppRoute for ErrorView {
6767
}
6868
}
6969

70-
fn render(
71-
&mut self,
72-
_area: Rect,
73-
_is_active: bool,
74-
f: &mut Frame<TerminalBackend>,
75-
) -> error::Result<()> {
70+
fn render(&mut self, _area: Rect, _is_active: bool, f: &mut Frame) -> error::Result<()> {
7671
let global_error_lock = self.ctx.global_error.lock().unwrap();
7772
let error = if let Some(error) = global_error_lock.deref() {
7873
error
7974
} else {
8075
return Ok(());
8176
};
8277

83-
let area = centered_rect(60, 20, f.size());
78+
let area = centered_rect(60, 20, f.area());
8479
f.render_widget(Clear, area); //this clears out the background
8580

8681
let paragraph = Paragraph::new(vec![Line::from(""), Line::from(format!("{error}"))]).block(

src/tui/mod.rs

+4-5
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,7 @@ trait AppRoute {
120120
where
121121
Self: Sized;
122122
fn handle_input(&mut self, key: &KeyEvent) -> HandleKeydownResult;
123-
fn render(&mut self, area: Rect, is_active: bool, f: &mut Frame<TerminalBackend>)
124-
-> Result<()>;
123+
fn render(&mut self, area: Rect, is_active: bool, f: &mut Frame) -> Result<()>;
125124
}
126125

127126
pub fn run_tui_app(ctx: Arc<Ctx>) -> Result<()> {
@@ -217,9 +216,9 @@ fn tui_loop(
217216
}
218217
}
219218

220-
fn ui(f: &mut Frame<TerminalBackend>, app: &mut App) {
219+
fn ui(f: &mut Frame, app: &mut App) {
221220
// Create two chunks with equal horizontal screen space
222-
let active_blocks = app.get_active_blocks(f.size().width);
221+
let active_blocks = app.get_active_blocks(f.area().width);
223222
let chunks = Layout::default()
224223
.direction(Direction::Horizontal)
225224
.constraints(
@@ -228,7 +227,7 @@ fn ui(f: &mut Frame<TerminalBackend>, app: &mut App) {
228227
.map(|_| Constraint::Ratio(1, active_blocks.len() as u32))
229228
.collect::<Vec<_>>(),
230229
)
231-
.split(f.size());
230+
.split(f.area());
232231

233232
for (i, block) in active_blocks.into_iter().enumerate() {
234233
let is_active = matches!(block, BlockVariant::Primary(_));

src/tui/peripheral_list.rs

+1-6
Original file line numberDiff line numberDiff line change
@@ -168,12 +168,7 @@ impl AppRoute for PeripheralList {
168168
HandleKeydownResult::Continue
169169
}
170170

171-
fn render(
172-
&mut self,
173-
area: Rect,
174-
route_active: bool,
175-
f: &mut Frame<super::TerminalBackend>,
176-
) -> Result<()> {
171+
fn render(&mut self, area: Rect, route_active: bool, f: &mut Frame) -> Result<()> {
177172
let scan = self.ctx.latest_scan.read();
178173
let BleScan {
179174
peripherals,

src/tui/peripheral_view.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ impl AppRoute for PeripheralView {
205205
&mut self,
206206
area: tui::layout::Rect,
207207
route_active: bool,
208-
f: &mut tui::Frame<super::TerminalBackend>,
208+
f: &mut tui::Frame,
209209
) -> crate::error::Result<()> {
210210
let active_route = self.ctx.get_active_route();
211211

src/tui/welcome.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use tui::{
44
widgets::{Block, Borders, Paragraph, Wrap},
55
};
66

7-
use crate::tui::{AppRoute, HandleKeydownResult, TerminalBackend};
7+
use crate::tui::{AppRoute, HandleKeydownResult};
88

99
pub struct WelcomeBlock {}
1010

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

0 commit comments

Comments
 (0)