From e9173796f51a03bf06a053f4d7704484b9489c79 Mon Sep 17 00:00:00 2001 From: Sam Keen Date: Wed, 6 Sep 2023 11:56:18 +0100 Subject: [PATCH] fix(governance,environment,proposals): network upgrade proposal urls include block height (#4704) --- apps/governance-e2e/src/integration/view/proposal.cy.ts | 4 ++-- .../protocol-upgrade-proposals-list-item.tsx | 2 +- apps/governance/src/routes/router-config.tsx | 2 +- libs/environment/src/hooks/use-links.ts | 6 +++--- .../proposals/src/components/protocol-upgrade-countdown.tsx | 2 +- .../protocol-upgrade-in-progress-notification.tsx | 4 ++-- .../components/protocol-upgrade-proposal-notification.tsx | 2 +- 7 files changed, 11 insertions(+), 11 deletions(-) diff --git a/apps/governance-e2e/src/integration/view/proposal.cy.ts b/apps/governance-e2e/src/integration/view/proposal.cy.ts index 28395cdbf..20eab7796 100644 --- a/apps/governance-e2e/src/integration/view/proposal.cy.ts +++ b/apps/governance-e2e/src/integration/view/proposal.cy.ts @@ -183,7 +183,7 @@ context( .first() .find('[data-testid="view-proposal-btn"]') .click(); - cy.url().should('contain', '/protocol-upgrades/v1'); + cy.url().should('contain', '/protocol-upgrades/v1/2015942'); cy.getByTestId('protocol-upgrade-proposal').within(() => { cy.get('h1').should('have.text', 'Vega Release v1'); cy.getByTestId('protocol-upgrade-block-height').should( @@ -243,7 +243,7 @@ context( ); cy.getByTestId('external-link') .should('have.attr', 'href') - .and('contain', '/proposals/protocol-upgrade/v1'); + .and('contain', '/proposals/protocol-upgrade/v1/2015942'); }); // estimate does not display possibly due to mocks or Cypress unless the proposal is clicked on several times diff --git a/apps/governance/src/routes/proposals/components/protocol-upgrade-proposals-list-item/protocol-upgrade-proposals-list-item.tsx b/apps/governance/src/routes/proposals/components/protocol-upgrade-proposals-list-item/protocol-upgrade-proposals-list-item.tsx index af65c9086..a8582b278 100644 --- a/apps/governance/src/routes/proposals/components/protocol-upgrade-proposals-list-item/protocol-upgrade-proposals-list-item.tsx +++ b/apps/governance/src/routes/proposals/components/protocol-upgrade-proposals-list-item/protocol-upgrade-proposals-list-item.tsx @@ -67,7 +67,7 @@ export const ProtocolUpgradeProposalsListItem = ({ diff --git a/apps/governance/src/routes/router-config.tsx b/apps/governance/src/routes/router-config.tsx index 53101b91f..90de63f6b 100644 --- a/apps/governance/src/routes/router-config.tsx +++ b/apps/governance/src/routes/router-config.tsx @@ -279,7 +279,7 @@ const routerConfig = [ ], }, { - path: `${Routes.PROTOCOL_UPGRADES}/:proposalReleaseTag`, + path: `${Routes.PROTOCOL_UPGRADES}/:proposalReleaseTag/:proposalBlockHeight`, element: , }, { diff --git a/libs/environment/src/hooks/use-links.ts b/libs/environment/src/hooks/use-links.ts index 7644920a5..5e8dd0da2 100644 --- a/libs/environment/src/hooks/use-links.ts +++ b/libs/environment/src/hooks/use-links.ts @@ -127,7 +127,7 @@ export const TOKEN_GOVERNANCE = '/proposals'; export const TOKEN_PROPOSALS = '/proposals'; export const TOKEN_PROPOSAL = '/proposals/:id'; export const TOKEN_PROTOCOL_UPGRADE_PROPOSAL = - '/proposals/protocol-upgrade/:tag'; + '/proposals/protocol-upgrade/:tag/:blockHeight'; export const TOKEN_VALIDATOR = '/validators/:id'; /** @@ -135,12 +135,12 @@ export const TOKEN_VALIDATOR = '/validators/:id'; */ export const useProtocolUpgradeProposalLink = () => { const governance = useLinks(DApp.Token); - return (releaseTag: string) => + return (releaseTag: string, blockHeight: string) => governance( TOKEN_PROTOCOL_UPGRADE_PROPOSAL.replace( ':tag', stripFullStops(releaseTag) - ) + ).replace(':blockHeight', blockHeight) ); }; diff --git a/libs/proposals/src/components/protocol-upgrade-countdown.tsx b/libs/proposals/src/components/protocol-upgrade-countdown.tsx index e531d6b43..e5acf94ff 100644 --- a/libs/proposals/src/components/protocol-upgrade-countdown.tsx +++ b/libs/proposals/src/components/protocol-upgrade-countdown.tsx @@ -73,7 +73,7 @@ export const ProtocolUpgradeCountdown = ({ return ( diff --git a/libs/proposals/src/components/protocol-upgrade-in-progress-notification.tsx b/libs/proposals/src/components/protocol-upgrade-in-progress-notification.tsx index 3330abb2c..66248d577 100644 --- a/libs/proposals/src/components/protocol-upgrade-in-progress-notification.tsx +++ b/libs/proposals/src/components/protocol-upgrade-in-progress-notification.tsx @@ -77,8 +77,8 @@ export const ProtocolUpgradeInProgressNotification = () => { {t( 'Trading and other network activity has stopped until the upgrade is complete.' )}{' '} - {vegaReleaseTag && ( - + {vegaReleaseTag && upgradeBlockHeight && ( + {t('View details')} )} diff --git a/libs/proposals/src/components/protocol-upgrade-proposal-notification.tsx b/libs/proposals/src/components/protocol-upgrade-proposal-notification.tsx index 30b76d2ce..b8075aa90 100644 --- a/libs/proposals/src/components/protocol-upgrade-proposal-notification.tsx +++ b/libs/proposals/src/components/protocol-upgrade-proposal-notification.tsx @@ -79,7 +79,7 @@ export const ProtocolUpgradeProposalNotification = ({ {t( 'Trading activity will be interrupted, manage your risk appropriately.' )}{' '} - + {t('View details')}