diff options
| author | Ben Sima <ben@bsima.me> | 2025-11-09 09:32:39 -0500 |
|---|---|---|
| committer | Ben Sima <ben@bsima.me> | 2025-11-09 09:32:39 -0500 |
| commit | 253fdc93cb3e79983de69e0875c69efa77660aac (patch) | |
| tree | 0294399d66217bb5128c9b55f493eecef238ba05 /Omni/Task/Core.hs | |
| parent | 9a1177a87b0c58168b2975705f1adf08f1a70251 (diff) | |
Show epic progress count instead of Epic label and checkbox
Changed epic display in tree view from:
t-PpXWsU [Epic] [ ] Task Manager Improvements
To:
t-PpXWsU [6/11] Task Manager Improvements
The [6/11] shows completed/total child tasks, giving immediate visual
feedback on epic progress. Regular tasks still use checkbox indicators:
[ ] open, [~] in-progress, [✓] done.
Diffstat (limited to 'Omni/Task/Core.hs')
| -rw-r--r-- | Omni/Task/Core.hs | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/Omni/Task/Core.hs b/Omni/Task/Core.hs index b322ea9..0351cf4 100644 --- a/Omni/Task/Core.hs +++ b/Omni/Task/Core.hs @@ -279,28 +279,30 @@ showTaskTree maybeId = do printTreeNode :: [Task] -> Task -> Int -> IO () printTreeNode allTasks task indent = do let prefix = T.pack (replicate (indent * 2) ' ') - -- Only show type label for epics - typeStr = case taskType task of - Epic -> "[Epic] " - WorkTask -> "" - statusStr = case taskStatus task of - Open -> "[ ]" - InProgress -> "[~]" - Done -> "[✓]" + children = filter (\t -> taskParent t == Just (taskId task)) allTasks + -- For epics, show progress count [completed/total]; for tasks, show status checkbox + statusStr = case taskType task of + Epic -> + let total = length children + completed = length <| filter (\t -> taskStatus t == Done) children + in "[" <> T.pack (show completed) <> "/" <> T.pack (show total) <> "]" + WorkTask -> case taskStatus task of + Open -> "[ ]" + InProgress -> "[~]" + Done -> "[✓]" nsStr = case taskNamespace task of Nothing -> "" Just ns -> "[" <> ns <> "] " -- Calculate available width for title (80 cols - prefix - id - labels) - usedWidth = T.length prefix + T.length (taskId task) + T.length typeStr + T.length statusStr + T.length nsStr + 2 + usedWidth = T.length prefix + T.length (taskId task) + T.length statusStr + T.length nsStr + 2 availableWidth = max 20 (80 - usedWidth) truncatedTitle = if T.length (taskTitle task) > availableWidth then T.take (availableWidth - 3) (taskTitle task) <> "..." else taskTitle task - putText <| prefix <> taskId task <> " " <> typeStr <> statusStr <> " " <> nsStr <> truncatedTitle + putText <| prefix <> taskId task <> " " <> statusStr <> " " <> nsStr <> truncatedTitle - -- Find and print children (tasks with this task as parent) - let children = filter (\t -> taskParent t == Just (taskId task)) allTasks + -- Print children traverse_ (\child -> printTreeNode allTasks child (indent + 1)) children -- Helper to print a task |
