"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;
var _react = _interopRequireDefault(require("react"));
var _reactNative = require("react-native");
var _reactNativePaper = require("react-native-paper");
var _enums = require("../../../enums");
var _AvatarElement = _interopRequireDefault(require("../../../elements/CommonElements/AvatarElement"));
var _ImageElement = _interopRequireDefault(require("../../../elements/CommonElements/ImageElement"));
var _TextKeyElement = _interopRequireDefault(require("../../../elements/TextKeyElement/TextKeyElement"));
var _TextElement = _interopRequireDefault(require("../../../elements/CommonElements/TextElement"));
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
const TargetItem = ({
  pageId = _enums.PageID.WildCardPage,
  componentId = _enums.ComponentID.WildCardComponent,
  avatarElementId = _enums.ElementID.WildCardElement,
  displayNameElementId,
  avatarFileId,
  displayName,
  isBadgeShow,
  isPrivate,
  onSelect,
  avatarCustomUrl
}) => {
  const theme = (0, _reactNativePaper.useTheme)();
  const styles = _reactNative.StyleSheet.create({
    container: {
      display: 'flex',
      flexDirection: 'row',
      alignItems: 'center',
      paddingHorizontal: 16,
      paddingVertical: 8
    },
    avatar: {
      width: 40,
      height: 40,
      borderRadius: 20,
      marginRight: 12
    },
    displayName: {
      color: theme.colors.base,
      fontSize: 15,
      fontWeight: '600'
    },
    badgeIcon: {
      width: 20,
      height: 20
    },
    lockIcon: {
      width: 20,
      height: 20,
      tintColor: theme.colors.base
    }
  });
  return /*#__PURE__*/_react.default.createElement(_reactNative.TouchableOpacity, {
    onPress: onSelect,
    style: styles.container
  }, /*#__PURE__*/_react.default.createElement(_AvatarElement.default, {
    style: styles.avatar,
    pageID: pageId,
    componentID: componentId,
    elementID: avatarElementId,
    avatarId: avatarFileId,
    targetType: "community",
    avatarCustomUrl: avatarCustomUrl
  }), isPrivate && /*#__PURE__*/_react.default.createElement(_ImageElement.default, {
    componentID: componentId,
    elementID: _enums.ElementID.community_private_badge,
    style: styles.lockIcon,
    configKey: "image"
  }), displayNameElementId ? /*#__PURE__*/_react.default.createElement(_TextKeyElement.default, {
    pageID: pageId,
    componentID: componentId,
    elementID: displayNameElementId,
    style: styles.displayName
  }) : /*#__PURE__*/_react.default.createElement(_TextElement.default, {
    pageID: pageId,
    componentID: componentId,
    elementID: _enums.ElementID.community_display_name,
    style: styles.displayName,
    text: displayName
  }), isBadgeShow && /*#__PURE__*/_react.default.createElement(_ImageElement.default, {
    componentID: componentId,
    elementID: _enums.ElementID.community_official_badge,
    style: styles.badgeIcon,
    configKey: "image"
  }));
};
var _default = exports.default = /*#__PURE__*/_react.default.memo(TargetItem);
//# sourceMappingURL=TargetItem.js.map