aboutsummaryrefslogtreecommitdiffstats
path: root/src/ui.rs
diff options
context:
space:
mode:
authorsam-anthony <samanthony6@protonmail.com>2022-03-26 13:35:58 -0230
committersam-anthony <samanthony6@protonmail.com>2022-03-26 13:35:58 -0230
commite8c878f4236c056b1c0c9308e2d49c5b23833963 (patch)
tree01f53ee620e256fa7b87ea43656b9315735e9c2a /src/ui.rs
parent90f42ad66feb6b77474d0da267d572eca16e2826 (diff)
downloadvolute-e8c878f4236c056b1c0c9308e2d49c5b23833963.zip
pressure and rough layout
Diffstat (limited to 'src/ui.rs')
-rw-r--r--src/ui.rs43
1 files changed, 0 insertions, 43 deletions
diff --git a/src/ui.rs b/src/ui.rs
deleted file mode 100644
index 65b1ad0..0000000
--- a/src/ui.rs
+++ /dev/null
@@ -1,43 +0,0 @@
-use crate::{app::App, input::InputParam, unit_of_measurement::UnitOfMeasurement};
-use std::ptr;
-use tui::{
- layout::Constraint,
- style::{Color, Style},
- widgets::{self, Block, Borders, Cell, Paragraph, Table, Widget},
-};
-
-pub fn input_table(app: &App) -> impl Widget {
- let rows = app.rows().iter().map(|row| {
- let cells = row.iter().map(|item| {
- let item_str = match item {
- InputParam::Rpm(rpm) => rpm.to_string(),
- InputParam::Ve(ve) => ve.to_string(),
- InputParam::Map(p) => p.as_unit(app.pressure_unit).to_string(),
- };
- if ptr::eq(item, app.selected_input_param()) {
- Cell::from(item_str).style(Style::default().fg(Color::Yellow))
- } else {
- Cell::from(item_str)
- }
- });
- widgets::Row::new(cells)
- });
-
- Table::new(rows)
- .header(widgets::Row::new(vec!["rpm", "ve", "map"]))
- .block(Block::default().borders(Borders::ALL).title("inputs"))
- .widths(&[
- Constraint::Length(5), // rpm
- Constraint::Length(3), // ve
- Constraint::Length(3), // map
- ])
-}
-
-pub fn output_table(app: &App) -> impl Widget {
- if let InputParam::Map(p) = &app.rows()[0].map {
- Paragraph::new(p.as_unit(app.pressure_unit).to_string())
- .block(Block::default().title("map").borders(Borders::ALL))
- } else {
- Paragraph::new("err").block(Block::default().title("map").borders(Borders::ALL))
- }
-}