rewrite features as part of store + add HIGHLIGHT_GROUPS

This commit is contained in:
Lachlan Kermode
2020-05-19 14:08:03 +02:00
parent 154b62f924
commit e93d7d8831
16 changed files with 151 additions and 84 deletions

View File

@@ -8,7 +8,7 @@ function BottomActions (props) {
function renderToggles () {
return [
<div className='bottom-action-block'>
{process.env.features.USE_SITES ? <SitesIcon
{props.features.USE_SITES ? <SitesIcon
isActive={props.sites.enabled}
onClickHandler={props.sites.toggle}
/> : null}
@@ -20,7 +20,7 @@ function BottomActions (props) {
/>
</div>,
<div className='botttom-action-block'>
{process.env.features.USE_COVER ? <CoverIcon
{props.features.USE_COVER ? <CoverIcon
onClickHandler={props.cover.toggle}
/> : null}
</div>

View File

@@ -32,7 +32,7 @@ class Toolbar extends React.Component {
}
renderSearch () {
if (process.env.features.USE_SEARCH) {
if (this.props.features.USE_SEARCH) {
return (
<TabPanel>
<Search
@@ -73,7 +73,7 @@ class Toolbar extends React.Component {
}
renderToolbarCategoriesPanel () {
if (process.env.features.CATEGORIES_AS_TAGS) {
if (this.props.features.CATEGORIES_AS_TAGS) {
return (
<TabPanel>
<CategoriesListPanel
@@ -88,7 +88,7 @@ class Toolbar extends React.Component {
}
renderToolbarTagPanel () {
if (process.env.features.USE_TAGS &&
if (this.props.features.USE_TAGS &&
this.props.tags.children) {
return (
<TabPanel>
@@ -154,7 +154,7 @@ class Toolbar extends React.Component {
const tagsLabel = copy[this.props.language].toolbar.tags_label
const categoriesLabel = 'Categories' // TODO:
const isTags = this.props.tags && this.props.tags.children
const isCategories = process.env.features.CATEGORIES_AS_TAGS
const isCategories = this.props.features.CATEGORIES_AS_TAGS
return (
<div className='toolbar'>
@@ -176,6 +176,7 @@ class Toolbar extends React.Component {
cover={{
toggle: this.props.actions.toggleCover
}}
features={this.props.features}
/>
</div>
)
@@ -195,6 +196,7 @@ class Toolbar extends React.Component {
function mapStateToProps (state) {
return {
features: selectors.getFeatures(state),
tags: selectors.getTagTree(state),
categories: selectors.getCategories(state),
narratives: selectors.selectNarratives(state),
@@ -202,7 +204,6 @@ function mapStateToProps (state) {
activeTags: selectors.getActiveTags(state),
activeCategories: selectors.getActiveCategories(state),
viewFilters: state.app.filters.views,
features: state.app.features,
narrative: state.app.narrative,
sitesShowing: state.app.flags.isShowingSites,
infoShowing: state.app.flags.isInfopopup