fix(trading): show deal ticket in sidebar by default (#5292)

This commit is contained in:
m.ray 2023-11-16 19:08:20 +02:00 committed by GitHub
parent 5661b74082
commit 79a16b8562
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,7 +1,5 @@
import { Route, Routes, useParams } from 'react-router-dom'; import { Route, Routes } from 'react-router-dom';
import { MarketState } from '@vegaprotocol/types';
import { t } from '@vegaprotocol/i18n'; import { t } from '@vegaprotocol/i18n';
import { useMarket } from '@vegaprotocol/markets';
import { VegaIconNames } from '@vegaprotocol/ui-toolkit'; import { VegaIconNames } from '@vegaprotocol/ui-toolkit';
import { import {
SidebarButton, SidebarButton,
@ -11,12 +9,7 @@ import {
import { useGetCurrentRouteId } from '../../lib/hooks/use-get-current-route-id'; import { useGetCurrentRouteId } from '../../lib/hooks/use-get-current-route-id';
export const MarketsSidebar = () => { export const MarketsSidebar = () => {
const { marketId } = useParams();
const currentRouteId = useGetCurrentRouteId(); const currentRouteId = useGetCurrentRouteId();
const { data } = useMarket(marketId);
const active =
data &&
[MarketState.STATE_ACTIVE, MarketState.STATE_PENDING].includes(data.state);
return ( return (
<> <>
@ -44,14 +37,12 @@ export const MarketsSidebar = () => {
element={ element={
<> <>
<SidebarDivider /> <SidebarDivider />
{active && (
<SidebarButton <SidebarButton
view={ViewType.Order} view={ViewType.Order}
icon={VegaIconNames.TICKET} icon={VegaIconNames.TICKET}
tooltip={t('Order')} tooltip={t('Order')}
routeId={currentRouteId} routeId={currentRouteId}
/> />
)}
<SidebarButton <SidebarButton
view={ViewType.Info} view={ViewType.Info}
icon={VegaIconNames.BREAKDOWN} icon={VegaIconNames.BREAKDOWN}