diff options
| author | Paul Bütow <1224732+snonux@users.noreply.github.com> | 2025-06-20 09:55:43 +0300 |
|---|---|---|
| committer | Paul Bütow <1224732+snonux@users.noreply.github.com> | 2025-06-20 09:55:43 +0300 |
| commit | 19546c19b501504f7ee1aebb9cb39d6624964fb8 (patch) | |
| tree | ad41c43f0030b44ca53373b48f4780543071790c /internal | |
| parent | 4c4e186b14b91163beb8316aff6eeda86f9dc171 (diff) | |
Add priority colorization and filter pending tasks
Diffstat (limited to 'internal')
| -rw-r--r-- | internal/ui/table.go | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/internal/ui/table.go b/internal/ui/table.go index 4293500..7ca487e 100644 --- a/internal/ui/table.go +++ b/internal/ui/table.go @@ -64,7 +64,8 @@ func newTable(rows []atable.Row) atable.Model { } func (m *Model) reload() error { - tasks, err := task.Export(strings.Fields(m.filter)...) + filters := append(strings.Fields(m.filter), "status:pending") + tasks, err := task.Export(filters...) if err != nil { return err } @@ -177,7 +178,7 @@ func taskToRow(t task.Task) atable.Row { t.Description, active, age, - t.Priority, + formatPriority(t.Priority), tags, t.Recur, formatDue(t.Due), @@ -203,3 +204,18 @@ func formatDue(s string) string { } return style.Render(val) } + +func formatPriority(p string) string { + style := lipgloss.NewStyle() + switch p { + case "L": + style = style.Foreground(lipgloss.Color("10")) + case "M": + style = style.Foreground(lipgloss.Color("12")) + case "H": + style = style.Foreground(lipgloss.Color("9")) + default: + return p + } + return style.Render(p) +} |
