mirror of
https://github.com/lidarr/lidarr.git
synced 2025-07-30 03:38:26 -07:00
Fixed: Sorting by title and release dates in Select Album modal
Fixes #5145 Closes #5125 Co-authored-by: Mark McDowall <mark@mcdowall.ca>
This commit is contained in:
parent
3a5012655e
commit
bd7d25f963
5 changed files with 143 additions and 70 deletions
|
@ -3,18 +3,14 @@ import PropTypes from 'prop-types';
|
|||
import React, { Component } from 'react';
|
||||
import { connect } from 'react-redux';
|
||||
import { createSelector } from 'reselect';
|
||||
import {
|
||||
clearInteractiveImportAlbums,
|
||||
fetchInteractiveImportAlbums,
|
||||
saveInteractiveImportItem,
|
||||
setInteractiveImportAlbumsSort,
|
||||
updateInteractiveImportItem } from 'Store/Actions/interactiveImportActions';
|
||||
import { clearAlbums, fetchAlbums, setAlbumsSort } from 'Store/Actions/albumSelectionActions';
|
||||
import { saveInteractiveImportItem, updateInteractiveImportItem } from 'Store/Actions/interactiveImportActions';
|
||||
import createClientSideCollectionSelector from 'Store/Selectors/createClientSideCollectionSelector';
|
||||
import SelectAlbumModalContent from './SelectAlbumModalContent';
|
||||
|
||||
function createMapStateToProps() {
|
||||
return createSelector(
|
||||
createClientSideCollectionSelector('interactiveImport.albums'),
|
||||
createClientSideCollectionSelector('albumSelection'),
|
||||
(albums) => {
|
||||
return albums;
|
||||
}
|
||||
|
@ -22,9 +18,9 @@ function createMapStateToProps() {
|
|||
}
|
||||
|
||||
const mapDispatchToProps = {
|
||||
fetchInteractiveImportAlbums,
|
||||
setInteractiveImportAlbumsSort,
|
||||
clearInteractiveImportAlbums,
|
||||
fetchAlbums,
|
||||
setAlbumsSort,
|
||||
clearAlbums,
|
||||
updateInteractiveImportItem,
|
||||
saveInteractiveImportItem
|
||||
};
|
||||
|
@ -39,20 +35,20 @@ class SelectAlbumModalContentConnector extends Component {
|
|||
artistId
|
||||
} = this.props;
|
||||
|
||||
this.props.fetchInteractiveImportAlbums({ artistId });
|
||||
this.props.fetchAlbums({ artistId });
|
||||
}
|
||||
|
||||
componentWillUnmount() {
|
||||
// This clears the albums for the queue and hides the queue
|
||||
// We'll need another place to store albums for manual import
|
||||
this.props.clearInteractiveImportAlbums();
|
||||
this.props.clearAlbums();
|
||||
}
|
||||
|
||||
//
|
||||
// Listeners
|
||||
|
||||
onSortPress = (sortKey, sortDirection) => {
|
||||
this.props.setInteractiveImportAlbumsSort({ sortKey, sortDirection });
|
||||
this.props.setAlbumsSort({ sortKey, sortDirection });
|
||||
};
|
||||
|
||||
onAlbumSelect = (albumId) => {
|
||||
|
@ -82,6 +78,7 @@ class SelectAlbumModalContentConnector extends Component {
|
|||
return (
|
||||
<SelectAlbumModalContent
|
||||
{...this.props}
|
||||
onSortPress={this.onSortPress}
|
||||
onAlbumSelect={this.onAlbumSelect}
|
||||
/>
|
||||
);
|
||||
|
@ -92,9 +89,9 @@ SelectAlbumModalContentConnector.propTypes = {
|
|||
ids: PropTypes.arrayOf(PropTypes.number).isRequired,
|
||||
artistId: PropTypes.number.isRequired,
|
||||
items: PropTypes.arrayOf(PropTypes.object).isRequired,
|
||||
fetchInteractiveImportAlbums: PropTypes.func.isRequired,
|
||||
setInteractiveImportAlbumsSort: PropTypes.func.isRequired,
|
||||
clearInteractiveImportAlbums: PropTypes.func.isRequired,
|
||||
fetchAlbums: PropTypes.func.isRequired,
|
||||
setAlbumsSort: PropTypes.func.isRequired,
|
||||
clearAlbums: PropTypes.func.isRequired,
|
||||
saveInteractiveImportItem: PropTypes.func.isRequired,
|
||||
updateInteractiveImportItem: PropTypes.func.isRequired,
|
||||
onModalClose: PropTypes.func.isRequired
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue