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.
37 lines
973 B
37 lines
973 B
import _ from 'lodash';
|
|
import { connect } from 'react-redux';
|
|
import { createSelector } from 'reselect';
|
|
import createAllArtistSelector from 'Store/Selectors/createAllArtistSelector';
|
|
import createTagsSelector from 'Store/Selectors/createTagsSelector';
|
|
import TagsModalContent from './TagsModalContent';
|
|
|
|
function createMapStateToProps() {
|
|
return createSelector(
|
|
(state, { artistIds }) => artistIds,
|
|
createAllArtistSelector(),
|
|
createTagsSelector(),
|
|
(artistIds, allArtists, tagList) => {
|
|
const series = _.intersectionWith(allArtists, artistIds, (s, id) => {
|
|
return s.id === id;
|
|
});
|
|
|
|
const artistTags = _.uniq(_.concat(..._.map(series, 'tags')));
|
|
|
|
return {
|
|
artistTags,
|
|
tagList
|
|
};
|
|
}
|
|
);
|
|
}
|
|
|
|
function createMapDispatchToProps(dispatch, props) {
|
|
return {
|
|
onAction() {
|
|
// Do something
|
|
}
|
|
};
|
|
}
|
|
|
|
export default connect(createMapStateToProps, createMapDispatchToProps)(TagsModalContent);
|