Skip to content

Commit

Permalink
Handle missing opening hours data
Browse files Browse the repository at this point in the history
  • Loading branch information
Siilwyn committed Oct 25, 2023
1 parent 8dc16ad commit b03238c
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
4 changes: 3 additions & 1 deletion src/components/AppNavigation/AppNavigation.vue
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,9 @@
{{ $t("filter") }}

<div class="app-menu__filter-indicator">
{{ spacesStore.numberOfSelectedFilters }}
<ClientOnly fallback="...">
{{ spacesStore.numberOfSelectedFilters }}
</ClientOnly>

<span class="a11y-sr-only">
{{ $t("filtersSelected") }}
Expand Down
13 changes: 8 additions & 5 deletions src/components/BuildingHeader/BuildingHeader.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,14 @@
:opening-hours="building.openingHours"
class="building-header__open-status"
/>
<OpeningHours
:opening-hours-building="building.openingHours"
:opening-hours-space="building.openingHours"
class="building-header__opening-hours"
/>
<ClientOnly>
<OpeningHours
v-if="building.openingHours"
:opening-hours-building="building.openingHours"
:opening-hours-space="building.openingHours"
class="building-header__opening-hours"
/>
</ClientOnly>
</div>
</div>
</template>
Expand Down
3 changes: 2 additions & 1 deletion src/lib/filter-spaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ function filterSpace(

return activeFilterKeys.every((activeFilterKey) => {
if (activeFilterKey == "showOpenLocations")
return spaceIsOpen(now, space.building.openingHours);
return space.building.openingHours
&& spaceIsOpen(now, space.building.openingHours);
if (activeFilterKey == "buildings")
return filters.buildings.includes(space.buildingNumber);
if (activeFilterKey == "quietness")
Expand Down

0 comments on commit b03238c

Please sign in to comment.