make USE_CATEGORIES optional

This commit is contained in:
Lachlan Kermode
2020-06-08 16:17:12 +02:00
parent 16358f5ab9
commit c473e4a998
6 changed files with 28 additions and 12 deletions

View File

@@ -16,6 +16,7 @@ import Notification from './Notification.jsx'
import StaticPage from './StaticPage'
import TemplateCover from './TemplateCover'
import colors from '../common/global'
import { binarySearch } from '../common/utilities'
import { isMobile } from 'react-device-detect'
@@ -87,6 +88,8 @@ class Dashboard extends React.Component {
}
getCategoryColor (category) {
if (!this.props.features.USE_CATEGORIES) { return colors.fallbackEventColor }
const cat = this.props.ui.style.categories[category]
if (cat) {
return cat
@@ -168,7 +171,7 @@ class Dashboard extends React.Component {
methods={{
onSelect: ev => this.handleSelect(ev, 0),
onUpdateTimerange: actions.updateTimeRange,
getCategoryColor: category => this.getCategoryColor(category)
getCategoryColor: this.getCategoryColor
}}
/>
<CardStack
@@ -177,7 +180,7 @@ class Dashboard extends React.Component {
onHighlight={this.handleHighlight}
onToggleCardstack={() => actions.updateSelected([])}
getNarrativeLinks={event => this.getNarrativeLinks(event)}
getCategoryColor={category => this.getCategoryColor(category)}
getCategoryColor={this.getCategoryColor}
/>
<NarrativeControls
narrative={app.narrative ? {