From f7c2c6f1bf68f5b9eb09c989f1d5c21fe5b36812 Mon Sep 17 00:00:00 2001 From: Eugene P Date: Thu, 7 Nov 2024 21:14:03 +0200 Subject: [PATCH] feat(tooling-wallet): enhance StakeDialog and SelectValidatorView with improved navigation and layout --- .../Dialogs/Staking/StakeDialog.tsx | 20 +++---- .../Staking/views/SelectValidatorView.tsx | 57 ++++++++++++++++--- 2 files changed, 59 insertions(+), 18 deletions(-) diff --git a/apps/wallet-dashboard/components/Dialogs/Staking/StakeDialog.tsx b/apps/wallet-dashboard/components/Dialogs/Staking/StakeDialog.tsx index 7b3f339fb4b..be8331b865f 100644 --- a/apps/wallet-dashboard/components/Dialogs/Staking/StakeDialog.tsx +++ b/apps/wallet-dashboard/components/Dialogs/Staking/StakeDialog.tsx @@ -85,17 +85,12 @@ function StakeDialog({ const validators = Object.keys(rollingAverageApys ?? {}) ?? []; - function handleNext(): void { - setView(StakeDialogView.EnterAmount); - } - function handleBack(): void { setView(StakeDialogView.SelectValidator); } function handleValidatorSelect(validator: string): void { setSelectedValidator(validator); - handleNext(); } function handleStake(): void { @@ -135,10 +130,9 @@ function StakeDialog({ setView(StakeDialogView.SelectValidator); } - const title = { - [View.SelectValidator]: 'Select Validator', - [View.EnterAmount]: 'Enter Amount', - }; + function selectValidatorHandleNext() { + setView(StakeDialogView.EnterAmount); + } return ( handleClose()}> @@ -151,7 +145,13 @@ function StakeDialog({ /> )} {view === StakeDialogView.SelectValidator && ( - + )} {view === StakeDialogView.EnterAmount && ( void; + handleClose: () => void; + onNext: () => void; + selectedValidator: string; } -function SelectValidatorView({ validators, onSelect }: SelectValidatorViewProps): JSX.Element { +function SelectValidatorView({ + validators, + onSelect, + handleClose, + onNext, + selectedValidator, +}: SelectValidatorViewProps): JSX.Element { return ( -
- {validators.map((validator) => ( - - ))} -
+ +
+ +
+ {validators.map((validator) => ( + + ))} +
+
+ + {!!selectedValidator && ( +