From 6eb0742a69eba5217bfb42e40c7a542907f8c98b Mon Sep 17 00:00:00 2001 From: fmtabbara Date: Thu, 9 Jun 2022 15:35:11 +0100 Subject: [PATCH] tommy fixes --- .../src/components/Delegation/DelegationActions.tsx | 5 +++-- .../src/components/Delegation/DelegationList.tsx | 1 + .../src/components/Delegation/DelegationModal.tsx | 6 ++++-- nym-wallet/src/pages/delegation/index.tsx | 11 ++++++++--- 4 files changed, 16 insertions(+), 7 deletions(-) diff --git a/nym-wallet/src/components/Delegation/DelegationActions.tsx b/nym-wallet/src/components/Delegation/DelegationActions.tsx index 82cf2a5719..2833a2ecde 100644 --- a/nym-wallet/src/components/Delegation/DelegationActions.tsx +++ b/nym-wallet/src/components/Delegation/DelegationActions.tsx @@ -98,7 +98,8 @@ export const DelegationsActionsMenu: React.FC<{ onActionClick?: (action: DelegationListItemActions) => void; isPending?: DelegationEventKind; disableRedeemingRewards?: boolean; -}> = ({ disableRedeemingRewards, onActionClick, isPending }) => { + disableDelegateMore?: boolean; +}> = ({ disableRedeemingRewards, disableDelegateMore, onActionClick, isPending }) => { const [anchorEl, setAnchorEl] = React.useState(null); const open = Boolean(anchorEl); const handleClick = (event: React.MouseEvent) => { @@ -134,7 +135,7 @@ export const DelegationsActionsMenu: React.FC<{ title="Delegate more" Icon={} onClick={() => handleActionSelect?.('delegate')} - disabled={false} + disabled={disableDelegateMore} /> (onItemActionClick ? onItemActionClick(item, action) : undefined)} disableRedeemingRewards={!item.accumulated_rewards || item.accumulated_rewards.amount === '0'} + disableDelegateMore={(item?.stake_saturation || 0) > 100} /> ) : ( void; } -> = ({ status, action, message, recipient, balance, transactionUrl, open, onClose, children }) => { +> = ({ status, action, message, recipient, balance, transactionUrl, open, onClose, tokenPool, children }) => { if (status === 'loading') { return ( @@ -79,7 +81,7 @@ export const DelegationModal: React.FC< )} theme.palette.text.secondary}> - Your current balance: {balance} + Your current {tokenPool === 'locked' ? 'locked balance' : 'balance'}: {balance} theme.palette.text.secondary}> Check the transaction hash{' '} diff --git a/nym-wallet/src/pages/delegation/index.tsx b/nym-wallet/src/pages/delegation/index.tsx index c79cf2bc9b..078e95b3cb 100644 --- a/nym-wallet/src/pages/delegation/index.tsx +++ b/nym-wallet/src/pages/delegation/index.tsx @@ -28,7 +28,7 @@ export const Delegation: FC = () => { const { clientDetails, network, - userBalance: { balance, originalVesting }, + userBalance: { balance, originalVesting, fetchBalance }, } = useContext(AppContext); const { @@ -103,6 +103,7 @@ export const Delegation: FC = () => { ? `${spendableLocked?.amount} ${spendableLocked?.denom}` : bal?.printable_balance || '-', transactionUrl: `${urls(network).blockExplorer}/transaction/${tx.transaction_hash}`, + tokenPool, }); } catch (e) { setConfirmationModalProps({ @@ -148,6 +149,7 @@ export const Delegation: FC = () => { balance: tokenPool === 'locked' ? `${spendableLocked?.amount} ${clientDetails?.denom}` : bal?.printable_balance || '-', transactionUrl: `${urls(network).blockExplorer}/transaction/${tx.transaction_hash}`, + tokenPool, }); } catch (e) { setConfirmationModalProps({ @@ -261,7 +263,7 @@ export const Delegation: FC = () => { onClick={() => setShowNewDelegationModal(true)} sx={{ py: 1.5, px: 5 }} > - New Delegation + Delegate { setConfirmationModalProps(undefined)} + onClose={async () => { + setConfirmationModalProps(undefined); + await fetchBalance(); + }} /> )}