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
@@ -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[] = []