123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192 |
- "use strict";
-
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
-
- var _col = require("antd/es/col");
-
- var _col2 = _interopRequireDefault(_col);
-
- var _row = require("antd/es/row");
-
- var _row2 = _interopRequireDefault(_row);
-
- var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
-
- require("antd/es/col/style/css");
-
- require("antd/es/row/style/css");
-
- var _react = require("react");
-
- var _react2 = _interopRequireDefault(_react);
-
- var _reactIntlUniversal = require("react-intl-universal");
-
- var _reactIntlUniversal2 = _interopRequireDefault(_reactIntlUniversal);
-
- require("./AvatarHoverCard.less");
-
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
-
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
-
- function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
-
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
-
- var AvatarHoverCard = function (_Component) {
- _inherits(AvatarHoverCard, _Component);
-
- function AvatarHoverCard(props) {
- _classCallCheck(this, AvatarHoverCard);
-
- var _this = _possibleConstructorReturn(this, (AvatarHoverCard.__proto__ || Object.getPrototypeOf(AvatarHoverCard)).call(this, props));
-
- _this.state = {
- showModal: false
- };
- return _this;
- }
-
- _createClass(AvatarHoverCard, [{
- key: "componentDidMount",
- value: function componentDidMount() {
- var isLogin = this.props.currentUser.user_id > 0 || this.props.currentUser.id > 0;
- this.props.getUserInfo({
- id: this.props.user_id,
- noCheckFollowed: !isLogin
- });
- }
- }, {
- key: "render",
- value: function render() {
- var _this2 = this;
-
- var _props = this.props,
- image = _props.image,
- user_id = _props.user_id,
- currentUser = _props.currentUser,
- userAvaHoverData = _props.userAvaHoverData;
-
- var followed = userAvaHoverData[user_id] && userAvaHoverData[user_id].isFollowed;
-
- return _react2.default.createElement(
- "div",
- { className: "AvatarHoverCard", onClick: function onClick(e) {
- return e.stopPropagation();
- } },
- _react2.default.createElement(
- "div",
- { onClick: function onClick() {
- return _this2.props.userAvaClick(user_id);
- } },
- _react2.default.createElement(
- _row2.default,
- { type: "flex", className: "rowUser" },
- _react2.default.createElement("div", {
- className: "avatar",
- style: {
- backgroundImage: "url(" + image + ")"
- }
- }),
- _react2.default.createElement(
- "div",
- { className: "nickname" },
- userAvaHoverData[user_id] && userAvaHoverData[user_id].nickname
- )
- )
- ),
- _react2.default.createElement("div", { className: "divider" }),
- _react2.default.createElement(
- _row2.default,
- { type: "flex", className: "rowNum" },
- _react2.default.createElement(
- _col2.default,
- { className: "colFans" },
- _react2.default.createElement(
- "div",
- { className: "count" },
- userAvaHoverData[user_id] && userAvaHoverData[user_id].fans
- ),
- _react2.default.createElement(
- "div",
- { className: "text" },
- _reactIntlUniversal2.default.get("bilingually.fan", {
- ext: userAvaHoverData[user_id] && userAvaHoverData[user_id].fans > 1 ? "s" : ""
- })
- )
- ),
- _react2.default.createElement(_col2.default, { className: "hdivider" }),
- _react2.default.createElement(
- _col2.default,
- { className: "colFollow" },
- _react2.default.createElement(
- "div",
- { className: "count" },
- userAvaHoverData[user_id] && userAvaHoverData[user_id].followers
- ),
- _react2.default.createElement(
- "div",
- { className: "text" },
- _reactIntlUniversal2.default.get("bilingually.follow", {
- ext: userAvaHoverData[user_id] && userAvaHoverData[user_id].followers > 1 ? "s" : ""
- })
- )
- )
- ),
- currentUser.user_id > 0 && currentUser.user_id !== user_id && _react2.default.createElement(
- _row2.default,
- { type: "flex", className: "rowBtn" },
- followed ? _react2.default.createElement(
- "div",
- {
- className: "unFollowBtn",
- onClick: function onClick(e) {
- e.stopPropagation();
- _this2.props.unFocus({
- id: user_id
- }).then(function () {
- _this2.props.getUserInfo({
- id: user_id
- });
- });
- }
- },
- _reactIntlUniversal2.default.get("bilingually.cancel_follow")
- ) : _react2.default.createElement(
- "div",
- {
- className: "followBtn",
- onClick: function onClick(e) {
- e.stopPropagation();
- _this2.props.focus({ id: user_id }).then(function () {
- _this2.props.getUserInfo({
- id: user_id
- });
- });
- }
- },
- _reactIntlUniversal2.default.get("bilingually.follow", { ext: "" })
- ),
- _react2.default.createElement(
- "div",
- {
- className: "privateMessageBtn " + (this.props.locale === "en-US" ? "enUs" : ""),
- onClick: function onClick() {
- return _this2.props.sendMessage({ id: user_id });
- }
- },
- _reactIntlUniversal2.default.get("bilingually.im.send_msg")
- )
- )
- );
- }
- }]);
-
- return AvatarHoverCard;
- }(_react.Component);
-
- exports.default = AvatarHoverCard;
- //# sourceMappingURL=AvatarHoverCard.js.map
|