From 8d4f75f158c4c61c2d7ecd81d8d1eb3b9002b9f0 Mon Sep 17 00:00:00 2001 From: Padreug Date: Tue, 16 Jun 2026 01:06:47 +0200 Subject: [PATCH] refactor(events): remove dead specific-date filter logic MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit With the DatePickerStrip gone, selectedDate/selectDate in useEventFilters were unreachable — nothing set a specific date anymore (the calendar page only navigates to event detail). Delete the orphaned DatePickerStrip component and strip the now-dead date-filter branch, state, and actions. The feed filters purely by temporal pills + past/upcoming + categories. Co-Authored-By: Claude Opus 4.8 (1M context) --- .../events/components/DatePickerStrip.vue | 73 ------------------- .../events/composables/useEventFilters.ts | 55 ++++---------- 2 files changed, 15 insertions(+), 113 deletions(-) delete mode 100644 src/modules/events/components/DatePickerStrip.vue diff --git a/src/modules/events/components/DatePickerStrip.vue b/src/modules/events/components/DatePickerStrip.vue deleted file mode 100644 index f605373..0000000 --- a/src/modules/events/components/DatePickerStrip.vue +++ /dev/null @@ -1,73 +0,0 @@ - - - diff --git a/src/modules/events/composables/useEventFilters.ts b/src/modules/events/composables/useEventFilters.ts index 71ce1ff..8742cd1 100644 --- a/src/modules/events/composables/useEventFilters.ts +++ b/src/modules/events/composables/useEventFilters.ts @@ -1,7 +1,7 @@ import { ref, computed } from 'vue' import { startOfDay, endOfDay, startOfWeek, endOfWeek, - startOfMonth, endOfMonth, addDays, isSameDay, + startOfMonth, endOfMonth, addDays, } from 'date-fns' import type { Event } from '../types/event' import type { EventCategory } from '../types/category' @@ -15,7 +15,6 @@ import { DEFAULT_FILTERS } from '../types/filters' // tapping Hosting toggled a private ref the page never saw. const temporal = ref(DEFAULT_FILTERS.temporal) const selectedCategories = ref([]) -const selectedDate = ref(undefined) const onlyOwnedTickets = ref(false) const onlyHosting = ref(false) const showPast = ref(false) @@ -36,30 +35,20 @@ export function useEventFilters() { function applyFilters(events: Event[]): Event[] { let result = events - // Specific date filter (from DatePickerStrip) takes priority over - // temporal. Picking a date also bypasses the past/upcoming split - // so the user can browse events for any day they choose. - if (selectedDate.value) { - const dayStart = startOfDay(selectedDate.value) - const dayEnd = endOfDay(selectedDate.value) - result = result.filter(a => { - const eventEnd = a.endDate ?? a.startDate - return a.startDate <= dayEnd && eventEnd >= dayStart - }) - } else { - // Temporal filter - result = applyTemporalFilter(result, temporal.value) - // 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 eventEnd = a.endDate ?? a.startDate - return showPast.value ? eventEnd < now : eventEnd >= now - }) - } + // Temporal filter (preset pills). Specific-date browsing now lives on + // the calendar page, so the feed only narrows by these windows. + result = applyTemporalFilter(result, temporal.value) + + // 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 eventEnd = a.endDate ?? a.startDate + return showPast.value ? eventEnd < now : eventEnd >= now + }) // Category filter if (selectedCategories.value.length > 0) { @@ -80,16 +69,6 @@ export function useEventFilters() { function setTemporal(value: TemporalFilter) { temporal.value = value - selectedDate.value = undefined // clear date pick when using temporal pills - } - - function selectDate(date: Date) { - if (selectedDate.value && isSameDay(selectedDate.value, date)) { - selectedDate.value = undefined // toggle off - } else { - selectedDate.value = date - temporal.value = 'all' // clear temporal pill when picking a specific date - } } function toggleCategory(category: EventCategory) { @@ -108,7 +87,6 @@ export function useEventFilters() { function resetFilters() { temporal.value = DEFAULT_FILTERS.temporal selectedCategories.value = [] - selectedDate.value = undefined onlyOwnedTickets.value = false onlyHosting.value = false showPast.value = false @@ -129,7 +107,6 @@ export function useEventFilters() { const hasActiveFilters = computed(() => temporal.value !== 'all' || selectedCategories.value.length > 0 || - selectedDate.value !== undefined || onlyOwnedTickets.value || onlyHosting.value || showPast.value @@ -139,7 +116,6 @@ export function useEventFilters() { // State temporal, selectedCategories, - selectedDate, onlyOwnedTickets, onlyHosting, showPast, @@ -149,7 +125,6 @@ export function useEventFilters() { // Actions applyFilters, setTemporal, - selectDate, toggleCategory, clearCategories, toggleOwnedTickets,