diff --git a/frontend/components/DailyTabs.tsx b/frontend/components/DailyTabs.tsx index 42628eb7..462da6f7 100644 --- a/frontend/components/DailyTabs.tsx +++ b/frontend/components/DailyTabs.tsx @@ -40,6 +40,8 @@ export default function DailyTabs({ allBaseFilters, showOnly, dateList, + durationFilter, + durationLength, hideMaterialReq, hideSoldOut, materialsRequired, @@ -57,11 +59,28 @@ export default function DailyTabs({ setTab(newValue); }; + const lowestDuration = durationFilter[0]; + const highestDuration = durationFilter[1]; + const durationKeys = Object.keys(durationLength).sort(); + const getEventsList = (date: string) => { const dayEvents = dateList[date] var eventsForDay = dayEvents.filter(val => !allBaseFilters.includes(val)); + if (Number(durationKeys[0]) != lowestDuration || Number(durationKeys[durationKeys.length - 1]) != highestDuration) { + durationKeys.map(key => { + if (Number(key) < lowestDuration){ + var events = durationLength[key] + eventsForDay = eventsForDay.filter(val => !events.includes(val)); + } + if (Number(key) > highestDuration){ + var events = durationLength[key] + eventsForDay = eventsForDay.filter(val => !events.includes(val)); + } + }) + } + if (hideMaterialReq) { eventsForDay = eventsForDay.filter(val => !materialsRequired.includes(val)); } diff --git a/frontend/components/SliderComponent.tsx b/frontend/components/SliderComponent.tsx index 329f6fcc..1f810bb4 100644 --- a/frontend/components/SliderComponent.tsx +++ b/frontend/components/SliderComponent.tsx @@ -27,7 +27,7 @@ export default function SliderComponent({ const chosenRange = minValue != maxValue ? `Between ${minValue} and ${maxValue} hours.` : `Only with a duration of ${minValue} hour(s).` return ( - <> +