Skip to content

Commit

Permalink
upgrade ratatui (#59)
Browse files Browse the repository at this point in the history
  • Loading branch information
demoray authored Jun 24, 2024
1 parent de8cc4b commit 0eabb16
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 38 deletions.
32 changes: 16 additions & 16 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,8 @@ anyhow = "1.0"
base64 = "0.22"
clap = { version = "4.5", features = ["derive"] }
clap_complete = "4.5"
crossterm = "0.27"
itertools = "0.13"
ratatui = { version = "0.26", features = ["crossterm"] }
ratatui = { version = "0.27", features = ["crossterm"] }
rayon = "1.10"
reqwest = { version = "0.12", features = ["blocking", "json"] }
retry = "2.0"
Expand Down
35 changes: 15 additions & 20 deletions src/interactive.rs
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
use crate::roles::{Assignment, Assignments};
use anyhow::Result;
use crossterm::{
event::{
self, Event,
KeyCode::{BackTab, Backspace, Char, Down, Enter, Esc, Tab, Up},
KeyEventKind,
},
execute,
terminal::{disable_raw_mode, enable_raw_mode, EnterAlternateScreen, LeaveAlternateScreen},
};
use ratatui::{
crossterm::{
event::{
self, Event,
KeyCode::{BackTab, Backspace, Char, Down, Enter, Esc, Tab, Up},
KeyEventKind,
},
execute,
terminal::{disable_raw_mode, enable_raw_mode, EnterAlternateScreen, LeaveAlternateScreen},
},
prelude::*,
widgets::{
Block, BorderType, Cell, HighlightSpacing, Paragraph, Row, ScrollbarState, Table,
TableState,
Block, BorderType, HighlightSpacing, Paragraph, Row, ScrollbarState, Table, TableState,
},
};
use std::io::stdout;
Expand Down Expand Up @@ -212,15 +211,12 @@ impl App {
Table::new(
self.items.iter().map(|data| {
Row::new(vec![
Cell::from(Text::from(format!(
format!(
"{} {}",
if data.enabled { ENABLED } else { DISABLED },
data.value.role
))),
Cell::from(Text::from(format!(
"{}\n{}",
data.value.scope_name, data.value.scope
))),
),
format!("{}\n{}", data.value.scope_name, data.value.scope),
])
.height(ITEM_HEIGHT)
}),
Expand All @@ -232,7 +228,6 @@ impl App {
.header(
["Role", "Scope"]
.into_iter()
.map(Cell::from)
.collect::<Row>()
.style(Style::default().add_modifier(Modifier::BOLD | Modifier::UNDERLINED))
.height(1),
Expand All @@ -251,14 +246,14 @@ impl App {

fn render_footer(&self, f: &mut Frame, area: Rect) {
f.render_widget(
Paragraph::new(Text::from(format!(
Paragraph::new(format!(
"{}\n{ALL_HELP}",
match self.input_state {
InputState::Duration => DURATION_TEXT,
InputState::Justification => JUSTIFICATION_TEXT,
InputState::Scopes => SCOPE_TEXT,
}
)))
))
.style(Style::new())
.centered()
.block(
Expand Down

0 comments on commit 0eabb16

Please sign in to comment.