Location 移入 EXIF 信息,紧跟在 Description 之后

This commit is contained in:
gallery
2026-11-15 22:03:13 +08:00
parent 850df50e63
commit c5e576caa1
2 changed files with 14 additions and 12 deletions
@@ -17,8 +17,6 @@ import { SidebarPhotoCover } from '../AlbumCovers'
import { SidebarPhotoShare } from '../Sharing'
import SidebarMediaDownload from '../SidebarDownloadMedia'
import SidebarHeader from '../SidebarHeader'
import { SidebarSection, SidebarSectionTitle } from '../SidebarComponents'
import { mediaCaption } from '../../../helpers/mediaCaption'
import { sidebarDownloadQuery_media_downloads } from '../__generated__/sidebarDownloadQuery'
import ExifDetails from './MediaSidebarExif'
import MediaSidebarPeople from './MediaSidebarPeople'
@@ -182,8 +180,6 @@ const SidebarContent = ({ media, hidePreview }: SidebarContentProps) => {
sidebarMap = <MediaSidebarMap coordinates={mediaCoordinates} />
}
const locationCity = mediaCaption(media.title)?.city
let albumPath = null
const mediaAlbum = media.album
if (!isNil(mediaAlbum)) {
@@ -231,14 +227,6 @@ const SidebarContent = ({ media, hidePreview }: SidebarContentProps) => {
)}
</div>
<ExifDetails media={media} />
{locationCity && !mediaCoordinates && (
<SidebarSection>
<SidebarSectionTitle>
{t('sidebar.location.title', 'Location')}
</SidebarSectionTitle>
<div className="mx-4 text-base">{locationCity}</div>
</SidebarSection>
)}
{albumPath}
<MediaSidebarPeople media={media} />
{sidebarMap}
@@ -5,6 +5,7 @@ import { isNil } from '../../../helpers/utils'
import { TranslationFn } from '../../../localization'
import SidebarItem from '../SidebarItem'
import { MediaSidebarMedia } from './MediaSidebar'
import { mediaCaption } from '../../../helpers/mediaCaption'
import { DateTime } from 'luxon'
const MetadataInfoContainer = styled.div`
@@ -19,6 +20,8 @@ const ExifDetails = ({ media }: ExifDetailsProps) => {
const { t, i18n } = useTranslation()
let exifItems: JSX.Element[] = []
const locationCity = mediaCaption(media?.title)?.city
const exifName = exifNameLookup(t)
if (media?.exif) {
@@ -103,6 +106,17 @@ const ExifDetails = ({ media }: ExifDetailsProps) => {
exifItems = exifKeys.map(key => (
<SidebarItem key={key} name={exifName[key]} value={exif[key] as string} />
))
if (locationCity) {
const descriptionIndex = exifKeys.indexOf('description')
exifItems.splice(descriptionIndex + 1, 0, (
<SidebarItem
key="location"
name={t('sidebar.location.title', 'Location')}
value={locationCity}
/>
))
}
}
let videoMetadataItems: JSX.Element[] = []