/** * * InstallPluginPage * */ import React from 'react'; import PropTypes from 'prop-types'; import { connect } from 'react-redux'; import { Helmet } from 'react-helmet'; import { FormattedMessage } from 'react-intl'; import { bindActionCreators, compose } from 'redux'; import cn from 'classnames'; // Design import Input from 'components/Input'; import PluginHeader from 'components/PluginHeader'; import injectSaga from 'utils/injectSaga'; import injectReducer from 'utils/injectReducer'; import { getPlugins, onChange, } from './actions'; import makeSelectInstallPluginPage from './selectors'; import reducer from './reducer'; import saga from './saga'; import styles from './styles.scss'; export class InstallPluginPage extends React.Component { // eslint-disable-line react/prefer-stateless-function componentDidMount() { // Don't fetch the available plugins if it has already been done if (!this.props.didFetchPlugins) { this.props.getPlugins(); } } render() { return (
{message => ( {message} )}
); } } InstallPluginPage.contextTypes = { plugins: PropTypes.object.isRequired, }; InstallPluginPage.propTypes = { didFetchPlugins: PropTypes.bool.isRequired, getPlugins: PropTypes.func.isRequired, onChange: PropTypes.func.isRequired, search: PropTypes.string.isRequired, }; const mapStateToProps = makeSelectInstallPluginPage(); function mapDispatchToProps(dispatch) { return bindActionCreators( { getPlugins, onChange, }, dispatch, ); } 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 */ const withReducer = injectReducer({ key: 'installPluginPage', 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 */ const withSaga = injectSaga({ key: 'installPluginPage', saga }); export default compose( withReducer, withSaga, withConnect, )(InstallPluginPage);