Skip to content

Commit

Permalink
Restored cramped table looks
Browse files Browse the repository at this point in the history
  • Loading branch information
mfep committed Mar 24, 2024
1 parent 71b5c4f commit 082ec34
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 17 deletions.
7 changes: 3 additions & 4 deletions src/ui/habit_day_list_widget.rs
Original file line number Diff line number Diff line change
Expand Up @@ -185,9 +185,9 @@ impl HabitDayListWidget {
let widths: Vec<Constraint> = (0..self.header.len() + 1)
.map(|i| {
if i == 0 {
Constraint::Min(12)
Constraint::Max(12)
} else {
Constraint::Min(3)
Constraint::Max(3)
}
})
.collect();
Expand All @@ -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(
Expand Down
15 changes: 6 additions & 9 deletions src/ui/habit_frequency_table_widget.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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: <Ctrl> + <←><→> Change periods: <a><s>")
.position(block::Position::Bottom),
),
Block::bordered().title(self.title()).title(
Title::default()
.content("Change scale: <Ctrl> + <←><→> Change periods: <a><s>")
.position(block::Position::Bottom),
),
area,
);

Expand All @@ -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<Span> = self
Expand Down
7 changes: 3 additions & 4 deletions src/ui/top_occurrence_list_widget.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ impl TopOccurrenceListWidget {
let widths: Vec<Constraint> = (0..self.header.len() + 1)
.map(|i| {
if i == 0 {
Constraint::Min(5)
Constraint::Max(5)
} else {
Constraint::Min(3)
Constraint::Max(3)
}
})
.collect();
Expand All @@ -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);
}

Expand Down

0 comments on commit 082ec34

Please sign in to comment.