Renames in Frontend

This commit is contained in:
Qstick
2020-05-15 23:32:52 -04:00
committed by ta264
parent ee4e44b81a
commit ee43ccf620
387 changed files with 4036 additions and 4364 deletions
@@ -0,0 +1,102 @@
import PropTypes from 'prop-types';
import React, { Component } from 'react';
import { connect } from 'react-redux';
import { createSelector } from 'reselect';
import { setAddDefault, addAuthor } from 'Store/Actions/searchActions';
import createDimensionsSelector from 'Store/Selectors/createDimensionsSelector';
import selectSettings from 'Store/Selectors/selectSettings';
import AddNewAuthorModalContent from './AddNewAuthorModalContent';
function createMapStateToProps() {
return createSelector(
(state) => state.search,
(state) => state.settings.metadataProfiles,
createDimensionsSelector(),
(searchState, metadataProfiles, dimensions) => {
const {
isAdding,
addError,
defaults
} = searchState;
const {
settings,
validationErrors,
validationWarnings
} = selectSettings(defaults, {}, addError);
return {
isAdding,
addError,
showMetadataProfile: metadataProfiles.items.length > 2, // NONE (not allowed for authors) and one other
isSmallScreen: dimensions.isSmallScreen,
validationErrors,
validationWarnings,
...settings
};
}
);
}
const mapDispatchToProps = {
setAddDefault,
addAuthor
};
class AddNewAuthorModalContentConnector extends Component {
//
// Listeners
onInputChange = ({ name, value }) => {
this.props.setAddDefault({ [name]: value });
}
onAddAuthorPress = (searchForMissingBooks) => {
const {
foreignAuthorId,
rootFolderPath,
monitor,
qualityProfileId,
metadataProfileId,
tags
} = this.props;
this.props.addAuthor({
foreignAuthorId,
rootFolderPath: rootFolderPath.value,
monitor: monitor.value,
qualityProfileId: qualityProfileId.value,
metadataProfileId: metadataProfileId.value,
tags: tags.value,
searchForMissingBooks
});
}
//
// Render
render() {
return (
<AddNewAuthorModalContent
{...this.props}
onInputChange={this.onInputChange}
onAddAuthorPress={this.onAddAuthorPress}
/>
);
}
}
AddNewAuthorModalContentConnector.propTypes = {
foreignAuthorId: PropTypes.string.isRequired,
rootFolderPath: PropTypes.object,
monitor: PropTypes.object.isRequired,
qualityProfileId: PropTypes.object,
metadataProfileId: PropTypes.object,
tags: PropTypes.object.isRequired,
onModalClose: PropTypes.func.isRequired,
setAddDefault: PropTypes.func.isRequired,
addAuthor: PropTypes.func.isRequired
};
export default connect(createMapStateToProps, mapDispatchToProps)(AddNewAuthorModalContentConnector);