Check for when there are no photos

This commit is contained in:
2021-10-12 15:09:20 +02:00
parent ee851f2cfa
commit a92d5465e6

View File

@@ -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}
</p>
&middot;
<p class="text-label" title={dayjs(photos[0].date_created).format('DD/MM/YYYY, hh:mm')}>
Updated <time datetime={dayjs(photos[0].date_created).format('YYYY-MM-DD')}>
{dayjs().to(dayjs(photos[0].date_created))}
</time>
</p>
{#if latestPhoto}
&middot;
<p class="text-label" title={dayjs(latestPhoto.date_created).format('DD/MM/YYYY, hh:mm')}>
Updated <time datetime={dayjs(latestPhoto.date_created).format('YYYY-MM-DD')}>
{dayjs().to(dayjs(latestPhoto.date_created))}
</time>
</p>
{/if}
</div>
<div class="ctas">
@@ -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,
}
}
}