"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;
var _react = require("react");
var _styles = require("./styles");
var _Header = _interopRequireDefault(require("./components/Header"));
var _reactNativeSafeAreaContext = require("react-native-safe-area-context");
var _Tabs = _interopRequireDefault(require("../../../../core/components/Tabs"));
var _PendingPostList = _interopRequireDefault(require("./components/PendingPostList"));
var _hooks = require("../../../hooks");
var _enums = require("../../../enums");
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
const useCommunityPendingRequest = () => {
  const {
    styles
  } = (0, _styles.useStyles)();
  const [activeTab, setActiveTab] = (0, _react.useState)('posts');
  const [pendingPostCount, setPendingPostCount] = (0, _react.useState)(0);
  const postsButtonTabElement = (0, _hooks.useAmityElement)({
    pageId: _enums.PageID.pending_request_page,
    componentId: _enums.ComponentID.WildCardComponent,
    elementId: _enums.ElementID.posts_button_tab
  });
  return {
    styles,
    activeTab,
    setActiveTab,
    pendingPostCount,
    setPendingPostCount,
    postsButtonTabElement
  };
};
const CommunityPendingRequest = ({
  community
}) => {
  var _postsButtonTabElemen;
  const {
    styles,
    activeTab,
    setActiveTab,
    pendingPostCount,
    setPendingPostCount,
    postsButtonTabElement
  } = useCommunityPendingRequest();
  return /*#__PURE__*/React.createElement(_reactNativeSafeAreaContext.SafeAreaView, {
    style: styles.container,
    edges: ['top']
  }, /*#__PURE__*/React.createElement(_Header.default, null), /*#__PURE__*/React.createElement(_Tabs.default, {
    variant: "underline",
    activeTab: activeTab,
    onChangeTab: setActiveTab
  }, /*#__PURE__*/React.createElement(_Tabs.default.List, null, /*#__PURE__*/React.createElement(_Tabs.default.Tab, {
    value: "posts",
    testID: postsButtonTabElement.accessibilityId
  }, (_postsButtonTabElemen = postsButtonTabElement.config) === null || _postsButtonTabElemen === void 0 ? void 0 : _postsButtonTabElemen.text, " (", pendingPostCount > 10 ? `10+` : pendingPostCount, ")")), /*#__PURE__*/React.createElement(_Tabs.default.Content, {
    value: "posts"
  }, /*#__PURE__*/React.createElement(_PendingPostList.default, {
    community: community,
    onPendingPostCountChange: setPendingPostCount
  }))));
};
var _default = exports.default = CommunityPendingRequest;
//# sourceMappingURL=PendingRequest.js.map