fix: hide enacted on proposal details page for freeform proposals (#1503)
This commit is contained in:
parent
9836f29e15
commit
0d8c052ec6
@ -686,5 +686,6 @@
|
|||||||
"MoreMarketsInfo": "To see Explorer data on existing markets visit",
|
"MoreMarketsInfo": "To see Explorer data on existing markets visit",
|
||||||
"MoreAssetsInfo": "To see Explorer data on existing assets visit",
|
"MoreAssetsInfo": "To see Explorer data on existing assets visit",
|
||||||
"ProposalNotFound": "Proposal not found",
|
"ProposalNotFound": "Proposal not found",
|
||||||
"ProposalNotFoundDetails": "The proposal you are looking for is not here, it may have been enacted before the last chain restore. You could check the Vega forums/discord instead for information about it."
|
"ProposalNotFoundDetails": "The proposal you are looking for is not here, it may have been enacted before the last chain restore. You could check the Vega forums/discord instead for information about it.",
|
||||||
|
"FreeformProposal": "Freeform proposal"
|
||||||
}
|
}
|
||||||
|
@ -79,6 +79,28 @@ it('Changes data based on if data is in future or past', () => {
|
|||||||
).toBeInTheDocument();
|
).toBeInTheDocument();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('Does not render enactment time for freeform proposal', () => {
|
||||||
|
const proposal = generateProposal({
|
||||||
|
state: ProposalState.STATE_ENACTED,
|
||||||
|
terms: {
|
||||||
|
__typename: 'ProposalTerms',
|
||||||
|
change: {
|
||||||
|
__typename: 'NewFreeform',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
render(<ProposalChangeTable proposal={proposal} />);
|
||||||
|
expect(screen.queryByText('Enacted on')).not.toBeInTheDocument();
|
||||||
|
expect(
|
||||||
|
screen.queryByText(
|
||||||
|
format(
|
||||||
|
new Date(proposal.terms.enactmentDatetime || 0),
|
||||||
|
DATE_FORMAT_DETAILED
|
||||||
|
)
|
||||||
|
)
|
||||||
|
).not.toBeInTheDocument();
|
||||||
|
});
|
||||||
|
|
||||||
it('Renders error details and rejection reason if present', () => {
|
it('Renders error details and rejection reason if present', () => {
|
||||||
const errorDetails = 'Error message';
|
const errorDetails = 'Error message';
|
||||||
const proposal = generateProposal({
|
const proposal = generateProposal({
|
||||||
|
@ -31,12 +31,14 @@ export const ProposalChangeTable = ({ proposal }: ProposalChangeTableProps) => {
|
|||||||
: t('closedOn')}
|
: t('closedOn')}
|
||||||
{format(new Date(terms.closingDatetime), DATE_FORMAT_DETAILED)}
|
{format(new Date(terms.closingDatetime), DATE_FORMAT_DETAILED)}
|
||||||
</KeyValueTableRow>
|
</KeyValueTableRow>
|
||||||
<KeyValueTableRow>
|
{terms.change.__typename !== 'NewFreeform' ? (
|
||||||
{isFuture(new Date(terms.enactmentDatetime || 0))
|
<KeyValueTableRow>
|
||||||
? t('proposedEnactment')
|
{isFuture(new Date(terms.enactmentDatetime || 0))
|
||||||
: t('enactedOn')}
|
? t('proposedEnactment')
|
||||||
{format(new Date(terms.enactmentDatetime || 0), DATE_FORMAT_DETAILED)}
|
: t('enactedOn')}
|
||||||
</KeyValueTableRow>
|
{format(new Date(terms.enactmentDatetime || 0), DATE_FORMAT_DETAILED)}
|
||||||
|
</KeyValueTableRow>
|
||||||
|
) : null}
|
||||||
<KeyValueTableRow>
|
<KeyValueTableRow>
|
||||||
{t('proposedBy')}
|
{t('proposedBy')}
|
||||||
<span style={{ wordBreak: 'break-word' }}>{proposal.party.id}</span>
|
<span style={{ wordBreak: 'break-word' }}>{proposal.party.id}</span>
|
||||||
|
@ -73,8 +73,7 @@ export const ProposalHeader = ({ proposal }: { proposal: ProposalFields }) => {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 'NewFreeform': {
|
case 'NewFreeform': {
|
||||||
details = `${proposal.id}`;
|
details = `${t('FreeformProposal')}: ${proposal.id}`;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user