From 470daf27e7f68e06f83508cd06501854109b3cbc Mon Sep 17 00:00:00 2001 From: Franc Camps-Febrer Date: Wed, 16 Jan 2019 09:57:51 -0500 Subject: [PATCH] Use tag arrays in events, no longer strings --- src/components/SourceOverlay.jsx | 7 +++-- src/components/TagListPanel.jsx | 2 +- src/components/Toolbar.jsx | 16 +++++------ src/reducers/schema/eventSchema.js | 2 +- src/scss/mediaoverlay.scss | 44 ++++++++++++++++++++++++++---- src/scss/timeline.scss | 5 ++++ src/selectors/index.js | 3 +- 7 files changed, 58 insertions(+), 21 deletions(-) diff --git a/src/components/SourceOverlay.jsx b/src/components/SourceOverlay.jsx index d18a865..ea94e2d 100644 --- a/src/components/SourceOverlay.jsx +++ b/src/components/SourceOverlay.jsx @@ -19,7 +19,7 @@ function SourceOverlay ({ source, onCancel }) { } + loader={
} unloader={} /> @@ -107,8 +107,8 @@ function SourceOverlay ({ source, onCancel }) { return (
{img ? img : ''} - {vid ? `, ${vid}`: ''} - {txt ? `, ${txt}`: ''} + {(img && vid) ? `, ${vid}`: (vid || '')} + {((img || vid) && txt) ? `, ${txt}`: (txt || '')}
) } @@ -145,6 +145,7 @@ function SourceOverlay ({ source, onCancel }) {
{title?

{title}

: null}
{_renderCounts(counts)}
+
{type ?

Media type

: null} {type ?

perm_media{type}

: null} {date ?

Date

: null} diff --git a/src/components/TagListPanel.jsx b/src/components/TagListPanel.jsx index fa6667b..1ca46e7 100644 --- a/src/components/TagListPanel.jsx +++ b/src/components/TagListPanel.jsx @@ -22,7 +22,7 @@ class TagListPanel extends React.Component { onClickCheckbox(tag) { tag.active = !tag.active - this.props.filter(tag); + this.props.onFilter(tag); } createNodeComponent (node, depth) { diff --git a/src/components/Toolbar.jsx b/src/components/Toolbar.jsx index ea526f9..53b0808 100644 --- a/src/components/Toolbar.jsx +++ b/src/components/Toolbar.jsx @@ -81,7 +81,7 @@ class Toolbar extends React.Component { categories={this.props.categories} tagFilters={this.props.tagFilters} categoryFilters={this.props.categoryFilters} - filter={this.props.filter} + onFilter={this.props.methods.onFilter} language={this.props.language} /> @@ -90,13 +90,13 @@ class Toolbar extends React.Component { return ''; } - renderToolbarTab(_selected, label) { + renderToolbarTab(_selected, label, icon_key) { const isActive = (this.state._selected === _selected); let classes = (isActive) ? 'toolbar-tab active' : 'toolbar-tab'; return (
{ this.selectTab(_selected); }}> - timeline + {icon_key}
{label}
); @@ -104,7 +104,7 @@ class Toolbar extends React.Component { renderToolbarTabs() { const title = copy[this.props.language].toolbar.title; - const isTags = this.props.tags && (this.props.tags.children > 0); + const isTags = this.props.tags && (Object.keys(this.props.tags.children) > 0); return (
@@ -125,7 +125,7 @@ class Toolbar extends React.Component { {this.renderClosePanel()} {this.renderToolbarNarrativePanel()} - {/* {this.renderToolbarTagPanel()} */} + {this.renderToolbarTagPanel()}}
) @@ -150,15 +150,15 @@ class Toolbar extends React.Component { renderToolbarTabs() { const title = copy[this.props.language].toolbar.title; - const isTags = this.props.tags && (this.props.tags.children > 0); + const isTags = this.props.tags && this.props.tags.children; return (

{title}

{/*this.renderToolbarTab(0, 'search')*/} - {this.renderToolbarTab(0, 'Narratives')} - {(isTags) ? this.renderToolbarTab(1, 'Explore by tag') : ''} + {this.renderToolbarTab(0, 'Narratives', 'timeline')} + {(isTags) ? this.renderToolbarTab(1, 'Explore by tag', 'style') : ''}
state.app.filters.timerange */ function isTaggedIn(event, tagFilters) { if (event.tags) { - const tagsInEvent = event.tags.split(",") - const isTagged = tagsInEvent.some((tag) => { + const isTagged = event.tags.some((tag) => { return tagFilters.find(tF => (tF.key === tag && tF.active)) }) return isTagged