feat(1820): Present vote progress bar as an indication of result (#2047)
This commit is contained in:
parent
1672e157a6
commit
c427339cc5
@ -555,7 +555,7 @@
|
|||||||
"rejectionReason": "Rejection reason",
|
"rejectionReason": "Rejection reason",
|
||||||
"reference": "Reference",
|
"reference": "Reference",
|
||||||
"voteBreakdown": "Vote breakdown",
|
"voteBreakdown": "Vote breakdown",
|
||||||
"willPass": "Will pass",
|
"expectedToPass": "Expected to pass",
|
||||||
"majorityMet": "Token majority met",
|
"majorityMet": "Token majority met",
|
||||||
"majorityLPMet": "Liquidity majority met",
|
"majorityLPMet": "Liquidity majority met",
|
||||||
"participationMet": "Token participation met",
|
"participationMet": "Token participation met",
|
||||||
@ -572,7 +572,8 @@
|
|||||||
"yesPercentage": "Yes percentage",
|
"yesPercentage": "Yes percentage",
|
||||||
"noPercentage": "No percentage",
|
"noPercentage": "No percentage",
|
||||||
"proposalTerms": "Proposal terms",
|
"proposalTerms": "Proposal terms",
|
||||||
"currentlySetTo": "Vote currently set to ",
|
"currentlySetTo": "Currently expected to ",
|
||||||
|
"finalOutcomeMayDiffer": "Final outcome may differ",
|
||||||
"rankingScore": "Ranking score",
|
"rankingScore": "Ranking score",
|
||||||
"stakeScore": "Stake score",
|
"stakeScore": "Stake score",
|
||||||
"performanceScore": "Performance",
|
"performanceScore": "Performance",
|
||||||
|
@ -79,7 +79,7 @@ it('Proposal open - renders will fail state if the proposal will fail', async ()
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
renderComponent({ proposal: failedProposal });
|
renderComponent({ proposal: failedProposal });
|
||||||
expect(await screen.findByText('Vote currently set to')).toBeInTheDocument();
|
expect(await screen.findByText('Currently expected to')).toBeInTheDocument();
|
||||||
expect(await screen.findByText('fail')).toBeInTheDocument();
|
expect(await screen.findByText('fail')).toBeInTheDocument();
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -87,7 +87,7 @@ it('Proposal open - renders will pass state if the proposal will pass', async ()
|
|||||||
const proposal = generateProposal();
|
const proposal = generateProposal();
|
||||||
|
|
||||||
renderComponent({ proposal });
|
renderComponent({ proposal });
|
||||||
expect(await screen.findByText('Vote currently set to')).toBeInTheDocument();
|
expect(await screen.findByText('Currently expected to')).toBeInTheDocument();
|
||||||
expect(await screen.findByText('pass')).toBeInTheDocument();
|
expect(await screen.findByText('pass')).toBeInTheDocument();
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -152,7 +152,7 @@ it('Proposal waiting for node vote - will pass - renders if the vote will pass
|
|||||||
expect(
|
expect(
|
||||||
await screen.findByText('Waiting for nodes to validate asset.')
|
await screen.findByText('Waiting for nodes to validate asset.')
|
||||||
).toBeInTheDocument();
|
).toBeInTheDocument();
|
||||||
expect(await screen.findByText('Vote currently set to')).toBeInTheDocument();
|
expect(await screen.findByText('Currently expected to')).toBeInTheDocument();
|
||||||
expect(await screen.findByText('fail')).toBeInTheDocument();
|
expect(await screen.findByText('fail')).toBeInTheDocument();
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -168,7 +168,7 @@ it('Proposal waiting for node vote - will fail - renders if the vote will pass a
|
|||||||
expect(
|
expect(
|
||||||
await screen.findByText('Waiting for nodes to validate asset.')
|
await screen.findByText('Waiting for nodes to validate asset.')
|
||||||
).toBeInTheDocument();
|
).toBeInTheDocument();
|
||||||
expect(await screen.findByText('Vote currently set to')).toBeInTheDocument();
|
expect(await screen.findByText('Currently expected to')).toBeInTheDocument();
|
||||||
expect(await screen.findByText('pass')).toBeInTheDocument();
|
expect(await screen.findByText('pass')).toBeInTheDocument();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -27,6 +27,7 @@ const WillPass = ({
|
|||||||
<>
|
<>
|
||||||
{children}
|
{children}
|
||||||
<StatusPass>{t('pass')}</StatusPass>
|
<StatusPass>{t('pass')}</StatusPass>
|
||||||
|
<span>{t('finalOutcomeMayDiffer')}</span>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
@ -34,6 +35,7 @@ const WillPass = ({
|
|||||||
<>
|
<>
|
||||||
{children}
|
{children}
|
||||||
<StatusFail>{t('fail')}</StatusFail>
|
<StatusFail>{t('fail')}</StatusFail>
|
||||||
|
<span>{t('finalOutcomeMayDiffer')}</span>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -46,7 +46,7 @@ describe('Proposal Votes Table', () => {
|
|||||||
|
|
||||||
it('should show vote breakdown fields, excluding custom update market fields', () => {
|
it('should show vote breakdown fields, excluding custom update market fields', () => {
|
||||||
renderComponent();
|
renderComponent();
|
||||||
expect(screen.getByText('Will pass')).toBeInTheDocument();
|
expect(screen.getByText('Expected to pass')).toBeInTheDocument();
|
||||||
expect(screen.getByText('Token majority met')).toBeInTheDocument();
|
expect(screen.getByText('Token majority met')).toBeInTheDocument();
|
||||||
expect(screen.getByText('Token participation met')).toBeInTheDocument();
|
expect(screen.getByText('Token participation met')).toBeInTheDocument();
|
||||||
expect(screen.getByText('Tokens for proposal')).toBeInTheDocument();
|
expect(screen.getByText('Tokens for proposal')).toBeInTheDocument();
|
||||||
|
@ -61,7 +61,7 @@ export const ProposalVotesTable = ({
|
|||||||
headingLevel={4}
|
headingLevel={4}
|
||||||
>
|
>
|
||||||
<KeyValueTableRow>
|
<KeyValueTableRow>
|
||||||
{t('willPass')}
|
{t('expectedToPass')}
|
||||||
{isUpdateMarket ? (
|
{isUpdateMarket ? (
|
||||||
updateMarketWillPass ? (
|
updateMarketWillPass ? (
|
||||||
<Thumbs up={true} text={updateMarketVotePassMethod} />
|
<Thumbs up={true} text={updateMarketVotePassMethod} />
|
||||||
|
@ -1,11 +1,14 @@
|
|||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
|
import { formatDistanceToNow } from 'date-fns';
|
||||||
|
import { useVegaWallet } from '@vegaprotocol/wallet';
|
||||||
|
import { ProposalState } from '@vegaprotocol/types';
|
||||||
import { formatNumber } from '../../../../lib/format-number';
|
import { formatNumber } from '../../../../lib/format-number';
|
||||||
import { ConnectToVega } from '../../../../components/connect-to-vega';
|
import { ConnectToVega } from '../../../../components/connect-to-vega';
|
||||||
import { useVoteInformation } from '../../hooks';
|
import { useVoteInformation } from '../../hooks';
|
||||||
import { useUserVote } from './use-user-vote';
|
import { useUserVote } from './use-user-vote';
|
||||||
|
import { CurrentProposalStatus } from '../current-proposal-status';
|
||||||
import { VoteButtonsContainer } from './vote-buttons';
|
import { VoteButtonsContainer } from './vote-buttons';
|
||||||
import { VoteProgress } from './vote-progress';
|
import { VoteProgress } from './vote-progress';
|
||||||
import { useVegaWallet } from '@vegaprotocol/wallet';
|
|
||||||
import { ProposalType } from '../proposal/proposal';
|
import { ProposalType } from '../proposal/proposal';
|
||||||
import type { Proposal_proposal } from '../../proposal/__generated__/Proposal';
|
import type { Proposal_proposal } from '../../proposal/__generated__/Proposal';
|
||||||
|
|
||||||
@ -45,12 +48,22 @@ export const VoteDetails = ({
|
|||||||
proposal.votes.no.votes
|
proposal.votes.no.votes
|
||||||
);
|
);
|
||||||
const defaultDecimals = 2;
|
const defaultDecimals = 2;
|
||||||
|
const daysLeft = t('daysLeft', {
|
||||||
|
daysLeft: formatDistanceToNow(new Date(proposal.terms.closingDatetime)),
|
||||||
|
});
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{proposalType === ProposalType.PROPOSAL_UPDATE_MARKET && (
|
{proposalType === ProposalType.PROPOSAL_UPDATE_MARKET && (
|
||||||
<section>
|
<section>
|
||||||
<h3 className="text-xl mb-2">{t('liquidityVotes')}</h3>
|
<h3 className="text-xl mb-2">{t('liquidityVotes')}</h3>
|
||||||
|
<p>
|
||||||
|
<span>
|
||||||
|
<CurrentProposalStatus proposal={proposal} />
|
||||||
|
</span>
|
||||||
|
{'. '}
|
||||||
|
{proposal.state === ProposalState.STATE_OPEN ? daysLeft : null}
|
||||||
|
</p>
|
||||||
<table className="w-full mb-8">
|
<table className="w-full mb-8">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
@ -93,6 +106,13 @@ export const VoteDetails = ({
|
|||||||
)}
|
)}
|
||||||
<section>
|
<section>
|
||||||
<h3 className="text-xl mb-2">{t('tokenVotes')}</h3>
|
<h3 className="text-xl mb-2">{t('tokenVotes')}</h3>
|
||||||
|
<p>
|
||||||
|
<span>
|
||||||
|
<CurrentProposalStatus proposal={proposal} />
|
||||||
|
</span>
|
||||||
|
{'. '}
|
||||||
|
{proposal.state === ProposalState.STATE_OPEN ? daysLeft : null}
|
||||||
|
</p>
|
||||||
<table className="w-full mb-4">
|
<table className="w-full mb-4">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
|
Loading…
Reference in New Issue
Block a user