My personal-knowledge-system, with deeply integrated task tracking and long term goal planning capabilities.
2
fork

Configure Feed

Select the types of activity you want to include in your feed.

feat: Group and Task inspector view styles

+81 -42
+7 -4
src/tui/app.rs
··· 37 37 /// The different regions of the application that the user can 38 38 /// be interacting with. Think of these kind of like the highest class of 39 39 /// components. 40 - #[derive( 41 - Default, Debug, Copy, Clone, PartialEq, Eq, Hash, Serialize, Deserialize, EnumIter, Display, 42 - )] 40 + #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, Serialize, Deserialize, EnumIter, Display)] 43 41 pub enum Page { 44 - #[default] 45 42 Zk, 46 43 Todo(TodoRegion), 44 + } 45 + 46 + impl Default for Page { 47 + fn default() -> Self { 48 + Self::Todo(TodoRegion::Explorer) 49 + } 47 50 } 48 51 49 52 impl App {
+24 -10
src/tui/components/todo/inspector/groupview.rs
··· 1 1 use ratatui::{ 2 2 layout::{Constraint, Layout}, 3 - widgets::{Paragraph, Widget}, 3 + style::Style, 4 + widgets::{Block, Paragraph, Widget}, 4 5 }; 6 + use ratatui_textarea::TextArea; 5 7 6 8 use crate::types::Group; 7 9 8 10 #[derive(Debug, Clone)] 9 11 pub struct GroupView<'text> { 10 - name: Paragraph<'text>, 11 - priority: Paragraph<'text>, 12 + name: TextArea<'text>, 13 + priority: TextArea<'text>, 12 14 created_at: Paragraph<'text>, 13 15 layouts: Layouts, 14 16 } ··· 23 25 fn default() -> Self { 24 26 Self { 25 27 left_content: Layout::horizontal(vec![ 26 - Constraint::Percentage(50), 28 + Constraint::Percentage(30), 27 29 Constraint::Fill(100), 28 30 ]), 29 31 name_priority_created_at: Layout::vertical(vec![ 30 - Constraint::Percentage(33), 31 - Constraint::Percentage(33), 32 - Constraint::Percentage(33), 32 + Constraint::Min(3), 33 + Constraint::Min(3), 34 + Constraint::Min(3), 35 + Constraint::Min(3), 33 36 ]), 34 37 } 35 38 } ··· 37 40 38 41 impl From<&Group> for GroupView<'_> { 39 42 fn from(value: &Group) -> Self { 43 + let mut name = TextArea::new(vec![value.name.clone()]); 44 + name.set_block(Block::bordered().title("[N]ame")); 45 + name.set_cursor_style(Style::reset()); 46 + name.set_cursor_line_style(Style::reset()); 47 + 48 + let mut priority = TextArea::new(vec![value.priority.to_string()]); 49 + priority.set_block(Block::bordered().title("[P]riority")); 50 + priority.set_cursor_style(Style::reset()); 51 + priority.set_cursor_line_style(Style::reset()); 52 + 40 53 Self { 41 - name: Paragraph::new(value.name.clone()), 42 - priority: Paragraph::new(value.priority.to_string()), 43 - created_at: Paragraph::new(value.created_at()), 54 + name, 55 + priority, 56 + created_at: Paragraph::new(value.created_at()) 57 + .block(Block::bordered().title("Created At")), 44 58 layouts: Layouts::default(), 45 59 } 46 60 }
+45 -24
src/tui/components/todo/inspector/taskview.rs
··· 1 1 use ratatui::{ 2 2 layout::{Constraint, Layout}, 3 - widgets::{Paragraph, Widget}, 3 + style::Style, 4 + widgets::{Block, Paragraph, Widget}, 4 5 }; 6 + use ratatui_textarea::TextArea; 5 7 6 8 use crate::types::Task; 7 9 8 10 #[derive(Debug, Clone)] 9 11 pub struct TaskView<'text> { 10 - name: Paragraph<'text>, 11 - priority: Paragraph<'text>, 12 - #[expect(dead_code)] 13 - created_at: Paragraph<'text>, 14 - #[expect(dead_code)] 12 + name: TextArea<'text>, 13 + priority: TextArea<'text>, 15 14 parent_group: Paragraph<'text>, 16 - 17 - due: Paragraph<'text>, 18 - 15 + due_finished_at: Paragraph<'text>, 19 16 layouts: Layouts, 20 17 } 21 18 22 19 #[derive(Debug, Clone)] 23 20 struct Layouts { 24 21 left_content: Layout, 25 - name_priority_due: Layout, 22 + name_priority_due_group: Layout, 26 23 } 27 24 28 25 impl Default for Layouts { 29 26 fn default() -> Self { 30 27 Self { 31 28 left_content: Layout::horizontal(vec![ 32 - Constraint::Percentage(50), 29 + Constraint::Percentage(30), 33 30 Constraint::Fill(100), 34 31 ]), 35 - name_priority_due: Layout::vertical(vec![ 36 - Constraint::Percentage(33), 37 - Constraint::Percentage(33), 38 - Constraint::Percentage(33), 32 + name_priority_due_group: Layout::vertical(vec![ 33 + Constraint::Min(3), 34 + Constraint::Min(3), 35 + Constraint::Min(3), 36 + Constraint::Min(3), 39 37 ]), 40 38 } 41 39 } ··· 43 41 44 42 impl From<&Task> for TaskView<'_> { 45 43 fn from(value: &Task) -> Self { 44 + let mut name = TextArea::new(vec![value.name.clone()]); 45 + name.set_block(Block::bordered().title("[N]ame")); 46 + name.set_cursor_style(Style::reset()); 47 + name.set_cursor_line_style(Style::reset()); 48 + 49 + let mut priority = TextArea::new(vec![value.priority.to_string()]); 50 + priority.set_block(Block::bordered().title("[P]riority")); 51 + priority.set_cursor_style(Style::reset()); 52 + priority.set_cursor_line_style(Style::reset()); 53 + 54 + let due_finished_at = { 55 + value.finished_at().map_or_else( 56 + || { 57 + value.due().map_or_else( 58 + || Paragraph::new("None").block(Block::bordered().title("Due")), 59 + |due| Paragraph::new(due).block(Block::bordered().title("Due")), 60 + ) 61 + }, 62 + |finished| Paragraph::new(finished).block(Block::bordered().title("Finished At")), 63 + ) 64 + }; 65 + 46 66 Self { 47 - name: Paragraph::new(value.name.clone()), 48 - priority: Paragraph::new(value.priority.to_string()), 49 - created_at: Paragraph::new(value.created_at()), 50 - parent_group: Paragraph::new(value.group.name.clone()), 51 - due: Paragraph::new(value.due().unwrap_or_else(|| "None".to_owned())), 67 + name, 68 + priority, 69 + due_finished_at, 70 + parent_group: Paragraph::new(value.group.name.clone()) 71 + .block(Block::bordered().title("Group")), 52 72 layouts: Layouts::default(), 53 73 } 54 74 } ··· 59 79 where 60 80 Self: Sized, 61 81 { 62 - let (name_rect, priority_rect, due_rect, _content_rect) = { 82 + let (name_rect, priority_rect, due_rect, group_rect, _content_rect) = { 63 83 let rects = self.layouts.left_content.split(area); 64 - let l_rects = self.layouts.name_priority_due.split(rects[0]); 84 + let l_rects = self.layouts.name_priority_due_group.split(rects[0]); 65 85 66 - (l_rects[0], l_rects[1], l_rects[2], rects[1]) 86 + (l_rects[0], l_rects[1], l_rects[2], l_rects[3], rects[1]) 67 87 }; 68 88 69 89 self.name.render(name_rect, buf); 70 90 self.priority.render(priority_rect, buf); 71 - self.due.render(due_rect, buf); 91 + self.due_finished_at.render(due_rect, buf); 92 + self.parent_group.render(group_rect, buf); 72 93 } 73 94 }
+1 -4
src/tui/components/todo/mod.rs
··· 182 182 Constraint::Percentage(40), 183 183 Constraint::Fill(100), 184 184 ]), 185 - inspector_task_list: Layout::vertical(vec![ 186 - Constraint::Percentage(30), 187 - Constraint::Fill(100), 188 - ]), 185 + inspector_task_list: Layout::vertical(vec![Constraint::Min(16), Constraint::Fill(100)]), 189 186 } 190 187 } 191 188 }
+4
src/tui/signal.rs
··· 65 65 /// Create a new `Task` 66 66 NewTask, 67 67 68 + /// Edit the name of a `Task` or a `Group`. 69 + /// Only works with the inspector 70 + EditName, 71 + 68 72 /// this is fucking temporary 69 73 Helix { 70 74 path: PathBuf,