From b058963b79fda39ab3f44840985b7b4a861488ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fe=CC=81lix=20Pe=CC=81ault?= Date: Sat, 30 Jul 2022 10:28:51 +0200 Subject: [PATCH] Add Shop module at end of Location page With linked poster if existing, otherwise with all products --- src/components/organisms/ShopModule.svelte | 2 +- src/routes/[country]/[location]/index.svelte | 56 +++++++++++++------- src/routes/[country]/[location]/index.ts | 14 ++++- src/style/layout/_modules.scss | 4 +- src/style/molecules/_pagination.scss | 2 +- src/style/pages/_location.scss | 28 +++++----- 6 files changed, 70 insertions(+), 36 deletions(-) diff --git a/src/components/organisms/ShopModule.svelte b/src/components/organisms/ShopModule.svelte index abf39f1..0b7fe6c 100644 --- a/src/components/organisms/ShopModule.svelte +++ b/src/components/organisms/ShopModule.svelte @@ -25,7 +25,7 @@ export let url: string = '/shop' export let enabled: boolean = true - if (textBottom !== null && textBottom !== undefined) { + if (textBottom !== null) { textBottom = `Posters available for ${locationsWithPoster.join(', ').replace(/,(?!.*,)/gmi, ' and')}.` } diff --git a/src/routes/[country]/[location]/index.svelte b/src/routes/[country]/[location]/index.svelte index 554d28f..1956741 100644 --- a/src/routes/[country]/[location]/index.svelte +++ b/src/routes/[country]/[location]/index.svelte @@ -20,10 +20,14 @@ import House from '$components/molecules/House.svelte' import Pagination from '$components/molecules/Pagination.svelte' import NewsletterModule from '$components/organisms/NewsletterModule.svelte' + import ShopModule from '$components/organisms/ShopModule.svelte' export let location: any export let photos: any[] export let totalPhotos: number + export let product: any + + console.log(product) dayjs.extend(relativeTime) @@ -285,25 +289,41 @@ {/each} -
-
- - {#if !ended} -

See more photos

- {:else} -

You've seen it all!

- {/if} -
- - {#if ended} - +
+ + {#if !ended} +

See more photos

+ {:else} +

You've seen it all!

{/if} -
+ + + {#if ended} +
+
+
+ {#if location.has_poster} + + {:else} + + {/if} + +
+
+
+ {/if}
{:else}
diff --git a/src/routes/[country]/[location]/index.ts b/src/routes/[country]/[location]/index.ts index e18caae..22ad7b6 100644 --- a/src/routes/[country]/[location]/index.ts +++ b/src/routes/[country]/[location]/index.ts @@ -63,9 +63,18 @@ export async function GET ({ params }: RequestEvent): Promise