"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;
var _reactNative = require("react-native");
var _style = require("./style");
var _PollFooter = require("./PollFooter");
var _PollOption = require("./PollOption");
var _usePoll = require("../../hooks/usePoll");
var _Typography = require("../../../core/components/Typography/Typography");
const PollContent = ({
  post,
  pollId,
  disabledPoll,
  showedAllOptions
}) => {
  const {
    styles
  } = (0, _style.useStyles)();
  const {
    poll,
    votePoll,
    unvotePoll,
    totalVotes,
    isPollClosed,
    isAlreadyVoted,
    isAuthorSeeingResults,
    setIsAuthorSeeingResults
  } = (0, _usePoll.usePoll)(pollId);
  if (!poll) return null;
  return /*#__PURE__*/React.createElement(_reactNative.View, {
    style: styles.container
  }, !isPollClosed && !isAlreadyVoted && /*#__PURE__*/React.createElement(_reactNative.View, {
    style: styles.header
  }, /*#__PURE__*/React.createElement(_Typography.Typography.CaptionBold, {
    style: styles.baseShade2
  }, "Select one option")), /*#__PURE__*/React.createElement(_PollOption.PollOptions, {
    post: post,
    votePoll: votePoll,
    options: poll.answers,
    totalVotes: totalVotes,
    disabledPoll: disabledPoll,
    isPollClosed: isPollClosed,
    answerType: poll.answerType,
    isAlreadyVoted: isAlreadyVoted,
    showedAllOptions: showedAllOptions,
    isAuthorSeeingResults: isAuthorSeeingResults
  }), /*#__PURE__*/React.createElement(_PollFooter.PollFooter, {
    poll: poll,
    post: post,
    totalVotes: totalVotes,
    isPollClosed: isPollClosed,
    isAlreadyVoted: isAlreadyVoted,
    unvotePoll: unvotePoll,
    disabledPoll: disabledPoll,
    isAuthorSeeingResults: isAuthorSeeingResults,
    setIsAuthorSeeingResults: setIsAuthorSeeingResults
  }));
};
var _default = exports.default = PollContent;
//# sourceMappingURL=index.js.map