From 3394050f761983ded83fe21aac907315829146b7 Mon Sep 17 00:00:00 2001 From: Matthew Russell Date: Tue, 29 Mar 2022 16:21:57 -0700 Subject: [PATCH] update types in submit button to use global types --- libs/deal-ticket/src/submit-button.tsx | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/libs/deal-ticket/src/submit-button.tsx b/libs/deal-ticket/src/submit-button.tsx index 901e639e5..6359a9f48 100644 --- a/libs/deal-ticket/src/submit-button.tsx +++ b/libs/deal-ticket/src/submit-button.tsx @@ -5,6 +5,7 @@ import { Order } from './use-order-state'; import { useVegaWallet } from '@vegaprotocol/wallet'; import { TransactionStatus } from './deal-ticket'; import { DealTicketQuery_market } from './__generated__/DealTicketQuery'; +import { MarketState, MarketTradingMode } from '@vegaprotocol/types'; interface SubmitButtonProps { transactionStatus: TransactionStatus; @@ -28,20 +29,22 @@ export const SubmitButton = ({ return 'Selected public key has been tainted'; } - // TODO: Change these to use enums from @vegaprotocol/graphql - if (market.state !== 'Active') { - if (market.state === 'Suspended') { + if (market.state !== MarketState.Active) { + if (market.state === MarketState.Suspended) { return 'Market is currently suspended'; } - if (market.state === 'Proposed' || market.state === 'Pending') { + if ( + market.state === MarketState.Proposed || + market.state === MarketState.Pending + ) { return 'Market is not active yet'; } return 'Market is no longer active'; } - if (market.tradingMode !== 'Continuous') { + if (market.tradingMode !== MarketTradingMode.Continuous) { if (order.type === OrderType.Market) { return 'Only limit orders are permitted when market is in auction'; }