mirror of
https://github.com/Prowlarr/Prowlarr.git
synced 2025-09-17 17:14:18 +02:00
Cleanup unused frontend components
This commit is contained in:
@@ -0,0 +1,69 @@
|
||||
import { push } from 'connected-react-router';
|
||||
import { connect } from 'react-redux';
|
||||
import { createSelector } from 'reselect';
|
||||
import { setSearchDefault } from 'Store/Actions/releaseActions';
|
||||
import createAllIndexersSelector from 'Store/Selectors/createAllIndexersSelector';
|
||||
import createDeepEqualSelector from 'Store/Selectors/createDeepEqualSelector';
|
||||
import createTagsSelector from 'Store/Selectors/createTagsSelector';
|
||||
import IndexerSearchInput from './IndexerSearchInput';
|
||||
|
||||
function createCleanMovieSelector() {
|
||||
return createSelector(
|
||||
createAllIndexersSelector(),
|
||||
createTagsSelector(),
|
||||
(allIndexers, allTags) => {
|
||||
return allIndexers.map((movie) => {
|
||||
const {
|
||||
name,
|
||||
titleSlug,
|
||||
sortTitle,
|
||||
year,
|
||||
images,
|
||||
alternateTitles = [],
|
||||
tags = []
|
||||
} = movie;
|
||||
|
||||
return {
|
||||
name,
|
||||
titleSlug,
|
||||
sortTitle,
|
||||
year,
|
||||
images,
|
||||
alternateTitles,
|
||||
firstCharacter: name.charAt(0).toLowerCase(),
|
||||
tags: tags.reduce((acc, id) => {
|
||||
const matchingTag = allTags.find((tag) => tag.id === id);
|
||||
|
||||
if (matchingTag) {
|
||||
acc.push(matchingTag);
|
||||
}
|
||||
|
||||
return acc;
|
||||
}, [])
|
||||
};
|
||||
});
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
function createMapStateToProps() {
|
||||
return createDeepEqualSelector(
|
||||
createCleanMovieSelector(),
|
||||
(movies) => {
|
||||
return {
|
||||
movies
|
||||
};
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
function createMapDispatchToProps(dispatch, props) {
|
||||
return {
|
||||
onGoToAddNewMovie(query) {
|
||||
dispatch(setSearchDefault({ searchQuery: query, searchIndexerIds: [-1, -2] }));
|
||||
dispatch(push(`${window.Prowlarr.urlBase}/search`));
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
export default connect(createMapStateToProps, createMapDispatchToProps)(IndexerSearchInput);
|
Reference in New Issue
Block a user