From a92d5465e66a95395d624d9d1e9720bf6948312b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fe=CC=81lix=20Pe=CC=81ault?= Date: Tue, 12 Oct 2021 15:09:20 +0200 Subject: [PATCH] Check for when there are no photos --- src/routes/[country]/[location]/index.svelte | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/routes/[country]/[location]/index.svelte b/src/routes/[country]/[location]/index.svelte index 846adb7..c2c68ad 100644 --- a/src/routes/[country]/[location]/index.svelte +++ b/src/routes/[country]/[location]/index.svelte @@ -23,6 +23,7 @@ let currentPage: number = 1 let ended: boolean let currentPhotosAmount: number + $: latestPhoto = photos[0] $: currentPhotosAmount = photos.length $: ended = currentPhotosAmount === totalPhotos @@ -120,12 +121,14 @@ {/if} {/each}

- · -

- Updated -

+ {#if latestPhoto} + · +

+ Updated +

+ {/if}
@@ -258,8 +261,8 @@ props: { data: data.location[0], photos: data.photos, - totalPhotos: locationPhotosCount.count.id, - lastUpdated: data.photos[0].date_created, + totalPhotos: data.photos.length ? locationPhotosCount.count.id : 0, + lastUpdated: data.photos.length ? data.photos[0].date_created : undefined, } } }