Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #2828 +/- ##
==========================================
+ Coverage 72.20% 72.21% +0.01%
==========================================
Files 134 134
Lines 7454 7457 +3
Branches 1528 1551 +23
==========================================
+ Hits 5382 5385 +3
+ Misses 2026 1944 -82
- Partials 46 128 +82 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
This PR adds card count indicators to tags in the CardStack component to help users understand how many cards are associated with each tag. The implementation modifies the tag mapping logic to track counts and displays them in badges alongside the existing tag selection checkmarks.
Changes:
- Modified
updateTagMapping()function to calculate and store the number of cards associated with each tag - Added a count badge display in the tag UI, positioned between the tag name and the selection checkmark
- Added comprehensive test coverage for the tag counting feature including edge cases
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| packages/vue-components/src/cardstack/CardStack.vue | Added count property to tag mappings, updated initialization logic to track tag occurrences, added count badge UI element, and adjusted CSS spacing for tag indicators |
| packages/vue-components/src/tests/snapshots/CardStack.spec.js.snap | Updated snapshot to reflect the new count badge in tag display |
| packages/vue-components/src/tests/CardStack.spec.js | Added four new test cases covering count initialization for custom tags, count increments for duplicate tags, count badge display, and badge ordering |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Can consider adding a boolean flag to set as false or true to disable the count per tag (default: show) |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated 7 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| margin: 2px; | ||
| cursor: pointer; | ||
| height: inherit; | ||
| padding: 5px; |
There was a problem hiding this comment.
The removal of margin: 2px from the .tag-badge class affects all tag badges (including the main tag badge elements and the "Select All" button), not just the count badge. This change should be reconsidered as it may cause unwanted layout changes. If spacing adjustments are needed for the count badge specifically, they should be applied only to .tag-count without removing margins from other badge elements.
| padding: 5px; | |
| padding: 5px; | |
| margin: 2px; |
| const firstTagCountBadge = tagBadges[0].find('.tag-indicator'); | ||
| expect(firstTagCountBadge.text()).toBe('2'); |
There was a problem hiding this comment.
This test selector will need to be updated once the tag-indicator class is removed from the count badge (line 37 of CardStack.vue). After that fix, this should use .find('.tag-count') instead of .find('.tag-indicator') to specifically target the count badge.
|
|
||
| // Second tag (Failure) should show count 1 | ||
| expect(tagBadges[1].text()).toContain('Failure'); | ||
| const secondTagCountBadge = tagBadges[1].findAll('.tag-indicator')[0]; |
There was a problem hiding this comment.
This test selector will need to be updated once the tag-indicator class is removed from the count badge (line 37 of CardStack.vue). After that fix, this should use .findAll('.tag-count')[0] or .find('.tag-count') instead of .findAll('.tag-indicator')[0] to specifically target the count badge.
| const secondTagCountBadge = tagBadges[1].findAll('.tag-indicator')[0]; | |
| const secondTagCountBadge = tagBadges[1].find('.tag-count'); |
| > | ||
| Short | ||
| <span | ||
| class="badge tag-count bg-light text-dark tag-indicator" |
There was a problem hiding this comment.
This snapshot will need to be updated after removing the tag-indicator class from the count badge (line 37 of CardStack.vue). The snapshot should be regenerated to reflect the corrected class structure.
| class="badge tag-count bg-light text-dark tag-indicator" | |
| class="badge tag-count bg-light text-dark" |
| disableTagCount: { | ||
| type: Boolean, | ||
| default: false, | ||
| }, |
There was a problem hiding this comment.
For consistency with the existing showSelectAll prop (line 89), consider renaming disableTagCount to showTagCount with an inverted default value (default: true). This would maintain a consistent positive naming pattern for feature toggle props. While both approaches work functionally, using positive boolean naming (show/enable) is generally preferred over negative naming (disable/hide) for better code readability.
| @click="updateTag(key[0])" | ||
| > | ||
| {{ key[0] }} | ||
| <span v-if="!disableTagCount" class="badge tag-count bg-light text-dark tag-indicator"> |
There was a problem hiding this comment.
The count badge should not have the tag-indicator class. This class applies width: 18px (defined at line 313) which is too narrow to properly display count numbers, especially double-digit counts. Remove tag-indicator from this span's classes, leaving only badge tag-count bg-light text-dark.
| <span v-if="!disableTagCount" class="badge tag-count bg-light text-dark tag-indicator"> | |
| <span v-if="!disableTagCount" class="badge tag-count bg-light text-dark"> |

What is the purpose of this pull request?
Overview of changes:
Add card counts to tag. Updated the
updateTagMapping()function inCardStack.vueto calculatethe number of cards associated with each tag and store this information in the
tagMapping.Displays the count between the tag text and the tickbox in the tags. Closes #2808
Anything you'd like to highlight/discuss:
How should I make it look prettier or is this fine?
Testing instructions:
Run
markbind serve -dto serve the docs and checkout the cardstack documentation pages.Proposed commit message: (wrap lines at 72 characters)
Add card counts to tags in CardStack component
Checklist: ☑️
Reviewer checklist:
Indicate the SEMVER impact of the PR:
At the end of the review, please label the PR with the appropriate label:
r.Major,r.Minor,r.Patch.Breaking change release note preparation (if applicable):