From 67c336c1314c371527bc9ec76d26409da0c59c75 Mon Sep 17 00:00:00 2001 From: efarooqui Date: Tue, 6 Oct 2020 17:22:47 -0700 Subject: [PATCH 1/7] Categories showing up on timeline with events; events are stacked on both and connected by a bar which looks like a UI bug somewhere --- src/actions/index.js | 26 +++++++++---------- src/common/constants.js | 7 +++-- src/components/Timeline.jsx | 6 +++-- src/components/TimelineCategories.jsx | 17 ++++++------ .../presentational/Timeline/Events.js | 1 + src/reducers/validate/validators.js | 6 ++--- src/selectors/index.js | 8 +++--- src/store/initial.js | 2 +- 8 files changed, 40 insertions(+), 33 deletions(-) diff --git a/src/actions/index.js b/src/actions/index.js index 7c47e25..9137027 100644 --- a/src/actions/index.js +++ b/src/actions/index.js @@ -4,7 +4,7 @@ import { urlFromEnv } from '../common/utilities' // TODO: relegate these URLs entirely to environment variables // const CONFIG_URL = urlFromEnv('CONFIG_EXT') const EVENT_DATA_URL = urlFromEnv('EVENTS_EXT') -const CATEGORY_URL = urlFromEnv('CATEGORIES_EXT') +// const CATEGORY_URL = urlFromEnv('CATEGORIES_EXT') const ASSOCIATIONS_URL = urlFromEnv('ASSOCIATIONS_EXT') const SOURCES_URL = urlFromEnv('SOURCES_EXT') const SITES_URL = urlFromEnv('SITES_EXT') @@ -42,12 +42,12 @@ export function fetchDomain () { ) ).then(results => results.flatMap(t => t)) - let catPromise = Promise.resolve([]) - if (features.USE_CATEGORIES) { - catPromise = fetch(CATEGORY_URL) - .then(response => response.json()) - .catch(() => handleError(domainMsg('categories'))) - } + // let catPromise = Promise.resolve([]) + // if (features.USE_CATEGORIES) { + // catPromise = fetch(CATEGORY_URL) + // .then(response => response.json()) + // .catch(() => handleError(domainMsg('categories'))) + // } let associationsPromise = Promise.resolve([]) if (features.USE_ASSOCIATIONS) { @@ -87,7 +87,7 @@ export function fetchDomain () { return Promise.all([ eventPromise, - catPromise, + // catPromise, associationsPromise, sourcesPromise, sitesPromise, @@ -96,11 +96,11 @@ export function fetchDomain () { .then(response => { const result = { events: response[0], - categories: response[1], - associations: response[2], - sources: response[3], - sites: response[4], - shapes: response[5], + // categories: response[1], + associations: response[1], + sources: response[2], + sites: response[3], + shapes: response[4], notifications } if (Object.values(result).some(resp => resp.hasOwnProperty('error'))) { diff --git a/src/common/constants.js b/src/common/constants.js index 0537970..c67a6b9 100644 --- a/src/common/constants.js +++ b/src/common/constants.js @@ -1,2 +1,5 @@ -export const FILTER_MODE = 'FILTER' -export const NARRATIVE_MODE = 'NARRATIVE' +export const ASSOCIATION_MODES = { + CATEGORY: 'CATEGORY', + NARRATIVE: 'NARRATIVE', + FILTER: 'FILTER' +} \ No newline at end of file diff --git a/src/components/Timeline.jsx b/src/components/Timeline.jsx index 61e91aa..78ac105 100644 --- a/src/components/Timeline.jsx +++ b/src/components/Timeline.jsx @@ -87,7 +87,8 @@ class Timeline extends React.Component { const catsYpos = categories.map((g, i) => { return ((i + 1) * catHeight) - shiftUp + marginShift + manualAdjustment }) - const catMap = categories.map(c => c.category) + const catMap = categories.map(c => c.id) + return (cat) => { const idx = catMap.indexOf(cat) return catsYpos[idx] @@ -273,11 +274,12 @@ class Timeline extends React.Component { if (!USE_CATEGORIES) { return this.state.dims.trackHeight / 2 } const { category, project } = event + if (GRAPH_NONLOCATED && GRAPH_NONLOCATED.categories.includes(category)) { return this.state.dims.marginTop + domain.projects[project].offset + this.props.ui.eventRadius } if (!this.state.scaleY) return 0 - + // console.info(event, this.state.scaleY(category)) return this.state.scaleY(category) } diff --git a/src/components/TimelineCategories.jsx b/src/components/TimelineCategories.jsx index 68741c9..98b99a9 100644 --- a/src/components/TimelineCategories.jsx +++ b/src/components/TimelineCategories.jsx @@ -26,11 +26,11 @@ class TimelineCategories extends React.Component { renderCategory (cat, idx) { const { features, dims } = this.props - const { category } = cat + const { id } = cat const strokeWidth = 1 // dims.trackHeight / (this.props.categories.length + 1) if (features.GRAPH_NONLOCATED && features.GRAPH_NONLOCATED.categories && - features.GRAPH_NONLOCATED.categories.includes(category)) { + features.GRAPH_NONLOCATED.categories.includes(id)) { return null } @@ -40,26 +40,27 @@ class TimelineCategories extends React.Component { class='tick' style={{ strokeWidth }} opacity='0.5' - transform={`translate(0,${this.props.getCategoryY(category)})`} + transform={`translate(0,${this.props.getCategoryY(id)})`} > - - {category} + + {id} ) } render () { - const { dims } = this.props - const categories = this.props.features.USE_CATEGORIES + const { dims, categories } = this.props + const categoriesExist = categories && categories.length > 0 + const renderedCategories = categoriesExist ? this.props.categories.map((cat, idx) => this.renderCategory(cat, idx)) : this.renderCategory('Events', 0) return ( - {categories} + {renderedCategories} state.domain.events -export const getCategories = state => state.domain.categories -export const getNarratives = state => state.domain.associations.filter(item => item.mode === NARRATIVE_MODE) +export const getCategories = state => state.domain.associations.filter(item => item.mode === ASSOCIATION_MODES.CATEGORY) +export const getNarratives = state => state.domain.associations.filter(item => item.mode === ASSOCIATION_MODES.NARRATIVE) export const getActiveNarrative = state => state.app.associations.narrative export const getSelected = state => state.app.selected export const getSites = state => state.domain.sites export const getSources = state => state.domain.sources export const getShapes = state => state.domain.shapes -export const getFilters = state => state.domain.associations.filter(item => item.mode === FILTER_MODE) +export const getFilters = state => state.domain.associations.filter(item => item.mode === ASSOCIATION_MODES.FILTER) export const getNotifications = state => state.domain.notifications export const getActiveFilters = state => state.app.associations.filters export const getActiveCategories = state => state.app.associations.categories diff --git a/src/store/initial.js b/src/store/initial.js index 1b9ab6d..aa39e4f 100644 --- a/src/store/initial.js +++ b/src/store/initial.js @@ -12,7 +12,7 @@ const initial = { domain: { events: [], locations: [], - categories: [], + // categories: [], associations: [], sources: {}, sites: [], From 909307a6ae79a412e7eaa5baea3b3d7f601f07ee Mon Sep 17 00:00:00 2001 From: efarooqui Date: Thu, 8 Oct 2020 16:58:31 -0700 Subject: [PATCH 2/7] Bug with graph nonlocated and getY function; need to refactor toolbar so that it selects the categories on the timeline --- src/components/Timeline.jsx | 22 ++++++++++++++----- src/components/Toolbar/CategoriesListPanel.js | 8 +++---- .../presentational/Timeline/Events.js | 2 +- src/reducers/app.js | 11 +++++----- src/reducers/validate/eventSchema.js | 2 +- src/selectors/index.js | 6 ++++- 6 files changed, 34 insertions(+), 17 deletions(-) diff --git a/src/components/Timeline.jsx b/src/components/Timeline.jsx index 78ac105..93a2075 100644 --- a/src/components/Timeline.jsx +++ b/src/components/Timeline.jsx @@ -78,7 +78,7 @@ class Timeline extends React.Component { makeScaleY (categories, trackHeight, marginTop) { const { features } = this.props if (features.GRAPH_NONLOCATED && features.GRAPH_NONLOCATED.categories) { - categories = categories.filter(cat => !features.GRAPH_NONLOCATED.categories.includes(cat.category)) + categories = categories.filter(cat => !features.GRAPH_NONLOCATED.categories.includes(cat.id)) } const catHeight = trackHeight / (categories.length) const shiftUp = trackHeight / (categories.length) / 2 @@ -269,17 +269,28 @@ class Timeline extends React.Component { getY (event) { const { features, domain } = this.props - const { USE_CATEGORIES, GRAPH_NONLOCATED } = features + const { categories } = domain - if (!USE_CATEGORIES) { return this.state.dims.trackHeight / 2 } + const categoriesExist = categories && categories.length > 0 + + const { GRAPH_NONLOCATED } = features + + if (!categoriesExist) { return this.state.dims.trackHeight / 2 } + + // const eventCategories = event.associations.reduce((acc, a) => { + // const foundCategory = categories.find(cat => cat.id === a) + // if (foundCategory) acc.push(foundCategory) + + // return acc + // }, []) const { category, project } = event - + if (GRAPH_NONLOCATED && GRAPH_NONLOCATED.categories.includes(category)) { return this.state.dims.marginTop + domain.projects[project].offset + this.props.ui.eventRadius } if (!this.state.scaleY) return 0 - // console.info(event, this.state.scaleY(category)) + return this.state.scaleY(category) } @@ -402,6 +413,7 @@ function mapStateToProps (state) { narratives: state.domain.narratives }, app: { + activeCategories: selectors.getActiveCategories(state), selected: state.app.selected, language: state.app.language, timeline: state.app.timeline, diff --git a/src/components/Toolbar/CategoriesListPanel.js b/src/components/Toolbar/CategoriesListPanel.js index 8ef7ef5..7ffee6f 100644 --- a/src/components/Toolbar/CategoriesListPanel.js +++ b/src/components/Toolbar/CategoriesListPanel.js @@ -13,14 +13,14 @@ export default ({
{categories.map(cat => { return (
  • onCategoryFilter(cat.category)} + label={cat.id} + isActive={activeCategories.includes(cat.id)} + onClickCheckbox={() => onCategoryFilter(cat.id)} />
  • ) })} diff --git a/src/components/presentational/Timeline/Events.js b/src/components/presentational/Timeline/Events.js index b566c92..f608c29 100644 --- a/src/components/presentational/Timeline/Events.js +++ b/src/components/presentational/Timeline/Events.js @@ -81,8 +81,8 @@ const TimelineEvents = ({ return null } } - const isDot = (!!event.location && !!event.longitude) || (features.GRAPH_NONLOCATED && event.projectOffset !== -1) + let renderShape = isDot ? renderDot : renderBar if (event.shape) { if (event.shape === 'bar') { diff --git a/src/reducers/app.js b/src/reducers/app.js index c1761f9..2e02c3a 100644 --- a/src/reducers/app.js +++ b/src/reducers/app.js @@ -113,13 +113,14 @@ function toggleFilter (appState, action) { if (!(action.value instanceof Array)) { action.value = [action.value] } + const { filter: associationType } = action - let newFilters = appState.associations.filters.slice(0) + let newAssociations = appState.associations[associationType].slice(0) action.value.forEach(vl => { - if (newFilters.includes(vl)) { - newFilters = newFilters.filter(s => s !== vl) + if (newAssociations.includes(vl)) { + newAssociations = newAssociations.filter(s => s !== vl) } else { - newFilters.push(vl) + newAssociations.push(vl) } }) @@ -127,7 +128,7 @@ function toggleFilter (appState, action) { ...appState, associations: { ...appState.associations, - filters: newFilters + [associationType]: newAssociations } } } diff --git a/src/reducers/validate/eventSchema.js b/src/reducers/validate/eventSchema.js index 312f7da..918f5fb 100644 --- a/src/reducers/validate/eventSchema.js +++ b/src/reducers/validate/eventSchema.js @@ -23,7 +23,7 @@ function createEventSchema (custom) { type: Joi.string().allow(''), category: Joi.string().allow(''), category_full: Joi.string().allow(''), - associations: Joi.array(), + associations: Joi.array().required().default([]), sources: Joi.array(), comments: Joi.string().allow(''), time_display: Joi.string().allow(''), diff --git a/src/selectors/index.js b/src/selectors/index.js index 60c214f..98770ab 100644 --- a/src/selectors/index.js +++ b/src/selectors/index.js @@ -55,7 +55,11 @@ export const selectEvents = createSelector( .some(s => s) ) || activeFilters.length === 0 const isActiveFilter = isMatchingFilter || activeFilters.length === 0 - const isActiveCategory = activeCategories.includes(event.category) || activeCategories.length === 0 + const isActiveCategory = (event.associations && + event.associations.map(association => + activeCategories.includes(association)) + .some(s => s) + ) || activeCategories.length === 0 let isActiveTime = isTimeRangedIn(event, timeRange) isActiveTime = features.GRAPH_NONLOCATED ? ((!event.latitude && !event.longitude) || isActiveTime) From b35fb488600ba8bfd697407827a468fb5a5767ef Mon Sep 17 00:00:00 2001 From: efarooqui Date: Mon, 12 Oct 2020 11:15:34 -0700 Subject: [PATCH 3/7] Setting initial categories upon load; need to modify for timeline and related events --- src/actions/index.js | 9 +++++++++ src/components/Timeline.jsx | 2 +- src/reducers/app.js | 19 +++++++++++++++++++ 3 files changed, 29 insertions(+), 1 deletion(-) diff --git a/src/actions/index.js b/src/actions/index.js index 9137027..9d2b538 100644 --- a/src/actions/index.js +++ b/src/actions/index.js @@ -107,6 +107,7 @@ export function fetchDomain () { throw new Error('Some URLs returned negative. If you are in development, check the server is running') } dispatch(toggleFetchingDomain()) + dispatch(setInitialCategories(result.associations)) return result }) .catch(err => { @@ -212,6 +213,14 @@ export function setNotLoading () { } } +export const SET_INITIAL_CATEGORIES = 'SET_INITIAL_CATEGORIES' +export function setInitialCategories (values) { + return { + type: SET_INITIAL_CATEGORIES, + values + } +} + export const UPDATE_TIMERANGE = 'UPDATE_TIMERANGE' export function updateTimeRange (timerange) { return { diff --git a/src/components/Timeline.jsx b/src/components/Timeline.jsx index 93a2075..0c177b8 100644 --- a/src/components/Timeline.jsx +++ b/src/components/Timeline.jsx @@ -305,7 +305,7 @@ class Timeline extends React.Component { */ styleDatetime (timestamp, category) { return [null, null] - } + } render () { const { isNarrative, app } = this.props diff --git a/src/reducers/app.js b/src/reducers/app.js index 2e02c3a..3049e38 100644 --- a/src/reducers/app.js +++ b/src/reducers/app.js @@ -1,4 +1,5 @@ import initial from '../store/initial.js' +import { ASSOCIATION_MODES } from '../common/constants' import { toggleFlagAC } from '../common/utilities' import { @@ -22,6 +23,7 @@ import { FETCH_SOURCE_ERROR, SET_LOADING, SET_NOT_LOADING, + SET_INITIAL_CATEGORIES, UPDATE_SEARCH_QUERY } from '../actions' @@ -219,6 +221,21 @@ function setNotLoading (appState) { } } +function setInitialCategories (appState, action) { + const categories = action.values.reduce((acc, val) => { + if (val.mode === ASSOCIATION_MODES.CATEGORY) acc.push(val.id) + return acc + }, []) + + return { + ...appState, + associations: { + ...appState.associations, + categories: categories + } + } +} + function updateSearchQuery (appState, action) { return { ...appState, @@ -270,6 +287,8 @@ function app (appState = initial.app, action) { return setLoading(appState) case SET_NOT_LOADING: return setNotLoading(appState) + case SET_INITIAL_CATEGORIES: + return setInitialCategories(appState, action) case UPDATE_SEARCH_QUERY: return updateSearchQuery(appState, action) default: From cde94262be82e93dd68dbf8b55bde18546526a59 Mon Sep 17 00:00:00 2001 From: efarooqui Date: Mon, 12 Oct 2020 14:54:45 -0700 Subject: [PATCH 4/7] Events showing up on timeline after interpolating categories from associations and passing into getY --- src/common/utilities.js | 12 +++++ src/components/Timeline.jsx | 8 +-- .../presentational/Timeline/Events.js | 49 ++++++++++++------- 3 files changed, 43 insertions(+), 26 deletions(-) diff --git a/src/common/utilities.js b/src/common/utilities.js index dac0f4a..989c370 100644 --- a/src/common/utilities.js +++ b/src/common/utilities.js @@ -62,6 +62,18 @@ export function trimAndEllipse (string, stringNum) { return string } +export function getEventCategories (event, categories) { + const matchedCategories = [] + if (event.associations && event.associations.length > 0) { + event.associations.reduce((acc, val) => { + const foundCategory = categories.find(cat => cat.id === val) + if (foundCategory) acc.push(foundCategory) + return acc + }, matchedCategories) + } + return matchedCategories +} + /** * Inset the full source represenation from 'allSources' into an event. The * function is 'curried' to allow easy use with maps. To use for a single diff --git a/src/components/Timeline.jsx b/src/components/Timeline.jsx index 0c177b8..49f375e 100644 --- a/src/components/Timeline.jsx +++ b/src/components/Timeline.jsx @@ -277,13 +277,6 @@ class Timeline extends React.Component { if (!categoriesExist) { return this.state.dims.trackHeight / 2 } - // const eventCategories = event.associations.reduce((acc, a) => { - // const foundCategory = categories.find(cat => cat.id === a) - // if (foundCategory) acc.push(foundCategory) - - // return acc - // }, []) - const { category, project } = event if (GRAPH_NONLOCATED && GRAPH_NONLOCATED.categories.includes(category)) { @@ -375,6 +368,7 @@ class Timeline extends React.Component { { const narIds = narrative ? narrative.steps.map(s => s.id) : [] - function renderEvent (event) { + function renderEvent (aggregated, event) { if (narrative) { if (!(narIds.includes(event.id))) { return null @@ -96,24 +97,33 @@ const TimelineEvents = ({ } } - const eventY = getY(event) + const relatedCategories = getEventCategories(event, categories) + + if (relatedCategories && relatedCategories.length > 0) { + relatedCategories.forEach(cat => { + const eventY = getY({...event, category: cat.id}) - let colour = event.colour ? event.colour : getCategoryColor(event.category) - const styles = { - fill: colour, - fillOpacity: eventY > 0 ? calcOpacity(1) : 0, - transition: `transform ${transitionDuration / 1000}s ease` + let colour = event.colour ? event.colour : getCategoryColor(cat.id) + const styles = { + fill: colour, + fillOpacity: eventY > 0 ? calcOpacity(1) : 0, + transition: `transform ${transitionDuration / 1000}s ease` + } + + aggregated.push( + renderShape(event, styles, { + x: getDatetimeX(event.datetime), + y: eventY, + eventRadius, + onSelect: () => onSelect(event), + dims, + highlights: features.HIGHLIGHT_GROUPS ? getHighlights(event.filters[features.HIGHLIGHT_GROUPS.filterIndexIndicatingGroup]) : [], + features + }) + ) + }) } - - return renderShape(event, styles, { - x: getDatetimeX(event.datetime), - y: eventY, - eventRadius, - onSelect: () => onSelect(event), - dims, - highlights: features.HIGHLIGHT_GROUPS ? getHighlights(event.filters[features.HIGHLIGHT_GROUPS.filterIndexIndicatingGroup]) : [], - features - }) + return aggregated } let renderProjects = () => null @@ -137,7 +147,8 @@ const TimelineEvents = ({ clipPath={'url(#clip)'} > {renderProjects()} - {events.map(event => renderEvent(event))} + {events.reduce(renderEvent, [])} + {/* {events.map(event => renderEvent(event))} */} ) } From b8b7c712de598332eb6d36a7d38418403d8e8e6b Mon Sep 17 00:00:00 2001 From: efarooqui Date: Mon, 12 Oct 2020 16:33:19 -0700 Subject: [PATCH 5/7] Ability to toggle categories on / off on timeline --- src/components/Timeline.jsx | 2 +- src/components/TimelineCategories.jsx | 11 +++++------ 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/components/Timeline.jsx b/src/components/Timeline.jsx index 49f375e..eb612c9 100644 --- a/src/components/Timeline.jsx +++ b/src/components/Timeline.jsx @@ -342,7 +342,7 @@ class Timeline extends React.Component { onDragStart={() => { this.onDragStart() }} onDrag={() => { this.onDrag() }} onDragEnd={() => { this.onDragEnd() }} - categories={this.props.domain.categories} + categories={this.props.app.activeCategories} features={this.props.features} /> - - {id} + + {cat} ) @@ -53,7 +52,7 @@ class TimelineCategories extends React.Component { render () { const { dims, categories } = this.props - const categoriesExist = categories && categories.length > 0 + const categoriesExist = categories && categories.length > 0 const renderedCategories = categoriesExist ? this.props.categories.map((cat, idx) => this.renderCategory(cat, idx)) : this.renderCategory('Events', 0) From 2cff35c3f245ddd87ab39647d33886351c7c9ed3 Mon Sep 17 00:00:00 2001 From: efarooqui Date: Fri, 16 Oct 2020 11:23:00 -0700 Subject: [PATCH 6/7] Removed commented out logic --- src/actions/index.js | 10 +--------- src/components/presentational/Timeline/Events.js | 1 - src/reducers/validate/categorySchema.js | 9 --------- src/reducers/validate/validators.js | 4 ---- src/store/initial.js | 1 - 5 files changed, 1 insertion(+), 24 deletions(-) delete mode 100644 src/reducers/validate/categorySchema.js diff --git a/src/actions/index.js b/src/actions/index.js index 9d2b538..388ed8a 100644 --- a/src/actions/index.js +++ b/src/actions/index.js @@ -41,13 +41,7 @@ export function fetchDomain () { .catch(() => handleError('events')) ) ).then(results => results.flatMap(t => t)) - - // let catPromise = Promise.resolve([]) - // if (features.USE_CATEGORIES) { - // catPromise = fetch(CATEGORY_URL) - // .then(response => response.json()) - // .catch(() => handleError(domainMsg('categories'))) - // } + let associationsPromise = Promise.resolve([]) if (features.USE_ASSOCIATIONS) { @@ -87,7 +81,6 @@ export function fetchDomain () { return Promise.all([ eventPromise, - // catPromise, associationsPromise, sourcesPromise, sitesPromise, @@ -96,7 +89,6 @@ export function fetchDomain () { .then(response => { const result = { events: response[0], - // categories: response[1], associations: response[1], sources: response[2], sites: response[3], diff --git a/src/components/presentational/Timeline/Events.js b/src/components/presentational/Timeline/Events.js index b6b9fe1..af9ea59 100644 --- a/src/components/presentational/Timeline/Events.js +++ b/src/components/presentational/Timeline/Events.js @@ -148,7 +148,6 @@ const TimelineEvents = ({ > {renderProjects()} {events.reduce(renderEvent, [])} - {/* {events.map(event => renderEvent(event))} */} ) } diff --git a/src/reducers/validate/categorySchema.js b/src/reducers/validate/categorySchema.js deleted file mode 100644 index 4eb7bf4..0000000 --- a/src/reducers/validate/categorySchema.js +++ /dev/null @@ -1,9 +0,0 @@ -import Joi from 'joi' - -const categorySchema = Joi.object().keys({ - category: Joi.string().required(), - description: Joi.string(), - group: Joi.string() -}) - -export default categorySchema diff --git a/src/reducers/validate/validators.js b/src/reducers/validate/validators.js index a3fdfa0..a6c24c4 100644 --- a/src/reducers/validate/validators.js +++ b/src/reducers/validate/validators.js @@ -1,7 +1,6 @@ import Joi from 'joi' import createEventSchema from './eventSchema' -import categorySchema from './categorySchema' import siteSchema from './siteSchema' import associationsSchema from './associationsSchema' import sourceSchema from './sourceSchema' @@ -47,7 +46,6 @@ function findDuplicateAssociations (associations) { export function validateDomain (domain, features) { const sanitizedDomain = { events: [], - // categories: [], sites: [], associations: [], sources: {}, @@ -61,7 +59,6 @@ export function validateDomain (domain, features) { const discardedDomain = { events: [], - // categories: [], sites: [], associations: [], sources: [], @@ -110,7 +107,6 @@ export function validateDomain (domain, features) { const eventSchema = createEventSchema(features.CUSTOM_EVENT_FIELDS) validateArray(domain.events, 'events', eventSchema) - // validateArray(domain.categories, 'categories', categorySchema) validateArray(domain.sites, 'sites', siteSchema) validateArray(domain.associations, 'associations', associationsSchema) validateObject(domain.sources, 'sources', sourceSchema) diff --git a/src/store/initial.js b/src/store/initial.js index aa39e4f..2ed221d 100644 --- a/src/store/initial.js +++ b/src/store/initial.js @@ -12,7 +12,6 @@ const initial = { domain: { events: [], locations: [], - // categories: [], associations: [], sources: {}, sites: [], From 6927ecc3cea59c6e26d9d815bc8b6adb3061391f Mon Sep 17 00:00:00 2001 From: efarooqui Date: Mon, 19 Oct 2020 09:05:54 -0700 Subject: [PATCH 7/7] Linting fixes --- src/actions/index.js | 1 - src/common/constants.js | 2 +- src/components/Timeline.jsx | 2 +- src/components/presentational/Timeline/Events.js | 4 ++-- src/reducers/app.js | 2 +- 5 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/actions/index.js b/src/actions/index.js index 388ed8a..66ba175 100644 --- a/src/actions/index.js +++ b/src/actions/index.js @@ -41,7 +41,6 @@ export function fetchDomain () { .catch(() => handleError('events')) ) ).then(results => results.flatMap(t => t)) - let associationsPromise = Promise.resolve([]) if (features.USE_ASSOCIATIONS) { diff --git a/src/common/constants.js b/src/common/constants.js index c67a6b9..1270368 100644 --- a/src/common/constants.js +++ b/src/common/constants.js @@ -2,4 +2,4 @@ export const ASSOCIATION_MODES = { CATEGORY: 'CATEGORY', NARRATIVE: 'NARRATIVE', FILTER: 'FILTER' -} \ No newline at end of file +} diff --git a/src/components/Timeline.jsx b/src/components/Timeline.jsx index eb612c9..5a0f5ef 100644 --- a/src/components/Timeline.jsx +++ b/src/components/Timeline.jsx @@ -298,7 +298,7 @@ class Timeline extends React.Component { */ styleDatetime (timestamp, category) { return [null, null] - } + } render () { const { isNarrative, app } = this.props diff --git a/src/components/presentational/Timeline/Events.js b/src/components/presentational/Timeline/Events.js index af9ea59..5898384 100644 --- a/src/components/presentational/Timeline/Events.js +++ b/src/components/presentational/Timeline/Events.js @@ -98,10 +98,10 @@ const TimelineEvents = ({ } const relatedCategories = getEventCategories(event, categories) - + if (relatedCategories && relatedCategories.length > 0) { relatedCategories.forEach(cat => { - const eventY = getY({...event, category: cat.id}) + const eventY = getY({ ...event, category: cat.id }) let colour = event.colour ? event.colour : getCategoryColor(cat.id) const styles = { diff --git a/src/reducers/app.js b/src/reducers/app.js index 3049e38..d87f029 100644 --- a/src/reducers/app.js +++ b/src/reducers/app.js @@ -232,7 +232,7 @@ function setInitialCategories (appState, action) { associations: { ...appState.associations, categories: categories - } + } } }