Skip to content

Self-hosted personal gallery application with online photo management and albums, supporting Live/Motion Photos, EXIF parsing, geolocation recognition, and an explore map.

fix(gallery): preserve photo wall when closing viewer

Timothy Yind4ca5551d155
diff --git a/packages/gallery/app/components/masonry/Root.vue b/packages/gallery/app/components/masonry/Root.vue
index 2fa685d3..1e395940 100644
--- a/packages/gallery/app/components/masonry/Root.vue
+++ b/packages/gallery/app/components/masonry/Root.vue
@@ -37,7 +37,7 @@ const displayPhotos = computed(() => {
})
const viewer = useViewerState()
-const { currentPhotoIndex, isViewerOpen } = storeToRefs(viewer)
+const { currentPhotoIndex } = storeToRefs(viewer)
const FIRST_SCREEN_ITEMS_COUNT = 50
const MASONRY_GAP = 4
@@ -359,13 +359,6 @@ const scrollToPhoto = (photoIndex: number) => {
}
}
-watch(currentPhotoIndex, (newIndex) => {
- if (isViewerOpen.value && newIndex >= 0) {
- nextTick(() => {
- scrollToPhoto(newIndex)
- })
- }
-})
</script>
<template>
diff --git a/packages/gallery/app/layouts/masonry.vue b/packages/gallery/app/layouts/masonry.vue
index bf250c63..d65346ff 100644
--- a/packages/gallery/app/layouts/masonry.vue
+++ b/packages/gallery/app/layouts/masonry.vue
@@ -5,6 +5,7 @@ useHead({
const { photos } = usePhotos()
const route = useRoute()
+const { homeView } = useHomeView()
const router = useRouter()
const { clearAllFilters, toggleFilter } = usePhotoFilters()
@@ -30,6 +31,7 @@ watch(
<div class="h-svh px-1">
<ClientOnly>
<MasonryRoot
+ v-if="route.path !== '/' || homeView !== 'albums'"
:photos="photos"
columns="auto"
/>
diff --git a/packages/gallery/app/pages/index.vue b/packages/gallery/app/pages/index.vue
index ae81ebc3..96e9bbb1 100644
--- a/packages/gallery/app/pages/index.vue
+++ b/packages/gallery/app/pages/index.vue
@@ -1,6 +1,7 @@
<script setup lang="ts">
definePageMeta({
middleware: 'home-tag-redirect',
+ layout: 'masonry',
})
const { homeView } = useHomeView()
@@ -8,10 +9,5 @@ const { homeView } = useHomeView()
<template>
<AlbumListing v-if="homeView === 'albums'" />
- <NuxtLayout
- v-else
- name="masonry"
- >
- <div />
- </NuxtLayout>
+ <div v-else />
</template>