import {Fragment, h} from 'preact' import {useSelector, useActions} from '../../../helpers/connect' import actions from '../../../actions' import printAda from '../../../helpers/printAda' import {AdaIcon} from '../../common/svg' import tooltip from '../../common/tooltip' import {Lovelace} from '../../../types' import {formatAccountIndex} from '../../../helpers/formatAccountIndex' import {shouldDisableSendingButton} from '../../../helpers/common' import BigNumber from 'bignumber.js' type TileProps = { accountIndex: number ticker: string | null availableBalance: BigNumber | null rewardsBalance: BigNumber | null shouldShowSaturatedBanner: boolean shouldShowAccountInfo?: boolean } const AccountTile = ({ accountIndex, ticker, availableBalance, rewardsBalance, shouldShowSaturatedBanner, shouldShowAccountInfo, }: TileProps) => { const { setActiveAccount, exploreNextAccount, showDelegationModal, showSendTransactionModal, } = useActions(actions) const {activeAccountIndex, walletOperationStatusType} = useSelector((state) => ({ activeAccountIndex: state.activeAccountIndex, walletOperationStatusType: state.walletOperationStatusType, })) const isActive = activeAccountIndex === accountIndex const accountLabel = `Account ${formatAccountIndex(accountIndex)}` const Balance = ({value}: {value: Lovelace}) => value !== null ? ( {printAda(value, 3)} ) : ( - ) const TransferButton = () => ( ) const DelegateButton = () => ( ) const ActivationButton = () => ( ) const ExplorationButton = () => ( ) return (

{accountLabel}

{accountLabel}

{shouldShowAccountInfo ? : }

Available balance

{shouldShowAccountInfo && (
)}

Rewards balance

Delegation

{ticker || '-'} {shouldShowSaturatedBanner && ( {''} )}
{shouldShowAccountInfo && (
)}
{shouldShowAccountInfo ? (
) : (
)}
) } export default AccountTile