utils#WalletSchemeProposalState TypeScript Examples

The following examples show how to use utils#WalletSchemeProposalState. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: useFilteredProposals.ts    From dxvote with GNU Affero General Public License v3.0 6 votes vote down vote up
matchStatus = (proposal: ProposalsExtended, status: string) => {
  if (status === 'Any Status' || !status) {
    return proposal;
  }
  // status is rejected
  if (status === '7') {
    return proposal.stateInScheme === WalletSchemeProposalState.Rejected;
  }
  // status is passed
  if (status === '8') {
    return (
      proposal.stateInScheme === WalletSchemeProposalState.Submitted &&
      proposal.stateInVotingMachine === VotingMachineProposalState.Executed
    );
  }
  return proposal.stateInVotingMachine === parseInt(status);
}
Example #2
Source File: index.tsx    From dxvote with GNU Affero General Public License v3.0 5 votes vote down vote up
Details = () => {
  const {
    context: { daoStore },
  } = useContext();

  const proposalId = useLocation().pathname.split('/')[3];
  const proposal = daoStore.getProposal(proposalId);

  const scheme = daoStore.getScheme(proposal.scheme);

  const boostedVoteRequiredPercentage =
    scheme.boostedVoteRequiredPercentage / 100;

  const { boostTime, finishTime } = daoStore.getProposalStatus(proposalId);

  return (
    <SpaceAroundRow>
      <ProposalDescription>
        <Detail>
          <strong>Proposer</strong>
          <small>
            <BlockchainLink type="user" text={proposal.proposer} toCopy />
          </small>
        </Detail>
        <Detail>
          <strong>Scheme</strong> <small>{scheme.name}</small>
        </Detail>
        <Detail>
          <strong>Voting Parameters</strong>{' '}
          <small>{proposal.paramsHash.substring(0, 10)}...</small>
        </Detail>
        <Detail>
          <strong>State in Voting Machine </strong>
          <small>
            {VotingMachineProposalState[proposal.stateInVotingMachine]}
          </small>
        </Detail>
        <Detail>
          <strong>State in Scheme </strong>
          <small>{WalletSchemeProposalState[proposal.stateInScheme]}</small>
        </Detail>
        <Detail>
          <strong>Submitted Date</strong>
          <small>
            {moment
              .unix(proposal.submittedTime.toNumber())
              .format('MMMM Do YYYY, HH:mm:ss')}
          </small>
        </Detail>
        <Detail>
          <strong>Boost Date</strong>
          <small>
            {boostTime.toNumber() > 0
              ? moment
                  .unix(boostTime.toNumber())
                  .format('MMMM Do YYYY, HH:mm:ss')
              : '-'}
          </small>
        </Detail>
        <Detail>
          <strong>Finish Date</strong>
          <small>
            {moment
              .unix(finishTime.toNumber())
              .format('MMMM Do YYYY, HH:mm:ss')}
          </small>
        </Detail>

        {boostedVoteRequiredPercentage > 0 && (
          <Detail>
            <strong> Required Boosted Vote: </strong>
            <small>{boostedVoteRequiredPercentage}%</small>
          </Detail>
        )}
      </ProposalDescription>
    </SpaceAroundRow>
  );
}