Location 移入 EXIF 信息,紧跟在 Description 之后
This commit is contained in:
@@ -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[] = []
|
||||
|
||||
Reference in New Issue
Block a user