From 0e17f4f2ed6d611c410279e2452e5bc0b97b9e8c Mon Sep 17 00:00:00 2001 From: Dheepak Krishnamurthy Date: Fri, 23 Oct 2020 00:02:21 -0600 Subject: [PATCH] Add tab like bar at the top --- src/app.rs | 48 +++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 45 insertions(+), 3 deletions(-) diff --git a/src/app.rs b/src/app.rs index 5941fc4..a2ea3d0 100644 --- a/src/app.rs +++ b/src/app.rs @@ -440,7 +440,21 @@ impl TTApp { .split(f.size()); let today = Local::today(); let c = Calendar::default() - .block(Block::default().title("Calendar").borders(Borders::ALL)) + .block(Block::default() + .title(Spans::from(vec![ + Span::styled( + "Task", + Style::default().add_modifier(Modifier::DIM), + ), + Span::from("|"), + Span::styled( + "Calendar", + Style::default().add_modifier(Modifier::BOLD), + ), + ]), + ) + .borders(Borders::ALL) + ) .year(self.calendar_year) .date_style(dates_with_styles) .months_per_row(self.config.uda_calendar_months_per_row); @@ -790,7 +804,20 @@ impl TTApp { fn draw_task_report(&mut self, f: &mut Frame, rect: Rect) { let (tasks, headers) = self.task_report(); if tasks.is_empty() { - f.render_widget(Block::default().borders(Borders::ALL).title("Task next"), rect); + f.render_widget(Block::default() + .borders(Borders::ALL) + .title(Spans::from(vec![ + Span::styled( + "task next", + Style::default().add_modifier(Modifier::BOLD), + ), + Span::from("|"), + Span::styled( + "Calendar", + Style::default().add_modifier(Modifier::DIM), + ), + ]), + ), rect); return; } @@ -865,7 +892,22 @@ impl TTApp { .collect(); let t = Table::new(header, rows.into_iter()) - .block(Block::default().borders(Borders::ALL).title("Task next")) + .block( + Block::default() + .borders(Borders::ALL) + .title(Spans::from(vec![ + Span::styled( + "Task", + Style::default().add_modifier(Modifier::BOLD), + ), + Span::from("|"), + Span::styled( + "Calendar", + Style::default().add_modifier(Modifier::DIM), + ), + ]), + ) + ) .highlight_style(highlight_style) .highlight_symbol(&self.config.uda_selection_indicator) .widths(&constraints);