From 8ddeadfdce3673215f9e053aeb66d92f3f234aa5 Mon Sep 17 00:00:00 2001 From: madalinaraicu Date: Fri, 15 Jul 2022 14:20:13 +0200 Subject: [PATCH] fix: capitalize trading mode --- apps/trading/pages/markets/[marketId].page.tsx | 1 + apps/trading/pages/markets/__generated__/Market.ts | 8 ++++++-- apps/trading/pages/markets/trade-grid.tsx | 9 ++++++++- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/apps/trading/pages/markets/[marketId].page.tsx b/apps/trading/pages/markets/[marketId].page.tsx index 7f49456f4..9b27255ea 100644 --- a/apps/trading/pages/markets/[marketId].page.tsx +++ b/apps/trading/pages/markets/[marketId].page.tsx @@ -32,6 +32,7 @@ const MARKET_QUERY = gql` bestStaticBidVolume bestStaticOfferVolume indicativeVolume + trigger } tradableInstrument { instrument { diff --git a/apps/trading/pages/markets/__generated__/Market.ts b/apps/trading/pages/markets/__generated__/Market.ts index c19827584..8394d1307 100644 --- a/apps/trading/pages/markets/__generated__/Market.ts +++ b/apps/trading/pages/markets/__generated__/Market.ts @@ -3,7 +3,7 @@ // @generated // This file was automatically generated and should not be edited. -import { Interval, MarketTradingMode, MarketState } from "@vegaprotocol/types"; +import { Interval, MarketTradingMode, MarketState, AuctionTrigger } from "@vegaprotocol/types"; // ==================================================== // GraphQL query operation: Market @@ -47,6 +47,10 @@ export interface Market_market_data { * the aggregated volume being offered at the best static offer price, excluding pegged orders. */ bestStaticOfferVolume: string; + /** + * what triggered an auction (if an auction was started) + */ + trigger: AuctionTrigger; } export interface Market_market_tradableInstrument_instrument_metadata { @@ -145,7 +149,7 @@ export interface Market_market { */ decimalPlaces: number; /** - * positionDecimalPlaces indicate the number of decimal places that an integer must be shifted in order to get a correct size (uint64). + * positionDecimalPlaces indicated the number of decimal places that an integer must be shifted in order to get a correct size (uint64). * i.e. 0 means there are no fractional orders for the market, and order sizes are always whole sizes. * 2 means sizes given as 10^2 * desired size, e.g. a desired size of 1.23 is represented as 123 in this market. */ diff --git a/apps/trading/pages/markets/trade-grid.tsx b/apps/trading/pages/markets/trade-grid.tsx index aea8c832a..2a856cba8 100644 --- a/apps/trading/pages/markets/trade-grid.tsx +++ b/apps/trading/pages/markets/trade-grid.tsx @@ -23,6 +23,7 @@ import { PriceCellChange, } from '@vegaprotocol/ui-toolkit'; import type { CandleClose } from '@vegaprotocol/types'; +import { MarketTradingMode } from '@vegaprotocol/types'; import capitalize from 'lodash/capitalize'; import startCase from 'lodash/startCase'; @@ -45,6 +46,8 @@ interface TradeMarketHeaderProps { className?: string; } +const formatLabel = (str: string) => capitalize(startCase(str).toLowerCase()); + export const TradeMarketHeader = ({ market, className, @@ -99,7 +102,11 @@ export const TradeMarketHeader = ({
Trading mode - {capitalize(startCase(market.tradingMode).toLowerCase())} + {market.tradingMode === MarketTradingMode.MonitoringAuction + ? `${formatLabel( + market.tradingMode + )} - ${market.data?.trigger.toLowerCase()}` + : formatLabel(market.tradingMode)}