diff --git a/mdx/rehype.mjs b/mdx/rehype.mjs index b137262d..9c93cab1 100644 --- a/mdx/rehype.mjs +++ b/mdx/rehype.mjs @@ -101,7 +101,8 @@ function getSections(node) { sections.push(`{ title: ${JSON.stringify(toString(child))}, id: ${JSON.stringify(child.properties.id)}, - tagName: ${JSON.stringify(child.tagName)}, + tagName: ${JSON.stringify(child.tagName)}, + tag: ${JSON.stringify(child.tag)}, ...${child.properties.annotation} }`) } else if (child.children) { diff --git a/src/components/Footer.jsx b/src/components/Footer.jsx index debd880d..7c8ab45a 100644 --- a/src/components/Footer.jsx +++ b/src/components/Footer.jsx @@ -4,7 +4,8 @@ import { useRouter } from 'next/router' import { Transition } from '@headlessui/react' import { Button } from '@/components/Button' -import {apiNavigation, docsNavigation, navigation} from '@/components/NavigationAPI' +import {apiNavigation} from '@/components/NavigationAPI' +import {docsNavigation} from "@/components/NavigationDocs"; function CheckIcon(props) { return ( diff --git a/src/components/LayoutDocs.jsx b/src/components/LayoutDocs.jsx index 9f8ba6bb..9eecfc09 100644 --- a/src/components/LayoutDocs.jsx +++ b/src/components/LayoutDocs.jsx @@ -79,50 +79,6 @@ function GitHubIcon(props) { ) } -// function Header({ navigation }) { -// let [isScrolled, setIsScrolled] = useState(false) -// -// useEffect(() => { -// function onScroll() { -// setIsScrolled(window.scrollY > 0) -// } -// onScroll() -// window.addEventListener('scroll', onScroll, { passive: true }) -// return () => { -// window.removeEventListener('scroll', onScroll) -// } -// }, []) -// -// return ( -//
-//
-// -//
-//
-// -// -// -// -//
-//
-// -//
-//
-// -// -// -//
-//
-// ) -// } - function useTableOfContents(tableOfContents) { let [currentSection, setCurrentSection] = useState(tableOfContents[0]?.id) @@ -176,7 +132,11 @@ export function LayoutDocs({ children, title, tableOfContents }) { let section = navigation.find((section) => section.links.find((link) => link.href === router.pathname) ) - let currentSection = useTableOfContents(tableOfContents) + + let currentSection + if(!router.route.startsWith("/ipa")) { + currentSection = useTableOfContents(tableOfContents) + } function isActive(section) { if (section.id === currentSection) { @@ -205,7 +165,8 @@ export function LayoutDocs({ children, title, tableOfContents }) {
- + {router.route.startsWith("/ipa") ? : + }
@@ -214,7 +175,7 @@ export function LayoutDocs({ children, title, tableOfContents }) {
-
+ {!router.route.startsWith("/ipa/resources") &&
-
+
} ) diff --git a/src/components/NavigationAPI.jsx b/src/components/NavigationAPI.jsx index ff677bd1..dc57bf78 100644 --- a/src/components/NavigationAPI.jsx +++ b/src/components/NavigationAPI.jsx @@ -105,15 +105,16 @@ export function ActivePageMarker({ group, pathname }) { ) } -function NavigationGroup({ group, className }) { +function NavigationGroup({ group, className, tableOfContents }) { // If this is the mobile navigation then we always render the initial // state, so that the state does not change during the close animation. // The state will still update when we re-open (re-render) the navigation. - let isInsideMobileNavigation = useIsInsideMobileNavigation() - let [router, sections] = useInitialValue( - [useRouter(), useSectionStore((s) => s.sections)], - isInsideMobileNavigation - ) + // let isInsideMobileNavigation = useIsInsideMobileNavigation() + let router = useRouter() + // let [router, sections] = useInitialValue( + // [useRouter(), useSectionStore((s) => s.sections)], + // isInsideMobileNavigation + // ) let isActiveGroup = group.links.findIndex((link) => link.href === router.pathname) !== -1 @@ -127,11 +128,11 @@ function NavigationGroup({ group, className }) { {group.title}
- - {isActiveGroup && ( - - )} - + {/**/} + {/* {isActiveGroup && (*/} + {/* */} + {/* )}*/} + {/**/} {link.title} - - {link.href === router.pathname && sections.length > 0 && ( + {/**/} + {link.href === router.pathname && ( - {sections.map((section) => ( + {console.log(tableOfContents.tableOfContents)} + {tableOfContents.tableOfContents.map((section) => (
  • )} - + {/**/} ))} @@ -183,73 +185,35 @@ function NavigationGroup({ group, className }) { ) } -export const docsNavigation = [ - { - title: 'About NetBird', - links: [ - { title: 'Why Wireguard with NetBird?', href: '/docs/about-netbird/why-wireguard-with-netbird' }, - { title: 'How Netbird Works', href: '/docs/about-netbird/how-netbird-works' }, - { title: 'NetBird vs. Traditional VPN', href: '/docs/about-netbird/netbird-vs-traditional-vpn' }, - { title: 'Other', href: '/docs/about-netbird/other' }, - { title: 'FAQ', href: '/docs/about-netbird/faq' }, - ], - }, - { - title: 'How-to', - links: [ - { title: 'Getting Started', href: '/docs/how-to/getting-started' }, - { title: 'Peers', href: '/docs/how-to/peers' }, - { title: 'Setup Keys', href: '/docs/how-to/setup-keys' }, - { title: 'Access Control', href: '/docs/how-to/access-control' }, - { title: 'Network Routes', href: '/docs/how-to/network-routes' }, - { title: 'DNS', href: '/docs/how-to/dns' }, - { title: 'Users', href: '/docs/how-to/users' }, - { title: 'Activity', href: '/docs/how-to/activity' }, - { title: 'Settings', href: '/docs/how-to/settings' }, - { title: 'Examples', href: '/docs/how-to/examples' }, - { title: 'CLI', href: '/docs/how-to/cli' }, - ], - }, - { - title: 'Self-Hosted', - links: [ - { title: 'Installation Guide', href: '/docs/selfhosted/selfhosted-guide' }, - { title: 'Identity Providers', href: '/docs/selfhosted/identity-providers' }, - ], - }, - -] - export const apiNavigation = [ { title: 'Guides', links: [ - { title: 'Quickstart', href: '/ipa/quickstart' }, - { title: 'Authentication', href: '/ipa/authentication' }, - { title: 'Errors', href: '/ipa/errors' }, + { title: 'Quickstart', href: '/ipa/guides/quickstart' }, + { title: 'Authentication', href: '/ipa/guides/authentication' }, + { title: 'Errors', href: '/ipa/guides/errors' }, // { title: 'Events', href: '/accounts' }, ], }, { title: 'Resources', links: [ - { title: 'Accounts', href: '/ipa/accounts' }, - { title: 'Users', href: '/ipa/users' }, - { title: 'Tokens', href: '/ipa/tokens' }, - { title: 'Peers', href: '/ipa/peers' }, - { title: 'Setup Keys', href: '/ipa/setup-keys' }, - { title: 'Groups', href: '/ipa/groups' }, - { title: 'Rules', href: '/ipa/rules' }, - { title: 'Policies', href: '/ipa/policies' }, - { title: 'Routes', href: '/ipa/routes' }, - { title: 'DNS', href: '/ipa/dns' }, - { title: 'Events', href: '/ipa/events' }, + { title: 'Accounts', href: '/ipa/resources/accounts' }, + { title: 'Users', href: '/ipa/resources/users' }, + { title: 'Tokens', href: '/ipa/resources/tokens' }, + { title: 'Peers', href: '/ipa/resources/peers' }, + { title: 'Setup Keys', href: '/ipa/resources/setup-keys' }, + { title: 'Groups', href: '/ipa/resources/groups' }, + { title: 'Rules', href: '/ipa/resources/rules' }, + { title: 'Policies', href: '/ipa/resources/policies' }, + { title: 'Routes', href: '/ipa/resources/routes' }, + { title: 'DNS', href: '/ipa/resources/dns' }, + { title: 'Events', href: '/ipa/resources/events' }, ], }, ] -export function NavigationAPI(props) { - let router = useRouter() +export function NavigationAPI(tableOfContents, props) { return (