diff --git a/example.config.js b/example.config.js index 8b5f008..7bad0a3 100644 --- a/example.config.js +++ b/example.config.js @@ -13,6 +13,7 @@ module.exports = { features: { USE_TAGS: false, USE_SEARCH: false, - USE_SITES: false + USE_SITES: false, + USE_SOURCES: true } } diff --git a/src/components/:w b/src/components/:w deleted file mode 100644 index acd0476..0000000 --- a/src/components/:w +++ /dev/null @@ -1,148 +0,0 @@ -import React from 'react'; - -import { bindActionCreators } from 'redux'; -import { connect } from 'react-redux'; -import * as actions from '../actions'; -import * as selectors from '../selectors'; - -import MediaOverlay from './presentational/MediaOverlay'; -import LoadingOverlay from './presentational/LoadingOverlay'; -import Viewport from './Viewport.jsx'; -import Toolbar from './Toolbar.jsx'; -import CardStack from './CardStack.jsx'; -import NarrativeCard from './NarrativeCard.js'; -import InfoPopUp from './InfoPopup.jsx'; -import Timeline from './Timeline.jsx'; -import Notification from './Notification.jsx'; - -import { parseDate } from '../js/utilities'; - -class Dashboard extends React.Component { - constructor(props) { - super(props); - - this.handleViewSource = this.handleViewSource.bind(this) - this.handleHighlight = this.handleHighlight.bind(this) - this.handleSelect = this.handleSelect.bind(this) - this.handleTagFilter = this.handleTagFilter.bind(this) - this.updateTimerange = this.updateTimerange.bind(this) - - this.eventsById = {} - } - - componentDidMount() { - if (!this.props.app.isMobile) { - this.props.actions.fetchDomain() - .then(domain => this.props.actions.updateDomain(domain)); - } - } - - handleHighlight(highlighted) { - this.props.actions.updateHighlighted((highlighted) ? highlighted : null); - } - - getEventById(eventId) { - if (this.eventsById[eventId]) return this.eventsById[eventId]; - this.eventsById[eventId] = this.props.domain.events.find(ev => ev.id === eventId); - return this.eventsById[eventId]; - } - - handleViewSource(source) { - console.log('handleViewSource: to implement in Dashboard.jsx') - this.props.actions.updateSource(source) - } - - handleSelect(selected) { - if (selected) { - let eventsToSelect = selected.map(event => this.getEventById(event.id)); - eventsToSelect = eventsToSelect.sort((a, b) => parseDate(a.timestamp) - parseDate(b.timestamp)) - - this.props.actions.updateSelected(eventsToSelect) - } - } - - handleTagFilter(tag) { - this.props.actions.updateTagFilters(tag); - } - - updateTimerange(timeRange) { - this.props.actions.updateTimeRange(timeRange); - } - - getCategoryColor(category='other') { - return this.props.ui.style.categories[category] || this.props.ui.style.categories['other'] - } - - getNarrativeLinks(event) { - const narrative = this.props.domain.narratives.find(nv => nv.id === event.narrative); - if (narrative) return narrative.byId[event.id]; - return null; - } - - render() { - return ( -
- this.getCategoryColor(category) - }} - /> - - this.props.actions.updateSelected([])} - getNarrativeLinks={event => this.getNarrativeLinks(event)} - getCategoryColor={category => this.getCategoryColor(category)} - /> - this.getCategoryColor(category) - }} - /> - this.props.actions.toggleInfoPopup()} - /> - - - - - -
- ); - } -} - -function mapDispatchToProps(dispatch) { - return { - actions: bindActionCreators(actions, dispatch) - }; -} - -export default connect( - state => state, - mapDispatchToProps, -)(Dashboard); diff --git a/src/components/presentational/CardSource.js b/src/components/presentational/CardSource.js index 88672c0..cde4ca9 100644 --- a/src/components/presentational/CardSource.js +++ b/src/components/presentational/CardSource.js @@ -25,9 +25,6 @@ const CardSource = ({ source, isLoading, onClickHandler }) => { } } - if (!source) { - return null; - } return (
{isLoading