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 type { ReactNode } from 'react';
|
||||||
import { Sticky } from 'component/common/Sticky/Sticky';
|
import { Sticky } from 'component/common/Sticky/Sticky';
|
||||||
import { AdminMenuNavigation } from './AdminNavigationItems';
|
import { AdminMenuNavigation } from './AdminNavigationItems';
|
||||||
|
import { useLocation } from 'react-router-dom';
|
||||||
|
|
||||||
const StyledAdminMainGrid = styled(Grid)(({ theme }) => ({
|
const StyledAdminMainGrid = styled(Grid)(({ theme }) => ({
|
||||||
minWidth: 0, // this is a fix for overflowing flex
|
minWidth: 0, // this is a fix for overflowing flex
|
||||||
@ -56,6 +57,7 @@ interface IWrapIfAdminSubpageProps {
|
|||||||
export const WrapIfAdminSubpage = ({ children }: IWrapIfAdminSubpageProps) => {
|
export const WrapIfAdminSubpage = ({ children }: IWrapIfAdminSubpageProps) => {
|
||||||
const newAdminUIEnabled = useUiFlag('adminNavUI');
|
const newAdminUIEnabled = useUiFlag('adminNavUI');
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
|
const location = useLocation();
|
||||||
const isSmallScreen = useMediaQuery(theme.breakpoints.down('lg'));
|
const isSmallScreen = useMediaQuery(theme.breakpoints.down('lg'));
|
||||||
const showAdminMenu =
|
const showAdminMenu =
|
||||||
!isSmallScreen &&
|
!isSmallScreen &&
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import type { VFC } from 'react';
|
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 { Divider, Drawer, styled } from '@mui/material';
|
||||||
import { ReactComponent as UnleashLogo } from 'assets/img/logoDarkWithText.svg';
|
import { ReactComponent as UnleashLogo } from 'assets/img/logoDarkWithText.svg';
|
||||||
import { ReactComponent as UnleashLogoWhite } from 'assets/img/logoWithWhiteText.svg';
|
import { ReactComponent as UnleashLogoWhite } from 'assets/img/logoWithWhiteText.svg';
|
||||||
@ -34,6 +34,7 @@ export const DrawerMenu: VFC<IDrawerMenuProps> = ({
|
|||||||
toggleDrawer,
|
toggleDrawer,
|
||||||
}) => {
|
}) => {
|
||||||
const newAdminUIEnabled = useUiFlag('adminNavUI');
|
const newAdminUIEnabled = useUiFlag('adminNavUI');
|
||||||
|
const location = useLocation();
|
||||||
const showOnlyAdminMenu =
|
const showOnlyAdminMenu =
|
||||||
newAdminUIEnabled && location.pathname.indexOf('/admin') === 0;
|
newAdminUIEnabled && location.pathname.indexOf('/admin') === 0;
|
||||||
const onClick = () => {
|
const onClick = () => {
|
||||||
|
Loading…
Reference in New Issue
Block a user