Skip to content

Commit

Permalink
use gatewayPages to determine if selector menu is shown
Browse files Browse the repository at this point in the history
  • Loading branch information
rustyjux committed Sep 13, 2024
1 parent a3bcf98 commit 844c9f1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 17 deletions.
9 changes: 4 additions & 5 deletions src/nextapp/components/nav-bar/nav-bar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import NextLink from 'next/link';
import type { NavLink } from '@/shared/data/links';
import NamespaceMenu from '../namespace-menu';
import { useAuth } from '@/shared/services/auth';
import { gatewayPages } from '@/shared/data/links';

const linkProps = {
px: 4,
Expand Down Expand Up @@ -48,6 +49,8 @@ const NavBar: React.FC<NavBarProps> = ({ site, links, pathname }) => {
return '';
}, [pathname]);

const requiresNamespace = gatewayPages.includes(pathname);

return (
<Flex>
<Box
Expand Down Expand Up @@ -100,11 +103,7 @@ const NavBar: React.FC<NavBarProps> = ({ site, links, pathname }) => {
))}
</Container>
</Box>
{((pathname.startsWith('/manager/') &&
pathname !== '/manager/gateways' &&
pathname !== '/manager/gateways/get-started' &&
pathname !== '/manager/gateways/list') ||
pathname === '/devportal/api-directory/your-products') && (
{requiresNamespace && (
<Box
as="nav"
role="banner"
Expand Down
16 changes: 4 additions & 12 deletions src/nextapp/pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import Header from '@/components/header';
import NavBar from '@/components/nav-bar';
import MaintenanceBanner from '@/components/maintenance-banner';
import theme from '@/shared/theme';
import links from '@/shared/data/links';
import links, { gatewayPages } from '@/shared/data/links';
import AuthAction from '@/components/auth-action';
import { ReactQueryDevtools } from 'react-query/devtools';
import type { AppProps } from 'next/app';
Expand Down Expand Up @@ -56,9 +56,6 @@ const App: React.FC<AppProps> = ({ Component, pageProps }) => {
const router = useRouter();
const queryClientRef = React.useRef<QueryClient>();
const site: string = React.useMemo(() => {
//if (router?.pathname.startsWith('/manager')) {
// return 'manager';
//}
if (router?.pathname.startsWith('/platform')) {
return 'platform';
}
Expand All @@ -70,12 +67,7 @@ const App: React.FC<AppProps> = ({ Component, pageProps }) => {
}, [router]);

// Temp solution for handing spacing around new gateways dropdown menu
const gatewaysMenu =
(router?.pathname.startsWith('/manager/') &&
router?.pathname !== '/manager/gateways' &&
router?.pathname !== '/manager/gateways/get-started' &&
router?.pathname !== '/manager/gateways/list') ||
router?.pathname === '/devportal/api-directory/your-products';
const requiresNamespace = gatewayPages.includes(router?.pathname);

if (!queryClientRef.current) {
queryClientRef.current = new QueryClient({
Expand Down Expand Up @@ -117,8 +109,8 @@ const App: React.FC<AppProps> = ({ Component, pageProps }) => {
as="main"
flex={1}
mt={{
base: gatewaysMenu ? '303px' : '65px',
sm: gatewaysMenu ? '163px' : '115px',
base: requiresNamespace ? '303px' : '65px',
sm: requiresNamespace ? '163px' : '115px',
}}
>
<AppWrapper router={router}>
Expand Down

0 comments on commit 844c9f1

Please sign in to comment.