"use strict";

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

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

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

var _avatar = _interopRequireDefault(require("../../../../../../components/avatar"));

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

var _utils = require("../../utils");

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

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

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-todos';

var TodoItem = function TodoItem(props) {
  var item = props.item,
      onItemClick = props.onItemClick,
      todos = props.todos;

  var handleTodosClick = function handleTodosClick(item) {
    onItemClick && onItemClick(false);

    if (item.objType === 7) {
      window.Talent.app.vent.trigger('global-pull-screen', item.objId, 'task');
    } else {
      (0, _tools.openPage)(item.objUrl);
    }
  };

  return /*#__PURE__*/_react["default"].createElement("li", {
    className: (0, _classnames["default"])("".concat(preCls, "__item"), _defineProperty({}, "".concat(preCls, "__item--scroll"), todos.length >= 4))
  }, /*#__PURE__*/_react["default"].createElement("div", {
    className: (0, _classnames["default"])("".concat(preCls, "__item-photo"))
  }, /*#__PURE__*/_react["default"].createElement(_avatar["default"], {
    userId: item.User.userId,
    name: item.User.name,
    color: item.User.avatar.Color,
    src: item.User.avatar.Big,
    size: {
      width: 32,
      textNum: 1,
      fontSize: 12
    }
  })), /*#__PURE__*/_react["default"].createElement("div", {
    className: (0, _classnames["default"])("".concat(preCls, "__item-right"))
  }, /*#__PURE__*/_react["default"].createElement("a", {
    onClick: function onClick() {
      return handleTodosClick(item);
    }
  }, /*#__PURE__*/_react["default"].createElement("div", {
    className: (0, _classnames["default"])("".concat(preCls, "__item-right-header"))
  }, /*#__PURE__*/_react["default"].createElement("span", {
    className: (0, _classnames["default"])("".concat(preCls, "__item-right-header-name"))
  }, /*#__PURE__*/_react["default"].createElement(_tooltipText["default"], {
    overlayClassName: "".concat(preCls, "__item-right-header-name-tooltip"),
    text: /*#__PURE__*/_react["default"].createElement(_openData.OpenUserName, {
      name: item.User.name,
      id: item.User.userId
    }),
    maxWidth: 100,
    mouseEnterDelay: 0.8
  })), /*#__PURE__*/_react["default"].createElement("span", {
    className: (0, _classnames["default"])("".concat(preCls, "__item-right-header-status"))
  }, item.subTitle)), /*#__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: (0, _openData.parseString)((0, _utils.deleteText)(item.content)),
    isPercent: true,
    mouseEnterDelay: 0.8
  })), /*#__PURE__*/_react["default"].createElement("div", {
    className: (0, _classnames["default"])("".concat(preCls, "__item-right-time"))
  }, item.createDate))));
};

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