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.

feat(home): add embedded and fixed home header layouts

Ahmet Ömerea2da32ba1e4
diff --git a/app/components/masonry/Root.vue b/app/components/masonry/Root.vue
index 3529eb36..d16f03c1 100644
--- a/app/components/masonry/Root.vue
+++ b/app/components/masonry/Root.vue
@@ -1,5 +1,6 @@
<script setup lang="ts">
import { motion } from 'motion-v'
+import { FIXED_HEADER_HEIGHT_PX } from '~/utils'
interface Props {
photos: Photo[]
columns?: number | 'auto'
@@ -14,6 +15,8 @@ const router = useRouter()
const { filteredPhotos, hasActiveFilters } = usePhotoFilters()
const { sortedPhotos } = usePhotoSort()
+const homeHeaderLayout = useSettingRef('app:appearance.homeHeaderLayout')
+const isFixedHeader = computed(() => homeHeaderLayout.value === 'fixed')
const displayPhotos = computed(() => {
return hasActiveFilters.value ? filteredPhotos.value : sortedPhotos.value
@@ -34,8 +37,10 @@ const isMobile = useMediaQuery('(max-width: 768px)')
const { batchProcessLivePhotos } = useLivePhotoProcessor()
const processedBatch = ref(new Set<string>())
-const headerRef = ref<HTMLElement>()
-const headerHeight = ref(0)
+const fixedHeaderRef = ref<HTMLElement>()
+const fixedHeaderHeight = ref(FIXED_HEADER_HEIGHT_PX)
+const embeddedHeaderRef = ref<HTMLElement>()
+const embeddedHeaderHeight = ref(0)
const headerColumnWidth = ref(0)
const columnWidth = computed(() => {
@@ -69,15 +74,22 @@ const masonryItems = computed(() => {
})) ?? []
)
})
-useResizeObserver(headerRef, (entries) => {
- const entry = entries[0]
- if (entry) {
- headerHeight.value = entry.contentRect.height
+const measureHeaderHeights = () => {
+ if (fixedHeaderRef.value) {
+ fixedHeaderHeight.value =
+ fixedHeaderRef.value.getBoundingClientRect().height
}
-})
+ if (embeddedHeaderRef.value) {
+ embeddedHeaderHeight.value =
+ embeddedHeaderRef.value.getBoundingClientRect().height
+ }
+}
-const updateHeaderWidth = () => {
- if (isMobile.value) {
+useResizeObserver(fixedHeaderRef, measureHeaderHeights)
+useResizeObserver(embeddedHeaderRef, measureHeaderHeights)
+
+const updateEmbeddedHeaderWidth = () => {
+ if (isMobile.value || isFixedHeader.value) {
headerColumnWidth.value = 0
return
}
@@ -86,58 +98,28 @@ const updateHeaderWidth = () => {
'.masonry-wall .masonry-column',
)
- if (columnElement) {
- headerColumnWidth.value = columnElement.getBoundingClientRect().width
- return
- }
-
- headerColumnWidth.value = columnWidth.value
+ headerColumnWidth.value =
+ columnElement?.getBoundingClientRect().width ?? columnWidth.value
}
-useResizeObserver(masonryWrapper, () => {
- updateHeaderWidth()
-})
-
-const headerOffset = computed(() => {
- if (isMobile.value) {
- return 0
- }
- return headerHeight.value + MASONRY_GAP
-})
-
-const headerStyle = computed(() => {
- const styles: Record<string, string> = {}
-
- if (isMobile.value) {
- styles.width = '100%'
- styles.marginBottom = `${MASONRY_GAP}px`
- return styles
- }
-
- const width = headerColumnWidth.value || columnWidth.value
- styles.width = `${width}px`
+useResizeObserver(masonryWrapper, updateEmbeddedHeaderWidth)
- return styles
+const embeddedHeaderOffset = computed(() => {
+ return isMobile.value ? 0 : embeddedHeaderHeight.value + MASONRY_GAP
})
-watch([columnWidth, maxColumns, minColumns], () => {
+const embeddedHeaderStyle = computed(() => {
if (isMobile.value) {
- return
+ return { width: '100%', marginBottom: `${MASONRY_GAP}px` }
}
- nextTick(() => {
- updateHeaderWidth()
- })
+ return { width: `${headerColumnWidth.value || columnWidth.value}px` }
})
-watch(isMobile, (mobile) => {
- if (mobile) {
- headerColumnWidth.value = 0
- return
- }
-
+watch([isMobile, isFixedHeader, columnWidth, maxColumns, minColumns], () => {
nextTick(() => {
- updateHeaderWidth()
+ updateEmbeddedHeaderWidth()
+ measureHeaderHeights()
})
})
@@ -310,10 +292,10 @@ const scrollToTop = () => {
onMounted(() => {
window.addEventListener('scroll', handleScroll, { passive: true })
- window.addEventListener('resize', updateHeaderWidth)
nextTick(() => {
- updateHeaderWidth()
+ updateEmbeddedHeaderWidth()
+ measureHeaderHeights()
if (currentPhotoIndex.value) {
scrollToPhoto(currentPhotoIndex.value)
@@ -323,7 +305,6 @@ onMounted(() => {
onUnmounted(() => {
window.removeEventListener('scroll', handleScroll)
- window.removeEventListener('resize', updateHeaderWidth)
})
const handleOpenViewer = (index: number) => {
@@ -371,6 +352,24 @@ watch(currentPhotoIndex, (newIndex) => {
:locations="visibleCities"
:is-visible="!!dateRange && showFloatingActions"
:is-mobile="isMobile"
+ :top-offset="isFixedHeader ? fixedHeaderHeight : undefined"
+ />
+
+ <div
+ v-if="isFixedHeader"
+ ref="fixedHeaderRef"
+ class="fixed inset-x-0 top-0 z-30"
+ >
+ <MasonryItemHeaderFixed
+ :stats="photoStats"
+ :date-range-text
+ />
+ </div>
+
+ <div
+ v-if="isFixedHeader"
+ aria-hidden="true"
+ :style="{ height: `${fixedHeaderHeight}px` }"
/>
<!-- Back to Top Button -->
@@ -403,13 +402,14 @@ watch(currentPhotoIndex, (newIndex) => {
ref="masonryWrapper"
class="relative"
:class="{ 'pt-2': isMobile }"
- :style="{ '--masonry-header-offset': `${headerOffset}px` }"
+ :style="{ '--masonry-header-offset': `${embeddedHeaderOffset}px` }"
>
<div
- ref="headerRef"
+ v-if="!isFixedHeader"
+ ref="embeddedHeaderRef"
class="masonry-header-wrapper"
:class="{ 'masonry-header-desktop': !isMobile }"
- :style="headerStyle"
+ :style="embeddedHeaderStyle"
>
<MasonryItemHeader
:stats="photoStats"
@@ -419,7 +419,7 @@ watch(currentPhotoIndex, (newIndex) => {
<!-- Masonry Wall -->
<MasonryWall
- class="masonry-wall-with-header"
+ :class="{ 'masonry-wall-with-header': !isFixedHeader }"
:items="masonryItems"
:column-width="columnWidth"
:gap="MASONRY_GAP"
diff --git a/app/components/masonry/item/Actions.vue b/app/components/masonry/item/Actions.vue
new file mode 100644
index 00000000..bb2b13c1
--- /dev/null
+++ b/app/components/masonry/item/Actions.vue
@@ -0,0 +1,193 @@
+<script lang="ts" setup>
+withDefaults(
+ defineProps<{
+ loggedIn: boolean
+ clear: () => void | Promise<void>
+ compact?: boolean
+ }>(),
+ { compact: false },
+)
+
+const colorMode = useColorMode()
+const isDark = computed({
+ get: () => colorMode.value === 'dark',
+ set: (dark) => {
+ colorMode.preference = dark ? 'dark' : 'light'
+ },
+})
+
+const { hasActiveFilters, selectedCounts } = usePhotoFilters()
+const { currentSortIcon, currentSortOption } = usePhotoSort()
+const totalSelectedFilters = computed(() =>
+ Object.values(selectedCounts.value).reduce(
+ (total, count) => total + count,
+ 0,
+ ),
+)
+</script>
+
+<template>
+ <div class="flex items-center">
+ <div
+ :class="compact ? 'hidden lg:flex' : 'flex'"
+ class="items-center"
+ >
+ <UTooltip :text="$t('ui.action.globe.tooltip')">
+ <UButton
+ variant="soft"
+ color="neutral"
+ class="cursor-pointer rounded-full bg-transparent"
+ icon="tabler:map-pin-2"
+ size="sm"
+ to="/globe"
+ />
+ </UTooltip>
+ <UTooltip :text="$t('title.albums')">
+ <UButton
+ variant="soft"
+ color="neutral"
+ class="cursor-pointer rounded-full bg-transparent"
+ icon="tabler:photo"
+ size="sm"
+ to="/albums"
+ />
+ </UTooltip>
+ </div>
+ <UPopover>
+ <UTooltip :text="$t('ui.action.filter.tooltip')">
+ <UChip
+ inset
+ size="sm"
+ color="info"
+ :show="totalSelectedFilters > 0"
+ >
+ <UButton
+ variant="soft"
+ :color="hasActiveFilters ? 'info' : 'neutral'"
+ class="relative cursor-pointer rounded-full bg-transparent"
+ icon="tabler:filter"
+ size="sm"
+ />
+ </UChip>
+ </UTooltip>
+ <template #content>
+ <UCard variant="glassmorphism"><OverlayFilterPanel /></UCard>
+ </template>
+ </UPopover>
+ <UPopover>
+ <UTooltip :text="$t('ui.action.sort.tooltip')">
+ <UButton
+ variant="soft"
+ :color="
+ currentSortOption?.key === 'dateTaken-desc' ? 'neutral' : 'info'
+ "
+ class="cursor-pointer rounded-full bg-transparent"
+ :icon="currentSortIcon"
+ size="sm"
+ />
+ </UTooltip>
+ <template #content>
+ <OverlaySortPanel />
+ </template>
+ </UPopover>
+ <div
+ :class="compact ? 'hidden lg:flex' : 'flex'"
+ class="items-center"
+ >
+ <UTooltip :text="$t('ui.action.theme.tooltip')">
+ <UButton
+ variant="soft"
+ color="neutral"
+ class="cursor-pointer rounded-full bg-transparent"
+ :icon="isDark ? 'tabler:sun' : 'tabler:moon'"
+ size="sm"
+ @click="isDark = !isDark"
+ />
+ </UTooltip>
+ <UTooltip
+ v-if="loggedIn"
+ :text="$t('ui.action.dashboard.tooltip')"
+ >
+ <UButton
+ size="sm"
+ color="info"
+ variant="soft"
+ class="cursor-pointer rounded-full bg-transparent"
+ icon="tabler:dashboard"
+ data-tour="home-dashboard"
+ to="/dashboard"
+ />
+ </UTooltip>
+ <UTooltip
+ v-if="loggedIn"
+ :text="$t('ui.action.logout.tooltip')"
+ >
+ <UButton
+ size="sm"
+ color="error"
+ variant="soft"
+ class="cursor-pointer rounded-full bg-transparent"
+ icon="tabler:logout"
+ @click="clear"
+ />
+ </UTooltip>
+ </div>
+ <UPopover v-if="compact">
+ <UButton
+ variant="soft"
+ color="neutral"
+ class="cursor-pointer rounded-full bg-transparent lg:hidden"
+ icon="tabler:dots"
+ size="sm"
+ :aria-label="$t('ui.action.more.tooltip')"
+ :data-tour="loggedIn ? 'home-dashboard' : undefined"
+ />
+ <template #content>
+ <div class="flex w-64 flex-col gap-1 p-2">
+ <UButton
+ variant="ghost"
+ color="neutral"
+ icon="tabler:map-pin-2"
+ :label="$t('ui.action.globe.tooltip')"
+ to="/globe"
+ />
+ <UButton
+ variant="ghost"
+ color="neutral"
+ icon="tabler:photo"
+ :label="$t('title.albums')"
+ to="/albums"
+ />
+ <UButton
+ variant="ghost"
+ color="neutral"
+ :icon="isDark ? 'tabler:sun' : 'tabler:moon'"
+ :label="$t('ui.action.theme.tooltip')"
+ @click="isDark = !isDark"
+ />
+ <UButton
+ v-if="loggedIn"
+ variant="ghost"
+ color="info"
+ icon="tabler:dashboard"
+ :label="$t('ui.action.dashboard.tooltip')"
+ to="/dashboard"
+ />
+ <UButton
+ v-if="loggedIn"
+ variant="ghost"
+ color="error"
+ icon="tabler:logout"
+ :label="$t('ui.action.logout.tooltip')"
+ @click="clear"
+ />
+ <div
+ class="mt-1 border-t border-neutral-200 px-2 pt-2 text-xs text-neutral-500 dark:border-neutral-800 dark:text-neutral-400"
+ >
+ <slot name="compact-details" />
+ </div>
+ </div>
+ </template>
+ </UPopover>
+ </div>
+</template>
diff --git a/app/components/masonry/item/Header.vue b/app/components/masonry/item/Header.vue
index 56f776e4..e4216e40 100644
--- a/app/components/masonry/item/Header.vue
+++ b/app/components/masonry/item/Header.vue
@@ -1,6 +1,4 @@
<script lang="ts" setup>
-import { motion, AnimatePresence } from 'motion-v'
-
defineProps<{
stats?: {
total: number
@@ -11,42 +9,12 @@ defineProps<{
}
dateRangeText: string
}>()
-
-const router = useRouter()
-// const config = useRuntimeConfig()
-const colorMode = useColorMode()
-
-const isDark = computed({
- get() {
- return colorMode.value === 'dark'
- },
- set(_isDark) {
- colorMode.preference = _isDark ? 'dark' : 'light'
- },
-})
-
-const handleOpenLogin = () => {
- router.push('/signin')
-}
-
-const { hasActiveFilters, selectedCounts } = usePhotoFilters()
-
-const { currentSortIcon, currentSortOption } = usePhotoSort()
-
-const totalSelectedFilters = computed(() => {
- return Object.values(selectedCounts.value).reduce(
- (total, count) => total + count,
- 0,
- )
-})
-
-const isRepoLinkHovering = ref(false)
</script>
<template>
- <div class="w-full relative overflow-hidden">
+ <div class="relative w-full overflow-hidden">
<div
- class="absolute inset-0 -z-10 blur-3xl scale-110 bg-cover bg-center opacity-35"
+ class="absolute inset-0 -z-10 scale-110 bg-cover bg-center opacity-35 blur-3xl"
:style="{
backgroundImage: `url(${getSetting('app:avatarUrl') || '/web-app-manifest-192x192.png'})`,
}"
@@ -54,213 +22,26 @@ const isRepoLinkHovering = ref(false)
<div
class="absolute inset-0 -z-10 bg-white/50 dark:bg-neutral-900/50"
></div>
- <div class="flex flex-col items-center py-6 pb-0 gap-2">
+ <div class="flex flex-col items-center gap-2 py-6 pb-0">
<AuthState>
<template #default="{ loggedIn, clear }">
- <div class="flex flex-col items-center gap-2">
- <div class="relative mx-auto">
- <div
- v-if="loggedIn"
- class="absolute -bottom-0.5 -right-0.5 bg-amber-500 text-white rounded-full flex items-center justify-center size-5 text-xs drop-shadow-lg drop-shadow-amber-500/30"
- >
- <Icon name="tabler:star-filled" />
- </div>
- <img
- :src="
- (getSetting('app:avatarUrl') as string) ||
- '/web-app-manifest-192x192.png'
- "
- class="size-16 rounded-full object-cover"
- :class="!loggedIn && 'cursor-pointer'"
- data-tour="home-avatar"
- :alt="$t('ui.photo.avatarAlt')"
- @click="!loggedIn && handleOpenLogin()"
- @error="handleAvatarError"
- />
- </div>
- <h1
- class="text-2xl font-bold text-neutral-900 dark:text-white/90 mb-2"
- >
- {{ getSetting('app:title') }}
- </h1>
- </div>
- <div
- class="text-neutral-600 dark:text-white/30 space-y-1 text-center"
- >
- <p
- v-if="stats?.total"
- class="text-xs font-medium"
- >
- {{
- $t('ui.stats.totalPhotosWithRange', {
- range: dateRangeText,
- count: stats?.total,
- })
- }}
- </p>
- <p
- v-else
- class="text-xs font-medium"
- >
- {{ $t('ui.stats.noPhotosTip') }}
- </p>
- <p
- v-if="getSetting('app:slogan')"
- class="font-[Pacifico]"
- >
- {{ getSetting('app:slogan') }}
- </p>
- </div>
- <div
- class="flex items-center gap-0 p-1 bg-white/30 dark:bg-neutral-900/50 rounded-full"
- >
- <UTooltip :text="$t('ui.action.globe.tooltip')">
- <UButton
- variant="soft"
- color="neutral"
- class="bg-transparent rounded-full cursor-pointer"
- icon="tabler:map-pin-2"
- size="sm"
- to="/globe"
- />
- </UTooltip>
- <UTooltip :text="$t('title.albums')">
- <UButton
- variant="soft"
- color="neutral"
- class="bg-transparent rounded-full cursor-pointer"
- icon="tabler:photo"
- size="sm"
- to="/albums"
- />
- </UTooltip>
- <UPopover>
- <UTooltip :text="$t('ui.action.filter.tooltip')">
- <UChip
- inset
- size="sm"
- color="info"
- :show="totalSelectedFilters > 0"
- >
- <UButton
- variant="soft"
- :color="hasActiveFilters ? 'info' : 'neutral'"
- class="bg-transparent rounded-full cursor-pointer relative"
- icon="tabler:filter"
- size="sm"
- />
- </UChip>
- </UTooltip>
-
- <template #content>
- <UCard variant="glassmorphism">
- <OverlayFilterPanel />
- </UCard>
- </template>
- </UPopover>
- <UPopover>
- <UTooltip :text="$t('ui.action.sort.tooltip')">
- <UButton
- variant="soft"
- :color="
- currentSortOption?.key === 'dateTaken-desc'
- ? 'neutral'
- : 'info'
- "
- class="bg-transparent rounded-full cursor-pointer"
- :icon="currentSortIcon"
- size="sm"
- />
- </UTooltip>
-
- <template #content>
- <OverlaySortPanel />
- </template>
- </UPopover>
- <UTooltip :text="$t('ui.action.theme.tooltip')">
- <UButton
- variant="soft"
- color="neutral"
- class="bg-transparent rounded-full cursor-pointer"
- :icon="isDark ? 'tabler:sun' : 'tabler:moon'"
- size="sm"
- @click="isDark = !isDark"
- />
- </UTooltip>
- <UTooltip
- v-if="loggedIn"
- :text="$t('ui.action.dashboard.tooltip')"
- >
- <UButton
- size="sm"
- color="info"
- variant="soft"
- class="bg-transparent rounded-full cursor-pointer"
- icon="tabler:dashboard"
- data-tour="home-dashboard"
- to="/dashboard"
- />
- </UTooltip>
- <UTooltip
- v-if="loggedIn"
- :text="$t('ui.action.logout.tooltip')"
- >
- <UButton
- size="sm"
- color="error"
- variant="soft"
- class="bg-transparent rounded-full cursor-pointer"
- icon="tabler:logout"
- @click="clear"
- /></UTooltip>
- </div>
+ <MasonryItemHeaderIdentity
+ variant="embedded"
+ :logged-in="loggedIn"
+ />
+ <MasonryItemHeaderStats
+ variant="embedded"
+ :total="stats?.total"
+ :date-range-text="dateRangeText"
+ />
+ <MasonryItemActions
+ :logged-in="loggedIn"
+ :clear="clear"
+ class="gap-0 rounded-full bg-white/30 p-1 dark:bg-neutral-900/50"
+ />
</template>
</AuthState>
- <div
- class="w-full px-2 pb-1 pt-1.5 bg-neutral-200/50 dark:bg-neutral-900/50 flex justify-between items-center gap-2"
- >
- <div
- v-if="getSetting('app:author') || getSetting('app:title')"
- class="text-xs text-neutral-500/80 dark:text-neutral-500 font-medium truncate"
- >
- © {{ $dayjs().format('YYYY') }}
- {{ getSetting('app:author') || getSetting('app:title') }}
- </div>
- <div
- class="text-xs text-neutral-500/60 dark:text-neutral-500/80 font-medium inline-flex justify-center items-center gap-0.5"
- >
- <a
- ref="projectLink"
- href="https://github.com/HoshinoSuzumi/chronoframe"
- target="_blank"
- rel="noopener noreferrer"
- class="hover:underline inline-flex items-center gap-0.5 group"
- @mouseenter="isRepoLinkHovering = true"
- @mouseleave="isRepoLinkHovering = false"
- >
- <Icon
- name="mdi:github"
- class="inline-block text-sm -mt-px"
- mode="svg"
- />
- ChronoFrame
- <AnimatePresence>
- <motion.span
- v-if="isRepoLinkHovering"
- :initial="{ width: 0, opacity: 0 }"
- :animate="{ width: 'auto', opacity: 1 }"
- :exit="{ width: 0, opacity: 0 }"
- :transition="{ duration: 0.3, ease: 'easeInOut' }"
- style="overflow: hidden; white-space: nowrap"
- >
- ({{ $config.public.VERSION }})
- </motion.span>
- </AnimatePresence>
- </a>
- </div>
- </div>
+ <MasonryItemHeaderFooter variant="embedded" />
</div>
</div>
</template>
-
-<style scoped></style>
diff --git a/app/components/masonry/item/HeaderFixed.vue b/app/components/masonry/item/HeaderFixed.vue
new file mode 100644
index 00000000..8ae5feef
--- /dev/null
+++ b/app/components/masonry/item/HeaderFixed.vue
@@ -0,0 +1,59 @@
+<script lang="ts" setup>
+import { FIXED_HEADER_HEIGHT_PX } from '~/utils'
+
+defineProps<{
+ stats?: {
+ total: number
+ dateRange: {
+ start: string | undefined
+ end: string | undefined
+ } | null
+ }
+ dateRangeText: string
+}>()
+</script>
+
+<template>
+ <header
+ class="w-full bg-white/90 text-neutral-900 backdrop-blur-xl dark:bg-neutral-950/90 dark:text-white"
+ >
+ <AuthState>
+ <template #default="{ loggedIn, clear }">
+ <div
+ class="flex w-full min-w-0 items-center gap-3 px-3 sm:px-4 lg:gap-5"
+ :style="{ height: `${FIXED_HEADER_HEIGHT_PX}px` }"
+ >
+ <MasonryItemHeaderIdentity
+ variant="fixed"
+ :logged-in="loggedIn"
+ />
+ <MasonryItemHeaderStats
+ variant="fixed"
+ :total="stats?.total"
+ :date-range-text="dateRangeText"
+ />
+ <MasonryItemActions
+ :logged-in="loggedIn"
+ :clear="clear"
+ compact
+ class="ml-auto shrink-0 gap-1 lg:ml-0"
+ >
+ <template #compact-details>
+ <MasonryItemHeaderStats
+ variant="fixed"
+ compact
+ :total="stats?.total"
+ :date-range-text="dateRangeText"
+ />
+ <MasonryItemHeaderFooter
+ variant="fixed"
+ compact
+ />
+ </template>
+ </MasonryItemActions>
+ <MasonryItemHeaderFooter variant="fixed" />
+ </div>
+ </template>
+ </AuthState>
+ </header>
+</template>
diff --git a/app/components/masonry/item/HeaderFooter.vue b/app/components/masonry/item/HeaderFooter.vue
new file mode 100644
index 00000000..983f91af
--- /dev/null
+++ b/app/components/masonry/item/HeaderFooter.vue
@@ -0,0 +1,76 @@
+<script lang="ts" setup>
+import { motion, AnimatePresence } from 'motion-v'
+
+const props = withDefaults(
+ defineProps<{
+ variant: 'embedded' | 'fixed'
+ compact?: boolean
+ }>(),
+ { compact: false },
+)
+
+const isFixed = computed(() => props.variant === 'fixed')
+const isRepoLinkHovering = ref(false)
+const copyrightName = computed(
+ () => getSetting('app:author') || getSetting('app:title'),
+)
+</script>
+
+<template>
+ <div
+ :class="
+ isFixed
+ ? compact
+ ? 'mt-2 border-t border-neutral-200 pt-2 dark:border-neutral-800'
+ : 'hidden max-w-52 shrink-0 flex-col items-end border-l border-neutral-200 pl-5 text-[11px] leading-5 text-neutral-500 dark:border-neutral-800 lg:flex'
+ : 'flex w-full items-center justify-between gap-2 bg-neutral-200/50 px-2 pb-1 pt-1.5 dark:bg-neutral-900/50'
+ "
+ >
+ <p
+ v-if="copyrightName"
+ :class="
+ isFixed
+ ? compact
+ ? ''
+ : 'w-full truncate text-right'
+ : 'truncate text-xs font-medium text-neutral-500/80 dark:text-neutral-500'
+ "
+ >
+ © {{ $dayjs().format('YYYY') }} {{ copyrightName }}
+ </p>
+ <a
+ href="https://github.com/HoshinoSuzumi/chronoframe"
+ target="_blank"
+ rel="noopener noreferrer"
+ :class="
+ isFixed
+ ? compact
+ ? 'inline-flex items-center gap-1 hover:underline'
+ : 'inline-flex items-center gap-1 whitespace-nowrap hover:underline'
+ : 'group inline-flex items-center gap-0.5 text-xs font-medium text-neutral-500/60 hover:underline dark:text-neutral-500/80'
+ "
+ @mouseenter="isRepoLinkHovering = true"
+ @mouseleave="isRepoLinkHovering = false"
+ >
+ <Icon
+ name="mdi:github"
+ mode="svg"
+ :class="isFixed ? '' : '-mt-px inline-block text-sm'"
+ />
+ ChronoFrame
+ <template v-if="isFixed">{{ ' ' }}{{ $config.public.VERSION }}</template>
+ <AnimatePresence v-else>
+ <motion.span
+ v-if="isRepoLinkHovering"
+ :initial="{ width: 0, opacity: 0 }"
+ :animate="{ width: 'auto', opacity: 1 }"
+ :exit="{ width: 0, opacity: 0 }"
+ :transition="{ duration: 0.3, ease: 'easeInOut' }"
+ style="overflow: hidden; white-space: nowrap"
+ >
+ ({{ $config.public.VERSION }})
+ </motion.span>
+ </AnimatePresence>
+ </a>
+ </div>
+</template>
diff --git a/app/components/masonry/item/HeaderIdentity.vue b/app/components/masonry/item/HeaderIdentity.vue
new file mode 100644
index 00000000..8437bff7
--- /dev/null
+++ b/app/components/masonry/item/HeaderIdentity.vue
@@ -0,0 +1,67 @@
+<script lang="ts" setup>
+const props = defineProps<{
+ variant: 'embedded' | 'fixed'
+ loggedIn: boolean
+}>()
+
+const router = useRouter()
+const isFixed = computed(() => props.variant === 'fixed')
+const title = computed(() => getSetting('app:title'))
+const author = computed(() => getSetting('app:author'))
+const avatarUrl = computed(
+ () =>
+ (getSetting('app:avatarUrl') as string) || '/web-app-manifest-192x192.png',
+)
+</script>
+
+<template>
+ <div
+ :class="
+ isFixed
+ ? 'flex min-w-0 flex-1 items-center gap-2 lg:flex-none lg:gap-3'
+ : 'flex flex-col items-center gap-2'
+ "
+ >
+ <div :class="isFixed ? 'relative shrink-0' : 'relative mx-auto'">
+ <img
+ :src="avatarUrl"
+ :class="isFixed ? 'size-11' : 'size-16'"
+ class="block rounded-full object-cover"
+ data-tour="home-avatar"
+ :alt="loggedIn ? $t('ui.photo.avatarAlt') : ''"
+ @error="handleAvatarError"
+ />
+ <button
+ v-if="!loggedIn"
+ type="button"
+ :aria-label="$t('auth.form.signin.title')"
+ class="absolute inset-0 cursor-pointer rounded-full focus-visible:outline-2 focus-visible:outline-offset-4 focus-visible:outline-primary-500"
+ @click="router.push('/signin')"
+ />
+ <span
+ v-if="loggedIn"
+ aria-hidden="true"
+ class="absolute -right-0.5 -bottom-0.5 flex size-5 items-center justify-center rounded-full bg-amber-500 text-xs text-white drop-shadow-lg drop-shadow-amber-500/30"
+ >
+ <Icon name="tabler:star-filled" />
+ </span>
+ </div>
+ <div :class="isFixed ? 'min-w-0 max-w-56' : ''">
+ <h1
+ :class="
+ isFixed
+ ? 'truncate text-base font-semibold leading-tight sm:text-lg'
+ : 'mb-2 text-2xl font-bold text-neutral-900 dark:text-white/90'
+ "
+ >
+ {{ title }}
+ </h1>
+ <p
+ v-if="isFixed && author && author !== title"
+ class="truncate text-xs text-neutral-500 dark:text-neutral-400"
+ >
+ {{ author }}
+ </p>
+ </div>
+ </div>
+</template>
diff --git a/app/components/masonry/item/HeaderStats.vue b/app/components/masonry/item/HeaderStats.vue
new file mode 100644
index 00000000..c0867de8
--- /dev/null
+++ b/app/components/masonry/item/HeaderStats.vue
@@ -0,0 +1,59 @@
+<script lang="ts" setup>
+const props = withDefaults(
+ defineProps<{
+ variant: 'embedded' | 'fixed'
+ compact?: boolean
+ total?: number
+ dateRangeText: string
+ }>(),
+ { compact: false },
+)
+
+const { t } = useI18n()
+const photoSummary = computed(() =>
+ props.total
+ ? t('ui.stats.totalPhotosWithRange', {
+ range: props.dateRangeText,
+ count: props.total,
+ })
+ : t('ui.stats.noPhotosTip'),
+)
+const isFixed = computed(() => props.variant === 'fixed')
+</script>
+
+<template>
+ <div
+ :class="
+ compact
+ ? ''
+ : isFixed
+ ? 'hidden min-w-0 flex-1 flex-col justify-center border-l border-neutral-200 pl-5 text-xs text-neutral-600 dark:border-neutral-800 dark:text-neutral-300 lg:flex'
+ : 'space-y-1 text-center text-neutral-600 dark:text-white/30'
+ "
+ >
+ <p
+ :class="
+ isFixed
+ ? compact
+ ? 'font-medium'
+ : 'truncate font-medium'
+ : 'text-xs font-medium'
+ "
+ :title="isFixed && !compact ? photoSummary : undefined"
+ >
+ {{ photoSummary }}
+ </p>
+ <p
+ v-if="getSetting('app:slogan')"
+ :class="
+ isFixed
+ ? compact
+ ? 'mt-1'
+ : 'truncate font-[Pacifico] text-sm text-neutral-500 dark:text-neutral-400'
+ : 'font-[Pacifico]'
+ "
+ >
+ {{ getSetting('app:slogan') }}
+ </p>
+ </div>
+</template>
diff --git a/app/components/ui/DateRangeIndicator.vue b/app/components/ui/DateRangeIndicator.vue
index f721a3d5..6c66044f 100644
--- a/app/components/ui/DateRangeIndicator.vue
+++ b/app/components/ui/DateRangeIndicator.vue
@@ -6,6 +6,7 @@ const props = defineProps<{
locations?: string
isVisible: boolean
isMobile?: boolean
+ topOffset?: number
class?: string
}>()
@@ -36,6 +37,12 @@ const mobileVariants = {
y: 0,
},
}
+
+// The desktop indicator is a floating card, so it keeps a gap below the fixed
+// header, mirroring the default top-4/top-6 offset it uses without a header.
+// The mobile indicator is an edge-to-edge bar; it intentionally sits flush
+// against the bottom edge of the fixed header instead of using this gap.
+const DESKTOP_TOP_GAP = 16
</script>
<template>
@@ -44,7 +51,13 @@ const mobileVariants = {
<!-- Desktop Date Range Indicator -->
<motion.div
v-if="shouldShow && !isMobile"
- class="fixed top-4 left-4 z-50 lg:top-6 lg:left-6 flex flex-col gap-1 bg-black/40 backdrop-blur-3xl rounded-xl border border-white/10 px-4 py-2 pb-4 shadow-2xl"
+ class="fixed left-4 z-50 lg:left-6 flex flex-col gap-1 bg-black/40 backdrop-blur-3xl rounded-xl border border-white/10 px-4 py-2 pb-4 shadow-2xl"
+ :class="topOffset == null ? 'top-4 lg:top-6' : ''"
+ :style="
+ topOffset == null
+ ? undefined
+ : { top: `${topOffset + DESKTOP_TOP_GAP}px` }
+ "
:initial="dateRangeVariants.initial"
:animate="dateRangeVariants.animate"
:exit="dateRangeVariants.initial"
@@ -55,7 +68,7 @@ const mobileVariants = {
}"
>
<span
- class="text-white text-4xl font-black leading-normal tracking-wide"
+ class="text-white text-2xl font-black leading-normal tracking-wide"
>{{ dateRange }}</span
>
<span
@@ -68,7 +81,9 @@ const mobileVariants = {
<!-- Mobile Date Range Indicator -->
<motion.div
v-if="shouldShow && isMobile"
- class="fixed inset-0 bottom-auto z-50"
+ class="fixed inset-x-0 bottom-auto z-50"
+ :class="topOffset == null ? 'top-0' : ''"
+ :style="topOffset == null ? undefined : { top: `${topOffset}px` }"
:initial="mobileVariants.initial"
:animate="mobileVariants.animate"
:exit="mobileVariants.initial"
diff --git a/app/utils/index.ts b/app/utils/index.ts
index a8b6f15e..fd89503e 100644
--- a/app/utils/index.ts
+++ b/app/utils/index.ts
@@ -1,3 +1,5 @@
+export const FIXED_HEADER_HEIGHT_PX = 60
+
// 格式化字节大小的辅助函数
export const formatBytes = (bytes: number): string => {
if (bytes === 0) return '0 B'
diff --git a/docs/guide/usage.md b/docs/guide/usage.md
index 5f7c22cc..c3368416 100644
--- a/docs/guide/usage.md
+++ b/docs/guide/usage.md
@@ -31,18 +31,20 @@ Album passwords control access through ChronoFrame. If S3, OpenList or a CDN exp
Site details, maps, location services, storage and upload limits can be edited in the dashboard. Settings are stored in the database; there is no need to edit `.env` or rebuild the container.
-| Setting | Purpose |
-| --------- | -------------------------------------------------------------------- |
-| Site | Title, description, author, avatar and color theme |
-| Storage | Add or edit local, S3 and OpenList schemes; choose the active scheme |
-| Map | MapLibre / Mapbox, access token and map style |
-| Location | Place-name language, Mapbox geocoding token and custom Nominatim URL |
-| System | Upload size limit, duplicate handling and GitHub login |
-| Privacy | Automatically remove location data from new uploads |
-| Analytics | Custom tracking scripts inserted into the page head or body |
+| Setting | Purpose |
+| --------- | ---------------------------------------------------------------------- |
+| Site | Title, description, author, avatar, color theme and home header layout |
+| Storage | Add or edit local, S3 and OpenList schemes; choose the active scheme |
+| Map | MapLibre / Mapbox, access token and map style |
+| Location | Place-name language, Mapbox geocoding token and custom Nominatim URL |
+| System | Upload size limit, duplicate handling and GitHub login |
+| Privacy | Automatically remove location data from new uploads |
+| Analytics | Custom tracking scripts inserted into the page head or body |
For provider selection, credentials and CORS, see [Storage schemes](/configuration/storage-providers). For tokens and styles, see [Maps and locations](/configuration/map-providers).
+In **General Settings → Appearance**, choose the home header layout. **Embedded in photo wall** is the default. **Fixed at top** keeps the header visible while visitors scroll the photos. Save the Appearance section to apply the change.
+
::: tip After changing settings
- **Place-name language**: reindex existing locations to update saved names.
diff --git a/docs/zh/guide/usage.md b/docs/zh/guide/usage.md
index 5c28fc91..d9716e27 100644
--- a/docs/zh/guide/usage.md
+++ b/docs/zh/guide/usage.md
@@ -33,7 +33,7 @@ Apple Live Photo 的照片和 MOV 文件使用同一文件名,例如 `IMG_1234
| 设置 | 用途 |
| ---- | --------------------------------------------------------- |
-| 站点 | 名称、介绍、作者、头像和明暗主题 |
+| 站点 | 名称、介绍、作者、头像、明暗主题和首页页眉布局 |
| 存储 | 新增和编辑本地、S3、OpenList 存储方案,选择当前使用的方案 |
| 地图 | MapLibre / Mapbox、访问令牌和地图样式 |
| 位置 | 地名语言、Mapbox 反向地理编码令牌、自定义 Nominatim 地址 |
@@ -43,6 +43,8 @@ Apple Live Photo 的照片和 MOV 文件使用同一文件名,例如 `IMG_1234
存储选型、凭据与 CORS 见[存储方案](/zh/configuration/storage-providers);地图令牌与样式设置见[地图和位置](/zh/configuration/map-providers)。
+在**基本设置 → 外观设置**中选择首页页眉布局。默认使用**嵌入照片墙**;选择**固定在顶部**后,访客滚动照片时页眉会保持可见。保存外观设置即可应用。
+
::: tip 修改设置后检查
- **地名语言**:已有地点名称不会自动更新,需要重新索引位置。
diff --git a/i18n/locales/en.json b/i18n/locales/en.json
index 2ce7e4b0..678c5f53 100644
--- a/i18n/locales/en.json
+++ b/i18n/locales/en.json
@@ -12,6 +12,7 @@
"auto": "Auto (browser language)"
},
"action": {
+ "more": { "tooltip": "More options" },
"filter": {
"tooltip": "Filter Photos",
"title": "Filter Photos",
@@ -1197,6 +1198,12 @@
"light": "Light",
"dark": "Dark",
"system": "System"
+ },
+ "homeHeaderLayout": {
+ "label": "Home header layout",
+ "description": "Choose how the header appears above the home photo wall",
+ "embedded": "Embedded in photo wall",
+ "fixed": "Fixed at top"
}
},
"upload": {
diff --git a/i18n/locales/ja.json b/i18n/locales/ja.json
index 31248842..83079b2a 100644
--- a/i18n/locales/ja.json
+++ b/i18n/locales/ja.json
@@ -12,6 +12,7 @@
"auto": "自動(ブラウザの言語)"
},
"action": {
+ "more": { "tooltip": "その他のメニュー" },
"filter": {
"tooltip": "写真をフィルター",
"title": "写真をフィルター",
@@ -1122,6 +1123,12 @@
"light": "ライト",
"dark": "ダーク",
"system": "システム"
+ },
+ "homeHeaderLayout": {
+ "label": "ホームのヘッダーレイアウト",
+ "description": "ホームの写真ウォールでのヘッダー表示方法を選択",
+ "embedded": "写真ウォールに埋め込む",
+ "fixed": "上部に固定"
}
},
"upload": {
diff --git a/i18n/locales/ru.json b/i18n/locales/ru.json
index 1260e12a..b89fd03b 100644
--- a/i18n/locales/ru.json
+++ b/i18n/locales/ru.json
@@ -12,6 +12,7 @@
"auto": "Авто (язык браузера)"
},
"action": {
+ "more": { "tooltip": "Другие действия" },
"filter": {
"tooltip": "Фильтр фотографий",
"title": "Фильтр фотографий",
@@ -1197,6 +1198,12 @@
"light": "Светлая",
"dark": "Тёмная",
"system": "Системная"
+ },
+ "homeHeaderLayout": {
+ "label": "Расположение заголовка главной страницы",
+ "description": "Выберите расположение заголовка относительно фотостены",
+ "embedded": "Встроен в фотостену",
+ "fixed": "Закреплён сверху"
}
},
"upload": {
diff --git a/i18n/locales/zh-Hans.json b/i18n/locales/zh-Hans.json
index 06af00fc..b1243746 100644
--- a/i18n/locales/zh-Hans.json
+++ b/i18n/locales/zh-Hans.json
@@ -27,6 +27,7 @@
},
"livePhoto": "实况",
"action": {
+ "more": { "tooltip": "更多选项" },
"dashboard": {
"tooltip": "控制台"
},
@@ -1197,6 +1198,12 @@
"light": "浅色",
"dark": "深色",
"system": "系统"
+ },
+ "homeHeaderLayout": {
+ "label": "首页页眉布局",
+ "description": "选择页眉在首页照片墙中的显示方式",
+ "embedded": "嵌入照片墙",
+ "fixed": "固定在顶部"
}
},
"upload": {
diff --git a/i18n/locales/zh-Hant-HK.json b/i18n/locales/zh-Hant-HK.json
index 621d135c..117d6637 100644
--- a/i18n/locales/zh-Hant-HK.json
+++ b/i18n/locales/zh-Hant-HK.json
@@ -27,6 +27,7 @@
},
"livePhoto": "原況",
"action": {
+ "more": { "tooltip": "更多選項" },
"dashboard": {
"tooltip": "控制台"
},
@@ -1122,6 +1123,12 @@
"light": "淺色",
"dark": "深色",
"system": "系統"
+ },
+ "homeHeaderLayout": {
+ "label": "首頁頁首版面",
+ "description": "選擇頁首喺首頁相片牆嘅顯示方式",
+ "embedded": "嵌入相片牆",
+ "fixed": "固定喺頂部"
}
},
"upload": {
diff --git a/i18n/locales/zh-Hant-TW.json b/i18n/locales/zh-Hant-TW.json
index 7c2d59bd..49ce9caf 100644
--- a/i18n/locales/zh-Hant-TW.json
+++ b/i18n/locales/zh-Hant-TW.json
@@ -27,6 +27,7 @@
},
"livePhoto": "原況",
"action": {
+ "more": { "tooltip": "更多選項" },
"dashboard": {
"tooltip": "儀表板"
},
@@ -1122,6 +1123,12 @@
"light": "淺色",
"dark": "深色",
"system": "系統"
+ },
+ "homeHeaderLayout": {
+ "label": "首頁頁首版面",
+ "description": "選擇頁首在首頁照片牆中的顯示方式",
+ "embedded": "嵌入照片牆",
+ "fixed": "固定在頂部"
}
},
"upload": {
diff --git a/server/services/settings/contants.ts b/server/services/settings/contants.ts
index f18ff906..c488a0ac 100644
--- a/server/services/settings/contants.ts
+++ b/server/services/settings/contants.ts
@@ -89,6 +89,16 @@ export const DEFAULT_SETTINGS = [
description: 'settings.app.appearance.theme.description',
isPublic: true,
},
+ {
+ namespace: 'app',
+ key: 'appearance.homeHeaderLayout',
+ type: 'string',
+ defaultValue: 'embedded',
+ enum: ['embedded', 'fixed'],
+ label: 'settings.app.appearance.homeHeaderLayout.label',
+ description: 'settings.app.appearance.homeHeaderLayout.description',
+ isPublic: true,
+ },
{
namespace: 'system',
key: 'upload.maxFileSize',
diff --git a/server/services/settings/ui-config.ts b/server/services/settings/ui-config.ts
index a929d326..335b7c3a 100644
--- a/server/services/settings/ui-config.ts
+++ b/server/services/settings/ui-config.ts
@@ -51,6 +51,21 @@ export const APP_SETTINGS_UI: Record<string, FieldUIConfig> = {
],
help: 'settings.app.appearance.theme.help',
},
+ 'appearance.homeHeaderLayout': {
+ type: 'tabs',
+ options: [
+ {
+ label: 'settings.app.appearance.homeHeaderLayout.embedded',
+ value: 'embedded',
+ icon: 'tabler:layout-grid',
+ },
+ {
+ label: 'settings.app.appearance.homeHeaderLayout.fixed',
+ value: 'fixed',
+ icon: 'tabler:layout-navbar',
+ },
+ ],
+ },
}
export const MAP_SETTINGS_UI: Record<string, FieldUIConfig> = {