From 51199b02cef173c8493d44cab119304ca848eb66 Mon Sep 17 00:00:00 2001 From: Art Date: Tue, 23 Jan 2024 10:13:56 +0100 Subject: [PATCH] feat(governance): update market proposal header with copy and open buttons (#5648) --- .../proposal-header.spec.tsx | 2 +- .../proposal-header.tsx | 46 +++++++++++++++++-- libs/environment/src/hooks/use-links.ts | 1 + libs/i18n/src/locales/en/governance.json | 2 + 4 files changed, 46 insertions(+), 5 deletions(-) diff --git a/apps/governance/src/routes/proposals/components/proposal-detail-header/proposal-header.spec.tsx b/apps/governance/src/routes/proposals/components/proposal-detail-header/proposal-header.spec.tsx index abab3f893..1f1f25788 100644 --- a/apps/governance/src/routes/proposals/components/proposal-detail-header/proposal-header.spec.tsx +++ b/apps/governance/src/routes/proposals/components/proposal-detail-header/proposal-header.spec.tsx @@ -124,7 +124,7 @@ describe('Proposal header', () => { screen.queryByTestId('proposal-description') ).not.toBeInTheDocument(); expect(screen.getByTestId('proposal-details')).toHaveTextContent( - 'Market change: MarketId' + 'Update to market ID: MarketId' ); }); diff --git a/apps/governance/src/routes/proposals/components/proposal-detail-header/proposal-header.tsx b/apps/governance/src/routes/proposals/components/proposal-detail-header/proposal-header.tsx index c96e0f925..243a3f5f6 100644 --- a/apps/governance/src/routes/proposals/components/proposal-detail-header/proposal-header.tsx +++ b/apps/governance/src/routes/proposals/components/proposal-detail-header/proposal-header.tsx @@ -1,5 +1,11 @@ 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 { Heading, SubHeading } from '../../../../components/heading'; import type { ReactNode } from 'react'; @@ -12,7 +18,12 @@ import { useNewTransferProposalDetails, useSuccessorMarketProposalDetails, } from '@vegaprotocol/proposals'; -import { useFeatureFlags } from '@vegaprotocol/environment'; +import { + CONSOLE_MARKET_PAGE, + DApp, + useFeatureFlags, + useLinks, +} from '@vegaprotocol/environment'; import Routes from '../../../routes'; import { Link } from 'react-router-dom'; import type { VoteState } from '../vote-details/use-user-vote'; @@ -32,6 +43,8 @@ export const ProposalHeader = ({ const { t } = useTranslation(); const change = proposal?.terms.change; + const consoleLink = useLinks(DApp.Console); + let details: ReactNode; let proposalType = ''; let fallbackTitle = ''; @@ -106,8 +119,33 @@ export const ProposalHeader = ({ fallbackTitle = t('UpdateMarketProposal'); details = ( <> - {t('MarketChange')}:{' '} - {truncateMiddle(change.marketId)} + {t('UpdateToMarket')}:{' '} + + {change.marketId} + + + + + + + + + ); break; diff --git a/libs/environment/src/hooks/use-links.ts b/libs/environment/src/hooks/use-links.ts index 078aea623..5789dc1d8 100644 --- a/libs/environment/src/hooks/use-links.ts +++ b/libs/environment/src/hooks/use-links.ts @@ -131,6 +131,7 @@ export const useEtherscanLink = () => { export const CONSOLE_TRANSFER = '#/portfolio/assets/transfer'; export const CONSOLE_TRANSFER_ASSET = '#/portfolio/assets/transfer?assetId=:assetId'; +export const CONSOLE_MARKET_PAGE = '#/markets/:marketId'; // Governance pages export const TOKEN_NEW_MARKET_PROPOSAL = '/proposals/propose/new-market'; diff --git a/libs/i18n/src/locales/en/governance.json b/libs/i18n/src/locales/en/governance.json index f09bd6076..e982ed992 100644 --- a/libs/i18n/src/locales/en/governance.json +++ b/libs/i18n/src/locales/en/governance.json @@ -799,6 +799,8 @@ "unsupportedVersion": "Looks like you're running an outdated version of GoWallet. You're running {{version}} but {{requiredVersion}} is required.", "UpdateAsset": "Update asset", "UpdateAssetProposal": "Update asset proposal", + "UpdateToMarket": "Update to market ID", + "OpenInConsole": "Open in Console", "UpdateMarket": "Update market", "UpdateMarketProposal": "Update market proposal", "UpdateMarketState": "Update market state",