update types in submit button to use global types
This commit is contained in:
parent
d3d28947ea
commit
3394050f76
@ -5,6 +5,7 @@ import { Order } from './use-order-state';
|
|||||||
import { useVegaWallet } from '@vegaprotocol/wallet';
|
import { useVegaWallet } from '@vegaprotocol/wallet';
|
||||||
import { TransactionStatus } from './deal-ticket';
|
import { TransactionStatus } from './deal-ticket';
|
||||||
import { DealTicketQuery_market } from './__generated__/DealTicketQuery';
|
import { DealTicketQuery_market } from './__generated__/DealTicketQuery';
|
||||||
|
import { MarketState, MarketTradingMode } from '@vegaprotocol/types';
|
||||||
|
|
||||||
interface SubmitButtonProps {
|
interface SubmitButtonProps {
|
||||||
transactionStatus: TransactionStatus;
|
transactionStatus: TransactionStatus;
|
||||||
@ -28,20 +29,22 @@ export const SubmitButton = ({
|
|||||||
return 'Selected public key has been tainted';
|
return 'Selected public key has been tainted';
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Change these to use enums from @vegaprotocol/graphql
|
if (market.state !== MarketState.Active) {
|
||||||
if (market.state !== 'Active') {
|
if (market.state === MarketState.Suspended) {
|
||||||
if (market.state === 'Suspended') {
|
|
||||||
return 'Market is currently 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 not active yet';
|
||||||
}
|
}
|
||||||
|
|
||||||
return 'Market is no longer active';
|
return 'Market is no longer active';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (market.tradingMode !== 'Continuous') {
|
if (market.tradingMode !== MarketTradingMode.Continuous) {
|
||||||
if (order.type === OrderType.Market) {
|
if (order.type === OrderType.Market) {
|
||||||
return 'Only limit orders are permitted when market is in auction';
|
return 'Only limit orders are permitted when market is in auction';
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user