import { Box } from '@material-ui/core'; import { useAppSelector } from 'store/hooks'; import { isSwapStateBtcCancelled, isSwapStateBtcLockInMempool, isSwapStateBtcPunished, isSwapStateBtcRedemeed, isSwapStateBtcRefunded, isSwapStateInitiated, isSwapStateProcessExited, isSwapStateReceivedQuote, isSwapStateStarted, isSwapStateWaitingForBtcDeposit, isSwapStateXmrLocked, isSwapStateXmrLockInMempool, isSwapStateXmrRedeemInMempool, SwapState, } from '../../../../../models/storeModel'; import InitiatedPage from './init/InitiatedPage'; import WaitingForBitcoinDepositPage from './init/WaitingForBitcoinDepositPage'; import StartedPage from './in_progress/StartedPage'; import BitcoinLockTxInMempoolPage from './in_progress/BitcoinLockTxInMempoolPage'; import XmrLockTxInMempoolPage from './in_progress/XmrLockInMempoolPage'; // eslint-disable-next-line import/no-cycle import ProcessExitedPage from './exited/ProcessExitedPage'; import XmrRedeemInMempoolPage from './done/XmrRedeemInMempoolPage'; import ReceivedQuotePage from './in_progress/ReceivedQuotePage'; import BitcoinRedeemedPage from './in_progress/BitcoinRedeemedPage'; import InitPage from './init/InitPage'; import XmrLockedPage from './in_progress/XmrLockedPage'; import BitcoinCancelledPage from './in_progress/BitcoinCancelledPage'; import BitcoinRefundedPage from './done/BitcoinRefundedPage'; import BitcoinPunishedPage from './done/BitcoinPunishedPage'; import { SyncingMoneroWalletPage } from './in_progress/SyncingMoneroWalletPage'; export default function SwapStatePage({ swapState, }: { swapState: SwapState | null; }) { const isSyncingMoneroWallet = useAppSelector( (state) => state.rpc.state.moneroWallet.isSyncing, ); if (isSyncingMoneroWallet) { return ; } if (swapState === null) { return ; } if (isSwapStateInitiated(swapState)) { return ; } if (isSwapStateReceivedQuote(swapState)) { return ; } if (isSwapStateWaitingForBtcDeposit(swapState)) { return ; } if (isSwapStateStarted(swapState)) { return ; } if (isSwapStateBtcLockInMempool(swapState)) { return ; } if (isSwapStateXmrLockInMempool(swapState)) { return ; } if (isSwapStateXmrLocked(swapState)) { return ; } if (isSwapStateBtcRedemeed(swapState)) { return ; } if (isSwapStateXmrRedeemInMempool(swapState)) { return ; } if (isSwapStateBtcCancelled(swapState)) { return ; } if (isSwapStateBtcRefunded(swapState)) { return ; } if (isSwapStateBtcPunished(swapState)) { return ; } if (isSwapStateProcessExited(swapState)) { return ; } console.error( `No swap state page found for swap state State: ${JSON.stringify( swapState, null, 4, )}`, ); return ( No information to display
State: ${JSON.stringify(swapState, null, 4)}
); }