/* * * InstallPluginPopup * */ import React from 'react'; import PropTypes from 'prop-types'; import { FormattedMessage } from 'react-intl'; import { Modal, ModalHeader, ModalBody } from 'reactstrap'; import { map } from 'lodash'; import cn from 'classnames'; import Official from 'components/Official'; // import StarsContainer from 'components/StarsContainer'; import styles from './styles.scss'; class InstallPluginPopup extends React.Component { handleClick = () => { this.props.history.push({ pathname: this.props.history.location.pathname }); if (!this.props.isAlreadyInstalled) { this.context.downloadPlugin(this.props.plugin.id); } } toggle = () => { this.props.history.push({ pathname: this.props.history.location.pathname, }); } navLinks = [ { content: 'app.components.InstallPluginPopup.navLink.description', name: 'description', }, { content: 'app.components.InstallPluginPopup.navLink.screenshots', name: 'screenshots', }, { content: 'app.components.InstallPluginPopup.navLink.avis', name: 'avis', }, { content: 'app.components.InstallPluginPopup.navLink.faq', name: 'faq', }, { content: 'app.components.InstallPluginPopup.navLink.changelog', name: 'changelog', }, ]; render() { const descriptions = { short: this.props.plugin.id === 'support-us' ? : this.props.plugin.description.short, long: this.props.plugin.id === 'support-us' ? : this.props.plugin.description.long || this.props.plugin.description.short, }; const buttonName = this.props.isAlreadyInstalled ? 'app.components.PluginCard.Button.label.install' : 'app.components.InstallPluginPopup.downloads'; return (
icon
{this.props.plugin.name}
{/*}
{this.props.plugin.ratings} /5
*/}
{descriptions.short}
{/*} +{this.props.plugin.downloads_nb}k  */}
{/* Uncomment whebn prices are running}
{this.props.plugin.price} €
*/}
{map(this.navLinks, link => { const isActive = this.props.history.location.hash.split('::')[1] === link.name; return (
{ if (link.name === 'description') { this.props.history.push({ pathname: this.props.history.location.pathname, hash: `${this.props.plugin.id}::${link.name}` }); } }} style={isActive ? { paddingTop: '4px'} : { paddingTop: '6px' }} >
); })}
{descriptions.long}
); } } InstallPluginPopup.contextTypes = { downloadPlugin: PropTypes.func.isRequired, }; InstallPluginPopup.defaultProps = { description: { short: 'app.Components.InstallPluginPopup.noDescription', }, }; InstallPluginPopup.propTypes = { description: PropTypes.shape({ long: PropTypes.string, short: PropTypes.string, }), history: PropTypes.object.isRequired, isAlreadyInstalled: PropTypes.bool.isRequired, isOpen: PropTypes.bool.isRequired, plugin: PropTypes.object.isRequired, }; export default InstallPluginPopup;