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(header): reserve mobile social row height before measurement

Ahmet Ömer577e56462923
diff --git a/packages/gallery/app/components/masonry/Root.vue b/packages/gallery/app/components/masonry/Root.vue
index 66cc2418..2fa685d3 100644
--- a/packages/gallery/app/components/masonry/Root.vue
+++ b/packages/gallery/app/components/masonry/Root.vue
@@ -1,6 +1,10 @@
<script setup lang="ts">
import { motion } from 'motion-v'
-import { FIXED_HEADER_HEIGHT_PX } from '#gallery/utils'
+import {
+ FIXED_HEADER_HEIGHT_PX,
+ FIXED_HEADER_SOCIAL_ROW_HEIGHT_PX,
+} from '#gallery/utils'
+import { parseSocialLinks } from '@chronoframe/contracts/social-links'
interface Props {
photos: Photo[]
columns?: number | 'auto'
@@ -19,6 +23,14 @@ const { filteredPhotos, hasActiveFilters } = usePhotoFilters()
const { sortedPhotos } = usePhotoSort()
const homeHeaderLayout = useSettingRef('app:appearance.homeHeaderLayout')
const isFixedHeader = computed(() => homeHeaderLayout.value === 'fixed')
+const socialLinksSetting = useSettingRef('app:socialLinks')
+const hasSocialLinks = computed(() => {
+ try {
+ return parseSocialLinks(socialLinksSetting.value).length > 0
+ } catch {
+ return false
+ }
+})
const displayPhotos = computed(() => {
return hasActiveFilters.value ? filteredPhotos.value : sortedPhotos.value
@@ -380,7 +392,11 @@ watch(currentPhotoIndex, (newIndex) => {
<div
v-if="isFixedHeader"
aria-hidden="true"
- :style="{ height: `${fixedHeaderHeight}px` }"
+ :class="{ 'fixed-header-spacer-with-social-links': hasSocialLinks }"
+ :style="{
+ height: `${fixedHeaderHeight}px`,
+ '--fixed-header-mobile-min-height': `${FIXED_HEADER_HEIGHT_PX + FIXED_HEADER_SOCIAL_ROW_HEIGHT_PX}px`,
+ }"
/>
<!-- Back to Top Button -->
@@ -462,6 +478,12 @@ watch(currentPhotoIndex, (newIndex) => {
</template>
<style scoped>
+@media (max-width: 1023px) {
+ .fixed-header-spacer-with-social-links {
+ min-height: var(--fixed-header-mobile-min-height);
+ }
+}
+
.masonry-header-wrapper {
z-index: 1;
}
diff --git a/packages/gallery/app/components/masonry/item/HeaderSocialLinks.vue b/packages/gallery/app/components/masonry/item/HeaderSocialLinks.vue
index 8038f8c0..fedec833 100644
--- a/packages/gallery/app/components/masonry/item/HeaderSocialLinks.vue
+++ b/packages/gallery/app/components/masonry/item/HeaderSocialLinks.vue
@@ -3,6 +3,7 @@ import {
parseSocialLinks,
resolveSocialPlatform,
} from '@chronoframe/contracts/social-links'
+import { FIXED_HEADER_SOCIAL_ROW_HEIGHT_PX } from '#gallery/utils'
const props = withDefaults(
defineProps<{ variant?: 'embedded' | 'fixedDesktop' | 'fixedMobile' }>(),
@@ -26,12 +27,18 @@ const links = computed(() => {
<nav
v-if="links.length"
:aria-label="$t('settings.app.socialLinks.title')"
- class="flex-wrap items-center justify-center gap-1"
+ class="items-center justify-center gap-1"
:class="{
- flex: props.variant === 'embedded',
+ 'flex flex-wrap': props.variant === 'embedded',
'hidden lg:flex': props.variant === 'fixedDesktop',
- 'flex lg:hidden': props.variant === 'fixedMobile',
+ 'flex flex-nowrap overflow-x-auto lg:hidden':
+ props.variant === 'fixedMobile',
}"
+ :style="
+ props.variant === 'fixedMobile'
+ ? { height: `${FIXED_HEADER_SOCIAL_ROW_HEIGHT_PX}px` }
+ : undefined
+ "
>
<a
v-for="link in links"
diff --git a/packages/gallery/app/utils/index.ts b/packages/gallery/app/utils/index.ts
index fd89503e..2f613499 100644
--- a/packages/gallery/app/utils/index.ts
+++ b/packages/gallery/app/utils/index.ts
@@ -1,4 +1,5 @@
export const FIXED_HEADER_HEIGHT_PX = 60
+export const FIXED_HEADER_SOCIAL_ROW_HEIGHT_PX = 44
// 格式化字节大小的辅助函数
export const formatBytes = (bytes: number): string => {