diff --git a/src/components/molecules/Location.svelte b/src/components/molecules/Location.svelte index e2d37f6..31179a5 100644 --- a/src/components/molecules/Location.svelte +++ b/src/components/molecules/Location.svelte @@ -8,22 +8,31 @@ import Badge from '$components/atoms/Badge.svelte' export let location: any + export let latestPhoto: any const { settings: { limit_new }}: any = getContext('global') - // Location date limit - const dateNowOffset = dayjs().subtract(limit_new, 'day') - const dateLocationUpdated = dayjs(location.date_updated) - const isNew = dateLocationUpdated.isAfter(dateNowOffset) - let locationEl: HTMLElement let photoIndex = 0 + + // Location date limit + let isNew = false + let dateUpdated: dayjs.Dayjs + const dateNowOffset = dayjs().subtract(limit_new, 'day') + + $: if (latestPhoto) { + dateUpdated = dayjs(latestPhoto.date_created) + isNew = dateUpdated.isAfter(dateNowOffset) + } + + + /** + * Moving cursor over + */ const offset = spring({ x: 0, y: 0 }, { stiffness: 0.075, damping: 0.9 }) - - // Moving cursor over const handleMouseMove = ({ clientX }: MouseEvent) => { const { width, left } = locationEl.getBoundingClientRect() const moveProgress = (clientX - left) / width // 0 to 1 diff --git a/src/components/organisms/Locations.svelte b/src/components/organisms/Locations.svelte index 9f15ced..270e21a 100644 --- a/src/components/organisms/Locations.svelte +++ b/src/components/organisms/Locations.svelte @@ -10,6 +10,7 @@ export let locations: any + const { continents, settings: { explore_list }} = getContext('global') // Continents filtering logic @@ -60,7 +61,10 @@ in:receive={{ key: location.slug }} out:send={{ key: location.slug }} > - + {/each} diff --git a/src/routes/__layout.svelte b/src/routes/__layout.svelte index 4d06a7e..fe4b07a 100644 --- a/src/routes/__layout.svelte +++ b/src/routes/__layout.svelte @@ -45,6 +45,7 @@ id title } + date_created } has_poster }