tommy fixes
This commit is contained in:
@@ -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 | HTMLElement>(null);
|
||||
const open = Boolean(anchorEl);
|
||||
const handleClick = (event: React.MouseEvent<HTMLButtonElement>) => {
|
||||
@@ -134,7 +135,7 @@ export const DelegationsActionsMenu: React.FC<{
|
||||
title="Delegate more"
|
||||
Icon={<Delegate />}
|
||||
onClick={() => handleActionSelect?.('delegate')}
|
||||
disabled={false}
|
||||
disabled={disableDelegateMore}
|
||||
/>
|
||||
<DelegationActionsMenuItem
|
||||
title="Undelegate"
|
||||
|
||||
@@ -174,6 +174,7 @@ export const DelegationList: React.FC<{
|
||||
isPending={undefined}
|
||||
onActionClick={(action) => (onItemActionClick ? onItemActionClick(item, action) : undefined)}
|
||||
disableRedeemingRewards={!item.accumulated_rewards || item.accumulated_rewards.amount === '0'}
|
||||
disableDelegateMore={(item?.stake_saturation || 0) > 100}
|
||||
/>
|
||||
) : (
|
||||
<Tooltip
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import React from 'react';
|
||||
import { Box, Button, CircularProgress, Link, Modal, Stack, Typography } from '@mui/material';
|
||||
import { modalStyle } from '../Modals/styles';
|
||||
import { TPoolOption } from '../TokenPoolSelector';
|
||||
|
||||
export type ActionType = 'delegate' | 'undelegate' | 'redeem' | 'redeem-all' | 'compound';
|
||||
|
||||
@@ -28,6 +29,7 @@ export type DelegationModalProps = {
|
||||
recipient?: string;
|
||||
balance?: string;
|
||||
transactionUrl?: string;
|
||||
tokenPool?: TPoolOption;
|
||||
};
|
||||
|
||||
export const DelegationModal: React.FC<
|
||||
@@ -35,7 +37,7 @@ export const DelegationModal: React.FC<
|
||||
open: boolean;
|
||||
onClose?: () => void;
|
||||
}
|
||||
> = ({ status, action, message, recipient, balance, transactionUrl, open, onClose, children }) => {
|
||||
> = ({ status, action, message, recipient, balance, transactionUrl, open, onClose, tokenPool, children }) => {
|
||||
if (status === 'loading') {
|
||||
return (
|
||||
<Modal open>
|
||||
@@ -79,7 +81,7 @@ export const DelegationModal: React.FC<
|
||||
</Typography>
|
||||
)}
|
||||
<Typography mb={1} fontSize="small" color={(theme) => theme.palette.text.secondary}>
|
||||
Your current balance: {balance}
|
||||
Your current {tokenPool === 'locked' ? 'locked balance' : 'balance'}: {balance}
|
||||
</Typography>
|
||||
<Typography mb={1} fontSize="small" color={(theme) => theme.palette.text.secondary}>
|
||||
Check the transaction hash{' '}
|
||||
|
||||
@@ -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
|
||||
</Button>
|
||||
</Box>
|
||||
<DelegationList
|
||||
@@ -357,7 +359,10 @@ export const Delegation: FC = () => {
|
||||
<DelegationModal
|
||||
{...confirmationModalProps}
|
||||
open={Boolean(confirmationModalProps)}
|
||||
onClose={() => setConfirmationModalProps(undefined)}
|
||||
onClose={async () => {
|
||||
setConfirmationModalProps(undefined);
|
||||
await fetchBalance();
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
</>
|
||||
|
||||
Reference in New Issue
Block a user