feat(governance): hide make proposal journey and link to docs instead (#3658)

Co-authored-by: Joe <joe@vega.xyz>
This commit is contained in:
Sam Keen 2023-05-09 15:43:39 +01:00 committed by GitHub
parent 3740a97d7e
commit 792ff1fc1f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
20 changed files with 50 additions and 63 deletions

View File

@ -161,7 +161,7 @@ context('Home Page - verify elements on page', { tags: '@smoke' }, function () {
cy.getByTestId('menu-drawer').should('be.visible'); cy.getByTestId('menu-drawer').should('be.visible');
}); });
it('should have link for proposal page', function () { it.skip('should have link for proposal page', function () {
cy.getByTestId('menu-drawer').within(() => { cy.getByTestId('menu-drawer').within(() => {
cy.get('[href="/proposals"]') cy.get('[href="/proposals"]')
.should('exist') .should('exist')

View File

@ -54,7 +54,7 @@ context(
}); });
}); });
it('should be able to see button for - new proposal', function () { it.skip('should be able to see button for - new proposal', function () {
// 3001-VOTE-002 // 3001-VOTE-002
cy.get(newProposalLink) cy.get(newProposalLink)
.should('be.visible') .should('be.visible')
@ -63,7 +63,7 @@ context(
.and('equal', '/proposals/propose'); .and('equal', '/proposals/propose');
}); });
it('should be able to see a connect wallet button - if vega wallet disconnected and user is submitting new proposal', function () { it.skip('should be able to see a connect wallet button - if vega wallet disconnected and user is submitting new proposal', function () {
goToMakeNewProposal(governanceProposalType.NETWORK_PARAMETER); goToMakeNewProposal(governanceProposalType.NETWORK_PARAMETER);
cy.get(connectToVegaWalletButton) cy.get(connectToVegaWalletButton)
.should('be.visible') .should('be.visible')

View File

@ -46,7 +46,7 @@ context('View functionality with public key', { tags: '@smoke' }, function () {
.and('contain.text', 'USDC (fake)'); .and('contain.text', 'USDC (fake)');
}); });
it('Unable to submit proposal with public key', function () { it.skip('Unable to submit proposal with public key', function () {
const expectedErrorTxt = `You are connected in a view only state for public key: ${vegaWalletPubKey}. In order to send transactions you must connect to a real wallet.`; const expectedErrorTxt = `You are connected in a view only state for public key: ${vegaWalletPubKey}. In order to send transactions you must connect to a real wallet.`;
navigateTo(navigation.proposals); navigateTo(navigation.proposals);

View File

@ -678,6 +678,8 @@
"FilterProposalsDescription": "Filter by proposal ID or proposer ID", "FilterProposalsDescription": "Filter by proposal ID or proposer ID",
"Freeform proposal": "Freeform proposal", "Freeform proposal": "Freeform proposal",
"NewProposal": "New proposal", "NewProposal": "New proposal",
"CreateProposalAndDownloadJSONToShare": "Create proposal and download JSON to share",
"SubmitAnAgreedProposalFromTheForum": "Submit an agreed proposal from the forum",
"ProposalTypeQuestion": "What type of proposal would you like to make?", "ProposalTypeQuestion": "What type of proposal would you like to make?",
"NetworkParameterProposal": "Update network parameter proposal", "NetworkParameterProposal": "Update network parameter proposal",
"parameter": "parameter", "parameter": "parameter",
@ -701,6 +703,7 @@
"AssetID": "Asset ID", "AssetID": "Asset ID",
"Freeform": "Freeform", "Freeform": "Freeform",
"RawProposal": "Let me choose (raw proposal)", "RawProposal": "Let me choose (raw proposal)",
"SubmitAgreedRawProposal": "Submit agreed raw proposal",
"UseMin": "Use minimum", "UseMin": "Use minimum",
"UseMax": "Use maximum", "UseMax": "Use maximum",
"Proposal": "Proposal", "Proposal": "Proposal",

View File

@ -6,13 +6,14 @@ 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 { Button } from '@vegaprotocol/ui-toolkit'; import { Button, VegaIcon, VegaIconNames } from '@vegaprotocol/ui-toolkit';
import { Link } from 'react-router-dom'; import { Link } from 'react-router-dom';
import { ExternalLinks } from '@vegaprotocol/utils'; import { createDocsLinks, ExternalLinks } from '@vegaprotocol/utils';
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 { useEnvironment } from '@vegaprotocol/environment';
interface ProposalsListProps { interface ProposalsListProps {
proposals: Array<ProposalFieldsFragment | ProposalQuery['proposal']>; proposals: Array<ProposalFieldsFragment | ProposalQuery['proposal']>;
@ -35,6 +36,7 @@ export const ProposalsList = ({
protocolUpgradeProposals, protocolUpgradeProposals,
lastBlockHeight, lastBlockHeight,
}: ProposalsListProps) => { }: ProposalsListProps) => {
const { VEGA_DOCS_URL } = useEnvironment();
const { t } = useTranslation(); const { t } = useTranslation();
const [filterString, setFilterString] = useState(''); const [filterString, setFilterString] = useState('');
const sortedProposals = proposals.reduce( const sortedProposals = proposals.reduce(
@ -81,15 +83,18 @@ export const ProposalsList = ({
marginBottom={false} marginBottom={false}
title={t('pageTitleProposals')} title={t('pageTitleProposals')}
/> />
<Link {VEGA_DOCS_URL && (
className="xs:justify-self-end" <div className="xs:justify-self-end" data-testid="new-proposal-link">
data-testid="new-proposal-link" <ExternalLink href={createDocsLinks(VEGA_DOCS_URL).PROPOSALS_GUIDE}>
to={`${Routes.PROPOSALS}/propose`} <Button variant="primary" size="sm">
> <div className="flex items-center gap-1">
<Button variant="primary" size="sm"> {t('NewProposal')}
{t('NewProposal')} <VegaIcon name={VegaIconNames.OPEN_EXTERNAL} size={13} />
</Button> </div>
</Link> </Button>
</ExternalLink>
</div>
)}
</div> </div>
<p className="mb-8"> <p className="mb-8">
{t( {t(

View File

@ -108,7 +108,7 @@ describe('Propose Freeform', () => {
expect(screen.getByTestId('proposal-title')).toBeTruthy(); expect(screen.getByTestId('proposal-title')).toBeTruthy();
expect(screen.getByTestId('proposal-description')).toBeTruthy(); expect(screen.getByTestId('proposal-description')).toBeTruthy();
expect(screen.getByTestId('proposal-vote-deadline')).toBeTruthy(); expect(screen.getByTestId('proposal-vote-deadline')).toBeTruthy();
expect(screen.getByTestId('proposal-submit')).toBeTruthy();
expect(screen.getByTestId('proposal-download-json')).toBeTruthy(); expect(screen.getByTestId('proposal-download-json')).toBeTruthy();
expect(screen.getByTestId('proposal-transaction-dialog')).toBeTruthy(); expect(screen.getByTestId('proposal-transaction-dialog')).toBeTruthy();
}); });

View File

@ -9,7 +9,6 @@ import { useEnvironment } from '@vegaprotocol/environment';
import { import {
ProposalFormDescription, ProposalFormDescription,
ProposalFormSubheader, ProposalFormSubheader,
ProposalFormSubmit,
ProposalFormTitle, ProposalFormTitle,
ProposalFormTransactionDialog, ProposalFormTransactionDialog,
ProposalFormDownloadJson, ProposalFormDownloadJson,
@ -48,7 +47,7 @@ export const ProposeFreeform = () => {
const { const {
register, register,
handleSubmit, handleSubmit,
formState: { isSubmitting, errors }, formState: { errors },
setValue, setValue,
watch, watch,
} = useForm<FreeformProposalFormFields>(); } = useForm<FreeformProposalFormFields>();
@ -165,7 +164,6 @@ export const ProposeFreeform = () => {
voteMaxClose={params.governance_proposal_freeform_maxClose} voteMaxClose={params.governance_proposal_freeform_maxClose}
/> />
<ProposalFormSubmit isSubmitting={isSubmitting} />
<ProposalFormDownloadJson downloadJson={viewJson} /> <ProposalFormDownloadJson downloadJson={viewJson} />
<ProposalFormTransactionDialog <ProposalFormTransactionDialog
finalizedProposal={finalizedProposal} finalizedProposal={finalizedProposal}

View File

@ -111,7 +111,7 @@ describe('Propose Network Parameter', () => {
expect(screen.getByTestId('proposal-description')).toBeTruthy(); expect(screen.getByTestId('proposal-description')).toBeTruthy();
expect(screen.getByTestId('proposal-vote-deadline')).toBeTruthy(); expect(screen.getByTestId('proposal-vote-deadline')).toBeTruthy();
expect(screen.getByTestId('proposal-enactment-deadline')).toBeTruthy(); expect(screen.getByTestId('proposal-enactment-deadline')).toBeTruthy();
expect(screen.getByTestId('proposal-submit')).toBeTruthy();
expect(screen.getByTestId('proposal-download-json')).toBeTruthy(); expect(screen.getByTestId('proposal-download-json')).toBeTruthy();
expect(screen.getByTestId('proposal-transaction-dialog')).toBeTruthy(); expect(screen.getByTestId('proposal-transaction-dialog')).toBeTruthy();
}); });

View File

@ -16,7 +16,6 @@ import { useEnvironment } from '@vegaprotocol/environment';
import { import {
ProposalFormDescription, ProposalFormDescription,
ProposalFormSubheader, ProposalFormSubheader,
ProposalFormSubmit,
ProposalFormTitle, ProposalFormTitle,
ProposalFormTransactionDialog, ProposalFormTransactionDialog,
ProposalFormVoteAndEnactmentDeadline, ProposalFormVoteAndEnactmentDeadline,
@ -90,7 +89,7 @@ export const ProposeNetworkParameter = () => {
const { const {
register, register,
handleSubmit, handleSubmit,
formState: { isSubmitting, errors }, formState: { errors },
setValue, setValue,
watch, watch,
} = useForm<NetworkParameterProposalFormFields>(); } = useForm<NetworkParameterProposalFormFields>();
@ -310,7 +309,6 @@ export const ProposeNetworkParameter = () => {
} }
/> />
<ProposalFormSubmit isSubmitting={isSubmitting} />
<ProposalFormDownloadJson downloadJson={viewJson} /> <ProposalFormDownloadJson downloadJson={viewJson} />
<ProposalFormTransactionDialog <ProposalFormTransactionDialog
finalizedProposal={finalizedProposal} finalizedProposal={finalizedProposal}

View File

@ -109,7 +109,7 @@ describe('Propose New Asset', () => {
expect(screen.getByTestId('proposal-vote-deadline')).toBeTruthy(); expect(screen.getByTestId('proposal-vote-deadline')).toBeTruthy();
expect(screen.getByTestId('proposal-validation-deadline')).toBeTruthy(); expect(screen.getByTestId('proposal-validation-deadline')).toBeTruthy();
expect(screen.getByTestId('proposal-enactment-deadline')).toBeTruthy(); expect(screen.getByTestId('proposal-enactment-deadline')).toBeTruthy();
expect(screen.getByTestId('proposal-submit')).toBeTruthy();
expect(screen.getByTestId('proposal-download-json')).toBeTruthy(); expect(screen.getByTestId('proposal-download-json')).toBeTruthy();
expect(screen.getByTestId('proposal-transaction-dialog')).toBeTruthy(); expect(screen.getByTestId('proposal-transaction-dialog')).toBeTruthy();
}); });

View File

@ -16,7 +16,6 @@ import {
import { import {
ProposalFormDescription, ProposalFormDescription,
ProposalFormSubheader, ProposalFormSubheader,
ProposalFormSubmit,
ProposalFormTerms, ProposalFormTerms,
ProposalFormTitle, ProposalFormTitle,
ProposalFormTransactionDialog, ProposalFormTransactionDialog,
@ -59,7 +58,7 @@ export const ProposeNewAsset = () => {
const { const {
register, register,
handleSubmit, handleSubmit,
formState: { isSubmitting, errors }, formState: { errors },
setValue, setValue,
watch, watch,
} = useForm<NewAssetProposalFormFields>(); } = useForm<NewAssetProposalFormFields>();
@ -226,7 +225,6 @@ export const ProposeNewAsset = () => {
} }
/> />
<ProposalFormSubmit isSubmitting={isSubmitting} />
<ProposalFormDownloadJson downloadJson={viewJson} /> <ProposalFormDownloadJson downloadJson={viewJson} />
<ProposalFormTransactionDialog <ProposalFormTransactionDialog
finalizedProposal={finalizedProposal} finalizedProposal={finalizedProposal}

View File

@ -103,7 +103,7 @@ describe('Propose New Market', () => {
expect(screen.getByTestId('proposal-terms')).toBeTruthy(); expect(screen.getByTestId('proposal-terms')).toBeTruthy();
expect(screen.getByTestId('proposal-vote-deadline')).toBeTruthy(); expect(screen.getByTestId('proposal-vote-deadline')).toBeTruthy();
expect(screen.getByTestId('proposal-enactment-deadline')).toBeTruthy(); expect(screen.getByTestId('proposal-enactment-deadline')).toBeTruthy();
expect(screen.getByTestId('proposal-submit')).toBeTruthy();
expect(screen.getByTestId('proposal-download-json')).toBeTruthy(); expect(screen.getByTestId('proposal-download-json')).toBeTruthy();
expect(screen.getByTestId('proposal-transaction-dialog')).toBeTruthy(); expect(screen.getByTestId('proposal-transaction-dialog')).toBeTruthy();
}); });

View File

@ -15,7 +15,6 @@ import {
import { import {
ProposalFormDescription, ProposalFormDescription,
ProposalFormSubheader, ProposalFormSubheader,
ProposalFormSubmit,
ProposalFormTerms, ProposalFormTerms,
ProposalFormTitle, ProposalFormTitle,
ProposalFormTransactionDialog, ProposalFormTransactionDialog,
@ -57,7 +56,7 @@ export const ProposeNewMarket = () => {
const { const {
register, register,
handleSubmit, handleSubmit,
formState: { isSubmitting, errors }, formState: { errors },
setValue, setValue,
watch, watch,
} = useForm<NewMarketProposalFormFields>(); } = useForm<NewMarketProposalFormFields>();
@ -208,7 +207,6 @@ export const ProposeNewMarket = () => {
enactmentMaxClose={params.governance_proposal_market_maxEnact} enactmentMaxClose={params.governance_proposal_market_maxEnact}
/> />
<ProposalFormSubmit isSubmitting={isSubmitting} />
<ProposalFormDownloadJson downloadJson={viewJson} /> <ProposalFormDownloadJson downloadJson={viewJson} />
<ProposalFormTransactionDialog <ProposalFormTransactionDialog
finalizedProposal={finalizedProposal} finalizedProposal={finalizedProposal}

View File

@ -15,10 +15,10 @@ describe('Propose', () => {
expect(baseElement).toBeTruthy(); expect(baseElement).toBeTruthy();
}); });
it('should render the heading, proposal type question and options', () => { it('should render the heading, proposals title and options', () => {
renderComponent(); renderComponent();
expect( expect(
screen.getByText('What type of proposal would you like to make?') screen.getByText('Create proposal and download JSON to share')
).toBeTruthy(); ).toBeTruthy();
expect(screen.getByText('Network parameter')).toBeTruthy(); expect(screen.getByText('Network parameter')).toBeTruthy();
expect(screen.getByText('New market')).toBeTruthy(); expect(screen.getByText('New market')).toBeTruthy();
@ -26,6 +26,9 @@ describe('Propose', () => {
expect(screen.getByText('New asset')).toBeTruthy(); expect(screen.getByText('New asset')).toBeTruthy();
expect(screen.getByText('Update asset')).toBeTruthy(); expect(screen.getByText('Update asset')).toBeTruthy();
expect(screen.getByText('Freeform')).toBeTruthy(); expect(screen.getByText('Freeform')).toBeTruthy();
expect(screen.getByText('Let me choose (raw proposal)')).toBeTruthy(); expect(
screen.getByText('Submit an agreed proposal from the forum')
).toBeTruthy();
expect(screen.getByText('Submit agreed raw proposal')).toBeTruthy();
}); });
}); });

View File

@ -39,8 +39,8 @@ export const Propose = () => {
</section> </section>
<section> <section>
<h2 className="text-h5">{t('ProposalTypeQuestion')}</h2> <h2 className="text-h5">{t('CreateProposalAndDownloadJSONToShare')}</h2>
<ul> <ul className="mb-6">
<li> <li>
<p> <p>
<Link <Link
@ -101,17 +101,14 @@ export const Propose = () => {
</Link> </Link>
</p> </p>
</li> </li>
<li>
<p>
<Link
className="underline"
to={`${Routes.PROPOSALS}/propose/raw`}
>
{t('RawProposal')}
</Link>
</p>
</li>
</ul> </ul>
<h2 className="text-h5">{t('SubmitAnAgreedProposalFromTheForum')}</h2>
<p>
<Link className="underline" to={`${Routes.PROPOSALS}/propose/raw`}>
{t('SubmitAgreedRawProposal')}
</Link>
</p>
</section> </section>
</> </>
); );

View File

@ -18,10 +18,8 @@ import { useProposalSubmit } from '@vegaprotocol/proposals';
import { import {
ProposalFormSubmit, ProposalFormSubmit,
ProposalFormTransactionDialog, ProposalFormTransactionDialog,
ProposalFormDownloadJson,
} from '../../components/propose'; } from '../../components/propose';
import { ProposalRawMinRequirements } from './proposal-raw-min-requirements'; import { ProposalRawMinRequirements } from './proposal-raw-min-requirements';
import { downloadJson } from '../../../../lib/download-json';
export interface RawProposalFormFields { export interface RawProposalFormFields {
rawProposalData: string; rawProposalData: string;
@ -47,7 +45,6 @@ export const ProposeRaw = () => {
register, register,
handleSubmit, handleSubmit,
formState: { isSubmitting, errors }, formState: { isSubmitting, errors },
watch,
} = useForm<RawProposalFormFields>(); } = useForm<RawProposalFormFields>();
const { finalizedProposal, submit, Dialog } = useProposalSubmit(); const { finalizedProposal, submit, Dialog } = useProposalSubmit();
@ -57,11 +54,6 @@ export const ProposeRaw = () => {
await submit(JSON.parse(fields.rawProposalData)); await submit(JSON.parse(fields.rawProposalData));
}; };
const viewJson = () => {
const formData = watch();
downloadJson(JSON.stringify(formData), 'vega-raw-proposal');
};
return ( return (
<AsyncRenderer <AsyncRenderer
loading={networkParamsLoading} loading={networkParamsLoading}
@ -132,7 +124,6 @@ export const ProposeRaw = () => {
)} )}
</FormGroup> </FormGroup>
<ProposalFormSubmit isSubmitting={isSubmitting} /> <ProposalFormSubmit isSubmitting={isSubmitting} />
<ProposalFormDownloadJson downloadJson={viewJson} />
<ProposalFormTransactionDialog <ProposalFormTransactionDialog
finalizedProposal={finalizedProposal} finalizedProposal={finalizedProposal}
TransactionDialog={Dialog} TransactionDialog={Dialog}

View File

@ -110,7 +110,7 @@ describe('Propose Update Asset', () => {
expect(screen.getByTestId('proposal-terms')).toBeTruthy(); expect(screen.getByTestId('proposal-terms')).toBeTruthy();
expect(screen.getByTestId('proposal-vote-deadline')).toBeTruthy(); expect(screen.getByTestId('proposal-vote-deadline')).toBeTruthy();
expect(screen.getByTestId('proposal-enactment-deadline')).toBeTruthy(); expect(screen.getByTestId('proposal-enactment-deadline')).toBeTruthy();
expect(screen.getByTestId('proposal-submit')).toBeTruthy();
expect(screen.getByTestId('proposal-download-json')).toBeTruthy(); expect(screen.getByTestId('proposal-download-json')).toBeTruthy();
expect(screen.getByTestId('proposal-transaction-dialog')).toBeTruthy(); expect(screen.getByTestId('proposal-transaction-dialog')).toBeTruthy();
}); });

View File

@ -15,7 +15,6 @@ import {
import { import {
ProposalFormDescription, ProposalFormDescription,
ProposalFormSubheader, ProposalFormSubheader,
ProposalFormSubmit,
ProposalFormTerms, ProposalFormTerms,
ProposalFormTitle, ProposalFormTitle,
ProposalFormTransactionDialog, ProposalFormTransactionDialog,
@ -57,7 +56,7 @@ export const ProposeUpdateAsset = () => {
const { const {
register, register,
handleSubmit, handleSubmit,
formState: { isSubmitting, errors }, formState: { errors },
setValue, setValue,
watch, watch,
} = useForm<UpdateAssetProposalFormFields>(); } = useForm<UpdateAssetProposalFormFields>();
@ -212,7 +211,6 @@ export const ProposeUpdateAsset = () => {
} }
/> />
<ProposalFormSubmit isSubmitting={isSubmitting} />
<ProposalFormDownloadJson downloadJson={viewJson} /> <ProposalFormDownloadJson downloadJson={viewJson} />
<ProposalFormTransactionDialog <ProposalFormTransactionDialog
finalizedProposal={finalizedProposal} finalizedProposal={finalizedProposal}

View File

@ -261,7 +261,7 @@ describe('Propose Update Market', () => {
expect(screen.getByTestId('proposal-terms')).toBeTruthy(); expect(screen.getByTestId('proposal-terms')).toBeTruthy();
expect(screen.getByTestId('proposal-vote-deadline')).toBeTruthy(); expect(screen.getByTestId('proposal-vote-deadline')).toBeTruthy();
expect(screen.getByTestId('proposal-enactment-deadline')).toBeTruthy(); expect(screen.getByTestId('proposal-enactment-deadline')).toBeTruthy();
expect(screen.getByTestId('proposal-submit')).toBeTruthy();
expect(screen.getByTestId('proposal-download-json')).toBeTruthy(); expect(screen.getByTestId('proposal-download-json')).toBeTruthy();
expect(screen.getByTestId('proposal-transaction-dialog')).toBeTruthy(); expect(screen.getByTestId('proposal-transaction-dialog')).toBeTruthy();
}); });

View File

@ -17,7 +17,6 @@ import {
ProposalFormDescription, ProposalFormDescription,
ProposalFormDownloadJson, ProposalFormDownloadJson,
ProposalFormSubheader, ProposalFormSubheader,
ProposalFormSubmit,
ProposalFormTerms, ProposalFormTerms,
ProposalFormTitle, ProposalFormTitle,
ProposalFormTransactionDialog, ProposalFormTransactionDialog,
@ -104,7 +103,7 @@ export const ProposeUpdateMarket = () => {
const { const {
register, register,
handleSubmit, handleSubmit,
formState: { isSubmitting, errors }, formState: { errors },
setValue, setValue,
watch, watch,
} = useForm<UpdateMarketProposalFormFields>(); } = useForm<UpdateMarketProposalFormFields>();
@ -317,7 +316,6 @@ export const ProposeUpdateMarket = () => {
} }
/> />
<ProposalFormSubmit isSubmitting={isSubmitting} />
<ProposalFormDownloadJson downloadJson={viewJson} /> <ProposalFormDownloadJson downloadJson={viewJson} />
<ProposalFormTransactionDialog <ProposalFormTransactionDialog
finalizedProposal={finalizedProposal} finalizedProposal={finalizedProposal}