2017-12-12 14:30:24 +01:00
|
|
|
/*
|
|
|
|
*
|
|
|
|
* 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';
|
2017-12-12 17:05:43 +01:00
|
|
|
import cn from 'classnames';
|
2017-12-12 14:30:24 +01:00
|
|
|
|
2017-12-16 16:51:23 +01:00
|
|
|
import Official from 'components/Official';
|
|
|
|
// import StarsContainer from 'components/StarsContainer';
|
|
|
|
|
|
|
|
// Icons
|
|
|
|
import IconAuth from 'assets/icons/icon_auth-permissions.svg';
|
|
|
|
import IconCM from 'assets/icons/icon_content-manager.svg';
|
|
|
|
import IconCTB from 'assets/icons/icon_content-type-builder.svg';
|
|
|
|
import IconSM from 'assets/icons/icon_settings-manager.svg';
|
|
|
|
|
2017-12-12 14:30:24 +01:00
|
|
|
import styles from './styles.scss';
|
|
|
|
|
|
|
|
class InstallPluginPopup extends React.Component {
|
2017-12-16 16:51:23 +01:00
|
|
|
getPluginICon = () => {
|
|
|
|
switch (this.props.plugin.id) {
|
|
|
|
case 'content-manager':
|
|
|
|
return IconCM;
|
|
|
|
case 'content-type-builder':
|
|
|
|
return IconCTB;
|
|
|
|
case 'settings-manager':
|
|
|
|
return IconSM;
|
|
|
|
case 'users-permissions':
|
|
|
|
return IconAuth;
|
|
|
|
default:
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-12-12 19:53:04 +01:00
|
|
|
handleClick = () => {
|
|
|
|
this.props.history.push({ pathname: this.props.history.location.pathname });
|
|
|
|
this.context.downloadPlugin(this.props.plugin.id);
|
|
|
|
}
|
|
|
|
|
2017-12-12 14:30:24 +01:00
|
|
|
toggle = () => {
|
|
|
|
this.props.history.push({
|
|
|
|
pathname: this.props.history.location.pathname,
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
navLinks = [
|
|
|
|
{
|
|
|
|
content: 'app.components.InstallPluginPopup.navLink.description',
|
|
|
|
name: 'description',
|
|
|
|
},
|
2017-12-12 17:05:43 +01:00
|
|
|
{
|
|
|
|
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',
|
|
|
|
},
|
2017-12-12 14:30:24 +01:00
|
|
|
];
|
|
|
|
|
|
|
|
render() {
|
|
|
|
return (
|
|
|
|
<Modal isOpen={this.props.isOpen} toggle={this.toggle} className={styles.modalPosition}>
|
|
|
|
<ModalHeader toggle={this.toggle} className={styles.modalHeader} />
|
|
|
|
<ModalBody className={styles.modalBody}>
|
2017-12-12 15:44:04 +01:00
|
|
|
<div className={styles.wrapper}>
|
|
|
|
|
|
|
|
<div className={styles.headerWrapper}>
|
2017-12-16 16:51:23 +01:00
|
|
|
<div className={styles.logo}><img src={this.getPluginICon()} alt="icon" /></div>
|
2017-12-12 15:44:04 +01:00
|
|
|
<div className={styles.headerInfo}>
|
|
|
|
<div className={styles.name}>{this.props.plugin.name}</div>
|
|
|
|
<div className={styles.ratings}>
|
2017-12-16 16:51:23 +01:00
|
|
|
{/*}
|
2017-12-12 17:49:06 +01:00
|
|
|
<StarsContainer ratings={this.props.plugin.ratings} />
|
2017-12-12 14:30:24 +01:00
|
|
|
<div>
|
2017-12-12 15:44:04 +01:00
|
|
|
<span style={{ fontWeight: '600', color: '#333740', fontSize: '12px'}}>{this.props.plugin.ratings}</span>
|
|
|
|
<span style={{ fontWeight: '500', color: '#666666', fontSize: '11px' }}>/5</span>
|
2017-12-12 14:30:24 +01:00
|
|
|
</div>
|
2017-12-16 16:51:23 +01:00
|
|
|
*/}
|
|
|
|
<Official style={{ marginTop: '0' }} />
|
2017-12-12 14:30:24 +01:00
|
|
|
</div>
|
2017-12-12 15:44:04 +01:00
|
|
|
<div className={styles.headerDescription}>
|
|
|
|
<FormattedMessage id={this.props.plugin.description} />
|
2017-12-12 14:30:24 +01:00
|
|
|
</div>
|
2017-12-12 15:44:04 +01:00
|
|
|
<div className={styles.headerButtonContainer}>
|
|
|
|
<div>
|
|
|
|
<i className={`fa fa-${this.props.plugin.isCompatible ? 'check' : 'times'}`} />
|
|
|
|
<FormattedMessage id={`app.components.PluginCard.compatible${this.props.plugin.id === 'support-us' ? 'Community' : ''}`} />
|
|
|
|
</div>
|
|
|
|
<div>
|
2017-12-12 17:49:06 +01:00
|
|
|
<div>
|
2017-12-12 18:30:09 +01:00
|
|
|
{/*}
|
2017-12-12 17:49:06 +01:00
|
|
|
<span style={{ fontWeight: '600' }}>+{this.props.plugin.downloads_nb}k </span><FormattedMessage id="app.components.InstallPluginPopup.downloads" />
|
2017-12-12 18:30:09 +01:00
|
|
|
*/}
|
2017-12-12 17:49:06 +01:00
|
|
|
</div>
|
2017-12-12 19:53:04 +01:00
|
|
|
<div className={styles.buttonWrapper} onClick={this.handleClick}>
|
2017-12-12 15:44:04 +01:00
|
|
|
<div>
|
|
|
|
<FormattedMessage id="app.components.InstallPluginPopup.downloads" />
|
|
|
|
</div>
|
2017-12-12 17:49:06 +01:00
|
|
|
{/* Uncomment whebn prices are running}
|
2017-12-12 15:44:04 +01:00
|
|
|
<div>{this.props.plugin.price} €</div>
|
2017-12-12 17:49:06 +01:00
|
|
|
*/}
|
2017-12-12 14:30:24 +01:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div className={styles.navContainer}>
|
|
|
|
{map(this.navLinks, link => {
|
2017-12-12 15:44:04 +01:00
|
|
|
const isActive = this.props.history.location.hash.split('::')[1] === link.name;
|
|
|
|
|
2017-12-12 14:30:24 +01:00
|
|
|
return (
|
2017-12-12 17:05:43 +01:00
|
|
|
<div
|
|
|
|
key={link.name}
|
|
|
|
className={cn(isActive ? styles.navLink : '', link.name !== 'description' ? styles.notAllowed : '')}
|
|
|
|
onClick={() => {
|
|
|
|
if (link.name === 'description') {
|
|
|
|
this.props.history.push({ pathname: this.props.history.location.pathname, hash: `${this.props.plugin.id}::${link.name}` });
|
|
|
|
}
|
|
|
|
}}
|
2017-12-12 17:49:06 +01:00
|
|
|
style={isActive ? { paddingTop: '4px'} : { paddingTop: '6px' }}
|
2017-12-12 17:05:43 +01:00
|
|
|
>
|
2017-12-12 14:30:24 +01:00
|
|
|
<FormattedMessage id={link.content} />
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
})}
|
|
|
|
</div>
|
2017-12-12 16:18:48 +01:00
|
|
|
<div className={styles.pluginDescription}>
|
|
|
|
{this.props.plugin.longDescription}
|
|
|
|
</div>
|
2017-12-12 14:30:24 +01:00
|
|
|
</ModalBody>
|
|
|
|
</Modal>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-12-12 19:53:04 +01:00
|
|
|
InstallPluginPopup.contextTypes = {
|
|
|
|
downloadPlugin: PropTypes.func.isRequired,
|
|
|
|
};
|
2017-12-12 14:30:24 +01:00
|
|
|
|
|
|
|
InstallPluginPopup.propTypes = {
|
|
|
|
history: PropTypes.object.isRequired,
|
|
|
|
isOpen: PropTypes.bool.isRequired,
|
|
|
|
plugin: PropTypes.object.isRequired,
|
|
|
|
};
|
|
|
|
|
|
|
|
export default InstallPluginPopup;
|