分享页: 照片按时间倒序、统一间距、卡片右下角显示日期与城市

This commit is contained in:
gallery
2026-11-15 20:33:21 +08:00
parent 8c376575f5
commit 6bec039595
12 changed files with 213 additions and 8 deletions
@@ -14,6 +14,7 @@ import {
import MediaSidebar from '../sidebar/MediaSidebar/MediaSidebar'
import { SidebarContext } from '../sidebar/Sidebar'
import { gql } from '@apollo/client'
import { mediaCaption } from '../../helpers/mediaCaption'
const Gallery = styled.div`
display: flex;
@@ -21,7 +22,7 @@ const Gallery = styled.div`
align-items: center;
min-height: 200px;
position: relative;
margin: -4px;
margin: -2px;
@media (max-width: 1000px) {
/* Compensate for tab bar on mobile */
@@ -37,6 +38,7 @@ export const PhotoFiller = styled.div`
export const MEDIA_GALLERY_FRAGMENT = gql`
fragment MediaGalleryFields on Media {
id
title
type
blurhash
thumbnail {
@@ -72,11 +74,17 @@ const MediaGallery = ({ mediaState, dispatchMedia }: MediaGalleryProps) => {
mediaElements = media.map((media, index) => {
const active = activeIndex == index
const caption = mediaCaption(media.title)
const captionText = caption
? `${caption.date}${caption.city ? ` ${caption.city}` : ''}`
: null
return (
<MediaThumbnail
key={media.id}
media={media}
active={active}
caption={captionText}
selectImage={() => {
dispatchMedia({
type: 'selectImage',