mirror of
https://github.com/bellingcat/ukraine-timemap.git
synced 2026-06-11 21:08:36 +03:00
Clean store fields, move from state.ui to state.app those that make sense
This commit is contained in:
@@ -1,5 +1,9 @@
|
||||
import copy from '../js/data/copy.json';
|
||||
import {isNotNullNorUndefined} from '../js/utilities';
|
||||
import {
|
||||
isNotNullNorUndefined,
|
||||
parseDate,
|
||||
formatterWithYear
|
||||
} from '../js/utilities';
|
||||
import React from 'react';
|
||||
|
||||
import Spinner from './presentational/Spinner';
|
||||
@@ -35,8 +39,8 @@ class Card extends React.Component {
|
||||
|
||||
makeTimelabel(timestamp) {
|
||||
if (timestamp === null) return null;
|
||||
const parsedTimestamp = this.props.tools.parser(timestamp);
|
||||
const timelabel = this.props.tools.formatterWithYear(parsedTimestamp);
|
||||
const parsedTimestamp = parseDate(timestamp);
|
||||
const timelabel = formatterWithYear(parsedTimestamp);
|
||||
return timelabel;
|
||||
}
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ class CardStack extends React.Component {
|
||||
<Card
|
||||
event={event}
|
||||
language={this.props.language}
|
||||
tools={this.props.tools}
|
||||
isLoading={this.props.isLoading}
|
||||
getNarrativeLinks={this.props.getNarrativeLinks}
|
||||
getCategoryGroup={this.props.getCategoryGroup}
|
||||
getCategoryColor={this.props.getCategoryColor}
|
||||
@@ -90,9 +90,8 @@ function mapStateToProps(state) {
|
||||
return {
|
||||
selected: state.app.selected,
|
||||
language: state.app.language,
|
||||
tools: state.ui.tools,
|
||||
isCardstack: state.ui.flags.isCardstack,
|
||||
isFetchingSources: state.ui.flags.isFetchingSources
|
||||
isCardstack: state.app.flags.isCardstack,
|
||||
isLoading: state.app.flags.isFetchingEvents
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -14,6 +14,8 @@ 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);
|
||||
@@ -110,12 +112,12 @@ class Dashboard extends React.Component {
|
||||
actions={this.props.actions}
|
||||
/>
|
||||
<Notification
|
||||
isNotification={this.props.ui.flags.isNotification}
|
||||
isNotification={this.props.app.flags.isNotification}
|
||||
notifications={this.props.domain.notifications}
|
||||
onToggle={this.props.actions.markNotificationsRead}
|
||||
/>
|
||||
<LoadingOverlay
|
||||
ui={this.props.ui.flags.isFetchingDomain}
|
||||
ui={this.props.app.flags.isFetchingDomain}
|
||||
language={this.props.app.language}
|
||||
/>
|
||||
</div>
|
||||
|
||||
@@ -27,7 +27,7 @@ export default class InfoPopUp extends React.Component{
|
||||
|
||||
renderView2DLegend() {
|
||||
return (
|
||||
<div className={`infopopup ${(this.props.ui.flags.isInfopopup) ? '' : 'hidden'}`}>
|
||||
<div className={`infopopup ${(this.props.app.flags.isInfopopup) ? '' : 'hidden'}`}>
|
||||
<button onClick={() => this.props.toggle()} className="side-menu-burg over-white is-active"><span /></button>
|
||||
{this.renderView2DCopy()}
|
||||
<div className="legend">
|
||||
|
||||
@@ -3,6 +3,7 @@ import { connect } from 'react-redux';
|
||||
import * as selectors from '../selectors';
|
||||
|
||||
import copy from '../js/data/copy.json';
|
||||
import { formatterWithYear } from '../js/utilities';
|
||||
import TimelineLogic from '../js/timeline/timeline.js';
|
||||
|
||||
class Timeline extends React.Component {
|
||||
@@ -15,7 +16,6 @@ class Timeline extends React.Component {
|
||||
|
||||
componentDidMount() {
|
||||
const ui = {
|
||||
tools: this.props.tools,
|
||||
dom: this.props.dom
|
||||
}
|
||||
|
||||
@@ -47,8 +47,8 @@ class Timeline extends React.Component {
|
||||
const labels_title_lang = copy[this.props.app.language].timeline.labels_title;
|
||||
const info_lang = copy[this.props.app.language].timeline.info;
|
||||
let classes = `timeline-wrapper ${(this.state.isFolded) ? ' folded' : ''}`;
|
||||
const date0 = this.props.tools.formatterWithYear(this.props.app.timerange[0]);
|
||||
const date1 = this.props.tools.formatterWithYear(this.props.app.timerange[1]);
|
||||
const date0 = formatterWithYear(this.props.app.timerange[0]);
|
||||
const date1 = formatterWithYear(this.props.app.timerange[1]);
|
||||
|
||||
return (
|
||||
<div className={classes}>
|
||||
@@ -82,9 +82,8 @@ function mapStateToProps(state) {
|
||||
language: state.app.language,
|
||||
zoomLevels: state.app.zoomLevels
|
||||
},
|
||||
tools: state.ui.tools,
|
||||
dom: state.ui.dom,
|
||||
}
|
||||
}
|
||||
|
||||
export default connect(mapStateToProps)(Timeline);
|
||||
export default connect(mapStateToProps)(Timeline);
|
||||
|
||||
@@ -157,7 +157,6 @@ function mapStateToProps(state) {
|
||||
categoryFilter: state.app.filters.categories,
|
||||
viewFilters: state.app.filters.views,
|
||||
features: state.app.features,
|
||||
isModeGuided: state.app.isModeGuided
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -22,10 +22,6 @@ class ToolbarBottomActions extends React.Component {
|
||||
this.props.actions.toggleMapView(layer);
|
||||
}
|
||||
|
||||
toggleGuidedMode() {
|
||||
this.props.actions.toggleGuidedMode();
|
||||
}
|
||||
|
||||
renderMapActions() {
|
||||
return (
|
||||
<div className="bottom-action-block">
|
||||
|
||||
Reference in New Issue
Block a user