mirror of
https://github.com/bellingcat/ukraine-timemap.git
synced 2026-06-11 12:58:35 +03:00
enables inline PDFs for sources
This commit is contained in:
@@ -10,7 +10,7 @@ export default ({ media, viewIdx, translations, switchLanguage, langIdx }) => {
|
||||
const shiftW = el ? el.getBoundingClientRect().width : 0
|
||||
|
||||
function renderMedia (media) {
|
||||
const { path, type, poster } = media
|
||||
let { path, type, poster } = media
|
||||
switch (type) {
|
||||
case 'Image':
|
||||
return (
|
||||
@@ -53,6 +53,10 @@ export default ({ media, viewIdx, translations, switchLanguage, langIdx }) => {
|
||||
/>
|
||||
</div>
|
||||
)
|
||||
case 'Document':
|
||||
return (
|
||||
<iframe className='source-document' src={path} />
|
||||
)
|
||||
default:
|
||||
return (
|
||||
<NoSource failedUrls={[`Application does not support extension: ${path.split('.')[1]}`]} />
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import React from 'react'
|
||||
import PropTypes from 'prop-types'
|
||||
import Img from 'react-image'
|
||||
|
||||
import Spinner from '../Spinner'
|
||||
import { typeForPath } from '../../../common/utilities'
|
||||
|
||||
const CardSource = ({ source, isLoading, onClickHandler }) => {
|
||||
function renderIconText (type) {
|
||||
@@ -21,6 +21,8 @@ const CardSource = ({ source, isLoading, onClickHandler }) => {
|
||||
return 'photo'
|
||||
case 'Photobook':
|
||||
return 'photo_album'
|
||||
case 'Document':
|
||||
return 'picture_as_pdf'
|
||||
default:
|
||||
return 'help'
|
||||
}
|
||||
@@ -43,6 +45,9 @@ const CardSource = ({ source, isLoading, onClickHandler }) => {
|
||||
thumbnail = imgs.length > 0 ? imgs[0] : null
|
||||
}
|
||||
|
||||
if (source.type === '' && source.paths.length >= 1) {
|
||||
source.type = typeForPath(source.paths[0])
|
||||
}
|
||||
const fallbackIcon = (
|
||||
<i className='material-icons source-icon'>
|
||||
{renderIconText(source.type)}
|
||||
|
||||
Reference in New Issue
Block a user