"use strict";
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 ChallengeResultsChart_1 = require("../ChallengeResultsChart");
var styledComponents_1 = require("./styledComponents");
var ChallengeResults = function (props) {
    var canBeWhitelisted = props.canBeWhitelisted, canResolveChallenge = props.canResolveChallenge, isAwaitingAppealRequest = props.isAwaitingAppealRequest, isAwaitingAppealJudgement = props.isAwaitingAppealJudgement, canListingAppealBeResolved = props.canListingAppealBeResolved, isAwaitingAppealChallenge = props.isAwaitingAppealChallenge, isInAppealChallengeCommitPhase = props.isInAppealChallengeCommitPhase, isInAppealChallengeRevealPhase = props.isInAppealChallengeRevealPhase, isUnderChallenge = props.isUnderChallenge, isRejected = props.isRejected, canListingAppealChallengeBeResolved = props.canListingAppealChallengeBeResolved, challengeID = props.challengeID, totalVotes = props.totalVotes, votesFor = props.votesFor, votesAgainst = props.votesAgainst, percentFor = props.percentFor, percentAgainst = props.percentAgainst, didChallengeOriginallySucceed = props.didChallengeOriginallySucceed;
    if (!(canBeWhitelisted ||
        canResolveChallenge ||
        isAwaitingAppealRequest ||
        isAwaitingAppealJudgement ||
        canListingAppealBeResolved ||
        isAwaitingAppealChallenge ||
        isInAppealChallengeCommitPhase ||
        isInAppealChallengeRevealPhase ||
        canListingAppealChallengeBeResolved ||
        (isRejected && !isUnderChallenge)) ||
        (canBeWhitelisted && !isUnderChallenge)) {
        return null;
    }
    var challengeIDDisplay = !!challengeID ? "#" + challengeID : "";
    return (React.createElement(styledComponents_1.ChallengeResultsContain, null,
        React.createElement(ChallengeResultsChart_1.ChallengeResults, { headerText: "Challenge " + challengeIDDisplay + " Results", styledHeaderComponent: styledComponents_1.StyledChallengeResultsHeader, totalVotes: totalVotes, votesFor: votesFor, votesAgainst: votesAgainst, percentFor: percentFor, percentAgainst: percentAgainst, didChallengeSucceed: didChallengeOriginallySucceed })));
};
exports.AppealChallengeResults = function (props) {
    var canListingAppealChallengeBeResolved = props.canListingAppealChallengeBeResolved, appealChallengeID = props.appealChallengeID, appealChallengeTotalVotes = props.appealChallengeTotalVotes, appealChallengeVotesFor = props.appealChallengeVotesFor, appealChallengeVotesAgainst = props.appealChallengeVotesAgainst, appealChallengePercentFor = props.appealChallengePercentFor, appealChallengePercentAgainst = props.appealChallengePercentAgainst, didAppealChallengeSucceed = props.didAppealChallengeSucceed, isRejected = props.isRejected, isUnderChallenge = props.isUnderChallenge;
    if ((!canListingAppealChallengeBeResolved && !(isRejected && !isUnderChallenge)) ||
        !appealChallengeID ||
        appealChallengeID === "0") {
        return null;
    }
    var challengeIDDisplay = !!appealChallengeID ? "#" + appealChallengeID : "";
    return (React.createElement(styledComponents_1.ChallengeResultsContain, null,
        React.createElement(ChallengeResultsChart_1.ChallengeResults, { headerText: "Appeal Challenge " + challengeIDDisplay + " Results", styledHeaderComponent: styledComponents_1.StyledChallengeResultsHeader, totalVotes: appealChallengeTotalVotes, votesFor: appealChallengeVotesFor, votesAgainst: appealChallengeVotesAgainst, percentFor: appealChallengePercentFor, percentAgainst: appealChallengePercentAgainst, didChallengeSucceed: didAppealChallengeSucceed, isAppealChallenge: true })));
};
exports.default = ChallengeResults;
//# sourceMappingURL=ChallengeResults.js.map