"use strict";

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

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

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

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

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

require("./index.css");

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

var preCls = 'titaui-dynamic-summary__remind-view';

var RemindUserView = function RemindUserView(props) {
  var data = props.data,
      curAtUser = props.curAtUser;

  var _ref = data || {},
      _ref$Departments = _ref.Departments,
      Departments = _ref$Departments === void 0 ? [] : _ref$Departments,
      _ref$Groups = _ref.Groups,
      Groups = _ref$Groups === void 0 ? [] : _ref$Groups,
      _ref$Users = _ref.Users,
      Users = _ref$Users === void 0 ? [] : _ref$Users;

  if (!data || !Departments.length && !Groups.length && !Users.length) return null;
  return /*#__PURE__*/_react["default"].createElement("div", {
    className: preCls
  }, /*#__PURE__*/_react["default"].createElement("div", {
    className: "".concat(preCls, "__title")
  }, (0, _getLocale.getLocale)("OKR_MyO_himher")), /*#__PURE__*/_react["default"].createElement("div", {
    className: "".concat(preCls, "__list")
  }, Users === null || Users === void 0 ? void 0 : Users.map(function (item) {
    return /*#__PURE__*/_react["default"].createElement("div", {
      className: "".concat(preCls, "__user")
    }, /*#__PURE__*/_react["default"].createElement(_avatar["default"], {
      userId: item.User.UserId,
      name: item.User.Name,
      src: item.User.Avatar.Medium,
      color: item.User.Avatar.Color
    }), /*#__PURE__*/_react["default"].createElement("span", {
      className: "".concat(preCls, "__user-name")
    }, /*#__PURE__*/_react["default"].createElement(_openData.OpenUserName, {
      name: item.User.Name,
      id: item.User.UserId
    }), /*#__PURE__*/_react["default"].createElement("i", {
      className: "".concat(preCls, "__user-name-icon ").concat((item.User.UserId === curAtUser || item.HasRead) && "hasRead")
    })));
  }), Departments === null || Departments === void 0 ? void 0 : Departments.map(function (item) {
    return /*#__PURE__*/_react["default"].createElement("div", {
      className: "".concat(preCls, "__user")
    }, /*#__PURE__*/_react["default"].createElement("span", {
      className: "".concat(preCls, "__user-departments")
    }, /*#__PURE__*/_react["default"].createElement(_avatar["default"], {
      userId: item.Id,
      name: item === null || item === void 0 ? void 0 : item.Name,
      color: "#3296fa",
      isDept: true
    }), /*#__PURE__*/_react["default"].createElement("span", {
      className: "".concat(preCls, "__user-name")
    }, /*#__PURE__*/_react["default"].createElement(_openData.OpenDepartmentName, {
      name: item === null || item === void 0 ? void 0 : item.Name,
      id: item.Id
    }))));
  }), Groups === null || Groups === void 0 ? void 0 : Groups.map(function (item) {
    return /*#__PURE__*/_react["default"].createElement("div", {
      className: "".concat(preCls, "__user")
    }, /*#__PURE__*/_react["default"].createElement("span", {
      className: "".concat(preCls, "__user-groups")
    }, /*#__PURE__*/_react["default"].createElement(_avatar["default"], {
      userId: item.id,
      name: item.name,
      color: "rgb(90, 216, 166)"
    }), /*#__PURE__*/_react["default"].createElement("span", {
      className: "".concat(preCls, "__user-name")
    }, /*#__PURE__*/_react["default"].createElement(_openData.OpenUserName, {
      name: item.name,
      id: item.id
    }))));
  })));
};

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