mirror of
https://github.com/bellingcat/ukraine-timemap.git
synced 2026-06-12 21:38:35 +03:00
render sources collectively in card
This commit is contained in:
@@ -87,16 +87,23 @@ class Card extends React.Component {
|
||||
}
|
||||
|
||||
renderSources() {
|
||||
return this.props.event.sources.map(source => (
|
||||
<CardSource
|
||||
isLoading={this.props.isLoading}
|
||||
language={this.props.language}
|
||||
source={{
|
||||
...source,
|
||||
error: this.props.sourceError
|
||||
}}
|
||||
/>
|
||||
))
|
||||
if (this.props.sourceError) {
|
||||
return <div>ERROR: something went wrong loading sources, TODO:</div>
|
||||
}
|
||||
|
||||
const source_lang = copy[this.props.language].cardstack.sources
|
||||
return (
|
||||
<div>
|
||||
<h4>{source_lang}: </h4>
|
||||
{this.props.event.sources.map(source => (
|
||||
<CardSource
|
||||
isLoading={this.props.isLoading}
|
||||
language={this.props.language}
|
||||
source={source}
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
// NB: should be internaionalized.
|
||||
|
||||
@@ -3,28 +3,28 @@ import Spinner from './Spinner'
|
||||
|
||||
import copy from '../../js/data/copy.json'
|
||||
|
||||
function renderSource(source) {
|
||||
return source.error ? (
|
||||
<div><small>{source.error}</small></div>
|
||||
) : (
|
||||
<div>
|
||||
<p>{source.id}</p>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
const CardSource = ({ source, language, isLoading, error }) => {
|
||||
const source_lang = copy[language].cardstack.source
|
||||
|
||||
function renderContent() {
|
||||
return isLoading
|
||||
? <Spinner/>
|
||||
: renderSource(source)
|
||||
if (isLoading) {
|
||||
return <Spinner/>
|
||||
} else if (source.error) {
|
||||
return (
|
||||
<div><small>{source.error}</small></div>
|
||||
)
|
||||
} else {
|
||||
/* source with no errors */
|
||||
return (
|
||||
<div>
|
||||
<p>{source.id}</p>
|
||||
<i className="material-icons md-36">photo</i>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="card-row card-cell source">
|
||||
<h4>{source_lang}: </h4>
|
||||
{renderContent()}
|
||||
</div>
|
||||
)
|
||||
|
||||
@@ -63,7 +63,7 @@
|
||||
"incident_type": "Tipo de acción",
|
||||
"description": "Hechos",
|
||||
"people": "Personas en el evento",
|
||||
"source": "Fuente",
|
||||
"sources": "Fuentes",
|
||||
"category": "Según el testimonio de",
|
||||
"communication": "Comunicación",
|
||||
"transmitter": "Transmisor",
|
||||
@@ -138,7 +138,7 @@
|
||||
"description": "Summary",
|
||||
"tags": "Tags",
|
||||
"notags": "No known tags for this event.",
|
||||
"source": "Source",
|
||||
"sources": "Sources",
|
||||
"unknown_source": "The information for this source could not be retrieved.",
|
||||
"category": "Category",
|
||||
"communication": "Communication",
|
||||
|
||||
Reference in New Issue
Block a user