"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;
};
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var React = __importStar(require("react"));
var styledComponents_1 = require("./styledComponents");
var textComponents_1 = require("./textComponents");
var Button_1 = require("../Button");
var ChallengeResultsChart_1 = require("../ChallengeResultsChart");
var PhaseCountdown_1 = require("../PhaseCountdown/");
var CommitVote_1 = require("./CommitVote");
var ChallengePhaseDetail_1 = require("./ChallengePhaseDetail");
var AppealDecisionDetail_1 = require("./AppealDecisionDetail");
var NeedHelp_1 = __importDefault(require("./NeedHelp"));
var AppealChallengeCommitVoteCard = /** @class */ (function (_super) {
    __extends(AppealChallengeCommitVoteCard, _super);
    function AppealChallengeCommitVoteCard(props) {
        var _this = _super.call(this, props) || this;
        _this.swapFlipped = function () {
            _this.setState(function () { return ({ flipped: !_this.state.flipped }); });
        };
        _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.AppealChallengeCommitVoteCalloutCopyText, null))));
        };
        _this.renderCommitVoteButtonText = function () {
            if (_this.props.userHasCommittedVote) {
                return React.createElement(React.Fragment, null, "Change My Vote");
            }
            return React.createElement(React.Fragment, null, "Ready To Commit My Vote");
        };
        _this.state = { flipped: false };
        return _this;
    }
    AppealChallengeCommitVoteCard.prototype.render = function () {
        return (React.createElement(styledComponents_1.StyledCardStage, { width: "485" },
            React.createElement(styledComponents_1.StyledCard, { flipped: this.state.flipped },
                React.createElement(styledComponents_1.StyledCardFront, null,
                    React.createElement(styledComponents_1.StyledListingDetailPhaseCardContainer, null,
                        React.createElement(styledComponents_1.StyledListingDetailPhaseCardSection, null,
                            React.createElement(styledComponents_1.StyledPhaseKicker, null,
                                "Challenge ID ",
                                this.props.challengeID),
                            React.createElement(styledComponents_1.StyledPhaseKicker, null,
                                "Appeal Challenge ID ",
                                this.props.appealChallengeID),
                            React.createElement(styledComponents_1.StyledPhaseDisplayName, null, "Challenge Appeal Decision"),
                            React.createElement(PhaseCountdown_1.TwoPhaseProgressBarCountdownTimer, { endTime: this.props.endTime, totalSeconds: this.props.phaseLength, displayLabel: "Submit Vote Phase", toolTipText: React.createElement(textComponents_1.CommitVoteToolTipText, { phaseLength: this.props.phaseLength }), secondaryDisplayLabel: "Confirm Vote Phase", secondaryToolTipText: React.createElement(textComponents_1.ConfirmVoteToolTipText, { phaseLength: this.props.secondaryPhaseLength }), flavorText: "under challenge", activePhaseIndex: 0 })),
                        React.createElement(styledComponents_1.StyledListingDetailPhaseCardSection, null,
                            React.createElement(ChallengePhaseDetail_1.ChallengePhaseDetail, { challengeID: this.props.challengeID, challenger: this.props.challenger, isViewingUserChallenger: this.props.isViewingUserChallenger, rewardPool: this.props.rewardPool, stake: this.props.stake, dispensationPct: this.props.dispensationPct })),
                        React.createElement(styledComponents_1.StyledListingDetailPhaseCardSection, null,
                            React.createElement(ChallengeResultsChart_1.ChallengeResults, { collapsable: true, totalVotes: this.props.totalVotes, votesFor: this.props.votesFor, votesAgainst: this.props.votesAgainst, percentFor: this.props.percentFor, percentAgainst: this.props.percentAgainst, didChallengeSucceed: this.props.didChallengeOriginallySucceed })),
                        React.createElement(AppealDecisionDetail_1.AppealDecisionDetail, { appealGranted: this.props.appealGranted, appealGrantedStatementURI: this.props.appealGrantedStatementURI }),
                        React.createElement(styledComponents_1.StyledListingDetailPhaseCardSection, { bgAccentColor: "COMMIT_VOTE" },
                            this.renderCommitVoteCallout(),
                            React.createElement(styledComponents_1.FullWidthButton, { size: Button_1.buttonSizes.MEDIUM, onClick: this.swapFlipped }, this.renderCommitVoteButtonText())),
                        React.createElement(NeedHelp_1.default, { faqURL: this.props.faqURL }))),
                React.createElement(styledComponents_1.StyledCardBack, null,
                    React.createElement(styledComponents_1.StyledListingDetailPhaseCardContainer, null,
                        React.createElement(styledComponents_1.StyledListingDetailPhaseCardSection, { bgAccentColor: "COMMIT_VOTE" },
                            React.createElement(styledComponents_1.StyledCardClose, null,
                                React.createElement("span", { onClick: this.swapFlipped }, "\u2716")),
                            this.renderCommitVoteCallout()),
                        React.createElement(styledComponents_1.StyledListingDetailPhaseCardSection, null,
                            React.createElement(styledComponents_1.StyledPhaseKicker, null,
                                "Appeal Challenge ID ",
                                this.props.appealChallengeID),
                            React.createElement(CommitVote_1.CommitVote, { isAppealChallenge: true, 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, onCommitMaxTokens: this.props.onCommitMaxTokens, onReviewVote: this.props.onReviewVote })))))));
    };
    return AppealChallengeCommitVoteCard;
}(React.Component));
exports.AppealChallengeCommitVoteCard = AppealChallengeCommitVoteCard;
//# sourceMappingURL=AppealChallengeCommitVoteCard.js.map