"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports["default"] = void 0;

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

var _classnames = _interopRequireDefault(require("classnames"));

var _getLocale = require("../../../../utils/getLocale");

var _tools = require("../../../../utils/tools");

var _openData = require("../../../../utils/open-data");

var _helper = require("../../helper");

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

function OName(props) {
  var editable = props.editable,
      okrName = props.okrName,
      setIsEdit = props.setIsEdit,
      okrStatus = props.okrStatus,
      children = props.children,
      approvalSetting = props.approvalSetting,
      applyState = props.applyState,
      OkrAndKrApprovalTypes = props.OkrAndKrApprovalTypes;

  var handleEditClick = function handleEditClick() {
    if ((0, _helper.getApprovalOkr)(approvalSetting, 'changeOkrName', applyState, OkrAndKrApprovalTypes)) {
      if (editable) {
        setIsEdit(true);
      }
    }
  };

  return /*#__PURE__*/_react["default"].createElement("div", {
    className: (0, _classnames["default"])('okr-drawer-header__title', {
      'okr-drawer-header__title--editable': editable
    })
  }, /*#__PURE__*/_react["default"].createElement("span", {
    className: "okr-drawer-header__name",
    onClick: handleEditClick
  }, (0, _openData.parseString)((0, _tools.htmlDecodeByRegExp)(okrName))), children, Number(okrStatus) === 2 && /*#__PURE__*/_react["default"].createElement("span", {
    className: "okr-drawer-header__over-tag"
  }, (0, _getLocale.getLocale)('OKR_MyO_Butt_Hasended')));
}

var _default = OName;
exports["default"] = _default;