Make mobile and desktop behave identically
- Remove isMobile() function from IconButton and works page - Remove mobile-specific conditionals for score and document icons - Always show nav and score iframe on works page - No more hydration mismatch - same HTML on server and client
This commit is contained in:
parent
1bbb7e0250
commit
6e9f859d59
|
|
@ -2,17 +2,10 @@
|
||||||
<div class="inline-flex p-1 min-w-[25px]">
|
<div class="inline-flex p-1 min-w-[25px]">
|
||||||
<div v-show="visible" class="bg-black rounded-full text-xs inline-flex" >
|
<div v-show="visible" class="bg-black rounded-full text-xs inline-flex" >
|
||||||
|
|
||||||
<!-- Score: Mobile = PDF (downloads), Desktop = work page with hash (opens modal) -->
|
<!-- Score: Always opens modal -->
|
||||||
<span v-if="type === 'score' && isMobile()">
|
<button v-if="type === 'score'" @click="openWithHash('score')" class="inline-flex p-1">
|
||||||
<a :href="scoreLink" class="inline-flex p-1">
|
<Icon name="ion:book-sharp" style="color: white" />
|
||||||
<Icon name="ion:book-sharp" style="color: white" />
|
</button>
|
||||||
</a>
|
|
||||||
</span>
|
|
||||||
<span v-else-if="type === 'score'">
|
|
||||||
<button @click="openWithHash('score')" class="inline-flex p-1">
|
|
||||||
<Icon name="ion:book-sharp" style="color: white" />
|
|
||||||
</button>
|
|
||||||
</span>
|
|
||||||
|
|
||||||
<!-- Document: Mobile = External opens new tab, PDF downloads, internal pages open modal -->
|
<!-- Document: Mobile = External opens new tab, PDF downloads, internal pages open modal -->
|
||||||
<span v-if="type === 'document'">
|
<span v-if="type === 'document'">
|
||||||
|
|
@ -66,14 +59,6 @@
|
||||||
|
|
||||||
const workSlug = computed(() => slugify(props.work?.title))
|
const workSlug = computed(() => slugify(props.work?.title))
|
||||||
|
|
||||||
const scoreLink = computed(() => {
|
|
||||||
if (!props.work?.score) return null
|
|
||||||
if (props.work.score.startsWith('/scores/')) {
|
|
||||||
return props.work.score
|
|
||||||
}
|
|
||||||
return '/scores/' + props.work.score
|
|
||||||
})
|
|
||||||
|
|
||||||
const isExternalLink = computed(() => {
|
const isExternalLink = computed(() => {
|
||||||
return props.link && !props.link.endsWith('.pdf') && !props.link.startsWith('/')
|
return props.link && !props.link.endsWith('.pdf') && !props.link.startsWith('/')
|
||||||
})
|
})
|
||||||
|
|
@ -82,11 +67,6 @@
|
||||||
return props.link && props.link.startsWith('/') && !props.link.endsWith('.pdf')
|
return props.link && props.link.startsWith('/') && !props.link.endsWith('.pdf')
|
||||||
})
|
})
|
||||||
|
|
||||||
const isMobile = () => {
|
|
||||||
if (typeof window === 'undefined') return false
|
|
||||||
return window.innerWidth < 768
|
|
||||||
}
|
|
||||||
|
|
||||||
const openDocument = () => {
|
const openDocument = () => {
|
||||||
if (props.link?.endsWith('.pdf')) {
|
if (props.link?.endsWith('.pdf')) {
|
||||||
modalStore.setModalProps('pdf', 'aspect-[1/1.414]', true, '', '', '', props.link)
|
modalStore.setModalProps('pdf', 'aspect-[1/1.414]', true, '', '', '', props.link)
|
||||||
|
|
|
||||||
|
|
@ -8,12 +8,7 @@
|
||||||
<nav class="flex gap-4 mb-6">
|
<nav class="flex gap-4 mb-6">
|
||||||
<a v-if="work.vimeo_trackid" href="#video" class="hover:underline">Video</a>
|
<a v-if="work.vimeo_trackid" href="#video" class="hover:underline">Video</a>
|
||||||
<a v-if="gallery && gallery.length" href="#images" class="hover:underline">Images</a>
|
<a v-if="gallery && gallery.length" href="#images" class="hover:underline">Images</a>
|
||||||
<span v-if="scoreUrl && isMobile()">
|
<a v-if="scoreUrl" href="#score" class="hover:underline">Score</a>
|
||||||
<a :href="scoreUrl" class="hover:underline">Score</a>
|
|
||||||
</span>
|
|
||||||
<span v-else-if="scoreUrl">
|
|
||||||
<a href="#score" class="hover:underline">Score</a>
|
|
||||||
</span>
|
|
||||||
</nav>
|
</nav>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -27,7 +22,7 @@
|
||||||
<ImageSlider :bucket="'images'" :gallery="gallery"></ImageSlider>
|
<ImageSlider :bucket="'images'" :gallery="gallery"></ImageSlider>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="score" v-if="scoreUrl && !isMobile()" class="mb-8 scroll-mt-[280px]">
|
<div id="score" v-if="scoreUrl" class="mb-8 scroll-mt-[280px]">
|
||||||
<iframe :src="scoreUrl + '#toolbar=1&navpanes=0&sidebar=0'" class="w-full h-[85vh] border"></iframe>
|
<iframe :src="scoreUrl + '#toolbar=1&navpanes=0&sidebar=0'" class="w-full h-[85vh] border"></iframe>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -82,11 +77,6 @@ const itemCount = computed(() => {
|
||||||
return count
|
return count
|
||||||
})
|
})
|
||||||
|
|
||||||
const isMobile = () => {
|
|
||||||
if (typeof window === 'undefined') return false
|
|
||||||
return window.innerWidth < 768
|
|
||||||
}
|
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
if (work.value?.soundcloud_trackid) {
|
if (work.value?.soundcloud_trackid) {
|
||||||
audioPlayerStore.setSoundCloudTrackID(work.value.soundcloud_trackid)
|
audioPlayerStore.setSoundCloudTrackID(work.value.soundcloud_trackid)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue