|
|
@ -8,7 +8,7 @@ import { findCommand } from 'Utilities/Command';
|
|
|
|
import createDimensionsSelector from 'Store/Selectors/createDimensionsSelector';
|
|
|
|
import createDimensionsSelector from 'Store/Selectors/createDimensionsSelector';
|
|
|
|
import createArtistSelector from 'Store/Selectors/createArtistSelector';
|
|
|
|
import createArtistSelector from 'Store/Selectors/createArtistSelector';
|
|
|
|
import createCommandsSelector from 'Store/Selectors/createCommandsSelector';
|
|
|
|
import createCommandsSelector from 'Store/Selectors/createCommandsSelector';
|
|
|
|
import { toggleAlbumsMonitored, setAlbumsTableOption } from 'Store/Actions/albumActions';
|
|
|
|
import { toggleAlbumsMonitored, setAlbumsTableOption, setAlbumsSort } from 'Store/Actions/albumActions';
|
|
|
|
import { executeCommand } from 'Store/Actions/commandActions';
|
|
|
|
import { executeCommand } from 'Store/Actions/commandActions';
|
|
|
|
import * as commandNames from 'Commands/commandNames';
|
|
|
|
import * as commandNames from 'Commands/commandNames';
|
|
|
|
import ArtistDetailsSeason from './ArtistDetailsSeason';
|
|
|
|
import ArtistDetailsSeason from './ArtistDetailsSeason';
|
|
|
@ -23,11 +23,20 @@ function createMapStateToProps() {
|
|
|
|
(label, albums, artist, commands, dimensions) => {
|
|
|
|
(label, albums, artist, commands, dimensions) => {
|
|
|
|
|
|
|
|
|
|
|
|
const albumsInGroup = _.filter(albums.items, { albumType: label });
|
|
|
|
const albumsInGroup = _.filter(albums.items, { albumType: label });
|
|
|
|
const sortedAlbums = _.orderBy(albumsInGroup, 'releaseDate', 'desc');
|
|
|
|
|
|
|
|
|
|
|
|
let sortDir = 'asc';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (albums.sortDirection === 'descending') {
|
|
|
|
|
|
|
|
sortDir = 'desc';
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const sortedAlbums = _.orderBy(albumsInGroup, albums.sortKey, sortDir);
|
|
|
|
|
|
|
|
|
|
|
|
return {
|
|
|
|
return {
|
|
|
|
items: sortedAlbums,
|
|
|
|
items: sortedAlbums,
|
|
|
|
columns: albums.columns,
|
|
|
|
columns: albums.columns,
|
|
|
|
|
|
|
|
sortKey: albums.sortKey,
|
|
|
|
|
|
|
|
sortDirection: albums.sortDirection,
|
|
|
|
artistMonitored: artist.monitored,
|
|
|
|
artistMonitored: artist.monitored,
|
|
|
|
isSmallScreen: dimensions.isSmallScreen
|
|
|
|
isSmallScreen: dimensions.isSmallScreen
|
|
|
|
};
|
|
|
|
};
|
|
|
@ -38,6 +47,7 @@ function createMapStateToProps() {
|
|
|
|
const mapDispatchToProps = {
|
|
|
|
const mapDispatchToProps = {
|
|
|
|
toggleAlbumsMonitored,
|
|
|
|
toggleAlbumsMonitored,
|
|
|
|
setAlbumsTableOption,
|
|
|
|
setAlbumsTableOption,
|
|
|
|
|
|
|
|
dispatchSetAlbumSort: setAlbumsSort,
|
|
|
|
executeCommand
|
|
|
|
executeCommand
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
@ -50,6 +60,10 @@ class ArtistDetailsSeasonConnector extends Component {
|
|
|
|
this.props.setAlbumsTableOption(payload);
|
|
|
|
this.props.setAlbumsTableOption(payload);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
onSortPress = (sortKey) => {
|
|
|
|
|
|
|
|
this.props.dispatchSetAlbumSort({ sortKey });
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
onMonitorAlbumPress = (albumIds, monitored) => {
|
|
|
|
onMonitorAlbumPress = (albumIds, monitored) => {
|
|
|
|
this.props.toggleAlbumsMonitored({
|
|
|
|
this.props.toggleAlbumsMonitored({
|
|
|
|
albumIds,
|
|
|
|
albumIds,
|
|
|
@ -64,6 +78,7 @@ class ArtistDetailsSeasonConnector extends Component {
|
|
|
|
return (
|
|
|
|
return (
|
|
|
|
<ArtistDetailsSeason
|
|
|
|
<ArtistDetailsSeason
|
|
|
|
{...this.props}
|
|
|
|
{...this.props}
|
|
|
|
|
|
|
|
onSortPress={this.onSortPress}
|
|
|
|
onTableOptionChange={this.onTableOptionChange}
|
|
|
|
onTableOptionChange={this.onTableOptionChange}
|
|
|
|
onMonitorAlbumPress={this.onMonitorAlbumPress}
|
|
|
|
onMonitorAlbumPress={this.onMonitorAlbumPress}
|
|
|
|
/>
|
|
|
|
/>
|
|
|
@ -75,6 +90,7 @@ ArtistDetailsSeasonConnector.propTypes = {
|
|
|
|
artistId: PropTypes.number.isRequired,
|
|
|
|
artistId: PropTypes.number.isRequired,
|
|
|
|
toggleAlbumsMonitored: PropTypes.func.isRequired,
|
|
|
|
toggleAlbumsMonitored: PropTypes.func.isRequired,
|
|
|
|
setAlbumsTableOption: PropTypes.func.isRequired,
|
|
|
|
setAlbumsTableOption: PropTypes.func.isRequired,
|
|
|
|
|
|
|
|
dispatchSetAlbumSort: PropTypes.func.isRequired,
|
|
|
|
executeCommand: PropTypes.func.isRequired
|
|
|
|
executeCommand: PropTypes.func.isRequired
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|