feat(governance): update market proposal header with copy and open buttons (#5648)
This commit is contained in:
parent
bb826c88f0
commit
51199b02ce
@ -124,7 +124,7 @@ describe('Proposal header', () => {
|
|||||||
screen.queryByTestId('proposal-description')
|
screen.queryByTestId('proposal-description')
|
||||||
).not.toBeInTheDocument();
|
).not.toBeInTheDocument();
|
||||||
expect(screen.getByTestId('proposal-details')).toHaveTextContent(
|
expect(screen.getByTestId('proposal-details')).toHaveTextContent(
|
||||||
'Market change: MarketId'
|
'Update to market ID: MarketId'
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -1,5 +1,11 @@
|
|||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import { Lozenge, VegaIcon, VegaIconNames } from '@vegaprotocol/ui-toolkit';
|
import {
|
||||||
|
CopyWithTooltip,
|
||||||
|
Lozenge,
|
||||||
|
Tooltip,
|
||||||
|
VegaIcon,
|
||||||
|
VegaIconNames,
|
||||||
|
} from '@vegaprotocol/ui-toolkit';
|
||||||
import { shorten } from '@vegaprotocol/utils';
|
import { shorten } from '@vegaprotocol/utils';
|
||||||
import { Heading, SubHeading } from '../../../../components/heading';
|
import { Heading, SubHeading } from '../../../../components/heading';
|
||||||
import type { ReactNode } from 'react';
|
import type { ReactNode } from 'react';
|
||||||
@ -12,7 +18,12 @@ import {
|
|||||||
useNewTransferProposalDetails,
|
useNewTransferProposalDetails,
|
||||||
useSuccessorMarketProposalDetails,
|
useSuccessorMarketProposalDetails,
|
||||||
} from '@vegaprotocol/proposals';
|
} from '@vegaprotocol/proposals';
|
||||||
import { useFeatureFlags } from '@vegaprotocol/environment';
|
import {
|
||||||
|
CONSOLE_MARKET_PAGE,
|
||||||
|
DApp,
|
||||||
|
useFeatureFlags,
|
||||||
|
useLinks,
|
||||||
|
} from '@vegaprotocol/environment';
|
||||||
import Routes from '../../../routes';
|
import Routes from '../../../routes';
|
||||||
import { Link } from 'react-router-dom';
|
import { Link } from 'react-router-dom';
|
||||||
import type { VoteState } from '../vote-details/use-user-vote';
|
import type { VoteState } from '../vote-details/use-user-vote';
|
||||||
@ -32,6 +43,8 @@ export const ProposalHeader = ({
|
|||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const change = proposal?.terms.change;
|
const change = proposal?.terms.change;
|
||||||
|
|
||||||
|
const consoleLink = useLinks(DApp.Console);
|
||||||
|
|
||||||
let details: ReactNode;
|
let details: ReactNode;
|
||||||
let proposalType = '';
|
let proposalType = '';
|
||||||
let fallbackTitle = '';
|
let fallbackTitle = '';
|
||||||
@ -106,8 +119,33 @@ export const ProposalHeader = ({
|
|||||||
fallbackTitle = t('UpdateMarketProposal');
|
fallbackTitle = t('UpdateMarketProposal');
|
||||||
details = (
|
details = (
|
||||||
<>
|
<>
|
||||||
<span>{t('MarketChange')}:</span>{' '}
|
<span>{t('UpdateToMarket')}:</span>{' '}
|
||||||
<span>{truncateMiddle(change.marketId)}</span>
|
<span className="inline-flex items-start gap-2">
|
||||||
|
<span className="break-all">{change.marketId} </span>
|
||||||
|
<span className="inline-flex items-end gap-0">
|
||||||
|
<CopyWithTooltip
|
||||||
|
text={change.marketId}
|
||||||
|
description={t('copyToClipboard')}
|
||||||
|
>
|
||||||
|
<button className="inline-block px-1">
|
||||||
|
<VegaIcon size={20} name={VegaIconNames.COPY} />
|
||||||
|
</button>
|
||||||
|
</CopyWithTooltip>
|
||||||
|
<Tooltip description={t('OpenInConsole')} align="center">
|
||||||
|
<button
|
||||||
|
className="inline-block px-1"
|
||||||
|
onClick={() => {
|
||||||
|
const marketPageLink = consoleLink(
|
||||||
|
CONSOLE_MARKET_PAGE.replace(':marketId', change.marketId)
|
||||||
|
);
|
||||||
|
window.open(marketPageLink, '_blank');
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<VegaIcon size={20} name={VegaIconNames.OPEN_EXTERNAL} />
|
||||||
|
</button>
|
||||||
|
</Tooltip>
|
||||||
|
</span>
|
||||||
|
</span>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
|
@ -131,6 +131,7 @@ export const useEtherscanLink = () => {
|
|||||||
export const CONSOLE_TRANSFER = '#/portfolio/assets/transfer';
|
export const CONSOLE_TRANSFER = '#/portfolio/assets/transfer';
|
||||||
export const CONSOLE_TRANSFER_ASSET =
|
export const CONSOLE_TRANSFER_ASSET =
|
||||||
'#/portfolio/assets/transfer?assetId=:assetId';
|
'#/portfolio/assets/transfer?assetId=:assetId';
|
||||||
|
export const CONSOLE_MARKET_PAGE = '#/markets/:marketId';
|
||||||
|
|
||||||
// Governance pages
|
// Governance pages
|
||||||
export const TOKEN_NEW_MARKET_PROPOSAL = '/proposals/propose/new-market';
|
export const TOKEN_NEW_MARKET_PROPOSAL = '/proposals/propose/new-market';
|
||||||
|
@ -799,6 +799,8 @@
|
|||||||
"unsupportedVersion": "Looks like you're running an outdated version of GoWallet. You're running {{version}} but {{requiredVersion}} is required.",
|
"unsupportedVersion": "Looks like you're running an outdated version of GoWallet. You're running {{version}} but {{requiredVersion}} is required.",
|
||||||
"UpdateAsset": "Update asset",
|
"UpdateAsset": "Update asset",
|
||||||
"UpdateAssetProposal": "Update asset proposal",
|
"UpdateAssetProposal": "Update asset proposal",
|
||||||
|
"UpdateToMarket": "Update to market ID",
|
||||||
|
"OpenInConsole": "Open in Console",
|
||||||
"UpdateMarket": "Update market",
|
"UpdateMarket": "Update market",
|
||||||
"UpdateMarketProposal": "Update market proposal",
|
"UpdateMarketProposal": "Update market proposal",
|
||||||
"UpdateMarketState": "Update market state",
|
"UpdateMarketState": "Update market state",
|
||||||
|
Loading…
Reference in New Issue
Block a user