From 90f1de296a0cf1c0fcf3220076c888e9f2b30d82 Mon Sep 17 00:00:00 2001 From: Sol Date: Tue, 14 Jul 2020 20:06:46 +0100 Subject: [PATCH] lint fixes --- src/actions/index.js | 2 +- src/components/Card.jsx | 6 +++--- src/components/CardStack.jsx | 10 +++++----- src/components/Map.jsx | 2 +- src/components/presentational/Map/Events.jsx | 12 ++++++------ src/reducers/app.js | 6 +++--- 6 files changed, 19 insertions(+), 19 deletions(-) diff --git a/src/actions/index.js b/src/actions/index.js index 7c9dcd7..b8741df 100644 --- a/src/actions/index.js +++ b/src/actions/index.js @@ -264,7 +264,7 @@ export const SELECT_NARRATIVE_EVENT = 'SELECT_NARRATIVE_EVENT' export function selectNarrativeEvent (idx) { return { type: SELECT_NARRATIVE_EVENT, - idx + idx } } diff --git a/src/components/Card.jsx b/src/components/Card.jsx index 2edf026..145678f 100644 --- a/src/components/Card.jsx +++ b/src/components/Card.jsx @@ -163,8 +163,8 @@ class Card extends React.Component { /> ) : null } - - render () { + + render () { const { isSelected, idx } = this.props return ( @@ -172,7 +172,7 @@ class Card extends React.Component { className={`event-card ${isSelected ? 'selected' : ''}`} id={`event-card-${idx}`} ref={this.props.innerRef} - onClick={(e) => {this.props.onClick(idx);} } + onClick={(e) => { this.props.onClick(idx) }} > {this.renderMain()} {this.state.isOpen ? this.renderExtra() : null} diff --git a/src/components/CardStack.jsx b/src/components/CardStack.jsx index 6f7018d..be4c014 100644 --- a/src/components/CardStack.jsx +++ b/src/components/CardStack.jsx @@ -10,7 +10,7 @@ import copy from '../common/data/copy.json' class CardStack extends React.Component { constructor () { super() - this.onCardClick = this.onCardClick.bind(this) + this.onCardClick = this.onCardClick.bind(this) this.refs = {} this.refCardStack = React.createRef() this.refCardStackContent = React.createRef() @@ -64,7 +64,7 @@ class CardStack extends React.Component { this.refs[idx] = thisRef return () }) } onCardClick (idx) { - this.props.actions.selectNarrativeEvent(idx) + this.props.actions.selectNarrativeEvent(idx) } renderSelectedCards () { @@ -135,7 +135,7 @@ class CardStack extends React.Component { renderNarrativeContent () { return (
    {this.renderNarrativeCards()} diff --git a/src/components/Map.jsx b/src/components/Map.jsx index 1ea725b..352c207 100644 --- a/src/components/Map.jsx +++ b/src/components/Map.jsx @@ -207,7 +207,7 @@ class Map extends React.Component { onSelectNarrativeEvent (idx) { console.log(idx) - this.props.actions.selectNarrativeEvent(idx) + this.props.actions.selectNarrativeEvent(idx) } renderEvents () { diff --git a/src/components/presentational/Map/Events.jsx b/src/components/presentational/Map/Events.jsx index 337ee98..3dafbc8 100644 --- a/src/components/presentational/Map/Events.jsx +++ b/src/components/presentational/Map/Events.jsx @@ -14,7 +14,7 @@ function MapEvents ({ svg, locations, eventRadius, - onSelectNarrative + onSelectNarrative }) { function getCoordinatesForPercent (radius, percent) { const x = radius * Math.cos(2 * Math.PI * percent) @@ -112,7 +112,7 @@ function MapEvents ({ // in narrative mode, only render events in narrative // TODO: move this to a selector // Gets around if block scope - var narrativeIdx = false; + var narrativeIdx = false if (narrative) { const { steps } = narrative @@ -123,8 +123,8 @@ function MapEvents ({ return null } else { // choose the first event at a given location - const locationEventId = eventsInNarrative[0].id; - const narrativeIdxObj = steps.find(s => s.id == locationEventId) + const locationEventId = eventsInNarrative[0].id + const narrativeIdxObj = steps.find(s => s.id === locationEventId) narrativeIdx = steps.indexOf(narrativeIdxObj) } } @@ -136,7 +136,7 @@ function MapEvents ({ ) - const isSelected = selected.reduce((acc, event) => { + const isSelected = selected.reduce((acc, event) => { return acc || (event.latitude === location.latitude && event.longitude === location.longitude) }, false) @@ -144,7 +144,7 @@ function MapEvents ({ onSelect(location.events) : () => {onSelectNarrative(narrativeIdx); onSelect(location.events)}} + onClick={(!narrative) ? () => onSelect(location.events) : () => { onSelectNarrative(narrativeIdx); onSelect(location.events) }} > {renderLocationSlicesByCategory(location)} {extraRender ? extraRender() : null} diff --git a/src/reducers/app.js b/src/reducers/app.js index 2b2f8c0..499aed0 100644 --- a/src/reducers/app.js +++ b/src/reducers/app.js @@ -122,13 +122,13 @@ function decrementNarrativeCurrent (appState, action) { } function selectNarrativeEvent (appState, action) { - appState.narrativeState.current = action.idx + appState.narrativeState.current = action.idx return { ...appState, narrativeState: { - current: appState.narrativeState.current - } + current: appState.narrativeState.current + } } }