You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
888 B
32 lines
888 B
import _ from 'lodash';
|
|
import { connect } from 'react-redux';
|
|
import { push } from 'react-router-redux';
|
|
import { createSelector } from 'reselect';
|
|
import createAllArtistSelector from 'Store/Selectors/createAllArtistSelector';
|
|
import ArtistSearchInput from './ArtistSearchInput';
|
|
|
|
function createMapStateToProps() {
|
|
return createSelector(
|
|
createAllArtistSelector(),
|
|
(artist) => {
|
|
return {
|
|
artist: _.sortBy(artist, 'sortName')
|
|
};
|
|
}
|
|
);
|
|
}
|
|
|
|
function createMapDispatchToProps(dispatch, props) {
|
|
return {
|
|
onGoToArtist(foreignArtistId) {
|
|
dispatch(push(`${window.Lidarr.urlBase}/artist/${foreignArtistId}`));
|
|
},
|
|
|
|
onGoToAddNewArtist(query) {
|
|
dispatch(push(`${window.Lidarr.urlBase}/add/new?term=${encodeURIComponent(query)}`));
|
|
}
|
|
};
|
|
}
|
|
|
|
export default connect(createMapStateToProps, createMapDispatchToProps)(ArtistSearchInput);
|