diff --git a/src/renderer/components/modal/swap/pages/exited/ProcessExitedAndNotDonePage.tsx b/src/renderer/components/modal/swap/pages/exited/ProcessExitedAndNotDonePage.tsx index 4a56960..beea315 100644 --- a/src/renderer/components/modal/swap/pages/exited/ProcessExitedAndNotDonePage.tsx +++ b/src/renderer/components/modal/swap/pages/exited/ProcessExitedAndNotDonePage.tsx @@ -2,6 +2,7 @@ import { Box, DialogContentText } from '@material-ui/core'; import { useActiveSwapInfo, useAppSelector } from 'store/hooks'; import { SwapStateProcessExited } from 'models/storeModel'; import CliLogsBox from '../../../../other/RenderedCliLog'; +import { SwapSpawnType } from 'models/cliModel'; export default function ProcessExitedAndNotDonePage({ state, @@ -10,24 +11,46 @@ export default function ProcessExitedAndNotDonePage({ }) { const swap = useActiveSwapInfo(); const logs = useAppSelector((s) => s.swap.logs); + const spawnType = useAppSelector((s) => s.swap.spawnType); - const text = swap ? ( - <> - The swap exited unexpectedly without completing. The current state is - "{swap.stateName}". You might have to manually take some action. - - ) : ( - <> - The swap exited unexpectedly before any funds were locked and without - completing. - - ); + function getText() { + const isCancelRefund = spawnType === SwapSpawnType.CANCEL_REFUND; + const hasRpcError = state.rpcError != null; + const hasSwap = swap != null; + + let messages = []; + + messages.push( + isCancelRefund + ? 'The manual cancel and refund was unsuccessful.' + : 'The swap exited unexpectedly without completing.', + ); + + if (!hasSwap && !isCancelRefund) { + messages.push('No funds were locked.'); + } + + messages.push( + hasRpcError + ? 'Check the error and the logs below for more information.' + : 'Check the logs below for more information.', + ); + + if (hasSwap) { + messages.push(`The swap is in the "${swap.stateName}" state.`); + if (!isCancelRefund) { + messages.push( + 'Try resuming the swap or attempt to initiate a manual cancel and refund.', + ); + } + } + + return messages.join(' '); + } return ( - - {text} Please check the logs displayed below for more information. - + {getText()} - {state.rpcError && ( )} + );