Series index selector improvements

This commit is contained in:
Mark McDowall 2019-04-05 20:17:24 -07:00
parent a63ca0f0e9
commit 2b63110323
4 changed files with 13 additions and 15 deletions

View File

@ -1,6 +1,5 @@
import { connect } from 'react-redux';
import { createSelector } from 'reselect';
import createClientSideCollectionSelector from 'Store/Selectors/createClientSideCollectionSelector';
import createUISettingsSelector from 'Store/Selectors/createUISettingsSelector';
import createDimensionsSelector from 'Store/Selectors/createDimensionsSelector';
import SeriesIndexOverviews from './SeriesIndexOverviews';
@ -8,18 +7,16 @@ import SeriesIndexOverviews from './SeriesIndexOverviews';
function createMapStateToProps() {
return createSelector(
(state) => state.seriesIndex.overviewOptions,
createClientSideCollectionSelector('series', 'seriesIndex'),
createUISettingsSelector(),
createDimensionsSelector(),
(overviewOptions, series, uiSettings, dimensions) => {
(overviewOptions, uiSettings, dimensions) => {
return {
overviewOptions,
showRelativeDates: uiSettings.showRelativeDates,
shortDateFormat: uiSettings.shortDateFormat,
longDateFormat: uiSettings.longDateFormat,
timeFormat: uiSettings.timeFormat,
isSmallScreen: dimensions.isSmallScreen,
...series
isSmallScreen: dimensions.isSmallScreen
};
}
);

View File

@ -1,6 +1,5 @@
import { connect } from 'react-redux';
import { createSelector } from 'reselect';
import createClientSideCollectionSelector from 'Store/Selectors/createClientSideCollectionSelector';
import createUISettingsSelector from 'Store/Selectors/createUISettingsSelector';
import createDimensionsSelector from 'Store/Selectors/createDimensionsSelector';
import SeriesIndexPosters from './SeriesIndexPosters';
@ -8,17 +7,15 @@ import SeriesIndexPosters from './SeriesIndexPosters';
function createMapStateToProps() {
return createSelector(
(state) => state.seriesIndex.posterOptions,
createClientSideCollectionSelector('series', 'seriesIndex'),
createUISettingsSelector(),
createDimensionsSelector(),
(posterOptions, series, uiSettings, dimensions) => {
(posterOptions, uiSettings, dimensions) => {
return {
posterOptions,
showRelativeDates: uiSettings.showRelativeDates,
shortDateFormat: uiSettings.shortDateFormat,
timeFormat: uiSettings.timeFormat,
isSmallScreen: dimensions.isSmallScreen,
...series
isSmallScreen: dimensions.isSmallScreen
};
}
);

View File

@ -320,6 +320,10 @@ class SeriesIndex extends Component {
<div className={styles.contentBodyContainer}>
<ViewComponent
contentBody={contentBody}
items={items}
filters={filters}
sortKey={sortKey}
sortDirection={sortDirection}
scrollTop={scrollTop}
jumpToCharacter={jumpToCharacter}
onRender={this.onRender}

View File

@ -1,18 +1,18 @@
import { connect } from 'react-redux';
import { createSelector } from 'reselect';
import createClientSideCollectionSelector from 'Store/Selectors/createClientSideCollectionSelector';
import { setSeriesSort } from 'Store/Actions/seriesIndexActions';
import SeriesIndexTable from './SeriesIndexTable';
function createMapStateToProps() {
return createSelector(
(state) => state.app.dimensions,
createClientSideCollectionSelector('series', 'seriesIndex'),
(dimensions, series) => {
(state) => state.seriesIndex.tableOptions,
(state) => state.seriesIndex.columns,
(dimensions, tableOptions, columns) => {
return {
isSmallScreen: dimensions.isSmallScreen,
...series,
showBanners: series.tableOptions.showBanners
showBanners: tableOptions.showBanners,
columns
};
}
);