diff --git a/src/components/Card.jsx b/src/components/Card.jsx index 35def13..3f4340f 100644 --- a/src/components/Card.jsx +++ b/src/components/Card.jsx @@ -87,16 +87,23 @@ class Card extends React.Component { } renderSources() { - return this.props.event.sources.map(source => ( - - )) + if (this.props.sourceError) { + return
ERROR: something went wrong loading sources, TODO:
+ } + + const source_lang = copy[this.props.language].cardstack.sources + return ( +
+

{source_lang}:

+ {this.props.event.sources.map(source => ( + + ))} +
+ ) } // NB: should be internaionalized. diff --git a/src/components/presentational/CardSource.js b/src/components/presentational/CardSource.js index fe67652..43f9329 100644 --- a/src/components/presentational/CardSource.js +++ b/src/components/presentational/CardSource.js @@ -3,28 +3,28 @@ import Spinner from './Spinner' import copy from '../../js/data/copy.json' -function renderSource(source) { - return source.error ? ( -
{source.error}
- ) : ( -
-

{source.id}

-
- ) -} - const CardSource = ({ source, language, isLoading, error }) => { - const source_lang = copy[language].cardstack.source function renderContent() { - return isLoading - ? - : renderSource(source) + if (isLoading) { + return + } else if (source.error) { + return ( +
{source.error}
+ ) + } else { + /* source with no errors */ + return ( +
+

{source.id}

+ photo +
+ ) + } } return (
-

{source_lang}:

{renderContent()}
) diff --git a/src/js/data/copy.json b/src/js/data/copy.json index 21702e0..039a50d 100644 --- a/src/js/data/copy.json +++ b/src/js/data/copy.json @@ -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",