From 2f05533a2049017d5d056be9f4c091e94dd056db Mon Sep 17 00:00:00 2001 From: Lachlan Kermode Date: Wed, 26 Dec 2018 12:21:52 +0100 Subject: [PATCH 1/3] correct check for empty category --- src/components/MapEvents.jsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/MapEvents.jsx b/src/components/MapEvents.jsx index 84cf6c4..2ef6009 100644 --- a/src/components/MapEvents.jsx +++ b/src/components/MapEvents.jsx @@ -30,7 +30,7 @@ class MapEvents extends React.Component { return ( 0) ? Math.sqrt(16 * events.length) + 3 : 0} style={{ fill: this.props.getCategoryColor(category), fillOpacity: 0.8 }} onClick={() => this.props.onSelect(events)} > @@ -63,4 +63,4 @@ class MapEvents extends React.Component { } } -export default MapEvents; \ No newline at end of file +export default MapEvents; From ede2f1efaa44f6c1afe337809b8800f6f0c8f7bd Mon Sep 17 00:00:00 2001 From: Lachlan Kermode Date: Wed, 26 Dec 2018 12:33:08 +0100 Subject: [PATCH 2/3] don't draw lines for unlocated events in narrative mode --- src/components/MapNarratives.jsx | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/components/MapNarratives.jsx b/src/components/MapNarratives.jsx index 8835fec..2c9d777 100644 --- a/src/components/MapNarratives.jsx +++ b/src/components/MapNarratives.jsx @@ -39,10 +39,18 @@ class MapNarratives extends React.Component { return 1; } + hasNoLocation(step) { + return (step.latitude === '' || step.longitude === '') + } + renderNarrativeStep(allSteps, step, idx, n) { const { x, y } = this.projectPoint([step.latitude, step.longitude]); - const step2 = allSteps[idx + 1]; + + // don't draw if one of the steps has no location + if (this.hasNoLocation(step) || this.hasNoLocation(step2)) + return null + const p2 = this.projectPoint([step2.latitude, step2.longitude]); return ( From 48b4184c483c6aba36a0fcc45fb8f044018b8938 Mon Sep 17 00:00:00 2001 From: Lachlan Kermode Date: Wed, 26 Dec 2018 12:58:51 +0100 Subject: [PATCH 3/3] fade events not in narrative --- src/components/MapEvents.jsx | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/components/MapEvents.jsx b/src/components/MapEvents.jsx index 2ef6009..11aeb78 100644 --- a/src/components/MapEvents.jsx +++ b/src/components/MapEvents.jsx @@ -27,11 +27,27 @@ class MapEvents extends React.Component { } renderCategory(events, category) { + let styleProps = ({ + fill: this.props.getCategoryColor(category), + fillOpacity: 0.8 + }) + + if (this.props.narrative) { + const { byId } = this.props.narrative + const eventsInNarrative = events.filter(e => byId.hasOwnProperty(e.id)) + if (eventsInNarrative.length <= 0) { + styleProps = { + ...styleProps, + fillOpacity: 0.1 + } + } + } + return ( 0) ? Math.sqrt(16 * events.length) + 3 : 0} - style={{ fill: this.props.getCategoryColor(category), fillOpacity: 0.8 }} + style={styleProps} onClick={() => this.props.onSelect(events)} >