"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 RevealVote_1 = require("./RevealVote");
var ChallengePhaseDetail_1 = require("./ChallengePhaseDetail");
var AppealDecisionDetail_1 = require("./AppealDecisionDetail");
var NeedHelp_1 = __importDefault(require("./NeedHelp"));
var AppealChallengeRevealVoteCard = /** @class */ (function (_super) {
    __extends(AppealChallengeRevealVoteCard, _super);
    function AppealChallengeRevealVoteCard(props) {
        var _this = _super.call(this, props) || this;
        _this.renderRevealVote = function () {
            if (_this.props.userHasCommittedVote === false) {
                return (React.createElement(React.Fragment, null,
                    React.createElement(styledComponents_1.FormHeader, null,
                        React.createElement(textComponents_1.RevealVoteDidNotCommitHeaderText, null)),
                    React.createElement(styledComponents_1.FormCopy, null,
                        React.createElement(textComponents_1.RevealVoteDidNotCommitCopyText, null))));
            }
            else if (_this.props.userHasRevealedVote) {
                return (React.createElement(React.Fragment, null,
                    React.createElement(styledComponents_1.FormHeader, null,
                        React.createElement(textComponents_1.RevealVoteDoneHeaderText, null)),
                    React.createElement(styledComponents_1.FormCopy, null,
                        React.createElement(textComponents_1.RevealVoteDoneCopyText, null))));
            }
            else {
                return (React.createElement(React.Fragment, null,
                    React.createElement(styledComponents_1.FormHeader, null,
                        React.createElement(textComponents_1.RevealVoteCallToActionHeaderText, null)),
                    React.createElement(styledComponents_1.FormCopy, null,
                        React.createElement(textComponents_1.RevealVoteCallToActionCopyText, null)),
                    React.createElement(styledComponents_1.FullWidthButton, { size: Button_1.buttonSizes.MEDIUM, onClick: _this.swapFlipped },
                        React.createElement(textComponents_1.RevealVoteButtonText, null))));
            }
        };
        _this.swapFlipped = function () {
            _this.setState(function () { return ({ flipped: !_this.state.flipped }); });
        };
        _this.state = { flipped: false };
        return _this;
    }
    AppealChallengeRevealVoteCard.prototype.render = function () {
        return (React.createElement(styledComponents_1.StyledCardStage, null,
            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: "Confirm Vote Phase", toolTipText: React.createElement(textComponents_1.ConfirmVoteToolTipText, { phaseLength: this.props.phaseLength }), secondaryDisplayLabel: "Submit Vote Phase", secondaryToolTipText: React.createElement(textComponents_1.CommitVoteToolTipText, { phaseLength: this.props.secondaryPhaseLength }), flavorText: "under challenge", activePhaseIndex: 1 })),
                        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: "REVEAL_VOTE" }, this.renderRevealVote()),
                        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: "REVEAL_VOTE" },
                            React.createElement(styledComponents_1.StyledCardClose, null,
                                React.createElement("span", { onClick: this.swapFlipped }, "\u2716")),
                            React.createElement(styledComponents_1.FormHeader, null,
                                "Confirm Your Secret Vote for Appeal Challenge #",
                                this.props.appealChallengeID),
                            React.createElement(styledComponents_1.FormCopy, null,
                                React.createElement(textComponents_1.RevealVoteCalloutCopyText, { votingSmartContractFaqURL: this.props.votingSmartContractFaqURL }))),
                        React.createElement(styledComponents_1.StyledListingDetailPhaseCardSection, null,
                            React.createElement(RevealVote_1.RevealVote, { isAppealChallenge: true, salt: this.props.salt, voteOption: this.props.voteOption, onInputChange: this.props.onInputChange, transactions: this.props.transactions, votingSmartContractFaqURL: this.props.votingSmartContractFaqURL })))))));
    };
    return AppealChallengeRevealVoteCard;
}(React.Component));
exports.AppealChallengeRevealVoteCard = AppealChallengeRevealVoteCard;
//# sourceMappingURL=AppealChallengeRevealVoteCard.js.map