fix(governance,environment): adjust proposal user journey (#4679)

Co-authored-by: Joe <joe@vega.xyz>
This commit is contained in:
Sam Keen 2023-09-11 22:04:30 +01:00 committed by GitHub
parent 84e40ccb2b
commit a0945be721
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 92 additions and 41 deletions

View File

@ -37,11 +37,39 @@ context(
}); });
// 3002-PROP-023 3004-PMAC-002 3005-PASN-002 3006-PASC-002 3007-PNEC-002 3008-PFRO-003 // 3002-PROP-023 3004-PMAC-002 3005-PASN-002 3006-PASC-002 3007-PNEC-002 3008-PFRO-003
it('should have button for link to more information on proposals', function () { it('new proposal page should have button for link to more information on proposals', function () {
const proposalsUrl = 'https://docs.vega.xyz/mainnet/tutorials/proposals'; cy.getByTestId('new-proposal-link').click();
cy.getByTestId('new-proposal-link') cy.url().should('include', '/proposals/propose/raw');
.find('a') cy.contains('To see Explorer data on proposals visit').within(() => {
.should('have.attr', 'href', proposalsUrl); cy.getByTestId('external-link').should(
'have.attr',
'href',
'https://explorer.fairground.wtf/governance'
);
});
cy.contains(
'1. Sense check your proposal with the community on the forum:'
).within(() => {
cy.getByTestId('external-link').should(
'have.attr',
'href',
'https://community.vega.xyz/c/governance/25'
);
});
cy.contains(
'2. Use the appropriate proposal template in the docs:'
).within(() => {
cy.getByTestId('external-link').should(
'have.attr',
'href',
'https://docs.vega.xyz/mainnet/tutorials/proposals'
);
});
cy.contains('Connect your wallet to submit a proposal').should(
'be.visible'
);
cy.getByTestId('connect-to-vega-wallet-btn').should('exist');
navigateTo(navigation.proposals);
}); });
it('should be able to see a working link for - find out more about Vega governance', function () { it('should be able to see a working link for - find out more about Vega governance', function () {

View File

@ -708,7 +708,7 @@
"NewAssetProposal": "New asset proposal", "NewAssetProposal": "New asset proposal",
"UpdateAssetProposal": "Update asset proposal", "UpdateAssetProposal": "Update asset proposal",
"NewFreeformProposal": "New freeform proposal", "NewFreeformProposal": "New freeform proposal",
"NewRawProposal": "New raw proposal", "NewRawProposal": "New proposal",
"MinProposalRequirements": "You must have at least {{value}} VEGA associated to make a proposal", "MinProposalRequirements": "You must have at least {{value}} VEGA associated to make a proposal",
"MinProposalVoteRequirements": "You must have at least {{value}} VEGA associated to vote on this proposal", "MinProposalVoteRequirements": "You must have at least {{value}} VEGA associated to vote on this proposal",
"totalSupply": "Total Supply", "totalSupply": "Total Supply",
@ -870,5 +870,9 @@
"Upgraded at": "Upgraded at", "Upgraded at": "Upgraded at",
"dataIsIdentical": "Data is identical", "dataIsIdentical": "Data is identical",
"updatesToMarket": "Updates to market", "updatesToMarket": "Updates to market",
"viewAsParty": "View as party" "viewAsParty": "View as party",
"HowToPropose": "How to make a proposal",
"HowToProposeRawStep1": "1. Sense check your proposal with the community on the forum:",
"HowToProposeRawStep2": "2. Use the appropriate proposal template in the docs:",
"HowToProposeRawStep3": "3. Submit on-chain below"
} }

View File

@ -7,18 +7,13 @@ import { ProposalsListItem } from '../proposals-list-item';
import { ProtocolUpgradeProposalsListItem } from '../protocol-upgrade-proposals-list-item/protocol-upgrade-proposals-list-item'; import { ProtocolUpgradeProposalsListItem } from '../protocol-upgrade-proposals-list-item/protocol-upgrade-proposals-list-item';
import { ProposalsListFilter } from '../proposals-list-filter'; import { ProposalsListFilter } from '../proposals-list-filter';
import Routes from '../../../routes'; import Routes from '../../../routes';
import { import { Button, Toggle } from '@vegaprotocol/ui-toolkit';
Button,
Toggle,
VegaIcon,
VegaIconNames,
} from '@vegaprotocol/ui-toolkit';
import { Link } from 'react-router-dom'; import { Link } from 'react-router-dom';
import { ExternalLink } from '@vegaprotocol/ui-toolkit'; import { ExternalLink } from '@vegaprotocol/ui-toolkit';
import type { ProposalQuery } from '../../proposal/__generated__/Proposal'; import type { ProposalQuery } from '../../proposal/__generated__/Proposal';
import type { ProposalFieldsFragment } from '../../proposals/__generated__/Proposals'; import type { ProposalFieldsFragment } from '../../proposals/__generated__/Proposals';
import type { ProtocolUpgradeProposalFieldsFragment } from '@vegaprotocol/proposals'; import type { ProtocolUpgradeProposalFieldsFragment } from '@vegaprotocol/proposals';
import { DocsLinks, ExternalLinks } from '@vegaprotocol/environment'; import { ExternalLinks } from '@vegaprotocol/environment';
interface ProposalsListProps { interface ProposalsListProps {
proposals: Array<ProposalFieldsFragment | ProposalQuery['proposal']>; proposals: Array<ProposalFieldsFragment | ProposalQuery['proposal']>;
@ -145,18 +140,13 @@ export const ProposalsList = ({
title={t('pageTitleProposals')} title={t('pageTitleProposals')}
/> />
{DocsLinks && ( <div className="xs:justify-self-end" data-testid="new-proposal-link">
<div className="xs:justify-self-end" data-testid="new-proposal-link"> <Link to={`${Routes.PROPOSALS}/propose/raw`}>
<ExternalLink href={DocsLinks.PROPOSALS_GUIDE}> <Button variant="primary" size="sm">
<Button variant="primary" size="sm"> <div className="flex items-center gap-1">{t('NewProposal')}</div>
<div className="flex items-center gap-1"> </Button>
{t('NewProposal')} </Link>
<VegaIcon name={VegaIconNames.OPEN_EXTERNAL} size={13} /> </div>
</div>
</Button>
</ExternalLink>
</div>
)}
</div> </div>
<p className="mb-8"> <p className="mb-8">

View File

@ -1,12 +1,17 @@
import { useForm } from 'react-hook-form'; import { useForm } from 'react-hook-form';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import { useEnvironment, DocsLinks } from '@vegaprotocol/environment'; import {
import { Heading } from '../../../../components/heading'; useEnvironment,
DocsLinks,
ExternalLinks,
} from '@vegaprotocol/environment';
import { Heading, SubHeading } from '../../../../components/heading';
import { import {
AsyncRenderer, AsyncRenderer,
ExternalLink, ExternalLink,
FormGroup, FormGroup,
InputError, InputError,
RoundedWrapper,
TextArea, TextArea,
} from '@vegaprotocol/ui-toolkit'; } from '@vegaprotocol/ui-toolkit';
import { validateJson } from '@vegaprotocol/utils'; import { validateJson } from '@vegaprotocol/utils';
@ -79,15 +84,6 @@ export const ProposeRaw = () => {
spamProtectionMin={params.spam_protection_proposal_min_tokens} spamProtectionMin={params.spam_protection_proposal_min_tokens}
/> />
{DocsLinks && (
<p className="text-sm" data-testid="proposal-docs-link">
<span className="mr-1">{t('ProposalTermsText')}</span>
<ExternalLink href={DocsLinks.PROPOSALS_GUIDE} target="_blank">
{DocsLinks.PROPOSALS_GUIDE}
</ExternalLink>
</p>
)}
{VEGA_EXPLORER_URL && ( {VEGA_EXPLORER_URL && (
<p className="text-sm"> <p className="text-sm">
{t('MoreProposalsInfo')}{' '} {t('MoreProposalsInfo')}{' '}
@ -98,12 +94,44 @@ export const ProposeRaw = () => {
</p> </p>
)} )}
<section data-testid="how-to" className="my-10">
<RoundedWrapper paddingBottom={true}>
<SubHeading title={t('HowToPropose')} />
<ul>
<li className="p-1">
{t('HowToProposeRawStep1')}{' '}
{ExternalLinks && (
<span data-testid="proposal-docs-link">
<ExternalLink
href={ExternalLinks.PROPOSALS_FORUM}
target="_blank"
>
{ExternalLinks.PROPOSALS_FORUM}
</ExternalLink>
</span>
)}
</li>
<li className="p-1">
{t('HowToProposeRawStep2')}{' '}
{DocsLinks && (
<span data-testid="proposal-docs-link">
<ExternalLink
href={DocsLinks.PROPOSALS_GUIDE}
target="_blank"
>
{DocsLinks.PROPOSALS_GUIDE}
</ExternalLink>
</span>
)}
</li>
<li className="p-1">{t('HowToProposeRawStep3')}</li>
</ul>
</RoundedWrapper>
</section>
<div data-testid="raw-proposal-form"> <div data-testid="raw-proposal-form">
<form onSubmit={handleSubmit(onSubmit)}> <form onSubmit={handleSubmit(onSubmit)}>
<FormGroup <FormGroup label="Valid JSON required" labelFor="proposal-data">
label="Make a proposal by submitting JSON"
labelFor="proposal-data"
>
<TextArea <TextArea
id="proposal-data" id="proposal-data"
className="min-h-[200px]" className="min-h-[200px]"

View File

@ -159,6 +159,7 @@ export const ExternalLinks = {
DISCORD: 'https://vega.xyz/discord', DISCORD: 'https://vega.xyz/discord',
GOVERNANCE_PAGE: 'https://vega.xyz/governance', GOVERNANCE_PAGE: 'https://vega.xyz/governance',
VALIDATOR_FORUM: 'https://community.vega.xyz/c/mainnet-validator-candidates', VALIDATOR_FORUM: 'https://community.vega.xyz/c/mainnet-validator-candidates',
PROPOSALS_FORUM: 'https://community.vega.xyz/c/governance/25',
MARGIN_CREDIT_RISK: MARGIN_CREDIT_RISK:
'https://vega.xyz/papers/margins-and-credit-risk.pdf#page=7', 'https://vega.xyz/papers/margins-and-credit-risk.pdf#page=7',
VEGA_WALLET_URL: 'https://vega.xyz/wallet', VEGA_WALLET_URL: 'https://vega.xyz/wallet',