"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.PollDuration = PollDuration;
var _dayjs = _interopRequireDefault(require("dayjs"));
var _reactNative = require("react-native");
var _reactNativeSvg = require("react-native-svg");
var _icons = require("../../../../../core/assets/icons");
var _Typography = require("../../../../../core/components/Typography/Typography");
var _PollPostComposer = require("../PollPostComposer");
var _styles = require("../styles");
var _PollDurationPicker = require("./PollDurationPicker");
var _FormLabel = _interopRequireDefault(require("../../../../elements/FormLabel"));
var _enums = require("../../../../enums");
var _FormDescription = _interopRequireDefault(require("../../../../elements/FormDescription"));
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
function PollDuration() {
  const {
    styles,
    theme
  } = (0, _styles.useStyles)();
  const {
    duration,
    bottomSheetRef
  } = (0, _PollPostComposer.usePollPostComposerContext)();
  return /*#__PURE__*/React.createElement(_reactNative.View, {
    style: styles.fieldContainer
  }, /*#__PURE__*/React.createElement(_FormLabel.default, {
    style: styles.base,
    pageId: _enums.PageID.poll_post_composer_page,
    elementId: _enums.ElementID.poll_duration_title
  }), /*#__PURE__*/React.createElement(_FormDescription.default, {
    style: styles.baseShade1,
    pageId: _enums.PageID.poll_post_composer_page,
    elementId: _enums.ElementID.poll_duration_desc
  }), /*#__PURE__*/React.createElement(_reactNative.View, null, /*#__PURE__*/React.createElement(_reactNative.TouchableOpacity, {
    style: styles.durationButton,
    onPress: () => {
      var _bottomSheetRef$curre;
      return (_bottomSheetRef$curre = bottomSheetRef.current) === null || _bottomSheetRef$curre === void 0 ? void 0 : _bottomSheetRef$curre.open();
    }
  }, /*#__PURE__*/React.createElement(_reactNative.View, {
    style: styles.rowContainer
  }, /*#__PURE__*/React.createElement(_Typography.Typography.Body, {
    style: styles.base
  }, duration.label), /*#__PURE__*/React.createElement(_reactNativeSvg.SvgXml, {
    width: "24",
    height: "24",
    xml: (0, _icons.arrowDown)(),
    color: theme.colors.baseShade2
  }))), _reactNative.Platform.OS === 'ios' && duration.value > 0 && /*#__PURE__*/React.createElement(_Typography.Typography.Caption, {
    style: styles.base
  }, "Ends on ", (0, _dayjs.default)().add(duration.value, 'day').format('DD MMM'), " at", ' ', (0, _dayjs.default)().add(duration.value, 'day').format('HH:mm A')), _reactNative.Platform.OS === 'android' && /*#__PURE__*/React.createElement(_PollDurationPicker.AndroidPollDurationPicker, null)));
}
//# sourceMappingURL=PollDuration.js.map