feat(governance): body can scroll again after clicking 'back to staking' (#2785)

This commit is contained in:
Sam Keen 2023-02-01 12:56:25 +00:00 committed by GitHub
parent 1ae2b4c153
commit 382a7ea411
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 5 deletions

View File

@ -1,6 +1,6 @@
import { Dialog, Icon, Intent } from '@vegaprotocol/ui-toolkit'; import { Dialog, Icon, Intent } from '@vegaprotocol/ui-toolkit';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import { Link } from 'react-router-dom'; import { Link, useNavigate } from 'react-router-dom';
import Routes from '../../routes'; import Routes from '../../routes';
import type { StakeAction } from './staking-form'; import type { StakeAction } from './staking-form';
import { Actions, RemoveType } from './staking-form'; import { Actions, RemoveType } from './staking-form';
@ -23,6 +23,7 @@ export const StakeSuccess = ({
toggleDialog, toggleDialog,
}: StakeSuccessProps) => { }: StakeSuccessProps) => {
const { t } = useTranslation(); const { t } = useTranslation();
const navigate = useNavigate();
const isAdd = action === Actions.Add; const isAdd = action === Actions.Add;
const title = isAdd const title = isAdd
? t('stakeAddSuccessTitle', { amount }) ? t('stakeAddSuccessTitle', { amount })
@ -44,7 +45,15 @@ export const StakeSuccess = ({
<div> <div>
<p>{message}</p> <p>{message}</p>
<p> <p>
<Link className="underline" to={Routes.VALIDATORS}> <Link
className="underline"
to={Routes.VALIDATORS}
onClick={(event) => {
event.preventDefault();
toggleDialog();
setTimeout(() => navigate(Routes.VALIDATORS), 0);
}}
>
{t('backToStaking')} {t('backToStaking')}
</Link> </Link>
</p> </p>

View File

@ -19195,9 +19195,9 @@ react-refresh@^0.11.0:
integrity sha512-F27qZr8uUqwhWZboondsPx8tnC3Ct3SxZA3V5WyEvujRyyNv0VYPhoBg1gZ8/MV5tubQp76Trw8lTv9hzRBa+A== integrity sha512-F27qZr8uUqwhWZboondsPx8tnC3Ct3SxZA3V5WyEvujRyyNv0VYPhoBg1gZ8/MV5tubQp76Trw8lTv9hzRBa+A==
react-remove-scroll-bar@^2.3.3: react-remove-scroll-bar@^2.3.3:
version "2.3.3" version "2.3.4"
resolved "https://registry.yarnpkg.com/react-remove-scroll-bar/-/react-remove-scroll-bar-2.3.3.tgz#e291f71b1bb30f5f67f023765b7435f4b2b2cd94" resolved "https://registry.yarnpkg.com/react-remove-scroll-bar/-/react-remove-scroll-bar-2.3.4.tgz#53e272d7a5cb8242990c7f144c44d8bd8ab5afd9"
integrity sha512-i9GMNWwpz8XpUpQ6QlevUtFjHGqnPG4Hxs+wlIJntu/xcsZVEpJcIV71K3ZkqNy2q3GfgvkD7y6t/Sv8ofYSbw== integrity sha512-63C4YQBUt0m6ALadE9XV56hV8BgJWDmmTPY758iIJjfQKt2nYwoUrPk0LXRXcB/yIj82T1/Ixfdpdk68LwIB0A==
dependencies: dependencies:
react-style-singleton "^2.2.1" react-style-singleton "^2.2.1"
tslib "^2.0.0" tslib "^2.0.0"