"use strict";
var __extends = (this && this.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
var __importStar = (this && this.__importStar) || function (mod) {
    if (mod && mod.__esModule) return mod;
    var result = {};
    if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
    result["default"] = mod;
    return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
var React = __importStar(require("react"));
var ReactDOM = __importStar(require("react-dom"));
var styledComponents_1 = require("../ListingDetailPhaseCard/styledComponents");
var ChallengePhaseDetail_1 = require("../ListingDetailPhaseCard/ChallengePhaseDetail");
var CommitVote_1 = require("../ListingDetailPhaseCard/CommitVote");
var textComponents_1 = require("../ListingDetailPhaseCard/textComponents");
var PhaseCountdown_1 = require("../PhaseCountdown/");
var ParameterizerStyledComponents_1 = require("./ParameterizerStyledComponents");
var textComponents_2 = require("./textComponents");
var ChallengeProposalCommitVote = /** @class */ (function (_super) {
    __extends(ChallengeProposalCommitVote, _super);
    function ChallengeProposalCommitVote() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.bucket = document.createElement("div");
        _this.renderCommitVoteCallout = function () {
            if (_this.props.userHasCommittedVote) {
                return (React.createElement(React.Fragment, null,
                    React.createElement(styledComponents_1.FormHeader, null,
                        React.createElement(textComponents_1.CommitVoteAlreadyVotedHeaderText, null)),
                    React.createElement(styledComponents_1.FormCopy, null,
                        React.createElement(textComponents_1.CommitVoteAlreadyVotedCopyText, null))));
            }
            return (React.createElement(React.Fragment, null,
                React.createElement(styledComponents_1.FormHeader, null,
                    React.createElement(textComponents_1.CommitVoteCalloutHeaderText, null)),
                React.createElement(styledComponents_1.FormCopy, null,
                    React.createElement(textComponents_1.CommitVoteCalloutCopyText, null))));
        };
        return _this;
    }
    ChallengeProposalCommitVote.prototype.componentDidMount = function () {
        document.body.appendChild(this.bucket);
    };
    ChallengeProposalCommitVote.prototype.componentWillUnmount = function () {
        document.body.removeChild(this.bucket);
    };
    ChallengeProposalCommitVote.prototype.render = function () {
        var callout = this.renderCommitVoteCallout();
        return ReactDOM.createPortal(React.createElement(ParameterizerStyledComponents_1.StyledCreateProposalOuter, null,
            React.createElement(ParameterizerStyledComponents_1.StyledChallengeProposalContainer, null,
                React.createElement(ParameterizerStyledComponents_1.StyledCreateProposalHeaderClose, { onClick: this.props.handleClose }, "\u2716"),
                React.createElement(ParameterizerStyledComponents_1.StyledCreateProposalContent, null,
                    React.createElement(ParameterizerStyledComponents_1.StyledSection, null,
                        React.createElement(styledComponents_1.StyledPhaseKicker, null,
                            "Challenge ID ",
                            this.props.challengeID),
                        React.createElement(styledComponents_1.StyledPhaseDisplayName, null,
                            React.createElement(textComponents_1.UnderChallengePhaseDisplayNameText, null)),
                        React.createElement(PhaseCountdown_1.TwoPhaseProgressBarCountdownTimer, { endTime: this.props.endTime, totalSeconds: this.props.phaseLength, displayLabel: "Accepting votes", secondaryDisplayLabel: "Confirming Votes", flavorText: "under challenge", activePhaseIndex: 0 })),
                    React.createElement(ParameterizerStyledComponents_1.StyledSection, null,
                        React.createElement(ParameterizerStyledComponents_1.StyledMetaName, null,
                            React.createElement(textComponents_2.CreateProposalParamNameLabelText, null)),
                        React.createElement(ParameterizerStyledComponents_1.StyledMetaValue, null, this.props.parameterDisplayName)),
                    React.createElement(ParameterizerStyledComponents_1.StyledSection, null,
                        React.createElement(ParameterizerStyledComponents_1.StyledMetaName, null,
                            React.createElement(textComponents_2.CreateProposalParamCurrentValueLabelText, null)),
                        React.createElement(ParameterizerStyledComponents_1.StyledMetaValue, null, this.props.parameterCurrentValue)),
                    React.createElement(ParameterizerStyledComponents_1.StyledSection, null,
                        React.createElement(ParameterizerStyledComponents_1.StyledMetaName, null,
                            React.createElement(textComponents_2.ChallengeProposalNewValueLabelText, null)),
                        React.createElement(ParameterizerStyledComponents_1.StyledMetaValue, null, this.props.parameterProposalValue)),
                    React.createElement(ParameterizerStyledComponents_1.StyledSection, null,
                        React.createElement(ChallengePhaseDetail_1.ChallengePhaseDetail, { challengeID: this.props.challengeID, challenger: this.props.challenger, rewardPool: this.props.rewardPool, stake: this.props.stake })),
                    callout,
                    React.createElement(ParameterizerStyledComponents_1.StyledSection, null,
                        React.createElement(styledComponents_1.StyledPhaseKicker, null,
                            "Challenge ID ",
                            this.props.challengeID),
                        React.createElement(CommitVote_1.CommitVote, { tokenBalance: this.props.tokenBalance, votingTokenBalance: this.props.votingTokenBalance, tokenBalanceDisplay: this.props.tokenBalanceDisplay, votingTokenBalanceDisplay: this.props.votingTokenBalanceDisplay, voteOption: this.props.voteOption, salt: this.props.salt, numTokens: this.props.numTokens, onInputChange: this.props.onInputChange, userHasCommittedVote: this.props.userHasCommittedVote, onReviewVote: this.props.onReviewVote, onCommitMaxTokens: this.props.onCommitMaxTokens },
                            "Should this proposal be ",
                            React.createElement("b", null, "accepted"),
                            " or ",
                            React.createElement("b", null, "rejected"),
                            " from the Civil Registry?"))))), this.bucket);
    };
    return ChallengeProposalCommitVote;
}(React.Component));
exports.ChallengeProposalCommitVote = ChallengeProposalCommitVote;
//# sourceMappingURL=ChallengeProposalCommitVote.js.map