fix(trading): prevent deposit sidebar showing on corresponding standalone page (#4840)
This commit is contained in:
parent
a6303456c5
commit
2005f19d50
@ -55,7 +55,6 @@ const MarketSidebarButtons = () => {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<SidebarDivider />
|
|
||||||
<SidebarButton
|
<SidebarButton
|
||||||
view={ViewType.Order}
|
view={ViewType.Order}
|
||||||
icon={VegaIconNames.TICKET}
|
icon={VegaIconNames.TICKET}
|
||||||
@ -72,15 +71,11 @@ const MarketSidebarButtons = () => {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export const Sidebar = () => {
|
const AssetSidebarButtons = () => {
|
||||||
const currentRouteId = useGetCurrentRouteId();
|
const currentRouteId = useGetCurrentRouteId();
|
||||||
const navClasses = 'flex lg:flex-col items-center gap-2 lg:gap-4 p-1';
|
|
||||||
const setViewAsDialogOpen = useViewAsDialog((state) => state.setOpen);
|
|
||||||
const { pubKeys } = useVegaWallet();
|
|
||||||
return (
|
return (
|
||||||
<div className="flex h-full p-1 lg:flex-col gap-2" data-testid="sidebar">
|
<>
|
||||||
<nav className={navClasses}>
|
|
||||||
{/* sidebar options that always show */}
|
|
||||||
<SidebarButton
|
<SidebarButton
|
||||||
view={ViewType.Deposit}
|
view={ViewType.Deposit}
|
||||||
icon={VegaIconNames.DEPOSIT}
|
icon={VegaIconNames.DEPOSIT}
|
||||||
@ -99,22 +94,46 @@ export const Sidebar = () => {
|
|||||||
tooltip={t('Transfer')}
|
tooltip={t('Transfer')}
|
||||||
routeId={currentRouteId}
|
routeId={currentRouteId}
|
||||||
/>
|
/>
|
||||||
{/* buttons for specific routes */}
|
</>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export const Sidebar = () => {
|
||||||
|
const currentRouteId = useGetCurrentRouteId();
|
||||||
|
const navClasses = 'flex lg:flex-col items-center gap-2 lg:gap-4 p-1';
|
||||||
|
const setViewAsDialogOpen = useViewAsDialog((state) => state.setOpen);
|
||||||
|
const { pubKeys } = useVegaWallet();
|
||||||
|
return (
|
||||||
|
<div className="flex h-full p-1 lg:flex-col gap-2" data-testid="sidebar">
|
||||||
|
<nav className={navClasses}>
|
||||||
<Routes>
|
<Routes>
|
||||||
|
<Route path="markets/all" element={<AssetSidebarButtons />} />
|
||||||
|
<Route path="portfolio">
|
||||||
<Route
|
<Route
|
||||||
path="markets/all"
|
// Show deposit/withdraw/transfer sidebar options only on portflio dashboard (index)
|
||||||
// render nothing for markets/all, otherwise markets/:marketId will match with markets/all
|
index={true}
|
||||||
element={null}
|
element={<AssetSidebarButtons />}
|
||||||
/>
|
/>
|
||||||
|
</Route>
|
||||||
<Route
|
<Route
|
||||||
// render nothing for portfolio
|
path="markets/:marketId"
|
||||||
path="portfolio"
|
element={
|
||||||
element={null}
|
<>
|
||||||
|
<AssetSidebarButtons />
|
||||||
|
<SidebarDivider />
|
||||||
|
<MarketSidebarButtons />
|
||||||
|
</>
|
||||||
|
}
|
||||||
/>
|
/>
|
||||||
<Route path="markets/:marketId" element={<MarketSidebarButtons />} />
|
|
||||||
<Route
|
<Route
|
||||||
path="liquidity/:marketId"
|
path="liquidity/:marketId"
|
||||||
element={<MarketSidebarButtons />}
|
element={
|
||||||
|
<>
|
||||||
|
<AssetSidebarButtons />
|
||||||
|
<SidebarDivider />
|
||||||
|
<MarketSidebarButtons />
|
||||||
|
</>
|
||||||
|
}
|
||||||
/>
|
/>
|
||||||
</Routes>
|
</Routes>
|
||||||
</nav>
|
</nav>
|
||||||
|
Loading…
Reference in New Issue
Block a user