mirror of
https://github.com/Unleash/unleash.git
synced 2025-06-04 01:18:20 +02:00
fix: useLocation instead of browser location for resolving pathname (#9640)
This commit is contained in:
parent
7f98709730
commit
39755c7f19
@ -3,6 +3,7 @@ import { useUiFlag } from 'hooks/useUiFlag';
|
||||
import type { ReactNode } from 'react';
|
||||
import { Sticky } from 'component/common/Sticky/Sticky';
|
||||
import { AdminMenuNavigation } from './AdminNavigationItems';
|
||||
import { useLocation } from 'react-router-dom';
|
||||
|
||||
const StyledAdminMainGrid = styled(Grid)(({ theme }) => ({
|
||||
minWidth: 0, // this is a fix for overflowing flex
|
||||
@ -56,6 +57,7 @@ interface IWrapIfAdminSubpageProps {
|
||||
export const WrapIfAdminSubpage = ({ children }: IWrapIfAdminSubpageProps) => {
|
||||
const newAdminUIEnabled = useUiFlag('adminNavUI');
|
||||
const theme = useTheme();
|
||||
const location = useLocation();
|
||||
const isSmallScreen = useMediaQuery(theme.breakpoints.down('lg'));
|
||||
const showAdminMenu =
|
||||
!isSmallScreen &&
|
||||
|
@ -1,5 +1,5 @@
|
||||
import type { VFC } from 'react';
|
||||
import { Link } from 'react-router-dom';
|
||||
import { Link, useLocation } from 'react-router-dom';
|
||||
import { Divider, Drawer, styled } from '@mui/material';
|
||||
import { ReactComponent as UnleashLogo } from 'assets/img/logoDarkWithText.svg';
|
||||
import { ReactComponent as UnleashLogoWhite } from 'assets/img/logoWithWhiteText.svg';
|
||||
@ -34,6 +34,7 @@ export const DrawerMenu: VFC<IDrawerMenuProps> = ({
|
||||
toggleDrawer,
|
||||
}) => {
|
||||
const newAdminUIEnabled = useUiFlag('adminNavUI');
|
||||
const location = useLocation();
|
||||
const showOnlyAdminMenu =
|
||||
newAdminUIEnabled && location.pathname.indexOf('/admin') === 0;
|
||||
const onClick = () => {
|
||||
|
Loading…
Reference in New Issue
Block a user