feat(#580): add link to update market proposal (#2074)

* feat(#580): add link to update market proposal

* feat(#580): fix cypress test for propose a change to market link

* feat(#580): fix market info proposal update cypress test
This commit is contained in:
m.ray 2022-11-15 06:52:43 -05:00 committed by GitHub
parent 2eae066ea7
commit 8d292c8f95
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 40 additions and 16 deletions

View File

@ -182,6 +182,11 @@ describe('market info is displayed', { tags: '@smoke' }, () => {
.should('have.text', 'View governance proposal')
.and('have.attr', 'href')
.and('contain', '/governance/market-0');
cy.getByTestId(externalLink)
.eq(1)
.should('have.text', 'Propose a change to this market')
.and('have.attr', 'href')
.and('contain', '/governance/propose/update-market');
});
afterEach('close toggle', () => {

View File

@ -28,11 +28,9 @@ import { generatePath, Link } from 'react-router-dom';
import { getMarketExpiryDateFormatted } from '../market-expires';
import { MarketInfoTable } from './info-key-value-table';
import { marketInfoDataProvider } from './market-info-data-provider';
import { TokenLinks } from '@vegaprotocol/react-helpers';
import type { MarketInfoQuery } from './__generated___/MarketInfo';
const Links = {
PROPOSAL_PAGE: ':tokenUrl/governance/:proposalId',
};
export interface InfoProps {
market: MarketInfoQuery['market'];
@ -359,19 +357,35 @@ export const Info = ({ market, onSelect }: InfoProps) => {
{
title: t('Proposal'),
content: (
<ExternalLink
href={generatePath(Links.PROPOSAL_PAGE, {
tokenUrl: VEGA_TOKEN_URL,
proposalId: market.proposal?.id || '',
})}
title={
market.proposal?.rationale.title ||
market.proposal?.rationale.description ||
''
}
>
{t('View governance proposal')}
</ExternalLink>
<div className="">
<ExternalLink
className="mb-2"
href={generatePath(TokenLinks.PROPOSAL_PAGE, {
tokenUrl: VEGA_TOKEN_URL,
proposalId: market.proposal?.id || '',
})}
title={
market.proposal?.rationale.title ||
market.proposal?.rationale.description ||
''
}
>
{t('View governance proposal')}
</ExternalLink>
<ExternalLink
className="mt-2"
href={generatePath(TokenLinks.UPDATE_PROPOSAL_PAGE, {
tokenUrl: VEGA_TOKEN_URL,
})}
title={
market.proposal?.rationale.title ||
market.proposal?.rationale.description ||
''
}
>
{t('Propose a change to this market')}
</ExternalLink>
</div>
),
},
];

View File

@ -23,3 +23,8 @@ export const ExternalLinks = {
VEGA_WALLET_URL: 'https://vega.xyz/wallet',
VEGA_WALLET_HOSTED_URL: 'https://vega-hosted-wallet.on.fleek.co/',
};
export const TokenLinks = {
PROPOSAL_PAGE: ':tokenUrl/governance/:proposalId',
UPDATE_PROPOSAL_PAGE: ':tokenUrl/governance/propose/update-market',
};