From 3de7b3a8c547fa2efbabeba2508a5d9d887d4a66 Mon Sep 17 00:00:00 2001 From: Lachlan Kermode Date: Tue, 22 Jan 2019 16:15:55 +0000 Subject: [PATCH] lint additional files --- src/actions/index.js | 11 +---- src/components/ToolbarBottomActions.jsx | 14 ++---- .../presentational/Card/Category.js | 12 ++--- .../presentational/Card/Location.js | 23 +++++----- .../presentational/Card/Narrative.js | 14 +++--- src/components/presentational/Card/Source.js | 45 +++++++++---------- src/components/presentational/Card/Summary.js | 15 +++---- src/components/presentational/Card/Tags.js | 41 +++++++++-------- .../presentational/Card/Timestamp.js | 31 +++++++------ .../presentational/Icons/CoeventIcon.js | 1 - .../presentational/Icons/RouteIcon.js | 1 - .../presentational/Timeline/Clip.js | 13 +++--- .../presentational/Timeline/Handles.js | 16 +++---- .../presentational/Timeline/Labels.js | 35 +++++++-------- src/reducers/app.js | 21 ++------- src/reducers/utils/helpers.js | 2 +- src/reducers/utils/validators.js | 12 ++--- src/selectors/index.js | 6 +-- src/store/initial.js | 2 +- 19 files changed, 135 insertions(+), 180 deletions(-) diff --git a/src/actions/index.js b/src/actions/index.js index 82066d1..5f10662 100644 --- a/src/actions/index.js +++ b/src/actions/index.js @@ -9,7 +9,6 @@ const SOURCES_URL = urlFromEnv('SOURCES_EXT') const NARRATIVE_URL = urlFromEnv('NARRATIVE_EXT') const SITES_URL = urlFromEnv('SITES_EXT') const SHAPES_URL = urlFromEnv('SHAPES_EXT') -const eventUrlMap = (event) => `${process.env.SERVER_ROOT}${process.env.EVENT_DESC_ROOT}/${(event.id) ? event.id : event}` const domainMsg = (domainType) => `Something went wrong fetching ${domainType}. Check the URL or try disabling them in the config file.` @@ -60,7 +59,7 @@ export function fetchDomain () { let sourcesPromise = Promise.resolve([]) if (process.env.features.USE_SOURCES) { if (!SOURCES_URL) { - sourcesPromise = Promise.resolve(makeError('USE_SOURCES is true, but you have not provided a SOURCES_EXT')) + sourcesPromise = Promise.resolve(handleError('USE_SOURCES is true, but you have not provided a SOURCES_EXT')) } else { sourcesPromise = fetch(SOURCES_URL) .then(response => response.json()) @@ -278,14 +277,6 @@ export function toggleInfoPopup () { } } -export const TOGGLE_MAPVIEW = 'TOGGLE_MAPVIEW' -export function toggleMapView (layer) { - return { - type: TOGGLE_MAPVIEW, - layer - } -} - export const TOGGLE_NOTIFICATIONS = 'TOGGLE_NOTIFICATIONS' export function toggleNotifications () { return { diff --git a/src/components/ToolbarBottomActions.jsx b/src/components/ToolbarBottomActions.jsx index b35990d..14489f5 100644 --- a/src/components/ToolbarBottomActions.jsx +++ b/src/components/ToolbarBottomActions.jsx @@ -1,26 +1,18 @@ import React from 'react'; import SitesIcon from './presentational/Icons/SitesIcon.js'; -import RefreshIcon from './presentational/Icons/RefreshIcon.js'; -import CoeventIcon from './presentational/Icons/CoeventIcon.js'; -import RouteIcon from './presentational/Icons/RouteIcon.js'; +// import RefreshIcon from './presentational/Icons/RefreshIcon.js'; +// import CoeventIcon from './presentational/Icons/CoeventIcon.js'; +// import RouteIcon from './presentational/Icons/RouteIcon.js'; function ToolbarBottomActions (props) { function renderMapActions() { return (
- {/* this.toggleMapViews(view)} */} - {/* isEnabled={this.props.viewFilters.routes} */} - {/* /> */} {process.env.features.USE_SITES ? : null} - {/* this.toggleMapViews(view)} */} - {/* isEnabled={this.props.viewFilters.coevents} */} - {/* /> */}
); } diff --git a/src/components/presentational/Card/Category.js b/src/components/presentational/Card/Category.js index ab6eb4c..83cda74 100644 --- a/src/components/presentational/Card/Category.js +++ b/src/components/presentational/Card/Category.js @@ -1,15 +1,15 @@ -import React from 'react'; +import React from 'react' -import { capitalizeFirstLetter } from '../../../js/utilities.js'; +import { capitalizeFirstLetter } from '../../../js/utilities.js' const CardCategory = ({ categoryTitle, categoryLabel, color }) => ( -
+

{categoryTitle}

{capitalizeFirstLetter(categoryLabel)} - +

-); +) -export default CardCategory; +export default CardCategory diff --git a/src/components/presentational/Card/Location.js b/src/components/presentational/Card/Location.js index 5025c5b..e828b67 100644 --- a/src/components/presentational/Card/Location.js +++ b/src/components/presentational/Card/Location.js @@ -1,30 +1,29 @@ -import React from 'react'; +import React from 'react' -import copy from '../../../js/data/copy.json'; -import { isNotNullNorUndefined } from '../../../js/utilities'; +import copy from '../../../js/data/copy.json' +import { isNotNullNorUndefined } from '../../../js/utilities' const CardLocation = ({ language, location }) => { - if (isNotNullNorUndefined(location)) { return ( -
+

- location_on + location_on {location}

- ); + ) } else { - const unknown = copy[language].cardstack.unknown_location; + const unknown = copy[language].cardstack.unknown_location return ( -
+

- location_on + location_on {unknown}

- ); + ) } } -export default CardLocation; +export default CardLocation diff --git a/src/components/presentational/Card/Narrative.js b/src/components/presentational/Card/Narrative.js index adc88f2..150180f 100644 --- a/src/components/presentational/Card/Narrative.js +++ b/src/components/presentational/Card/Narrative.js @@ -1,15 +1,15 @@ -import React from 'react'; +import React from 'react' -import CardNarrativeLink from './NarrativeLink'; +import CardNarrativeLink from './NarrativeLink' const CardNarrative = (props) => ( -
+

Connected events

-
-

+
+

-); +) -export default CardNarrative; +export default CardNarrative diff --git a/src/components/presentational/Card/Source.js b/src/components/presentational/Card/Source.js index 7447ca6..6ebacde 100644 --- a/src/components/presentational/Card/Source.js +++ b/src/components/presentational/Card/Source.js @@ -3,11 +3,10 @@ import PropTypes from 'prop-types' import Img from 'react-image' import Spinner from '../Spinner' -import copy from '../../../js/data/copy.json' const CardSource = ({ source, isLoading, onClickHandler }) => { - function renderIconText(type) { - switch(type) { + function renderIconText (type) { + switch (type) { case 'Eyewitness Testimony': return 'visibility' case 'Government Data': @@ -29,7 +28,7 @@ const CardSource = ({ source, isLoading, onClickHandler }) => { if (!source) { return ( -
+
Error: this source was not found
) @@ -45,30 +44,30 @@ const CardSource = ({ source, isLoading, onClickHandler }) => { } const fallbackIcon = ( - + {renderIconText(source.type)} ) return ( -
+
{isLoading - ? - : ( -
onClickHandler(source)}> - {!!thumbnail ? ( - } - unloader={fallbackIcon} - width={30} - height={30} - /> - ) : fallbackIcon} -

{source.id}

-
- )} + ? + : ( +
onClickHandler(source)}> + {thumbnail ? ( + } + unloader={fallbackIcon} + width={30} + height={30} + /> + ) : fallbackIcon} +

{source.id}

+
+ )}
) } @@ -79,7 +78,7 @@ CardSource.propTypes = { type: PropTypes.string }), isLoading: PropTypes.bool, - onClickHandler: PropTypes.func.isRequired, + onClickHandler: PropTypes.func.isRequired } export default CardSource diff --git a/src/components/presentational/Card/Summary.js b/src/components/presentational/Card/Summary.js index ac5bbd2..ea170b4 100644 --- a/src/components/presentational/Card/Summary.js +++ b/src/components/presentational/Card/Summary.js @@ -1,19 +1,18 @@ -import React from 'react'; +import React from 'react' -import copy from '../../../js/data/copy.json'; +import copy from '../../../js/data/copy.json' const CardSummary = ({ language, description, isHighlighted }) => { - - const summary = copy[language].cardstack.description; + const summary = copy[language].cardstack.description return ( -
-
+
+

{summary}

{description}

- ); + ) } -export default CardSummary; +export default CardSummary diff --git a/src/components/presentational/Card/Tags.js b/src/components/presentational/Card/Tags.js index 2bc4cc4..446d819 100644 --- a/src/components/presentational/Card/Tags.js +++ b/src/components/presentational/Card/Tags.js @@ -1,37 +1,36 @@ -import React from 'react'; +import React from 'react' -import copy from '../../../js/data/copy.json'; +import copy from '../../../js/data/copy.json' const CardTags = ({ tags, language }) => { - const tags_lang = copy[language].cardstack.tags; - const no_tags_lang = copy[language].cardstack.notags; + const tagsLang = copy[language].cardstack.tags + const noTagsLang = copy[language].cardstack.notags if (tags.length > 0) { return ( -
-

{tags_lang}:

+
+

{tagsLang}:

{tags.map((tag, idx) => { - return ( - - {tag.name} - {(idx < tags.length - 1) - ? ',' - : ''} - - ); + return ( + + {tag.name} + {(idx < tags.length - 1) + ? ',' + : ''} + + ) })}

- ); + ) } return ( -
-

{tags_lang}

-

{no_tags_lang}

+
+

{tagsLang}

+

{noTagsLang}

- ); - + ) } -export default CardTags; +export default CardTags diff --git a/src/components/presentational/Card/Timestamp.js b/src/components/presentational/Card/Timestamp.js index 6ac69e6..ee95994 100644 --- a/src/components/presentational/Card/Timestamp.js +++ b/src/components/presentational/Card/Timestamp.js @@ -1,34 +1,33 @@ -import React from 'react'; +import React from 'react' -import copy from '../../../js/data/copy.json'; -import { isNotNullNorUndefined } from '../../../js/utilities'; +import copy from '../../../js/data/copy.json' +import { isNotNullNorUndefined } from '../../../js/utilities' const CardTimestamp = ({ makeTimelabel, language, timestamp }) => { - - const daytime_lang = copy[language].cardstack.timestamp; - const estimated_lang = copy[language].cardstack.estimated; - const unknown_lang = copy[language].cardstack.unknown_time; + // const daytimeLang = copy[language].cardstack.timestamp + // const estimatedLang = copy[language].cardstack.estimated + const unknownLang = copy[language].cardstack.unknown_time if (isNotNullNorUndefined(timestamp)) { - const timelabel = makeTimelabel(timestamp); + const timelabel = makeTimelabel(timestamp) return ( -
+

- today + today {timelabel}

- ); + ) } else { return ( -
+

- today - {unknown_lang} + today + {unknownLang}

- ); + ) } } -export default CardTimestamp; +export default CardTimestamp diff --git a/src/components/presentational/Icons/CoeventIcon.js b/src/components/presentational/Icons/CoeventIcon.js index 7ddc2f9..5c88ee1 100644 --- a/src/components/presentational/Icons/CoeventIcon.js +++ b/src/components/presentational/Icons/CoeventIcon.js @@ -3,7 +3,6 @@ import React from 'react' const CoeventIcon = ({ isEnabled, toggleMapViews }) => { return (