"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.RecommendedCommunityItem = void 0;
var _react = _interopRequireDefault(require("react"));
var _reactNative = require("react-native");
var _styles = require("./styles");
var _CommunityJoinedButtonElement = _interopRequireDefault(require("../../../../../elements/CommunityJoinedButtonElement/CommunityJoinedButtonElement"));
var _CommunityJoinButtonElement = _interopRequireDefault(require("../../../../../elements/CommunityJoinButtonElement/CommunityJoinButtonElement"));
var _reactNativeSvg = require("react-native-svg");
var _icons = require("../../../../../../core/assets/icons");
var _CommunityPrivateBadge = _interopRequireDefault(require("../../../../../elements/CommunityPrivateBadge/CommunityPrivateBadge"));
var _CommunityOfficialBadge = _interopRequireDefault(require("../../../../../elements/CommunityOfficialBadge/CommunityOfficialBadge"));
var _CommunityMemeberCount = _interopRequireDefault(require("../../../../../elements/CommunityMemeberCount/CommunityMemeberCount"));
var _CommunityDisplayname = _interopRequireDefault(require("../../../../../elements/CommunityDisplayname/CommunityDisplayname"));
var _utils = require("../../../../../utils");
var _enums = require("../../../../../enums");
var _CommunityCategories = require("../../CommunityCategories/CommunityCategories");
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
const RecommendedCommunityItem = ({
  community,
  pageId = _enums.PageID.WildCardPage
}) => {
  var _community$avatar, _community$avatar2;
  const componentId = _enums.ComponentID.recommended_communities;
  const styles = (0, _styles.useStyles)();
  return /*#__PURE__*/_react.default.createElement(_reactNative.View, {
    style: styles.container
  }, (_community$avatar = community.avatar) !== null && _community$avatar !== void 0 && _community$avatar.fileUrl ? /*#__PURE__*/_react.default.createElement(_reactNative.Image, {
    style: styles.image,
    source: {
      uri: (0, _utils.getFileUrlWithSize)((_community$avatar2 = community.avatar) === null || _community$avatar2 === void 0 ? void 0 : _community$avatar2.fileUrl)
    },
    resizeMode: "cover"
  }) : /*#__PURE__*/_react.default.createElement(_reactNative.View, {
    style: styles.imagePlaceholder
  }, /*#__PURE__*/_react.default.createElement(_reactNativeSvg.SvgXml, {
    xml: (0, _icons.community)()
  })), /*#__PURE__*/_react.default.createElement(_reactNative.View, {
    style: styles.detailWrap
  }, /*#__PURE__*/_react.default.createElement(_reactNative.View, {
    style: styles.displayName
  }, !community.isPublic && /*#__PURE__*/_react.default.createElement(_CommunityPrivateBadge.default, {
    pageId: pageId,
    componentId: componentId
  }), /*#__PURE__*/_react.default.createElement(_CommunityDisplayname.default, {
    communityName: community.displayName,
    pageId: pageId,
    componentId: componentId
  }), community.isOfficial && /*#__PURE__*/_react.default.createElement(_CommunityOfficialBadge.default, {
    pageId: pageId,
    componentId: componentId
  })), /*#__PURE__*/_react.default.createElement(_reactNative.View, {
    style: styles.detailBottomWrap
  }, /*#__PURE__*/_react.default.createElement(_reactNative.View, {
    style: styles.detailBottomWrapLeft
  }, /*#__PURE__*/_react.default.createElement(_CommunityCategories.CommunityCategories, {
    categories: community.categories,
    pageId: pageId,
    componentId: componentId
  }), /*#__PURE__*/_react.default.createElement(_CommunityMemeberCount.default, {
    counts: community.membersCount,
    pageId: pageId,
    componentId: componentId
  })), /*#__PURE__*/_react.default.createElement(_reactNative.View, {
    style: styles.detailBottomWrapRight
  }, community.isJoined ? /*#__PURE__*/_react.default.createElement(_CommunityJoinedButtonElement.default, {
    pageId: pageId,
    componentId: componentId,
    communityId: community.communityId
  }) : /*#__PURE__*/_react.default.createElement(_CommunityJoinButtonElement.default, {
    pageId: pageId,
    componentId: componentId,
    communityId: community.communityId
  })))));
};
exports.RecommendedCommunityItem = RecommendedCommunityItem;
//# sourceMappingURL=RecommenedCommunityItems.js.map