feat: Show how many cards a list holds

A board level switch, off by default. With it on, each list puts its card
count on the add-card button. Useful to a board that is being kept to a size
and noise to one that is not, which is why it is a choice rather than always
on.

The count is every card in the list, not the ones a filter leaves visible.
Those answer different questions: how full is this list, versus how many match
what I am looking at right now. The first is the one a counter is for, and it
is also what the same switch counts in Pro, so a board keeps its meaning
across an upgrade.

The column matches Pro's name, type and default, so the setting survives that
upgrade rather than being dropped on the way.
This commit is contained in:
Daniel Hiller
2026-09-17 03:51:40 +02:00
parent ca035d670e
commit b581a97c2c
11 changed files with 123 additions and 0 deletions
+23
View File
@@ -65,6 +65,27 @@ export const makeSelectFilteredCardIdsByListId = () =>
export const selectFilteredCardIdsByListId = makeSelectFilteredCardIdsByListId();
// How many cards the list holds.
//
// Unfiltered on purpose: a filter hides cards, it does not remove them, and a
// count that fell as the filter narrowed would say the list had emptied.
export const makeSelectCardCountByListId = () =>
createSelector(
orm,
(_, id) => id,
({ List }, id) => {
const listModel = List.withId(id);
if (!listModel) {
return null;
}
return listModel.getCardsModelArray().length;
},
);
export const selectCardCountByListId = makeSelectCardCountByListId();
export const selectIsListWithIdAvailableForCurrentUser = createSelector(
orm,
(_, id) => id,
@@ -171,6 +192,8 @@ export default {
selectCardIdsByListId,
makeSelectFilteredCardIdsByListId,
selectFilteredCardIdsByListId,
makeSelectCardCountByListId,
selectCardCountByListId,
selectIsListWithIdAvailableForCurrentUser,
selectCurrentListId,
selectCurrentList,