"use strict";

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

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

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

var _tooltipText = _interopRequireDefault(require("../../../../../tooltip/tooltip-text"));

var _appTixing = _interopRequireDefault(require("../../images/app-tixing.svg"));

var _constant = require("../../constant");

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

require("./index.css");

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

function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }

var preCls = 'titaui-user-message-msg-remind';

function Remind(props) {
  var _props$item = props.item,
      content = _props$item.content,
      id = _props$item.id,
      objId = _props$item.objId,
      objName = _props$item.objName,
      objType = _props$item.objType,
      remindUser = _props$item.remindUser,
      onItemClick = props.onItemClick,
      deleteTask = props.deleteTask,
      reminds = props.reminds;

  var handleRemindClick = function handleRemindClick() {
    onItemClick && onItemClick(false);
  };

  var deleteOneTask = function deleteOneTask() {
    deleteTask(props.item);
  };

  var getItemLabelName = function getItemLabelName() {
    var labelName;

    switch (objType) {
      case _constant.EObjType.Interview:
        labelName = (0, _getLocale.getLocale)('Ooo_Mo_1on1');
        break;

      default:
        labelName = (0, _getLocale.getLocale)('Mod_Tasks');
        break;
    }

    return labelName;
  };

  var getHref = function getHref() {
    var href;

    switch (objType) {
      case _constant.EObjType.Interview:
        href = "".concat(_constant.apiServer, "/u/").concat(_constant.userId, "/Home#/interview?reactRouterName=detail&recordId=").concat(objId, "&toUserId=").concat(remindUser === null || remindUser === void 0 ? void 0 : remindUser.userId, "&hideNavTop=true");
        break;

      default:
        href = "".concat(_constant.apiServer, "/u/").concat(_constant.userId, "/Home#more/taskinfo?Id=").concat(objId);
        break;
    }

    return href;
  };

  return /*#__PURE__*/_react["default"].createElement("li", {
    className: (0, _classnames["default"])("".concat(preCls, "__item"), _defineProperty({}, "".concat(preCls, "__item--scroll"), reminds.length >= 5)),
    key: id
  }, /*#__PURE__*/_react["default"].createElement("img", {
    src: _appTixing["default"],
    className: (0, _classnames["default"])("".concat(preCls, "__item-photo"))
  }), /*#__PURE__*/_react["default"].createElement("div", {
    className: (0, _classnames["default"])("".concat(preCls, "__item-right"))
  }, /*#__PURE__*/_react["default"].createElement("div", {
    className: (0, _classnames["default"])("".concat(preCls, "__item-right-name"))
  }, /*#__PURE__*/_react["default"].createElement("span", null, getItemLabelName()), /*#__PURE__*/_react["default"].createElement("span", {
    className: (0, _classnames["default"])("".concat(preCls, "__item-right-name-status"))
  }, content)), /*#__PURE__*/_react["default"].createElement("div", {
    className: (0, _classnames["default"])("".concat(preCls, "__item-right-content"))
  }, /*#__PURE__*/_react["default"].createElement(_tooltipText["default"], {
    overlayClassName: "".concat(preCls, "__item-right-content-tooltip"),
    text: objName,
    isPercent: true,
    mouseEnterDelay: 0.8
  }))), /*#__PURE__*/_react["default"].createElement("div", {
    className: (0, _classnames["default"])("".concat(preCls, "__item-handle"))
  }, /*#__PURE__*/_react["default"].createElement("span", {
    className: (0, _classnames["default"])("".concat(preCls, "__item-handle-ignore")),
    onClick: deleteOneTask
  }, (0, _getLocale.getLocale)('Tasks_Menu_Ignore')), /*#__PURE__*/_react["default"].createElement("a", {
    target: "_blank",
    href: getHref(),
    onClick: handleRemindClick,
    rel: "noreferrer"
  }, /*#__PURE__*/_react["default"].createElement("span", {
    className: (0, _classnames["default"])("".concat(preCls, "__item-handle-deal")),
    onClick: deleteOneTask
  }, (0, _getLocale.getLocale)('Feed_Tab_ToDealWith')))));
}

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