Skip to content

Commit

Permalink
Bump ratatui version
Browse files Browse the repository at this point in the history
  • Loading branch information
boundless-forest committed Nov 9, 2023
1 parent 503111d commit 6537e95
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 29 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ scale-info = { version = "2.9.0" }
subxt-metadata = { version = "0.31.0" }
scale-value = { version = "0.12.0" }
comfy-table = { version = "7.0.1" }
ratatui = { version = "0.23.0", features = ["all-widgets"] }
ratatui = { version = "0.24.0", features = ["all-widgets"] }
crossterm = { version = "0.27.0" }
array-bytes = { version = "6.1.0" }
open = { version = "5.0.0" }
Expand Down
12 changes: 2 additions & 10 deletions src/app/dashboard/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -172,11 +172,7 @@ where
}
}

fn ui<B, CI>(f: &mut Frame<B>, dash_board: &mut DashBoard<CI>)
where
B: Backend,
CI: ChainInfo,
{
fn ui<CI: ChainInfo>(f: &mut Frame, dash_board: &mut DashBoard<CI>) {
let size = f.size();
let chunks = Layout::default()
.direction(Direction::Vertical)
Expand All @@ -187,11 +183,7 @@ where
draw_tabs(f, dash_board, chunks[1]);
}

fn draw_tabs<B, CI>(f: &mut Frame<B>, dash_board: &mut DashBoard<CI>, area: Rect)
where
B: Backend,
CI: ChainInfo,
{
fn draw_tabs<CI: ChainInfo>(f: &mut Frame, dash_board: &mut DashBoard<CI>, area: Rect) {
let chunks = Layout::default()
.direction(Direction::Vertical)
.constraints([Constraint::Length(3), Constraint::Min(0)].as_ref())
Expand Down
8 changes: 2 additions & 6 deletions src/app/dashboard/tab_blocks.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// crates.io
use ratatui::{
prelude::{text::Line, Backend, Color, Constraint, Direction, Frame, Layout, Modifier, Rect, Span, Style},
prelude::{text::Line, Color, Constraint, Direction, Frame, Layout, Modifier, Rect, Span, Style},
widgets::*,
};
use sp_core::Encode;
Expand All @@ -12,11 +12,7 @@ use sp_runtime::{
use super::{DashBoard, BLOCKS_MAX_LIMIT};
use crate::networks::ChainInfo;

pub fn draw_blocks_tab<B, CI>(f: &mut Frame<B>, app: &mut DashBoard<CI>, area: Rect)
where
B: Backend,
CI: ChainInfo,
{
pub fn draw_blocks_tab<CI: ChainInfo>(f: &mut Frame, app: &mut DashBoard<CI>, area: Rect) {
let chunks = Layout::default()
.direction(Direction::Horizontal)
.constraints(vec![Constraint::Percentage(30), Constraint::Percentage(70)])
Expand Down
8 changes: 2 additions & 6 deletions src/app/dashboard/tab_events.rs
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
// crates.io
use ratatui::{
prelude::{Backend, Color, Frame, Rect, Style},
prelude::{Color, Frame, Rect, Style},
widgets::*,
};
// this crate
use super::{DashBoard, EVENTS_MAX_LIMIT};
use crate::networks::ChainInfo;

pub fn draw_events_tab<B, CI>(f: &mut Frame<B>, app: &mut DashBoard<CI>, area: Rect)
where
B: Backend,
CI: ChainInfo,
{
pub fn draw_events_tab<CI: ChainInfo>(f: &mut Frame, app: &mut DashBoard<CI>, area: Rect) {
let mut text = "".to_string();
for e in &app.events.items {
text.push_str(&format!("{}\n", serde_json::to_string(e).unwrap_or("Decode Error Occurred.".to_string())));
Expand Down
8 changes: 2 additions & 6 deletions src/app/dashboard/tab_system.rs
Original file line number Diff line number Diff line change
@@ -1,18 +1,14 @@
// crates.io
use ratatui::{
prelude::{Backend, Color, Constraint, Direction, Frame, Layout, Rect, Style},
prelude::{Color, Constraint, Direction, Frame, Layout, Rect, Style},
style::Stylize,
widgets::*,
};
// this crate
use super::DashBoard;
use crate::networks::ChainInfo;

pub fn draw_system<B, CI>(f: &mut Frame<B>, app: &mut DashBoard<CI>, area: Rect)
where
B: Backend,
CI: ChainInfo,
{
pub fn draw_system<CI: ChainInfo>(f: &mut Frame, app: &mut DashBoard<CI>, area: Rect) {
let chunks = Layout::default()
.direction(Direction::Horizontal)
.constraints(vec![Constraint::Percentage(100)])
Expand Down

0 comments on commit 6537e95

Please sign in to comment.