diff --git a/libs/deal-ticket/src/components/deal-ticket/deal-ticket-status.tsx b/libs/deal-ticket/src/components/deal-ticket/deal-ticket-status.tsx deleted file mode 100644 index 08b92e48b..000000000 --- a/libs/deal-ticket/src/components/deal-ticket/deal-ticket-status.tsx +++ /dev/null @@ -1,128 +0,0 @@ -import { useCallback, useMemo } from 'react'; -import type { ReactNode } from 'react'; -import type { VegaTxState } from '@vegaprotocol/wallet'; -import { - WalletError, - useVegaWallet, - useVegaWalletDialogStore, - ClientErrors, -} from '@vegaprotocol/wallet'; -import * as Schema from '@vegaprotocol/types'; -import { Button, Icon, Intent } from '@vegaprotocol/ui-toolkit'; -import { t } from '@vegaprotocol/react-helpers'; - -interface ErrorContentProps { - transaction: VegaTxState; - reset: () => void; -} - -export const ErrorContent = ({ transaction, reset }: ErrorContentProps) => { - const { openVegaWalletDialog } = useVegaWalletDialogStore((store) => ({ - openVegaWalletDialog: store.openVegaWalletDialog, - })); - const { disconnect } = useVegaWallet(); - const reconnect = useCallback(async () => { - reset(); - await disconnect(); - openVegaWalletDialog(); - }, [reset, disconnect, openVegaWalletDialog]); - return useMemo(() => { - const { error } = transaction; - if (error) { - if ( - error instanceof WalletError && - error.code === ClientErrors.NO_SERVICE.code - ) { - return ( -
- {error.message}{' '} - {error instanceof WalletError ? `: ${error.data}` : null} -
- ); - } - return null; - }, [transaction, reconnect]); -}; - -export const getOrderDialogTitle = ( - status?: Schema.OrderStatus -): string | undefined => { - if (!status) { - return; - } - - switch (status) { - case Schema.OrderStatus.STATUS_ACTIVE: - return t('Order submitted'); - case Schema.OrderStatus.STATUS_FILLED: - return t('Order filled'); - case Schema.OrderStatus.STATUS_PARTIALLY_FILLED: - return t('Order partially filled'); - case Schema.OrderStatus.STATUS_PARKED: - return t('Order parked'); - case Schema.OrderStatus.STATUS_STOPPED: - return t('Order stopped'); - case Schema.OrderStatus.STATUS_CANCELLED: - return t('Order cancelled'); - case Schema.OrderStatus.STATUS_EXPIRED: - return t('Order expired'); - case Schema.OrderStatus.STATUS_REJECTED: - return t('Order rejected'); - default: - return t('Submission failed'); - } -}; - -export const getOrderDialogIntent = ( - status?: Schema.OrderStatus -): Intent | undefined => { - if (!status) { - return; - } - switch (status) { - case Schema.OrderStatus.STATUS_PARKED: - case Schema.OrderStatus.STATUS_EXPIRED: - case Schema.OrderStatus.STATUS_PARTIALLY_FILLED: - return Intent.Warning; - case Schema.OrderStatus.STATUS_REJECTED: - case Schema.OrderStatus.STATUS_STOPPED: - case Schema.OrderStatus.STATUS_CANCELLED: - return Intent.Danger; - case Schema.OrderStatus.STATUS_FILLED: - case Schema.OrderStatus.STATUS_ACTIVE: - return Intent.Success; - default: - return; - } -}; - -export const getOrderDialogIcon = ( - status?: Schema.OrderStatus -): ReactNode | undefined => { - if (!status) { - return; - } - - switch (status) { - case Schema.OrderStatus.STATUS_PARKED: - case Schema.OrderStatus.STATUS_EXPIRED: - return