diff --git a/Cargo.lock b/Cargo.lock index 5565e67..7c4a9cd 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -538,7 +538,7 @@ dependencies = [ [[package]] name = "rusistor" -version = "0.2.1" +version = "0.3.0" [[package]] name = "rustc-demangle" @@ -756,7 +756,7 @@ dependencies = [ [[package]] name = "tusistor" -version = "0.4.0" +version = "0.5.0" dependencies = [ "color-eyre", "crossterm", diff --git a/Cargo.toml b/Cargo.toml index ff291e4..40fd285 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,7 +8,7 @@ repository = "https://github.com/dawedawe/tusistor" [package] name = "tusistor" -version = "0.4.0" +version = "0.5.0" authors.workspace = true license.workspace = true edition.workspace = true @@ -20,5 +20,5 @@ crossterm = "0.28.1" ratatui = "0.29.0" color-eyre = "0.6.3" tui-input = "0.11.1" -rusistor = { path = "rusistor", version = "0.2.1" } +rusistor = { path = "rusistor", version = "0.3.0" } engineering-repr = "1.1.0" diff --git a/README.md b/README.md index 7fa3002..b020cf7 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,9 @@ You can go from selected color codes to specs or from specs to color codes. The resistance input supports the RKM notation, e.g. `4k7`. The input of tolerance and/or TCR are optional depending on your resistance input. -![tusistor.png](./tusistor.png) +![tusistor1.png](./tusistor1.png) + +![tusistor2.png](./tusistor2.png) [Ratatui]: https://ratatui.rs diff --git a/rusistor/Cargo.toml b/rusistor/Cargo.toml index 369a6a7..850f378 100644 --- a/rusistor/Cargo.toml +++ b/rusistor/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "rusistor" -version = "0.2.1" +version = "0.3.0" authors.workspace = true license.workspace = true edition.workspace = true diff --git a/src/app.rs b/src/app.rs index 11f9746..93348e9 100644 --- a/src/app.rs +++ b/src/app.rs @@ -114,7 +114,7 @@ pub mod view { text::{Line, Span, Text}, widgets::{ Bar, BarChart, BarGroup, Block, Borders, List, ListDirection, ListItem, ListState, - Paragraph, Tabs, + Padding, Paragraph, Tabs, }, Frame, }; @@ -372,21 +372,12 @@ pub mod view { ]) .split(chunks[1]); - let main_rects = Layout::default() - .direction(Direction::Horizontal) - .constraints([ - Constraint::Percentage(10), - Constraint::Percentage(80), - Constraint::Percentage(10), - ]) - .split(chunks[2]); - let tabs_rect = center_horizontal(chunks[0], tabs_width); let help_msg_rect = center_horizontal(chunks[3], 82); let resistance_rect = input_rects[0]; let tolerance_rect = input_rects[1]; let tcr_rect = input_rects[2]; - let main_rect = main_rects[1]; + let main_rect = chunks[2]; let tabs = tabs(&model.selected_tab); frame.render_widget(tabs, tabs_rect); @@ -522,16 +513,22 @@ pub mod view { let title = Line::from(title).centered(); BarChart::default() .data(BarGroup::default().bars(&bars)) - .block(Block::new().title(title).borders(Borders::all())) - .bar_width(21) + .block( + Block::new() + .padding(Padding::new(1, 1, 1, 1)) + .title(title) + .borders(Borders::all()), + ) + .bar_width(19) + .bar_gap(1) } fn bar((sem_info, num_info, color, name): &(String, String, Color, String)) -> Bar { Bar::default() .value(100) - .text_value(format!(" {}: {} ", sem_info, num_info.trim())) + .text_value(format!(" {} ", name)) .value_style(Style::default().fg(Color::White).bg(Color::Black)) - .label(Line::from(name.as_str())) + .label(Line::from(format!("{}: {}", sem_info, num_info.trim()))) .style(bar_style(color)) } diff --git a/tusistor.png b/tusistor1.png similarity index 100% rename from tusistor.png rename to tusistor1.png diff --git a/tusistor2.png b/tusistor2.png new file mode 100644 index 0000000..4334734 Binary files /dev/null and b/tusistor2.png differ