Fix MarketPlace and plugin documentation proptypes error

This commit is contained in:
soupette 2019-04-03 17:06:07 +02:00
parent 44a00f9c75
commit c8d269aeca
2 changed files with 31 additions and 21 deletions

View File

@ -1,7 +1,7 @@
/**
*
*
* Marketplace
*
*
*/
import React from 'react';
@ -33,11 +33,9 @@ import saga from './saga';
import styles from './styles.scss';
class Marketplace extends React.Component {
getChildContext = () => (
{
downloadPlugin: this.props.downloadPlugin,
}
);
getChildContext = () => ({
downloadPlugin: this.props.downloadPlugin,
});
componentDidMount() {
// Fetch the available and installed plugins
@ -56,9 +54,15 @@ class Marketplace extends React.Component {
);
renderPluginCard = plugin => {
const { adminPage: { currentEnvironment }, availablePlugins, downloadPlugin, history, installedPlugins } = this.props;
const {
admin: { currentEnvironment },
availablePlugins,
downloadPlugin,
history,
installedPlugins,
} = this.props;
const currentPlugin = availablePlugins[plugin];
return (
<PluginCard
currentEnvironment={currentEnvironment}
@ -67,7 +71,7 @@ class Marketplace extends React.Component {
plugin={currentPlugin}
showSupportUsButton={currentPlugin.id === 'support-us'}
isAlreadyInstalled={installedPlugins.includes(currentPlugin.id)}
downloadPlugin={(e) => {
downloadPlugin={e => {
e.preventDefault();
e.stopPropagation();
@ -77,7 +81,7 @@ class Marketplace extends React.Component {
}}
/>
);
}
};
render() {
const { availablePlugins, isLoading } = this.props;
@ -113,7 +117,7 @@ Marketplace.childContextTypes = {
Marketplace.defaultProps = {};
Marketplace.propTypes = {
adminPage: PropTypes.object.isRequired,
admin: PropTypes.object.isRequired,
availablePlugins: PropTypes.array.isRequired,
downloadPlugin: PropTypes.func.isRequired,
getAvailableAndInstalledPlugins: PropTypes.func.isRequired,
@ -136,16 +140,19 @@ function mapDispatchToProps(dispatch) {
);
}
const withConnect = connect(mapStateToProps, mapDispatchToProps);
const withConnect = connect(
mapStateToProps,
mapDispatchToProps,
);
/* Remove this line if the container doesn't have a route and
* check the documentation to see how to create the container's store
*/
* check the documentation to see how to create the container's store
*/
const withReducer = injectReducer({ key: 'marketplace', reducer });
/* Remove the line below the container doesn't have a route and
* check the documentation to see how to create the container's store
*/
* check the documentation to see how to create the container's store
*/
const withSaga = injectSaga({ key: 'marketplace', saga });
export default compose(

View File

@ -202,7 +202,7 @@ HomePage.defaultProps = {
didCheckErrors: false,
docVersions: [],
form: [],
formErrors: [],
formErrors: {},
isLoading: true,
onChange: () => {},
onClickDeleteDoc: () => {},
@ -210,7 +210,6 @@ HomePage.defaultProps = {
onSubmit: () => {},
onUpdateDoc: () => {},
versionToDelete: '',
};
HomePage.propTypes = {
@ -218,7 +217,7 @@ HomePage.propTypes = {
didCheckErrors: PropTypes.bool,
docVersions: PropTypes.array,
form: PropTypes.array,
formErrors: PropTypes.array,
formErrors: PropTypes.object,
getDocInfos: PropTypes.func.isRequired,
isLoading: PropTypes.bool,
onChange: PropTypes.func,
@ -249,7 +248,11 @@ const withConnect = connect(
mapStateToProps,
mapDispatchToProps,
);
const withReducer = strapi.injectReducer({ key: 'homePage', reducer, pluginId });
const withReducer = strapi.injectReducer({
key: 'homePage',
reducer,
pluginId,
});
const withSaga = strapi.injectSaga({ key: 'homePage', saga, pluginId });
export default compose(