Files
Readarr/frontend/src/Author/Index/AuthorIndexFooterConnector.js
T
2020-09-27 10:38:30 -04:00

47 lines
1.0 KiB
JavaScript

import { connect } from 'react-redux';
import { createSelector } from 'reselect';
import createClientSideCollectionSelector from 'Store/Selectors/createClientSideCollectionSelector';
import createDeepEqualSelector from 'Store/Selectors/createDeepEqualSelector';
import AuthorIndexFooter from './AuthorIndexFooter';
function createUnoptimizedSelector() {
return createSelector(
createClientSideCollectionSelector('authors', 'authorIndex'),
(authors) => {
return authors.items.map((s) => {
const {
monitored,
status,
statistics
} = s;
return {
monitored,
status,
statistics
};
});
}
);
}
function createAuthorSelector() {
return createDeepEqualSelector(
createUnoptimizedSelector(),
(author) => author
);
}
function createMapStateToProps() {
return createSelector(
createAuthorSelector(),
(author) => {
return {
author
};
}
);
}
export default connect(createMapStateToProps)(AuthorIndexFooter);