"use strict";

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

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

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

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

var _bsGlobal = require("../../utils/bs-global");

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 = "like-ranking-table";

var columns = function columns() {
  var formatRaking = function formatRaking(num) {
    if (num === 1) {
      return /*#__PURE__*/_react["default"].createElement("img", {
        className: "".concat(preCls, "-medal"),
        src: require("./image/ranking-1.png"),
        alt: "\u91D1\u724C"
      });
    }

    if (num === 2) {
      return /*#__PURE__*/_react["default"].createElement("img", {
        className: "".concat(preCls, "-medal"),
        src: require("./image/ranking-2.png"),
        alt: "\u94F6\u724C"
      });
    }

    if (num === 3) {
      return /*#__PURE__*/_react["default"].createElement("img", {
        className: "".concat(preCls, "-medal"),
        src: require("./image/ranking-3.png"),
        alt: "\u94DC\u724C"
      });
    }

    return /*#__PURE__*/_react["default"].createElement("span", {
      className: "".concat(preCls, "-ranking")
    }, num);
  };

  return [{
    title: (0, _getLocale.getLocale)("Feed_Set_Form_Title_Ranking"),
    dataIndex: "rankNum",
    width: 100,
    key: "rankNum",
    className: "".concat(preCls, "__td ").concat(preCls, "__td-raking"),
    render: function render(text, data) {
      return formatRaking(data.rankNum);
    }
  }, {
    title: (0, _getLocale.getLocale)("Mod_UserName"),
    dataIndex: "name",
    key: "name",
    width: 100,
    className: "".concat(preCls, "__td"),
    render: function render(text, data) {
      var user = data.user; // const url = getUrlForUserPage({
      //   userId: user.userId,
      //   userType: user.userType || 2,
      // });
      // const handleOpenUserPage = () => {
      //   window.open(url, "_blank");
      // };

      return /*#__PURE__*/_react["default"].createElement("span", {
        className: "".concat(preCls, "__td-name")
      }, /*#__PURE__*/_react["default"].createElement("span", {
        className: "".concat(preCls, "__td-name-avatar")
      }, /*#__PURE__*/_react["default"].createElement(_default["default"], {
        name: user.name,
        src: user.avatar.small,
        color: user.avatar.color,
        userId: user.userId
      })), /*#__PURE__*/_react["default"].createElement("span", {
        className: "".concat(preCls, "__td-name-text")
      }, /*#__PURE__*/_react["default"].createElement(_tooltipText["default"], {
        text: /*#__PURE__*/_react["default"].createElement(_openData.OpenUserName, {
          id: user.userId,
          name: user.name
        }),
        isPercent: true
      })));
    }
  }, {
    title: (0, _getLocale.getLocale)("Per_Ass_New_Appr_detail_Affiliat"),
    width: 100,
    dataIndex: "departmentName",
    key: "departmentName",
    className: "".concat(preCls, "__td"),
    render: function render(text, data) {
      var user = data.user;
      return /*#__PURE__*/_react["default"].createElement(_tooltipText["default"], {
        text: /*#__PURE__*/_react["default"].createElement(_openData.OpenDepartmentName, {
          id: user.departmentId,
          name: user.departmentName
        }),
        isPercent: true
      });
    }
  }, {
    title: (0, _getLocale.getLocale)("Per_Ass_New_Appr_detail_First"),
    width: 100,
    dataIndex: "oneLevelDepName",
    key: "oneLevelDepName",
    className: "".concat(preCls, "__td"),
    render: function render(text, data) {
      return /*#__PURE__*/_react["default"].createElement(_tooltipText["default"], {
        text: /*#__PURE__*/_react["default"].createElement(_openData.OpenDepartmentName, {
          id: data.oneLevelDepName,
          name: data.oneLevelDepName
        }),
        isPercent: true
      });
    }
  }, {
    title: (0, _getLocale.getLocale)("Feed_Set_Form_Title_Likes"),
    width: 100,
    dataIndex: "pariseNums",
    key: "pariseNums",
    className: "".concat(preCls, "__td"),
    render: function render(text, data) {
      return /*#__PURE__*/_react["default"].createElement("span", {
        className: "".concat(preCls, "__td-like")
      }, /*#__PURE__*/_react["default"].createElement("span", {
        className: "".concat(preCls, "__td-num")
      }, (0, _bsGlobal.formatNum)(data.pariseNums)), (0, _getLocale.getLocale)("Mod_Kudos"));
    }
  }];
};

exports.columns = columns;