Last little fixes and debugging
This commit is contained in:
@@ -40,7 +40,6 @@
|
||||
pageAnimation
|
||||
} from 'utils/store'
|
||||
import { getThumbnail } from 'utils/functions'
|
||||
|
||||
// Components
|
||||
import IconGlobe from 'atoms/IconGlobe'
|
||||
import IconCross from 'atoms/IconCross'
|
||||
@@ -48,24 +47,24 @@
|
||||
import Fullscreen from 'organisms/Fullscreen'
|
||||
import Transition from 'utils/Transition'
|
||||
import SocialMetas from 'utils/SocialMetas'
|
||||
|
||||
// Animations
|
||||
import { animateIn } from 'animations/viewer'
|
||||
|
||||
// Props
|
||||
export let photos
|
||||
|
||||
// Variables
|
||||
const { page } = stores()
|
||||
pageAnimation.set(animateIn)
|
||||
let windowWidth
|
||||
let gotoLink
|
||||
let currentPhoto = photos.find(photo => photo.slug === $page.params.photo)
|
||||
let pageTitle = ($currentLocation) ? `Beautiful homes of ${$currentLocation.name}, ${$currentLocation.country.name}` : ''
|
||||
|
||||
// Update store current location
|
||||
if (!$currentLocation) currentLocation.set($locations.find(loc => loc.slug === $page.params.place))
|
||||
if (!$currentPhotos) currentPhotos.set(photos)
|
||||
currentLocation.set($locations.find(loc => loc.slug === $page.params.place))
|
||||
currentPhotos.set(photos)
|
||||
|
||||
let windowWidth
|
||||
let gotoLink
|
||||
let pageTitle
|
||||
let currentPhoto = photos.find(photo => photo.slug === $page.params.photo)
|
||||
|
||||
|
||||
// Photo has changed (from Carousel)
|
||||
const photoChanged = event => {
|
||||
@@ -73,10 +72,10 @@
|
||||
const windowPathname = window.location.pathname
|
||||
const newUrl = windowPathname.substring(0, windowPathname.lastIndexOf('/') + 1) + currentPhoto.slug
|
||||
// Go to page via a sapper-noscroll link to avoid scroll jump (hacky)
|
||||
gotoLink.href = newUrl
|
||||
gotoLink.click()
|
||||
// Change page title with photo name
|
||||
pageTitle = `${currentPhoto.name}, ${currentPhoto.location.country.name}`
|
||||
if (gotoLink && newUrl) {
|
||||
gotoLink.href = newUrl
|
||||
gotoLink.click()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -90,11 +89,11 @@
|
||||
</script>
|
||||
|
||||
<svelte:head>
|
||||
<title>{$site.seo_name} – {pageTitle}</title>
|
||||
<title>{$site.seo_name} – Beautiful homes of {$currentLocation.name}, {$currentLocation.country.name}</title>
|
||||
<meta name="description" content="{$site.seo_name} {$currentLocation.name} {$currentLocation.description}">
|
||||
<SocialMetas
|
||||
url="https://{$page.host}/viewer/{currentPhoto.location.country.slug}/{currentPhoto.location.slug}/{currentPhoto.slug}"
|
||||
title="{$site.seo_name} - {pageTitle}"
|
||||
title="{$site.seo_name} - Beautiful homes of {$currentLocation.name}, {$currentLocation.country.name}"
|
||||
description="{$site.seo_name} {$currentLocation.name} {$currentLocation.description}"
|
||||
image={getThumbnail(currentPhoto.image.private_hash, 1200, 630)}
|
||||
/>
|
||||
@@ -122,8 +121,7 @@
|
||||
<a href="/" bind:this={gotoLink} aria-hidden="true" hidden class="hidden" sapper-noscroll> </a>
|
||||
</div>
|
||||
|
||||
<Carousel {photos}
|
||||
viewer="true"
|
||||
<Carousel {photos} viewer={true}
|
||||
on:photoChange={photoChanged}
|
||||
/>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user