"use strict";

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

var _react = _interopRequireDefault(require("react"));

var _propTypes = _interopRequireDefault(require("prop-types"));

var _reactIntl = require("react-intl");

var _cspaceInput = require("cspace-input");

var _RunButton = _interopRequireDefault(require("../../../styles/cspace-ui/RunButton.css"));

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

const {
  Button
} = _cspaceInput.components;
const messages = (0, _reactIntl.defineMessages)({
  label: {
    "id": "runButton.label",
    "defaultMessage": "Run\u2026"
  }
});
const propTypes = {
  isRunnable: _propTypes.default.bool,
  isModified: _propTypes.default.bool,
  isRunning: _propTypes.default.bool,
  onClick: _propTypes.default.func
};

function RunButton(props) {
  const {
    isRunnable,
    isModified,
    isRunning,
    onClick
  } = props;

  if (!isRunnable) {
    return null;
  }

  return /*#__PURE__*/_react.default.createElement(Button, {
    className: _RunButton.default.common,
    disabled: isRunning || isModified,
    icon: true,
    name: "run",
    onClick: onClick
  }, /*#__PURE__*/_react.default.createElement(_reactIntl.FormattedMessage, messages.label));
}

RunButton.propTypes = propTypes;