From 082ec34008cbcc34f28699dd42d91fe364cac4da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C5=91rinc=20Serf=C5=91z=C5=91?= Date: Sun, 24 Mar 2024 14:07:18 +0100 Subject: [PATCH] Restored cramped table looks --- src/ui/habit_day_list_widget.rs | 7 +++---- src/ui/habit_frequency_table_widget.rs | 15 ++++++--------- src/ui/top_occurrence_list_widget.rs | 7 +++---- 3 files changed, 12 insertions(+), 17 deletions(-) diff --git a/src/ui/habit_day_list_widget.rs b/src/ui/habit_day_list_widget.rs index 2630e54..adb3ac4 100644 --- a/src/ui/habit_day_list_widget.rs +++ b/src/ui/habit_day_list_widget.rs @@ -185,9 +185,9 @@ impl HabitDayListWidget { let widths: Vec = (0..self.header.len() + 1) .map(|i| { if i == 0 { - Constraint::Min(12) + Constraint::Max(12) } else { - Constraint::Min(3) + Constraint::Max(3) } }) .collect(); @@ -197,8 +197,7 @@ impl HabitDayListWidget { let table = Table::new(rows, widths) .header(table_utils::get_table_header(&self.header, "Date")) .block( - Block::new() - .borders(Borders::ALL) + Block::bordered() .title(self.get_footer()) .title_position(block::Position::Bottom) .title( diff --git a/src/ui/habit_frequency_table_widget.rs b/src/ui/habit_frequency_table_widget.rs index 72d467d..1df9ad2 100644 --- a/src/ui/habit_frequency_table_widget.rs +++ b/src/ui/habit_frequency_table_widget.rs @@ -66,14 +66,11 @@ impl HabitFrequencyTableWidget { pub fn render(&self, frame: &mut Frame, area: Rect) { let inner_area = area.inner(&Margin::new(1, 1)); frame.render_widget( - Block::default() - .borders(Borders::ALL) - .title(self.title()) - .title( - Title::default() - .content("Change scale: + <←><→> Change periods: ") - .position(block::Position::Bottom), - ), + Block::bordered().title(self.title()).title( + Title::default() + .content("Change scale: + <←><→> Change periods: ") + .position(block::Position::Bottom), + ), area, ); @@ -83,7 +80,7 @@ impl HabitFrequencyTableWidget { let inner_chunks = Layout::default() .direction(Direction::Vertical) - .constraints([Constraint::Min(date_range_lines), Constraint::Min(0)]) + .constraints([Constraint::Max(date_range_lines), Constraint::Min(0)]) .split(inner_area); let date_list_text: Vec = self diff --git a/src/ui/top_occurrence_list_widget.rs b/src/ui/top_occurrence_list_widget.rs index 8574326..a3fa13c 100644 --- a/src/ui/top_occurrence_list_widget.rs +++ b/src/ui/top_occurrence_list_widget.rs @@ -39,9 +39,9 @@ impl TopOccurrenceListWidget { let widths: Vec = (0..self.header.len() + 1) .map(|i| { if i == 0 { - Constraint::Min(5) + Constraint::Max(5) } else { - Constraint::Min(3) + Constraint::Max(3) } }) .collect(); @@ -57,8 +57,7 @@ impl TopOccurrenceListWidget { } rows.push(Row::new(cells)); } - let table = Table::new(rows, widths) - .block(Block::default().borders(Borders::ALL).title(self.title())); + let table = Table::new(rows, widths).block(Block::bordered().title(self.title())); frame.render_widget(table, area); }