diff --git a/app/components/UI/Stake/components/StakingBalance/StakingBalance.tsx b/app/components/UI/Stake/components/StakingBalance/StakingBalance.tsx index 9aafb72b6e9..a014fca6425 100644 --- a/app/components/UI/Stake/components/StakingBalance/StakingBalance.tsx +++ b/app/components/UI/Stake/components/StakingBalance/StakingBalance.tsx @@ -43,6 +43,7 @@ import type { TokenI } from '../../../Tokens/types'; import useBalance from '../../hooks/useBalance'; import { NetworkBadgeSource } from '../../../AssetOverview/Balance/Balance'; import { selectChainId } from '../../../../../selectors/networkController'; +import SkeletonPlaceholder from 'react-native-skeleton-placeholder'; export interface StakingBalanceProps { asset: TokenI; @@ -62,6 +63,7 @@ const StakingBalanceContent = ({ asset }: StakingBalanceProps) => { exchangeRate, hasStakedPositions, hasEthToUnstake, + isLoadingPooledStakesData, } = usePooledStakes(); const { vaultData } = useVaultData(); const annualRewardRate = vaultData?.apy || ''; @@ -94,6 +96,74 @@ const StakingBalanceContent = ({ asset }: StakingBalanceProps) => { return <>; } + const renderStakingContent = () => { + if (isLoadingPooledStakesData) { + return ( + + + + ); + } + + if (!isEligibleForPooledStaking) { + return ( + + ); + } + + return ( + <> + {unstakingRequests.map( + ({ positionTicket, withdrawalTimestamp, assetsToDisplay }) => + assetsToDisplay && ( + + ), + )} + + {hasClaimableEth && ( + + )} + + {!hasStakedPositions && ( + + )} + + + + ); + }; + return ( {hasStakedPositions && ( @@ -120,61 +190,7 @@ const StakingBalanceContent = ({ asset }: StakingBalanceProps) => { )} - - {!isEligibleForPooledStaking ? ( - - ) : ( - <> - {unstakingRequests.map( - ({ positionTicket, withdrawalTimestamp, assetsToDisplay }) => - assetsToDisplay && ( - - ), - )} - - {hasClaimableEth && ( - - )} - - {!hasStakedPositions && ( - - )} - - - - )} - + {renderStakingContent()} ); };