diff --git a/apps/wallet-dashboard/components/Dialogs/Staking/StakeDialog.tsx b/apps/wallet-dashboard/components/Dialogs/Staking/StakeDialog.tsx index 3009112cb9e..6829097f6c3 100644 --- a/apps/wallet-dashboard/components/Dialogs/Staking/StakeDialog.tsx +++ b/apps/wallet-dashboard/components/Dialogs/Staking/StakeDialog.tsx @@ -87,31 +87,38 @@ export function StakeDialog({ const validators = Object.keys(rollingAverageApys ?? {}) ?? []; function handleBack(): void { - setView?.(StakeDialogView.SelectValidator); + setView(StakeDialogView.SelectValidator); } function handleValidatorSelect(validator: string): void { setSelectedValidator?.(validator); } + function setViewBasedOnStakingType() { + setView( + isTimelockedStaking + ? StakeDialogView.EnterTimelockedAmount + : StakeDialogView.EnterAmount, + ); + } + function selectValidatorHandleNext(): void { if (selectedValidator) { - setView?.( - isTimelockedStaking - ? StakeDialogView.EnterTimelockedAmount - : StakeDialogView.EnterAmount, - ); + setViewBasedOnStakingType(); } } function detailsHandleStake() { - setView?.(StakeDialogView.SelectValidator); + if (stakedDetails) { + setSelectedValidator?.(stakedDetails.validatorAddress); + setViewBasedOnStakingType(); + } } function handleTransactionSuccess(digest: string) { onSuccess?.(digest); setTxDigest(digest); - setView?.(StakeDialogView.TransactionDetails); + setView(StakeDialogView.TransactionDetails); } return (