import * as React from "react"; import { Link } from "react-router-dom"; import { UserVotingSummary, CHALLENGE_RESULTS_VOTE_TYPES, StyledDashbaordActvityItemSection, StyledDashbaordActvityItemSectionOuter, StyledDashbaordActvityItemHeader, StyledDashbaordActvityItemSectionInner, StyledChallengeSummarySection, StyledDashboardActivityItemAction, DashboardActivityProposalItemCTAButton, } from "@joincivil/components"; import { getFormattedTokenBalance, paramPropChallengeHelpers } from "@joincivil/utils"; import WinningChallengeResults from "./WinningChallengeResults"; import { MyTasksProposalItemOwnProps, MyTasksProposalItemReduxProps, } from "./MyTasksProposalItem/MyTasksProposalItemTypes"; const CurrentChallengeStateExplanation: React.FunctionComponent< MyTasksProposalItemOwnProps & MyTasksProposalItemReduxProps > = props => { const { challenge } = props; if (!challenge) { return <>>; } const isResolved = challenge.resolved; const canResolveChallenge = paramPropChallengeHelpers.canParamPropChallengeBeResolved(challenge); const didChallengeSucceed = paramPropChallengeHelpers.didParamPropChallengeSucceed(challenge); const currentProposalStatus = didChallengeSucceed ? "reject" : "approve"; // The ordering of these cases is significant. Appeal Challenge, then Appeal, the Original Challenge states should be checked in that order to ensure the proper explanation is set. let explanation = <>>; if (canResolveChallenge || isResolved) { explanation =
The Civil Community voted to {currentProposalStatus} this parameter proposal.
; } return explanation; }; const ChallengeSummary: React.FunctionComponent< MyTasksProposalItemOwnProps & MyTasksProposalItemReduxProps > = props => { const { challengeID, challenge, userChallengeData, showClaimRewardsTab, showRescueTokensTab } = props; if (!userChallengeData || !challenge) { return <>>; } const { canUserCollect, canUserRescue, didUserReveal, choice, numTokens } = userChallengeData; let userVotingSummary; let userVotingSummaryContent; let userChoice; if (didUserReveal) { if (choice) { userChoice = choice.toNumber() === 1 ? CHALLENGE_RESULTS_VOTE_TYPES.REMAIN : CHALLENGE_RESULTS_VOTE_TYPES.REMOVE; userVotingSummaryContent = (