summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Bütow <1224732+snonux@users.noreply.github.com>2025-06-20 09:56:01 +0300
committerGitHub <noreply@github.com>2025-06-20 09:56:01 +0300
commit6d87b5190d784fa73bcaeb23dfeaafa9544a719b (patch)
treef98c5f1721555b518fba14c96ecd817071a161f3
parent5d32fb6d89450fa387f9f4c51b561324075a4964 (diff)
parent19546c19b501504f7ee1aebb9cb39d6624964fb8 (diff)
Merge pull request #13 from snonux/codex/add-color-coding-to-priority-cell-and-filter-pending-tasks
Enhance task table view
-rw-r--r--internal/ui/table.go20
1 files changed, 18 insertions, 2 deletions
diff --git a/internal/ui/table.go b/internal/ui/table.go
index bd61525..a14b392 100644
--- a/internal/ui/table.go
+++ b/internal/ui/table.go
@@ -74,7 +74,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
}
@@ -190,7 +191,7 @@ func taskToRow(t task.Task) atable.Row {
t.Description,
active,
age,
- t.Priority,
+ formatPriority(t.Priority),
tags,
t.Recur,
formatDue(t.Due),
@@ -216,3 +217,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)
+}