'use strict';

Object.defineProperty(exports, "__esModule", {
  value: true
});

var _react = require('react');

var _react2 = _interopRequireDefault(_react);

var _propTypes = require('prop-types');

var _propTypes2 = _interopRequireDefault(_propTypes);

var _reactFontawesome = require('react-fontawesome');

var _reactFontawesome2 = _interopRequireDefault(_reactFontawesome);

var _reactBootstrap = require('react-bootstrap');

var _reactRemarkable = require('react-remarkable');

var _reactRemarkable2 = _interopRequireDefault(_reactRemarkable);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

const __ = window.i18n.setting.__.bind(window.i18n.setting);

class UninstalledPlugin extends _react.PureComponent {
  render() {
    const plugin = this.props.plugin;
    const installButtonText = this.props.installing ? `${__('Installing')}` : `${__('Install')}`;
    const installButtonFAname = this.props.installing ? 'spinner' : 'download';
    return _react2.default.createElement(
      _reactBootstrap.Row,
      { className: 'plugin-wrapper' },
      _react2.default.createElement(
        _reactBootstrap.Col,
        { xs: 12 },
        _react2.default.createElement(
          _reactBootstrap.Panel,
          { className: 'plugin-content' },
          _react2.default.createElement(
            _reactBootstrap.Row,
            null,
            _react2.default.createElement(
              _reactBootstrap.Col,
              { xs: 12, className: 'div-row' },
              _react2.default.createElement(
                'span',
                { className: 'plugin-name' },
                _react2.default.createElement(_reactFontawesome2.default, { name: plugin.icon }),
                ` ${plugin[window.language]}`
              ),
              _react2.default.createElement(
                'div',
                { className: 'author-wrapper' },
                '@',
                _react2.default.createElement(
                  'a',
                  { className: 'author-link',
                    href: plugin.link },
                  plugin.author
                )
              )
            )
          ),
          _react2.default.createElement(
            _reactBootstrap.Row,
            null,
            _react2.default.createElement(
              _reactBootstrap.Col,
              { className: 'plugin-description', xs: 7 },
              _react2.default.createElement(_reactRemarkable2.default, { source: plugin[`des${window.language}`] })
            ),
            _react2.default.createElement(
              _reactBootstrap.Col,
              { className: 'plugin-option-install', xs: 5 },
              _react2.default.createElement(
                _reactBootstrap.ButtonGroup,
                { bsSize: 'small', className: 'plugin-buttongroup btn-xs-4' },
                _react2.default.createElement(
                  _reactBootstrap.OverlayTrigger,
                  { placement: 'top', overlay: _react2.default.createElement(
                      _reactBootstrap.Tooltip,
                      { id: `${plugin.id}-ins-btn` },
                      installButtonText
                    ) },
                  _react2.default.createElement(
                    _reactBootstrap.Button,
                    { bsStyle: 'primary',
                      disabled: this.props.npmWorking,
                      onClick: this.props.handleInstall,
                      className: 'plugin-control-button btn-xs-12' },
                    _react2.default.createElement(_reactFontawesome2.default, { name: installButtonFAname,
                      pulse: this.props.installing })
                  )
                )
              )
            )
          )
        )
      )
    );
  }
}

UninstalledPlugin.propTypes = {
  plugin: _propTypes2.default.object,
  installing: _propTypes2.default.bool,
  npmWorking: _propTypes2.default.bool,
  handleInstall: _propTypes2.default.func
};
exports.default = UninstalledPlugin;
module.exports = exports['default'];