|
|
|
@ -4,8 +4,9 @@ import { connect } from 'react-redux';
|
|
|
|
|
import { createSelector } from 'reselect';
|
|
|
|
|
import * as commandNames from 'Commands/commandNames';
|
|
|
|
|
import { executeCommand } from 'Store/Actions/commandActions';
|
|
|
|
|
import { setEpisodesTableOption, toggleEpisodesMonitored } from 'Store/Actions/episodeActions';
|
|
|
|
|
import { setEpisodesSort, setEpisodesTableOption, toggleEpisodesMonitored } from 'Store/Actions/episodeActions';
|
|
|
|
|
import { toggleSeasonMonitored } from 'Store/Actions/seriesActions';
|
|
|
|
|
import createClientSideCollectionSelector from 'Store/Selectors/createClientSideCollectionSelector';
|
|
|
|
|
import createCommandsSelector from 'Store/Selectors/createCommandsSelector';
|
|
|
|
|
import createDimensionsSelector from 'Store/Selectors/createDimensionsSelector';
|
|
|
|
|
import createSeriesSelector from 'Store/Selectors/createSeriesSelector';
|
|
|
|
@ -15,7 +16,7 @@ import SeriesDetailsSeason from './SeriesDetailsSeason';
|
|
|
|
|
function createMapStateToProps() {
|
|
|
|
|
return createSelector(
|
|
|
|
|
(state, { seasonNumber }) => seasonNumber,
|
|
|
|
|
(state) => state.episodes,
|
|
|
|
|
createClientSideCollectionSelector('episodes'),
|
|
|
|
|
createSeriesSelector(),
|
|
|
|
|
createCommandsSelector(),
|
|
|
|
|
createDimensionsSelector(),
|
|
|
|
@ -27,11 +28,12 @@ function createMapStateToProps() {
|
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
const episodesInSeason = episodes.items.filter((episode) => episode.seasonNumber === seasonNumber);
|
|
|
|
|
const sortedEpisodes = episodesInSeason.sort((a, b) => b.episodeNumber - a.episodeNumber);
|
|
|
|
|
|
|
|
|
|
return {
|
|
|
|
|
items: sortedEpisodes,
|
|
|
|
|
items: episodesInSeason,
|
|
|
|
|
columns: episodes.columns,
|
|
|
|
|
sortKey: episodes.sortKey,
|
|
|
|
|
sortDirection: episodes.sortDirection,
|
|
|
|
|
isSearching,
|
|
|
|
|
seriesMonitored: series.monitored,
|
|
|
|
|
path: series.path,
|
|
|
|
@ -45,6 +47,7 @@ const mapDispatchToProps = {
|
|
|
|
|
toggleSeasonMonitored,
|
|
|
|
|
toggleEpisodesMonitored,
|
|
|
|
|
setEpisodesTableOption,
|
|
|
|
|
setEpisodesSort,
|
|
|
|
|
executeCommand
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
@ -90,6 +93,13 @@ class SeriesDetailsSeasonConnector extends Component {
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
onSortPress = (sortKey, sortDirection) => {
|
|
|
|
|
this.props.setEpisodesSort({
|
|
|
|
|
sortKey,
|
|
|
|
|
sortDirection
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
// Render
|
|
|
|
|
|
|
|
|
@ -98,6 +108,7 @@ class SeriesDetailsSeasonConnector extends Component {
|
|
|
|
|
<SeriesDetailsSeason
|
|
|
|
|
{...this.props}
|
|
|
|
|
onTableOptionChange={this.onTableOptionChange}
|
|
|
|
|
onSortPress={this.onSortPress}
|
|
|
|
|
onMonitorSeasonPress={this.onMonitorSeasonPress}
|
|
|
|
|
onSearchPress={this.onSearchPress}
|
|
|
|
|
onMonitorEpisodePress={this.onMonitorEpisodePress}
|
|
|
|
@ -112,6 +123,7 @@ SeriesDetailsSeasonConnector.propTypes = {
|
|
|
|
|
toggleSeasonMonitored: PropTypes.func.isRequired,
|
|
|
|
|
toggleEpisodesMonitored: PropTypes.func.isRequired,
|
|
|
|
|
setEpisodesTableOption: PropTypes.func.isRequired,
|
|
|
|
|
setEpisodesSort: PropTypes.func.isRequired,
|
|
|
|
|
executeCommand: PropTypes.func.isRequired
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|