fix(activities): "Past events" chip narrows to past-only, not include-past

The chip should mirror the "My tickets" / "Hosting" mental model
(narrow to *only* X), not "additionally include X". Toggling ON with
"This Week" / "This Month" / "Tomorrow" was leaking upcoming events
through — confusing because the other role chips don't behave that
way.

Flip the past-events filter from a hide-when-off guard to a
side-of-now split: showPast=false → upcoming-only (default),
showPast=true → past-only. The DatePickerStrip override stays outside
this branch so date-pick still bypasses the split.
This commit is contained in:
Padreug 2026-05-25 11:46:19 +02:00
commit aa2e573f0e

View file

@ -50,8 +50,8 @@ export function useActivityFilters() {
let result = activities let result = activities
// Specific date filter (from DatePickerStrip) takes priority over // Specific date filter (from DatePickerStrip) takes priority over
// temporal. Picking a date also bypasses the past-events hide so // temporal. Picking a date also bypasses the past/upcoming split
// the user can browse activities for any day they choose. // so the user can browse activities for any day they choose.
if (selectedDate.value) { if (selectedDate.value) {
const dayStart = startOfDay(selectedDate.value) const dayStart = startOfDay(selectedDate.value)
const dayEnd = endOfDay(selectedDate.value) const dayEnd = endOfDay(selectedDate.value)
@ -62,15 +62,16 @@ export function useActivityFilters() {
} else { } else {
// Temporal filter // Temporal filter
result = applyTemporalFilter(result, temporal.value) result = applyTemporalFilter(result, temporal.value)
// Past-events hide (default ON). Composes with temporal pills: // Past/upcoming split — the chip narrows to one side of "now",
// e.g. "This Week" + showPast=false drops days already passed. // mirroring the "My tickets" / "Hosting" mental model. Default
if (!showPast.value) { // (showPast=false) is upcoming-only; toggling on flips to
const now = new Date() // past-only. Composes with temporal pills: "This Week" +
result = result.filter(a => { // showPast=true shows only the days already passed this week.
const activityEnd = a.endDate ?? a.startDate const now = new Date()
return activityEnd >= now result = result.filter(a => {
}) const activityEnd = a.endDate ?? a.startDate
} return showPast.value ? activityEnd < now : activityEnd >= now
})
} }
// Category filter // Category filter