fix: capitalize trading mode

This commit is contained in:
madalinaraicu 2022-07-15 14:20:13 +02:00
parent 7bc838e12c
commit 8ddeadfdce
3 changed files with 15 additions and 3 deletions

View File

@ -32,6 +32,7 @@ const MARKET_QUERY = gql`
bestStaticBidVolume
bestStaticOfferVolume
indicativeVolume
trigger
}
tradableInstrument {
instrument {

View File

@ -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.
*/

View File

@ -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 = ({
<div className={headerItemClassName}>
<span className={itemClassName}>Trading mode</span>
<span data-testid="trading-mode" className={itemValueClassName}>
{capitalize(startCase(market.tradingMode).toLowerCase())}
{market.tradingMode === MarketTradingMode.MonitoringAuction
? `${formatLabel(
market.tradingMode
)} - ${market.data?.trigger.toLowerCase()}`
: formatLabel(market.tradingMode)}
</span>
</div>
</div>