fix(trading): update filter for market selector to include suspended via governance (#4957)

This commit is contained in:
m.ray 2023-10-02 20:00:49 +03:00 committed by GitHub
parent c65c296db2
commit a19ea1c939
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 33 additions and 0 deletions

View File

@ -7,6 +7,8 @@ import * as Schema from '@vegaprotocol/types';
import { HeaderStat } from '../header';
import { useCallback, useRef, useState } from 'react';
import * as constants from '../constants';
import { DocsLinks } from '@vegaprotocol/environment';
import { ExternalLink } from '@vegaprotocol/ui-toolkit';
export const MarketState = ({ market }: { market: Market | null }) => {
const [marketState, setMarketState] = useState<Schema.MarketState | null>(
@ -90,5 +92,20 @@ const getMarketStateTooltip = (state: Schema.MarketState | null) => {
);
}
if (state === Schema.MarketState.STATE_SUSPENDED_VIA_GOVERNANCE) {
return (
<p>
{t(
`This market has been suspended via a governance vote and can be resumed or terminated by further votes.`
)}
{DocsLinks && (
<ExternalLink href={DocsLinks.MARKET_LIFECYCLE} className="ml-1">
{t('Find out more')}
</ExternalLink>
)}
</p>
);
}
return undefined;
};

View File

@ -5,6 +5,7 @@ const MARKET_TEMPLATE = [
MarketState.STATE_ACTIVE,
MarketState.STATE_SUSPENDED,
MarketState.STATE_PENDING,
MarketState.STATE_SUSPENDED_VIA_GOVERNANCE,
];
export const isMarketActive = (state: MarketState) => {

View File

@ -114,6 +114,20 @@ export const TradingModeTooltip = ({
</section>
);
}
case Schema.MarketTradingMode.TRADING_MODE_SUSPENDED_VIA_GOVERNANCE: {
return (
<section data-testid="trading-mode-suspended-via-governance">
{t(
`This market has been suspended via a governance vote and can be resumed or terminated by further votes.`
)}
{DocsLinks && (
<ExternalLink href={DocsLinks.MARKET_LIFECYCLE} className="ml-1">
{t('Find out more')}
</ExternalLink>
)}
</section>
);
}
case Schema.MarketTradingMode.TRADING_MODE_MONITORING_AUCTION: {
switch (trigger) {
case Schema.AuctionTrigger.AUCTION_TRIGGER_LIQUIDITY_TARGET_NOT_MET: {

View File

@ -80,6 +80,7 @@ export const DocsLinks = VEGA_DOCS_URL
LIQUIDITY: `${VEGA_DOCS_URL}/concepts/liquidity/provision`,
WITHDRAWAL_LIMITS: `${VEGA_DOCS_URL}/concepts/assets/deposits-withdrawals#withdrawal-limits`,
VALIDATOR_SCORES_REWARDS: `${VEGA_DOCS_URL}/concepts/vega-chain/validator-scores-and-rewards`,
MARKET_LIFECYCLE: `${VEGA_DOCS_URL}/concepts/trading-on-vega/market-lifecycle`,
}
: undefined;