Show dynamic locations with a poster on Shop module

This commit is contained in:
2021-10-09 16:49:24 +02:00
parent 5cbd0d25f8
commit 5e790ad68c
2 changed files with 11 additions and 1 deletions

View File

@@ -1,6 +1,13 @@
<script lang="ts"> <script lang="ts">
import { getContext } from 'svelte'
// Components // Components
import Button from '$components/atoms/Button.svelte' import Button from '$components/atoms/Button.svelte'
const { location } = getContext('global')
const locationsWithPoster = location
.filter((loc: any) => loc.has_poster)
.map((loc: any) => loc.name)
</script> </script>
<div class="shop shadow-box-dark"> <div class="shop shadow-box-dark">
@@ -16,7 +23,9 @@
text="Shop" text="Shop"
url="/shop" url="/shop"
/> />
<p class="detail">Posters available for Melbourne, Brisbane, Montpellier and Bordeaux.</p> <p class="detail">
Posters available for {locationsWithPoster.join(', ').replace(/,(?!.*,)/gmi, ' and')}.
</p>
</div> </div>
</div> </div>
</div> </div>

View File

@@ -46,6 +46,7 @@
title title
} }
} }
has_poster
} }
country (filter: { status: { _eq: "published" }}) { country (filter: { status: { _eq: "published" }}) {