mirror of
https://github.com/kdheepak/taskwarrior-tui.git
synced 2025-08-24 23:46:41 +02:00
feat: Refactor to using tokio instead of async-std ✨
This commit is contained in:
parent
7a1246f0bd
commit
7c6a1f77e3
11 changed files with 998 additions and 1323 deletions
37
src/ui.rs
Normal file
37
src/ui.rs
Normal file
|
@ -0,0 +1,37 @@
|
|||
use tui::{
|
||||
backend::Backend,
|
||||
layout::{Alignment, Constraint, Direction, Layout, Rect},
|
||||
style::{Color, Modifier, Style},
|
||||
symbols,
|
||||
text::{Span, Spans},
|
||||
widgets::{Block, BorderType, Borders, Cell, LineGauge, Paragraph, Row, Table},
|
||||
Frame,
|
||||
};
|
||||
|
||||
use crate::app::TaskwarriorTui;
|
||||
|
||||
pub fn draw<B>(rect: &mut Frame<B>, app: &TaskwarriorTui)
|
||||
where
|
||||
B: Backend,
|
||||
{
|
||||
let size = rect.size();
|
||||
let chunks = Layout::default()
|
||||
.direction(Direction::Vertical)
|
||||
.constraints([Constraint::Length(3), Constraint::Min(10), Constraint::Length(3)].as_ref())
|
||||
.split(size);
|
||||
|
||||
let title = draw_title();
|
||||
rect.render_widget(title, chunks[0]);
|
||||
}
|
||||
|
||||
fn draw_title<'a>() -> Paragraph<'a> {
|
||||
Paragraph::new("Taskwarrior TUI")
|
||||
.style(Style::default().fg(Color::LightCyan))
|
||||
.alignment(Alignment::Center)
|
||||
.block(
|
||||
Block::default()
|
||||
.borders(Borders::ALL)
|
||||
.style(Style::default().fg(Color::White))
|
||||
.border_type(BorderType::Plain),
|
||||
)
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue