From 3703a7fd88e5d98e00a637ca333aaf6b9a101837 Mon Sep 17 00:00:00 2001 From: Dan Anglin Date: Fri, 12 Jan 2024 16:00:17 +0000 Subject: [PATCH] feat(ui): display the number of cards in a status. Display the number of cards in a status column. Resolves apollo/pelican#21 --- README.asciidoc | 10 +++++----- internal/ui/column.go | 7 +++++-- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/README.asciidoc b/README.asciidoc index 97a1d6e..1a41cca 100644 --- a/README.asciidoc +++ b/README.asciidoc @@ -74,19 +74,19 @@ and initialises the database with an empty project. |Key |Action -|CTRL + q +|`CTRL + q` |Quit the application -|c +|`c` |Create a new card -|CTRL + d +|`CTRL + d` |Delete a card -|m +|`m` |Move a card from one column to another (press `Enter` to confirm your selection). -|Enter +|`Enter` |View the details of a card (press `ESC` to go back to the main board). |=== diff --git a/internal/ui/column.go b/internal/ui/column.go index e1c9454..75dcb2b 100644 --- a/internal/ui/column.go +++ b/internal/ui/column.go @@ -36,7 +36,6 @@ func newColumn(statusID int, statusName string, getBoardModeFunc func() boardMod } column.SetBorder(true) - column.SetTitle(" " + statusName + " ") return &column } @@ -88,7 +87,9 @@ func (c *column) update(kanban board.Board) error { return fmt.Errorf("unable to retrieve details about Status %d from the database; %w", c.statusID, err) } - if status.CardIds != nil && len(status.CardIds) > 0 { + numCardIDs := len(status.CardIds) + + if status.CardIds != nil && numCardIDs > 0 { cards, err := kanban.CardList(status.CardIds) if err != nil { return fmt.Errorf("unable to get the list of cards from Status %d; %w", c.statusID, err) @@ -99,6 +100,8 @@ func (c *column) update(kanban board.Board) error { } } + c.SetTitle(fmt.Sprintf(" %s (%d) ", c.statusName, numCardIDs)) + return nil }