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(gallery): redesign header and mobile gallery controls

Timothy Yind74327f66e74
diff --git a/packages/gallery/app/components/masonry/Root.vue b/packages/gallery/app/components/masonry/Root.vue
index 1e395940..78ead290 100644
--- a/packages/gallery/app/components/masonry/Root.vue
+++ b/packages/gallery/app/components/masonry/Root.vue
@@ -1,10 +1,6 @@
<script setup lang="ts">
import { motion } from 'motion-v'
-import {
- FIXED_HEADER_HEIGHT_PX,
- FIXED_HEADER_SOCIAL_ROW_HEIGHT_PX,
-} from '#gallery/utils'
-import { parseSocialLinks } from '@chronoframe/contracts/social-links'
+import { FIXED_HEADER_HEIGHT_PX } from '#gallery/utils'
interface Props {
photos: Photo[]
columns?: number | 'auto'
@@ -23,14 +19,6 @@ 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
@@ -45,6 +33,7 @@ const MASONRY_GAP = 4
const masonryWrapper = ref<HTMLElement>()
const hasAnimated = ref(false)
const showFloatingActions = ref(false)
+const isHeaderCondensed = ref(false)
const dateRange = ref<string>()
const visiblePhotos = ref(new Set<number>())
@@ -299,6 +288,7 @@ const updateDateRange = () => {
const handleScroll = () => {
const scrollTop = window.pageYOffset || document.documentElement.scrollTop
+ isHeaderCondensed.value = scrollTop > 32
showFloatingActions.value = scrollTop > 500
}
@@ -311,6 +301,7 @@ const scrollToTop = () => {
onMounted(() => {
window.addEventListener('scroll', handleScroll, { passive: true })
+ handleScroll()
nextTick(() => {
updateEmbeddedHeaderWidth()
@@ -358,7 +349,6 @@ const scrollToPhoto = (photoIndex: number) => {
})
}
}
-
</script>
<template>
@@ -366,8 +356,7 @@ const scrollToPhoto = (photoIndex: number) => {
<DateRangeIndicator
:date-range="dateRange"
:locations="visibleCities"
- :is-visible="!!dateRange && showFloatingActions"
- :is-mobile="isMobile"
+ :is-visible="!!dateRange && showFloatingActions && !isMobile"
:top-offset="isFixedHeader ? fixedHeaderHeight : undefined"
/>
@@ -379,17 +368,16 @@ const scrollToPhoto = (photoIndex: number) => {
<MasonryItemHeaderFixed
:stats="photoStats"
:date-range-text
+ :visible-date-range="dateRange"
+ :visible-locations="visibleCities"
+ :condensed="isMobile && isHeaderCondensed && !!dateRange"
/>
</div>
<div
v-if="isFixedHeader"
aria-hidden="true"
- :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`,
- }"
+ :style="{ height: `${fixedHeaderHeight}px` }"
/>
<!-- Back to Top Button -->
@@ -416,12 +404,12 @@ const scrollToPhoto = (photoIndex: number) => {
<div
class="lg:px-0 lg:pb-0"
- :class="isMobile ? 'px-1 pb-1' : 'p-1'"
+ :class="isFixedHeader || isMobile ? 'px-1 pb-1' : 'p-1'"
>
<div
ref="masonryWrapper"
class="relative"
- :class="{ 'pt-2': isMobile }"
+ :class="{ 'pt-2': isMobile && !isFixedHeader }"
:style="{ '--masonry-header-offset': `${embeddedHeaderOffset}px` }"
>
<div
@@ -471,12 +459,6 @@ const scrollToPhoto = (photoIndex: number) => {
</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/Actions.vue b/packages/gallery/app/components/masonry/item/Actions.vue
index 2284fb59..86d8f597 100644
--- a/packages/gallery/app/components/masonry/item/Actions.vue
+++ b/packages/gallery/app/components/masonry/item/Actions.vue
@@ -1,11 +1,17 @@
<script lang="ts" setup>
+import {
+ photoOverlayCardUi,
+ photoOverlayPopoverUi,
+} from '../../../utils/photoOverlayPresentation'
+
withDefaults(
defineProps<{
loggedIn: boolean
clear: () => void | Promise<void>
compact?: boolean
+ grouped?: boolean
}>(),
- { compact: false },
+ { compact: false, grouped: false },
)
const colorMode = useColorMode()
@@ -28,68 +34,195 @@ const totalSelectedFilters = computed(() =>
</script>
<template>
- <div class="flex items-center">
+ <div
+ class="flex items-center"
+ :class="grouped ? 'gap-2' : undefined"
+ >
<div
- :class="compact ? 'hidden lg:flex' : 'flex'"
- class="items-center"
+ class="flex items-center"
+ :class="
+ grouped
+ ? 'gap-0.5 rounded-2xl bg-neutral-900/[0.04] p-1 dark:bg-white/[0.06]'
+ : undefined
+ "
>
- <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="albumListPath"
- />
- </UTooltip>
- </div>
- <OverlayFilterPopover>
- <UTooltip :text="$t('ui.action.filter.tooltip')">
- <UChip
- inset
- size="sm"
- color="info"
- :show="totalSelectedFilters > 0"
+ <div
+ :class="
+ grouped
+ ? 'hidden items-center gap-0.5 lg:flex'
+ : compact
+ ? 'hidden items-center lg:flex'
+ : 'flex items-center'
+ "
+ >
+ <UTooltip
+ :text="$t('ui.action.globe.tooltip')"
+ :delay-duration="0"
>
<UButton
variant="soft"
- :color="hasActiveFilters ? 'info' : 'neutral'"
- class="relative cursor-pointer rounded-full bg-transparent"
- icon="tabler:filter"
+ color="neutral"
+ class="cursor-pointer rounded-full bg-transparent"
+ icon="tabler:map-pin-2"
size="sm"
+ to="/globe"
/>
- </UChip>
- </UTooltip>
- </OverlayFilterPopover>
- <OverlaySortPopover>
- <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>
- </OverlaySortPopover>
+ </UTooltip>
+ <UTooltip
+ :text="$t('title.albums')"
+ :delay-duration="0"
+ >
+ <UButton
+ variant="soft"
+ color="neutral"
+ class="cursor-pointer rounded-full bg-transparent"
+ icon="tabler:photo"
+ size="sm"
+ :to="albumListPath"
+ />
+ </UTooltip>
+ </div>
+ <OverlayFilterPopover>
+ <UTooltip
+ :text="$t('ui.action.filter.tooltip')"
+ :delay-duration="0"
+ >
+ <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>
+ </OverlayFilterPopover>
+ <OverlaySortPopover>
+ <UTooltip
+ :text="$t('ui.action.sort.tooltip')"
+ :delay-duration="0"
+ >
+ <UButton
+ variant="soft"
+ :color="
+ currentSortOption?.key === 'dateTaken-desc' ? 'neutral' : 'info'
+ "
+ class="cursor-pointer rounded-full bg-transparent"
+ :icon="currentSortIcon"
+ size="sm"
+ />
+ </UTooltip>
+ </OverlaySortPopover>
+ <UPopover
+ v-if="compact"
+ :ui="photoOverlayPopoverUi"
+ >
+ <UTooltip
+ :text="$t('ui.action.more.tooltip')"
+ :delay-duration="0"
+ >
+ <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"
+ />
+ </UTooltip>
+ <template #content>
+ <UCard
+ variant="glassmorphism"
+ :ui="photoOverlayCardUi"
+ class="w-3xs max-w-[calc(100vw-1rem)]"
+ >
+ <div class="space-y-1">
+ <UButton
+ variant="ghost"
+ color="neutral"
+ icon="tabler:map-pin-2"
+ :label="$t('ui.action.globe.tooltip')"
+ size="sm"
+ block
+ class="justify-start"
+ to="/globe"
+ />
+ <UButton
+ variant="ghost"
+ color="neutral"
+ icon="tabler:photo"
+ :label="$t('title.albums')"
+ size="sm"
+ block
+ class="justify-start"
+ :to="albumListPath"
+ />
+ <UButton
+ variant="ghost"
+ color="neutral"
+ :icon="isDark ? 'tabler:sun' : 'tabler:moon'"
+ :label="$t('ui.action.theme.tooltip')"
+ size="sm"
+ block
+ class="justify-start"
+ @click="isDark = !isDark"
+ />
+ <UButton
+ v-if="loggedIn"
+ variant="ghost"
+ color="info"
+ icon="tabler:dashboard"
+ :label="$t('ui.action.dashboard.tooltip')"
+ size="sm"
+ block
+ class="justify-start"
+ to="/dashboard"
+ />
+ <UButton
+ v-if="loggedIn"
+ variant="ghost"
+ color="error"
+ icon="tabler:logout"
+ :label="$t('ui.action.logout.tooltip')"
+ size="sm"
+ block
+ class="justify-start"
+ @click="clear"
+ />
+ </div>
+ <MasonryItemHeaderSocialLinksMenu />
+ <div
+ v-if="$slots['compact-details']"
+ class="border-t border-neutral-300/50 px-1 pt-2 text-[11px] leading-4 text-neutral-500 dark:border-neutral-500/50 dark:text-neutral-400"
+ >
+ <slot name="compact-details" />
+ </div>
+ <MasonryItemHeaderFooter variant="menu" />
+ </UCard>
+ </template>
+ </UPopover>
+ </div>
<div
- :class="compact ? 'hidden lg:flex' : 'flex'"
- class="items-center"
+ :class="[
+ 'items-center',
+ grouped
+ ? 'hidden gap-0.5 rounded-2xl bg-neutral-900/[0.04] p-1 lg:flex dark:bg-white/[0.06]'
+ : compact
+ ? 'hidden lg:flex'
+ : 'flex',
+ ]"
>
- <UTooltip :text="$t('ui.action.theme.tooltip')">
+ <UTooltip
+ :text="$t('ui.action.theme.tooltip')"
+ :delay-duration="0"
+ >
<UButton
variant="soft"
color="neutral"
@@ -102,6 +235,7 @@ const totalSelectedFilters = computed(() =>
<UTooltip
v-if="loggedIn"
:text="$t('ui.action.dashboard.tooltip')"
+ :delay-duration="0"
>
<UButton
size="sm"
@@ -116,6 +250,7 @@ const totalSelectedFilters = computed(() =>
<UTooltip
v-if="loggedIn"
:text="$t('ui.action.logout.tooltip')"
+ :delay-duration="0"
>
<UButton
size="sm"
@@ -127,62 +262,5 @@ const totalSelectedFilters = computed(() =>
/>
</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="albumListPath"
- />
- <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/packages/gallery/app/components/masonry/item/Header.vue b/packages/gallery/app/components/masonry/item/Header.vue
index 5f29b8af..7b48a6b4 100644
--- a/packages/gallery/app/components/masonry/item/Header.vue
+++ b/packages/gallery/app/components/masonry/item/Header.vue
@@ -41,7 +41,7 @@ defineProps<{
/>
</template>
</AuthState>
- <MasonryItemHeaderSocialLinks />
+ <MasonryItemHeaderSocialLinks variant="embedded" />
<MasonryItemHeaderFooter variant="embedded" />
</div>
</div>
diff --git a/packages/gallery/app/components/masonry/item/HeaderFixed.vue b/packages/gallery/app/components/masonry/item/HeaderFixed.vue
index 621bbee1..9eea75c6 100644
--- a/packages/gallery/app/components/masonry/item/HeaderFixed.vue
+++ b/packages/gallery/app/components/masonry/item/HeaderFixed.vue
@@ -10,55 +10,77 @@ defineProps<{
} | null
}
dateRangeText: string
+ visibleDateRange?: string
+ visibleLocations?: string
+ condensed?: boolean
}>()
</script>
<template>
- <header
- class="w-full bg-white/90 text-neutral-900 backdrop-blur-xl dark:bg-neutral-950/90 dark:text-white"
- >
+ <header class="fixed-header-glass w-full text-neutral-900 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"
+ class="flex w-full min-w-0 items-center gap-3 px-3 lg:gap-4"
:style="{ height: `${FIXED_HEADER_HEIGHT_PX}px` }"
>
<MasonryItemHeaderIdentity
variant="fixed"
:logged-in="loggedIn"
+ :visible-date-range="visibleDateRange"
+ :visible-locations="visibleLocations"
+ :condensed="condensed"
/>
<MasonryItemHeaderStats
variant="fixed"
:total="stats?.total"
:date-range-text="dateRangeText"
/>
- <MasonryItemHeaderSocialLinks variant="fixedDesktop" />
- <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 class="ml-auto flex shrink-0 items-center gap-2">
+ <MasonryItemHeaderSocialLinks variant="fixedDesktop" />
+ <MasonryItemActions
+ :logged-in="loggedIn"
+ :clear="clear"
+ compact
+ grouped
+ class="shrink-0"
+ >
+ <template #compact-details>
+ <MasonryItemHeaderStats
+ variant="fixed"
+ compact
+ :total="stats?.total"
+ :date-range-text="dateRangeText"
+ />
+ </template>
+ </MasonryItemActions>
+ </div>
</div>
- <MasonryItemHeaderSocialLinks
- variant="fixedMobile"
- class="border-t border-neutral-200 px-2 dark:border-neutral-800"
- />
</template>
</AuthState>
</header>
</template>
+
+<style scoped>
+.fixed-header-glass {
+ background-image: linear-gradient(
+ to bottom,
+ rgb(255 255 255 / 96%) 0%,
+ rgb(255 255 255 / 92%) 25%,
+ rgb(255 255 255 / 78%) 50%,
+ rgb(255 255 255 / 42%) 75%,
+ transparent 100%
+ );
+}
+
+.dark .fixed-header-glass {
+ background-image: linear-gradient(
+ to bottom,
+ rgb(37 38 41 / 96%) 0%,
+ rgb(37 38 41 / 92%) 25%,
+ rgb(37 38 41 / 78%) 50%,
+ rgb(37 38 41 / 42%) 75%,
+ transparent 100%
+ );
+}
+</style>
diff --git a/packages/gallery/app/components/masonry/item/HeaderFooter.vue b/packages/gallery/app/components/masonry/item/HeaderFooter.vue
index 2fc9c464..2af5c3e6 100644
--- a/packages/gallery/app/components/masonry/item/HeaderFooter.vue
+++ b/packages/gallery/app/components/masonry/item/HeaderFooter.vue
@@ -4,22 +4,30 @@ import { siteFooterLink } from '../../../utils/site-footer-link'
const props = withDefaults(
defineProps<{
- variant: 'embedded' | 'fixed'
+ variant: 'embedded' | 'fixed' | 'menu'
compact?: boolean
}>(),
{ compact: false },
)
const isFixed = computed(() => props.variant === 'fixed')
+const isMenu = computed(() => props.variant === 'menu')
const entry = useEntryContext()
const capabilities = useEntryCapabilities()
-const websiteHref = computed(() =>
- siteFooterLink(
- entry.value?.capabilities.edition ?? capabilities.edition,
- props.variant,
- entry.value?.siteId,
- ),
+const edition = computed(
+ () => entry.value?.capabilities.edition ?? capabilities.edition,
)
+const showMenuVersion = computed(() => isMenu.value && edition.value !== 'site')
+const websiteHref = computed(() => {
+ if (props.variant === 'menu') {
+ // Site editions keep the same marketing attribution as the embedded footer,
+ // including the original UTM parameters.
+ return edition.value === 'site'
+ ? siteFooterLink('site', 'embedded', entry.value?.siteId)
+ : null
+ }
+ return siteFooterLink(edition.value, props.variant, entry.value?.siteId)
+})
const isRepoLinkHovering = ref(false)
const copyrightName = computed(
() => getSetting('app:author') || getSetting('app:title'),
@@ -29,15 +37,17 @@ const copyrightName = computed(
<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'
+ isMenu
+ ? 'flex w-full items-center justify-end px-1 pt-2'
+ : 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"
+ v-if="copyrightName && !isMenu"
:class="
isFixed
? compact
@@ -57,7 +67,9 @@ const copyrightName = computed(
? 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'
+ : isMenu
+ ? 'group inline-flex items-center gap-0.5 text-xs font-medium text-neutral-500 hover:underline dark:text-neutral-400'
+ : '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 = !websiteHref"
@mouseleave="isRepoLinkHovering = false"
@@ -68,7 +80,9 @@ const copyrightName = computed(
:class="isFixed ? '' : '-mt-px inline-block text-sm'"
/>
ChronoFrame
- <template v-if="isFixed">{{ ' ' }}{{ $config.public.VERSION }}</template>
+ <template v-if="isFixed || showMenuVersion"
+ >{{ ' ' }}{{ $config.public.VERSION }}</template
+ >
<AnimatePresence v-else-if="!websiteHref">
<motion.span
v-if="isRepoLinkHovering"
diff --git a/packages/gallery/app/components/masonry/item/HeaderIdentity.vue b/packages/gallery/app/components/masonry/item/HeaderIdentity.vue
index 79550197..8e9b8666 100644
--- a/packages/gallery/app/components/masonry/item/HeaderIdentity.vue
+++ b/packages/gallery/app/components/masonry/item/HeaderIdentity.vue
@@ -2,12 +2,15 @@
const props = defineProps<{
variant: 'embedded' | 'fixed'
loggedIn: boolean
+ visibleDateRange?: string
+ visibleLocations?: string
+ condensed?: boolean
}>()
const visitorIdentity = useEntryCapabilities().identity === 'visitor'
const isFixed = computed(() => props.variant === 'fixed')
const title = computed(() => getSetting('app:title'))
-const author = computed(() => getSetting('app:author'))
+const slogan = computed(() => getSetting('app:slogan'))
const avatarUrl = computed(
() =>
(getSetting('app:avatarUrl') as string) || '/web-app-manifest-192x192.png',
@@ -18,14 +21,14 @@ const avatarUrl = computed(
<div
:class="
isFixed
- ? 'flex min-w-0 flex-1 items-center gap-2 lg:flex-none lg:gap-3'
+ ? 'flex min-w-0 flex-1 items-center gap-2 lg:flex-none lg:gap-2.5'
: '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="isFixed ? 'size-8' : 'size-16'"
class="block rounded-full object-cover"
data-tour="home-avatar"
:alt="loggedIn ? $t('ui.photo.avatarAlt') : ''"
@@ -46,27 +49,62 @@ const avatarUrl = computed(
<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"
+ class="absolute -right-0.5 -bottom-0.5 flex items-center justify-center rounded-full bg-amber-500 text-white drop-shadow-lg drop-shadow-amber-500/30"
+ :class="isFixed ? 'size-3.5 text-[8px]' : 'size-5 text-xs'"
>
<Icon name="tabler:star-filled" />
</span>
</div>
- <div :class="isFixed ? 'min-w-0 max-w-56' : ''">
- <h1
+ <div
+ :class="isFixed ? 'relative min-w-0 flex-1 lg:max-w-52 lg:flex-none' : ''"
+ >
+ <div
+ class="transition-all duration-300 ease-out"
: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'
+ isFixed && condensed
+ ? '-translate-y-2 opacity-0'
+ : 'translate-y-0 opacity-100'
"
+ :aria-hidden="isFixed && condensed ? 'true' : undefined"
>
- {{ title }}
- </h1>
- <p
- v-if="isFixed && author && author !== title"
- class="truncate text-xs text-neutral-500 dark:text-neutral-400"
+ <h1
+ :class="
+ isFixed
+ ? 'truncate text-sm font-semibold leading-tight'
+ : 'mb-2 text-2xl font-bold text-neutral-900 dark:text-white/90'
+ "
+ >
+ {{ title }}
+ </h1>
+ <p
+ v-if="isFixed && slogan"
+ class="truncate font-[Pacifico] text-sm leading-5 text-neutral-600 dark:text-neutral-300"
+ :title="slogan"
+ >
+ {{ slogan }}
+ </p>
+ </div>
+ <div
+ v-if="isFixed"
+ class="pointer-events-none absolute inset-0 flex flex-col items-center justify-center text-center transition-all duration-300 ease-out"
+ :class="
+ condensed ? 'translate-y-0 opacity-100' : 'translate-y-2 opacity-0'
+ "
+ :aria-hidden="condensed ? undefined : 'true'"
>
- {{ author }}
- </p>
+ <span
+ v-if="visibleDateRange"
+ class="max-w-full truncate text-sm font-semibold leading-5"
+ >
+ {{ visibleDateRange }}
+ </span>
+ <span
+ v-if="visibleLocations"
+ class="max-w-full truncate text-xs leading-4 text-neutral-600 dark:text-neutral-300"
+ >
+ {{ visibleLocations }}
+ </span>
+ </div>
</div>
</div>
</template>
diff --git a/packages/gallery/app/components/masonry/item/HeaderSocialLinks.vue b/packages/gallery/app/components/masonry/item/HeaderSocialLinks.vue
index 2a0656e5..514a1681 100644
--- a/packages/gallery/app/components/masonry/item/HeaderSocialLinks.vue
+++ b/packages/gallery/app/components/masonry/item/HeaderSocialLinks.vue
@@ -1,63 +1,52 @@
<script lang="ts" setup>
-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' }>(),
+ defineProps<{ variant?: 'embedded' | 'fixedDesktop' }>(),
{ variant: 'embedded' },
)
-const setting = useSettingRef('app:socialLinks')
-const links = computed(() => {
- try {
- return parseSocialLinks(setting.value).map((href) => ({
- href,
- ...resolveSocialPlatform(href),
- }))
- } catch {
- return []
- }
-})
+const links = useSocialLinks()
</script>
<template>
<nav
v-if="links.length"
:aria-label="$t('settings.app.socialLinks.title')"
- class="items-center justify-center gap-1"
+ class="items-center justify-center"
:class="{
- 'flex flex-wrap': props.variant === 'embedded',
+ flex: props.variant === 'embedded',
'hidden lg:flex': props.variant === 'fixedDesktop',
- '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"
- :key="link.href"
- :href="link.href"
- :aria-label="
- $t('settings.app.socialLinks.visit', { platform: link.label })
+ <div
+ :class="
+ props.variant === 'embedded'
+ ? 'flex items-center justify-center gap-0.5'
+ : 'flex items-center gap-0.5 rounded-2xl bg-neutral-900/[0.04] p-1 dark:bg-white/[0.06]'
"
- :title="link.label"
- target="_blank"
- rel="noopener noreferrer"
- class="inline-flex size-10 items-center justify-center rounded-full text-neutral-600 transition-colors hover:bg-neutral-200/70 hover:text-neutral-950 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary-500 dark:text-neutral-300 dark:hover:bg-neutral-700/70 dark:hover:text-white"
>
- <Icon
- :name="link.icon"
- mode="svg"
- class="size-4"
- aria-hidden="true"
- />
- </a>
+ <UTooltip
+ v-for="link in links"
+ :key="link.href"
+ :text="link.href"
+ :delay-duration="0"
+ >
+ <a
+ :href="link.href"
+ :aria-label="
+ $t('settings.app.socialLinks.visit', { platform: link.label })
+ "
+ target="_blank"
+ rel="noopener noreferrer"
+ class="inline-flex size-7 shrink-0 items-center justify-center rounded-full text-default transition-colors hover:bg-accented/75 active:bg-accented/75 focus-visible:outline-3 focus-visible:outline-inverted/25"
+ >
+ <Icon
+ :name="link.icon"
+ mode="svg"
+ class="size-4"
+ aria-hidden="true"
+ />
+ </a>
+ </UTooltip>
+ </div>
</nav>
</template>
diff --git a/packages/gallery/app/components/masonry/item/HeaderSocialLinksMenu.vue b/packages/gallery/app/components/masonry/item/HeaderSocialLinksMenu.vue
new file mode 100644
index 00000000..34ca03bf
--- /dev/null
+++ b/packages/gallery/app/components/masonry/item/HeaderSocialLinksMenu.vue
@@ -0,0 +1,37 @@
+<script lang="ts" setup>
+const links = useSocialLinks()
+</script>
+
+<template>
+ <div
+ v-if="links.length"
+ class="border-t border-neutral-300/50 dark:border-neutral-500/50"
+ >
+ <div class="grid grid-cols-2 gap-1 py-2">
+ <UTooltip
+ v-for="link in links"
+ :key="link.href"
+ :text="link.href"
+ :delay-duration="0"
+ >
+ <a
+ :href="link.href"
+ :aria-label="
+ $t('settings.app.socialLinks.visit', { platform: link.label })
+ "
+ target="_blank"
+ rel="noopener noreferrer"
+ class="flex min-w-0 items-center gap-1.5 rounded-md px-2 py-1.5 text-xs font-medium text-neutral-600 transition-colors hover:bg-accented/75 hover:text-neutral-900 active:bg-accented/75 focus-visible:outline-3 focus-visible:outline-inverted/25 dark:text-neutral-300 dark:hover:text-white"
+ >
+ <Icon
+ :name="link.icon"
+ mode="svg"
+ class="size-4 shrink-0"
+ aria-hidden="true"
+ />
+ <span class="truncate">{{ link.label }}</span>
+ </a>
+ </UTooltip>
+ </div>
+ </div>
+</template>
diff --git a/packages/gallery/app/components/masonry/item/HeaderStats.vue b/packages/gallery/app/components/masonry/item/HeaderStats.vue
index c0867de8..0110275a 100644
--- a/packages/gallery/app/components/masonry/item/HeaderStats.vue
+++ b/packages/gallery/app/components/masonry/item/HeaderStats.vue
@@ -27,7 +27,7 @@ const isFixed = computed(() => props.variant === 'fixed')
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'
+ ? 'hidden min-h-8 min-w-0 flex-1 flex-col justify-center border-l border-neutral-200/80 pl-4 text-[11px] leading-4 text-neutral-600 dark:border-white/10 dark:text-neutral-300 lg:flex'
: 'space-y-1 text-center text-neutral-600 dark:text-white/30'
"
>
@@ -44,14 +44,8 @@ const isFixed = computed(() => props.variant === 'fixed')
{{ 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]'
- "
+ v-if="!isFixed && getSetting('app:slogan')"
+ class="font-[Pacifico]"
>
{{ getSetting('app:slogan') }}
</p>
diff --git a/packages/gallery/app/components/ui/DateRangeIndicator.vue b/packages/gallery/app/components/ui/DateRangeIndicator.vue
index 6c66044f..89deb0a9 100644
--- a/packages/gallery/app/components/ui/DateRangeIndicator.vue
+++ b/packages/gallery/app/components/ui/DateRangeIndicator.vue
@@ -5,7 +5,6 @@ const props = defineProps<{
dateRange?: string
locations?: string
isVisible: boolean
- isMobile?: boolean
topOffset?: number
class?: string
}>()
@@ -27,30 +26,16 @@ const dateRangeVariants = {
},
}
-const mobileVariants = {
- initial: {
- opacity: 0,
- y: -20,
- },
- animate: {
- opacity: 1,
- 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.
+// Keep a gap below the fixed header, mirroring the default top-4/top-6
+// offset used when the page has no fixed header.
const DESKTOP_TOP_GAP = 16
</script>
<template>
<div>
<AnimatePresence>
- <!-- Desktop Date Range Indicator -->
<motion.div
- v-if="shouldShow && !isMobile"
+ v-if="shouldShow"
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="
@@ -77,33 +62,6 @@ const DESKTOP_TOP_GAP = 16
>{{ locations }}</span
>
</motion.div>
-
- <!-- Mobile Date Range Indicator -->
- <motion.div
- v-if="shouldShow && isMobile"
- 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"
- :transition="{
- type: 'spring',
- duration: 0.3,
- bounce: 0.1,
- }"
- >
- <div
- class="bg-black/60 backdrop-blur-3xl border-b border-white/10 px-4 py-2 shadow-2xl flex flex-col"
- >
- <span class="text-white text-lg font-medium">{{ dateRange }}</span>
- <span
- v-if="locations"
- class="text-white/80 text-xs"
- >{{ locations }}</span
- >
- </div>
- </motion.div>
</AnimatePresence>
</div>
</template>
diff --git a/packages/gallery/app/composables/useSocialLinks.ts b/packages/gallery/app/composables/useSocialLinks.ts
new file mode 100644
index 00000000..ba06b172
--- /dev/null
+++ b/packages/gallery/app/composables/useSocialLinks.ts
@@ -0,0 +1,19 @@
+import {
+ parseSocialLinks,
+ resolveSocialPlatform,
+} from '@chronoframe/contracts/social-links'
+
+export function useSocialLinks() {
+ const setting = useSettingRef('app:socialLinks')
+
+ return computed(() => {
+ try {
+ return parseSocialLinks(setting.value).map((href) => ({
+ href,
+ ...resolveSocialPlatform(href),
+ }))
+ } catch {
+ return []
+ }
+ })
+}
diff --git a/packages/gallery/app/utils/index.ts b/packages/gallery/app/utils/index.ts
index 2f613499..320f0897 100644
--- a/packages/gallery/app/utils/index.ts
+++ b/packages/gallery/app/utils/index.ts
@@ -1,5 +1,4 @@
-export const FIXED_HEADER_HEIGHT_PX = 60
-export const FIXED_HEADER_SOCIAL_ROW_HEIGHT_PX = 44
+export const FIXED_HEADER_HEIGHT_PX = 56
// 格式化字节大小的辅助函数
export const formatBytes = (bytes: number): string => {