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

View File

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