diff --git a/apps/trading/components/market-banner/market-update-state-banner.tsx b/apps/trading/components/market-banner/market-update-state-banner.tsx index bb85b3831..211ff6664 100644 --- a/apps/trading/components/market-banner/market-update-state-banner.tsx +++ b/apps/trading/components/market-banner/market-update-state-banner.tsx @@ -2,7 +2,7 @@ import { type ReactNode } from 'react'; import sortBy from 'lodash/sortBy'; import { format, formatDuration, intervalToDuration } from 'date-fns'; import { type MarketViewProposalFieldsFragment } from '@vegaprotocol/proposals'; -import { ProposalState } from '@vegaprotocol/types'; +import { MarketUpdateType, ProposalState } from '@vegaprotocol/types'; import { DApp, TOKEN_PROPOSAL, @@ -24,6 +24,16 @@ export const MarketUpdateStateBanner = ({ const t = useT(); const governanceLink = useLinks(DApp.Governance); + const openTradingProposals = sortBy( + proposals.filter( + (p) => + p.terms.change.__typename === 'UpdateMarketState' && + p.terms.change.updateType === + MarketUpdateType.MARKET_STATE_UPDATE_TYPE_RESUME + ), + (p) => p.terms.enactmentDatetime + ); + const openProposals = sortBy( proposals.filter((p) => p.state === ProposalState.STATE_OPEN), (p) => p.terms.enactmentDatetime @@ -45,12 +55,32 @@ export const MarketUpdateStateBanner = ({ ? governanceLink(TOKEN_PROPOSAL.replace(':id', openProposals[0]?.id)) : undefined; + const openTradingProposalsLink = openTradingProposals[0]?.id + ? governanceLink(TOKEN_PROPOSAL.replace(':id', openTradingProposals[0]?.id)) + : undefined; + const proposalsLink = openProposals.length > 1 ? governanceLink(TOKEN_PROPOSALS) : undefined; let content: ReactNode; - if (passedProposals.length) { + if (openTradingProposals.length >= 1) { + content = ( + <> +

+ {t( + 'Trading on market {{name}} was suspended by governance. There are open proposals to resume trading on this market.', + { name } + )} +

+

+ + {t('View proposals')} + +

+ + ); + } else if (passedProposals.length) { const { date, duration, price } = getMessageVariables(passedProposals[0]); content = ( <>