fix: eslint errors

This commit is contained in:
2023-02-10 17:28:54 +01:00
parent 6624bfefb0
commit 0c829c88c5
86 changed files with 171 additions and 169 deletions

View File

@@ -70,10 +70,10 @@ export const load = (async ({ params, setHeaders }) => {
}
}`)
const { data: { location: location, photos, total_published, product }} = res
const { data: { location: location, photos, total_published, product } } = res
if (!location.length || location.length && params.country !== location[0].country.slug) {
throw error(404, "This location is not available… yet!")
throw error(404, 'This location is not available… yet!')
}
setHeaders({ 'Cache-Control': 'public, max-age=1, stale-while-revalidate=604799' })

View File

@@ -91,7 +91,7 @@
}
}`,
})
const { data: { photos }} = await res.json()
const { data: { photos } } = await res.json()
if (photos) {
// Return new photos
@@ -219,7 +219,6 @@
/>
<PageTransition>
<main class="location-page">
<section class="location-page__intro grid" bind:this={introEl}>
@@ -241,7 +240,7 @@
<div class="info">
<p class="text-label">
Photos by
{#each location.credits as { credit_id: { name, website }}}
{#each location.credits as { credit_id: { name, website } }}
{#if website}
<a href={website} target="_blank" rel="noopener external">
{name}
@@ -302,7 +301,7 @@
location={location.name}
ratio={width / height}
date={date_taken}
index={(totalPhotos - index < 10) ? '0' : ''}{totalPhotos - index}
index="{(totalPhotos - index < 10) ? '0' : ''}{totalPhotos - index}"
/>
{/each}
</section>
@@ -312,7 +311,7 @@
ended={ended}
current={currentPhotosAmount}
total={totalPhotos}
on:click={!ended && loadMorePhotos}
on:click={() => !ended && loadMorePhotos()}
>
{#if !ended}
<p class="more">See more photos</p>
@@ -365,4 +364,4 @@
</div>
{/if}
</main>
</PageTransition>
</PageTransition>

View File

@@ -93,10 +93,10 @@
const handleKeydown = ({ key, defaultPrevented }: KeyboardEvent) => {
if (defaultPrevented) return
switch (key) {
case 'ArrowLeft': goToPrevious(); break;
case 'ArrowRight': goToNext(); break;
case 'Escape': closeViewer(); break;
default: return;
case 'ArrowLeft': goToPrevious(); break
case 'ArrowRight': goToNext(); break
case 'Escape': closeViewer(); break
default: return
}
}
@@ -105,15 +105,15 @@
// Swipe up and down on mobile/small screens
if (innerWidth < 992) {
switch (detail) {
case '-y': goToNext(); break;
case 'y': goToPrevious(); break;
case '-y': goToNext(); break
case 'y': goToPrevious(); break
}
}
// Swipe left and right on larger screens
else {
switch (detail) {
case '-x': goToNext(); break;
case 'x': goToPrevious(); break;
case '-x': goToNext(); break
case 'x': goToPrevious(); break
}
}
}
@@ -174,7 +174,7 @@
}
}`,
})
const { data: { photos: newPhotos }} = await res.json()
const { data: { photos: newPhotos } } = await res.json()
// Not loading anymore
isLoading = false
@@ -320,7 +320,11 @@
</ButtonCircle>
<div class="photo-page__carousel">
<div class="photo-page__images" use:swipe on:swipe={handleSwipe} on:tap={toggleFullscreen}>
<div class="photo-page__images"
use:swipe
on:swipe={handleSwipe}
on:tap={toggleFullscreen}
>
{#each visiblePhotos as { id, image, title }, index (id)}
<div class="photo-page__picture is-{currentIndex === 0 ? index + 1 : index}">
<Image
@@ -377,7 +381,8 @@
</div>
{#if isFullscreen}
<div class="photo-page__fullscreen" bind:this={fullscreenEl} on:click={toggleFullscreen}
<div class="photo-page__fullscreen" bind:this={fullscreenEl}
on:click={toggleFullscreen} on:keydown
in:fade={{ easing: quartOut, duration: 1000 }}
out:fade={{ easing: quartOut, duration: 1000, delay: 300 }}
>
@@ -398,4 +403,4 @@
</div>
{/if}
</main>
</PageTransition>
</PageTransition>

View File

@@ -70,7 +70,7 @@ export const load = (async ({ setHeaders }) => {
seo_image { id }
}
}`)
const { data: { about, photos: photosIds }} = res
const { data: { about, photos: photosIds } } = res
// Get random photos
const randomPhotosIds = [...getRandomItems(photosIds, 42)].map(({ id }) => id)
@@ -89,7 +89,7 @@ export const load = (async ({ setHeaders }) => {
}`)
if (photosRes) {
const { data: { photo: photos }} = photosRes
const { data: { photo: photos } } = photosRes
setHeaders({ 'Cache-Control': 'public, max-age=1, stale-while-revalidate=604799' })

View File

@@ -3,7 +3,7 @@
</style>
<script lang="ts">
import { navigating, page } from '$app/stores'
import { navigating } from '$app/stores'
import { onMount, afterUpdate } from 'svelte'
import { quartOut as quartOutSvelte } from 'svelte/easing'
import { fade, fly } from 'svelte/transition'
@@ -12,6 +12,7 @@
import { mailtoClipboard, map } from '$utils/functions'
import { getAssetUrlKey } from '$utils/api'
import { DELAY } from '$utils/constants'
import { sendEvent } from '$utils/analytics'
import { quartOut } from '$animations/easings'
// Components
import Metas from '$components/Metas.svelte'
@@ -21,7 +22,6 @@
import AboutGridPhoto from '$components/atoms/AboutGridPhoto.svelte'
import ProcessStep from '$components/molecules/ProcessStep.svelte'
import Banner from '$components/organisms/Banner.svelte'
import { sendEvent } from '$utils/analytics';
export let data: PageData
const { about, photos } = data
@@ -223,7 +223,7 @@
{about.intro_firstphoto_caption}<br>
in
<a href="/{about.intro_firstlocation.country.slug}/{about.intro_firstlocation.slug}" data-sveltekit-noscroll>
<img src="{getAssetUrlKey(about.intro_firstlocation.country.flag.id, 'square-small-jpg')}" width="32" height="32" alt="{about.intro_firstlocation.country.flag.title}">
<img src={getAssetUrlKey(about.intro_firstlocation.country.flag.id, 'square-small-jpg')} width="32" height="32" alt={about.intro_firstlocation.country.flag.title}>
<span>Naarm Australia (Melbourne)</span>
</a>
</figcaption>
@@ -399,4 +399,4 @@
</div>
</section>
</main>
</PageTransition>
</PageTransition>

View File

@@ -146,4 +146,4 @@
<InteractiveGlobe type="cropped" />
</main>
</PageTransition>
</PageTransition>

View File

@@ -47,7 +47,7 @@ export const GET = (async ({ url, setHeaders }) => {
slug: siteProduct.location.slug,
description: siteProduct.description,
price: product.price,
images: siteProduct.photos_product.map(({ directus_files_id: { id }}: any) => getAssetUrlKey(id, `product-large-jpg`)),
images: siteProduct.photos_product.map(({ directus_files_id: { id } }: any) => getAssetUrlKey(id, `product-large-jpg`)),
gCategory: category.value,
gType: category.type,
})
@@ -93,4 +93,4 @@ const render = (origin: string, products: any[]) => {
`).join('')}
</channel>
</rss>`
}
}

View File

@@ -14,7 +14,7 @@
import Heading from '$components/molecules/Heading.svelte'
const { locations }: any = getContext('global')
const text = "Explore the globe to discover unique locations across the world"
const text = 'Explore the globe to discover unique locations across the world'
</script>
<Metas
@@ -39,4 +39,4 @@
</div>
</section>
</main>
</PageTransition>
</PageTransition>

View File

@@ -193,7 +193,7 @@
}`,
})
const { data: { photos }} = await res.json()
const { data: { photos } } = await res.json()
if (photos) {
// Return new photos
@@ -496,4 +496,4 @@
</div>
</section>
</main>
</PageTransition>
</PageTransition>

View File

@@ -96,4 +96,4 @@
<InteractiveGlobe type="cropped" />
</main>
</PageTransition>
</PageTransition>

View File

@@ -46,4 +46,4 @@
</div>
</section>
</main>
</PageTransition>
</PageTransition>