import { createElement, Component } from '@wordpress/element' import pluginsActionsService from '../services/premium-plugins-actions.js' import { __, sprintf } from 'ct-i18n' export default class SinglePremiumPlugin extends Component { state = { isLoading: false } makeAction = action => () => { this.setState({ isLoading: true }) action(this.props.plugin.name) .then( ({ success }) => (success || true) && this.props.onPluginsSync() ) .always(() => setTimeout(() => this.setState({ isLoading: false }), 1000) ) } deactivate = this.makeAction(pluginsActionsService.performDeactivation) download = this.makeAction(pluginsActionsService.performDownload) activate = this.makeAction(pluginsActionsService.performActivation) deletion = this.makeAction(pluginsActionsService.performDeletion) render() { const { isLoading } = this.state const { status, plugin } = this.props return (
{plugin.description}
}