Files
HealthLog/src/components/data-list/index.ts
T
Marc-André Bombeck f2bd051fa7 feat(measurements): shared filter bar and multi-select bulk delete
Extract the duplicated list chrome — SortableHead and the single-row
DeleteButton — into a shared src/components/data-list/ module and add a
page-scoped multi-select with a selection action bar, used by both the
measurements and mood management lists.

Filter bar: each list keeps its primary Select (type / mood level) and
gains a source Select (measurements sends sourceEq, mood sends source)
plus an optional date range wired to the existing from/to params. Every
filter resets pagination to page 1 and is baked into the query key via
the centralised factory (queryKeys.measurementsList / moodEntriesList)
so the cache stays correct per filter combination.

Multi-select is scoped to the current page: a leading checkbox column on
desktop, a checkbox on the mobile cards, and a select-all-on-page header
checkbox. When at least one row is selected an action bar shows the count,
a clear affordance, and a destructive Delete (N) behind an AlertDialog
confirm that POSTs to the bulk-delete route, then invalidates the same
dependent-key bundle the single delete busts and clears the selection.
Selection clears on any page / filter / sort change; the selection math
lives in a pure, unit-tested helper. The locked-type insights subpage
keeps its focused single-metric view (source filter + date range
suppressed).

New strings land in a dataList namespace plus per-list source-filter and
bulk-delete keys, translated across all six locales.
2026-06-07 19:39:41 +02:00

21 lines
732 B
TypeScript

/**
* Shared chrome for the data-management lists (measurements + mood).
*
* v1.15.13 — the `SortableHead` + single-row `DeleteButton` were copy-
* pasted between `measurement-list.tsx` and `mood-list.tsx`; they now
* live here once, alongside the new page-scoped multi-select selection
* bar and its pure selection math. Each list keeps its own columns +
* formatting; only the shared chrome lives in this module.
*/
export { SortableHead } from "./sortable-head";
export { DeleteButton } from "./delete-button";
export { SelectionActionBar } from "./selection-action-bar";
export {
toggleId,
toggleSelectAll,
selectAllState,
selectedIdsOnPage,
selectedCountOnPage,
type SelectAllState,
} from "./selection";