mirror of
https://github.com/bellingcat/ukraine-timemap.git
synced 2026-06-12 13:28:36 +03:00
cleaner declaration for cover translations
This commit is contained in:
@@ -94,8 +94,22 @@ class SourceOverlay extends React.Component {
|
||||
|
||||
renderIntlContent () {
|
||||
const { langIdx } = this.state
|
||||
const source = langIdx === 0 ? this.props.source : this.props.translations[langIdx - 1]
|
||||
return this.renderContent(source)
|
||||
const { translations, source } = this.props
|
||||
let translated = null
|
||||
if (translations && translations.length && langIdx > 0) {
|
||||
translated = translations[langIdx - 1]
|
||||
}
|
||||
if (translated) {
|
||||
translated = {
|
||||
...translated,
|
||||
poster: source.poster,
|
||||
// NOTE: this is to allow a slightly nicer syntax when using the Media
|
||||
// overlay in cover videos.
|
||||
paths: translated.file ? [translated.file] : translated.paths
|
||||
}
|
||||
}
|
||||
|
||||
return this.renderContent(langIdx === 0 ? source : translated)
|
||||
}
|
||||
|
||||
render () {
|
||||
|
||||
Reference in New Issue
Block a user