kopia lustrzana https://github.com/bugout-dev/moonstream
Updating pages to use the new SITEMAP schema.
rodzic
e82c53fe5d
commit
145980e42a
|
@ -14,7 +14,7 @@ import {
|
|||
import { RiAccountCircleLine } from "react-icons/ri";
|
||||
import useLogout from "../core/hooks/useLogout";
|
||||
import UIContext from "../core/providers/UIProvider/context";
|
||||
import { ALL_NAV_PATHES } from "../core/constants";
|
||||
import { SITEMAP } from "../core/constants";
|
||||
|
||||
const AccountIconButton = (props) => {
|
||||
const { logout } = useLogout();
|
||||
|
@ -47,14 +47,22 @@ const AccountIconButton = (props) => {
|
|||
</MenuGroup>
|
||||
<MenuDivider />
|
||||
{ui.isMobileView &&
|
||||
ALL_NAV_PATHES.map((pathToLink, idx) => {
|
||||
return (
|
||||
<MenuItem key={`AccountIconButton-All_nav_pathes-${idx}`}>
|
||||
<RouterLink href={pathToLink.path}>
|
||||
{pathToLink.title}
|
||||
</RouterLink>
|
||||
</MenuItem>
|
||||
);
|
||||
SITEMAP.map((item, idx) => {
|
||||
if (item.children) {
|
||||
return (
|
||||
<MenuGroup key={`AccountIconButton-MenuGroup-${idx}`}>
|
||||
{item.children.map((child, idx) => {
|
||||
return (
|
||||
<MenuItem key={`AccountIconButton-SITEMAP-${idx}`}>
|
||||
<RouterLink href={child.path}>
|
||||
{child.title}
|
||||
</RouterLink>
|
||||
</MenuItem>
|
||||
);
|
||||
})}
|
||||
</MenuGroup>
|
||||
);
|
||||
}
|
||||
})}
|
||||
<MenuDivider />
|
||||
<MenuItem
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import React, { useState, useContext, useEffect } from "react";
|
||||
import RouterLink from "next/link";
|
||||
import {
|
||||
Flex,
|
||||
Image,
|
||||
|
@ -15,12 +16,19 @@ import {
|
|||
useBreakpointValue,
|
||||
Spacer,
|
||||
ButtonGroup,
|
||||
Button,
|
||||
Menu,
|
||||
MenuButton,
|
||||
MenuList,
|
||||
MenuItem,
|
||||
Portal,
|
||||
} from "@chakra-ui/react";
|
||||
import {
|
||||
HamburgerIcon,
|
||||
QuestionOutlineIcon,
|
||||
ArrowLeftIcon,
|
||||
ArrowRightIcon,
|
||||
ChevronDownIcon,
|
||||
} from "@chakra-ui/icons";
|
||||
import useRouter from "../core/hooks/useRouter";
|
||||
import UIContext from "../core/providers/UIProvider/context";
|
||||
|
@ -30,6 +38,7 @@ import AddNewIconButton from "./AddNewIconButton";
|
|||
import {
|
||||
USER_NAV_PATHES,
|
||||
ALL_NAV_PATHES,
|
||||
SITEMAP,
|
||||
WHITE_LOGO_W_TEXT_URL,
|
||||
} from "../core/constants";
|
||||
|
||||
|
@ -98,21 +107,53 @@ const AppNavbar = () => {
|
|||
<>
|
||||
{!ui.isMobileView && (
|
||||
<>
|
||||
<Flex width="100%" px={2}>
|
||||
<Flex px={2}>
|
||||
<Spacer />
|
||||
<Flex placeSelf="flex-end">
|
||||
<ButtonGroup spacing={4} colorScheme="orange">
|
||||
{ALL_NAV_PATHES.map((item, idx) => (
|
||||
<RouteButton
|
||||
key={`${idx}-${item.title}-landing-all-links`}
|
||||
variant="link"
|
||||
href={item.path}
|
||||
color="white"
|
||||
isActive={!!(router.nextRouter.pathname === item.path)}
|
||||
>
|
||||
{item.title}
|
||||
</RouteButton>
|
||||
))}
|
||||
<ButtonGroup variant="link" spacing={4} colorScheme="orange">
|
||||
{SITEMAP.map((item, idx) => {
|
||||
if (!item.children) {
|
||||
return (
|
||||
<RouteButton
|
||||
key={`${idx}-${item.title}-landing-all-links`}
|
||||
variant="link"
|
||||
href={item.path}
|
||||
color="white"
|
||||
isActive={!!(router.pathname === item.path)}
|
||||
>
|
||||
{item.title}
|
||||
</RouteButton>
|
||||
);
|
||||
} else {
|
||||
return (
|
||||
<Menu key={`menu-${idx}`}>
|
||||
<MenuButton
|
||||
key={`menu-button-${idx}`}
|
||||
as={Button}
|
||||
rightIcon={<ChevronDownIcon />}
|
||||
>
|
||||
{item.title}
|
||||
</MenuButton>
|
||||
<Portal>
|
||||
<MenuList zIndex={100}>
|
||||
{item.children.map((child, idx) => (
|
||||
<RouterLink
|
||||
shallow={true}
|
||||
key={`${idx}-${item.title}-menu-links`}
|
||||
href={child.path}
|
||||
passHref
|
||||
>
|
||||
<MenuItem key={`menu-${idx}`} as={"a"} m={0}>
|
||||
{child.title}
|
||||
</MenuItem>
|
||||
</RouterLink>
|
||||
))}
|
||||
</MenuList>
|
||||
</Portal>
|
||||
</Menu>
|
||||
);
|
||||
}
|
||||
})}
|
||||
{USER_NAV_PATHES.map((item, idx) => {
|
||||
return (
|
||||
<RouteButton
|
||||
|
|
|
@ -64,44 +64,46 @@ const LandingNavbar = () => {
|
|||
<>
|
||||
<Spacer />
|
||||
<ButtonGroup variant="link" colorScheme="orange" spacing={4} pr={16}>
|
||||
{SITEMAP.map((item, idx) => (
|
||||
<>
|
||||
{!item.children && (
|
||||
<RouteButton
|
||||
key={`${idx}-${item.title}-landing-all-links`}
|
||||
variant="link"
|
||||
href={item.path}
|
||||
color="white"
|
||||
isActive={!!(router.pathname === item.path)}
|
||||
>
|
||||
{item.title}
|
||||
</RouteButton>
|
||||
)}
|
||||
{item.children && (
|
||||
<Menu>
|
||||
<MenuButton as={Button} rightIcon={<ChevronDownIcon />}>
|
||||
{SITEMAP.map((item, idx) => {
|
||||
return (
|
||||
<React.Fragment key={`Fragment-${idx}`}>
|
||||
{!item.children && (
|
||||
<RouteButton
|
||||
key={`${idx}-${item.title}-landing-all-links`}
|
||||
variant="link"
|
||||
href={item.path}
|
||||
color="white"
|
||||
isActive={!!(router.pathname === item.path)}
|
||||
>
|
||||
{item.title}
|
||||
</MenuButton>
|
||||
<Portal>
|
||||
<MenuList zIndex={100}>
|
||||
{item.children.map((child, idx) => (
|
||||
<RouterLink
|
||||
shallow={true}
|
||||
key={`${idx}-${item.title}-menu-links`}
|
||||
href={child.path}
|
||||
passHref
|
||||
>
|
||||
<MenuItem key={`menu-${idx}`} as={"a"} m={0}>
|
||||
{child.title}
|
||||
</MenuItem>
|
||||
</RouterLink>
|
||||
))}
|
||||
</MenuList>
|
||||
</Portal>
|
||||
</Menu>
|
||||
)}
|
||||
</>
|
||||
))}
|
||||
</RouteButton>
|
||||
)}
|
||||
{item.children && (
|
||||
<Menu>
|
||||
<MenuButton as={Button} rightIcon={<ChevronDownIcon />}>
|
||||
{item.title}
|
||||
</MenuButton>
|
||||
<Portal>
|
||||
<MenuList zIndex={100}>
|
||||
{item.children.map((child, idx) => (
|
||||
<RouterLink
|
||||
shallow={true}
|
||||
key={`${idx}-${item.title}-menu-links`}
|
||||
href={child.path}
|
||||
passHref
|
||||
>
|
||||
<MenuItem key={`menu-${idx}`} as={"a"} m={0}>
|
||||
{child.title}
|
||||
</MenuItem>
|
||||
</RouterLink>
|
||||
))}
|
||||
</MenuList>
|
||||
</Portal>
|
||||
</Menu>
|
||||
)}
|
||||
</React.Fragment>
|
||||
);
|
||||
})}
|
||||
|
||||
{ui.isLoggedIn && (
|
||||
<RouterLink href="/welcome" passHref>
|
||||
|
|
|
@ -25,7 +25,7 @@ import {
|
|||
LockIcon,
|
||||
} from "@chakra-ui/icons";
|
||||
import { MdSettings, MdDashboard, MdTimeline } from "react-icons/md";
|
||||
import { WHITE_LOGO_W_TEXT_URL, ALL_NAV_PATHES } from "../core/constants";
|
||||
import { WHITE_LOGO_W_TEXT_URL, SITEMAP } from "../core/constants";
|
||||
import useDashboard from "../core/hooks/useDashboard";
|
||||
import { MODAL_TYPES } from "../core/providers/OverlayProvider/constants";
|
||||
import OverlayContext from "../core/providers/OverlayProvider/context";
|
||||
|
@ -102,14 +102,27 @@ const Sidebar = () => {
|
|||
Login
|
||||
</MenuItem>
|
||||
{ui.isMobileView &&
|
||||
ALL_NAV_PATHES.map((pathToLink, linkItemIndex) => {
|
||||
return (
|
||||
<MenuItem key={`mobile-all-nav-path-item-${linkItemIndex}`}>
|
||||
<RouterLink href={pathToLink.path}>
|
||||
{pathToLink.title}
|
||||
</RouterLink>
|
||||
</MenuItem>
|
||||
);
|
||||
SITEMAP.map((item, idx) => {
|
||||
if (item.children) {
|
||||
return (
|
||||
<React.Fragment key={`Fragment-${idx}`}>
|
||||
{item.children.map((child, idx) => {
|
||||
return (
|
||||
<MenuItem key={`MenuItem-SITEMAP-${idx}`}>
|
||||
<RouterLink
|
||||
href={child.path}
|
||||
onClick={() => {
|
||||
ui.setSidebarToggled(false);
|
||||
}}
|
||||
>
|
||||
{child.title}
|
||||
</RouterLink>
|
||||
</MenuItem>
|
||||
);
|
||||
})}
|
||||
</React.Fragment>
|
||||
);
|
||||
}
|
||||
})}
|
||||
</>
|
||||
)}
|
||||
|
|
Ładowanie…
Reference in New Issue