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