diff --git a/src/app/docs/layout.tsx b/src/app/docs/layout.tsx index 6ccc94c9..ce296c06 100644 --- a/src/app/docs/layout.tsx +++ b/src/app/docs/layout.tsx @@ -1,6 +1,6 @@ import { Layout } from 'nextra-theme-docs' import 'nextra-theme-docs/style.css' -import { DocsNavbar, DocsFooter, DocsBanner, DirectRouteHighlighter } from '@/components/docs/index' +import { DocsNavbar, DocsFooter, DocsBanner } from '@/components/docs/index' import { Inter, JetBrains_Mono } from "next/font/google" import { Suspense } from 'react' import { ThemeProvider } from "next-themes" @@ -43,7 +43,7 @@ export default async function DocsLayout({ children }: Props) { const branch = getBranchForVersion(defaultVersion) // Build page map for the default version - const { pageMap, directRouteMap } = await buildPageMapForBranch(branch) + const { pageMap } = await buildPageMapForBranch(branch) return ( @@ -65,7 +65,6 @@ export default async function DocsLayout({ children }: Props) { title: "On This Page" }} > - {children} diff --git a/src/app/docs/page-map.ts b/src/app/docs/page-map.ts index 0c4d56a8..efc531cb 100644 --- a/src/app/docs/page-map.ts +++ b/src/app/docs/page-map.ts @@ -84,7 +84,7 @@ type FolderNode = { kind: 'Folder'; name: string; route: string; children: PageM { file: 'release-notes.md' } ]], ['Install & Configure', [ - { file: 'get-started.md' }, + // { file: 'get-started.md' }, { file: 'pre-reqs.md' }, { file: 'start-from-ocm.md' }, { file: 'setup-limitations.md' }, @@ -346,14 +346,5 @@ type FolderNode = { kind: 'Folder'; name: string; route: string; children: PageM // normalizePageMap has compatible types now; remove stale suppressor const pageMap = normalizePageMap(_pageMap) - // Build a map of direct routes to their canonical category routes - const directRouteMap: Record = {} - for (const { alias, fp } of aliases) { - if (DIRECT_ROOT && fp.startsWith(`${DIRECT_ROOT}/`)) { - const fileName = fp.split('/').pop()!.replace(/\.(md|mdx)$/i, '') - directRouteMap[`/docs/direct/${fileName}`] = `/docs/${alias}` - } - } - - return { pageMap, routeMap, filePaths: allDocFiles, branch, directRouteMap } + return { pageMap, routeMap, filePaths: allDocFiles, branch } } \ No newline at end of file diff --git a/src/components/docs/DirectRouteHighlighter.tsx b/src/components/docs/DirectRouteHighlighter.tsx deleted file mode 100644 index 065c41a6..00000000 --- a/src/components/docs/DirectRouteHighlighter.tsx +++ /dev/null @@ -1,112 +0,0 @@ -'use client' - -import { usePathname } from 'next/navigation' -import { useEffect } from 'react' - -type DirectRouteHighlighterProps = { - directRouteMap: Record -} - -export function DirectRouteHighlighter({ directRouteMap }: DirectRouteHighlighterProps) { - const pathname = usePathname() - - useEffect(() => { - // If current path is a direct route, find its canonical route - const canonicalRoute = directRouteMap[pathname] - - if (canonicalRoute) { - - const activateLink = () => { - // Find ALL links in the page - const allLinks = document.querySelectorAll('a') - - allLinks.forEach(link => { - const href = link.getAttribute('href') - - if (href === canonicalRoute) { - // Remove inactive state classes - link.classList.remove( - 'x:text-gray-600', - 'x:dark:text-neutral-400', - 'x:hover:text-gray-900', - 'x:dark:hover:text-gray-50', - 'x:contrast-more:text-gray-900', - 'x:contrast-more:dark:text-gray-50', - 'x:hover:bg-gray-100', - 'x:dark:hover:bg-primary-100/5', - 'x:contrast-more:border-transparent', - 'x:contrast-more:hover:border-gray-900', - 'x:contrast-more:dark:hover:border-gray-50' - ) - - // Add Nextra's active state classes - link.classList.add( - 'x:bg-primary-100', - 'x:font-semibold', - 'x:text-primary-800', - 'x:dark:bg-primary-400/10', - 'x:dark:text-primary-600', - 'x:contrast-more:border-primary-500' - ) - link.setAttribute('aria-current', 'page') - link.setAttribute('data-active', 'true') - - // Expand all parent folders - let parent = link.parentElement - while (parent) { - // Look for the collapse container div (has x:overflow-hidden class) - if (parent.classList.contains('x:overflow-hidden')) { - // Expand this folder by removing collapsed styles - parent.classList.remove('x:opacity-0') - parent.classList.add('x:opacity-100') - parent.style.height = 'auto' - - // Find the previous sibling button (the folder toggle) - const prevButton = parent.previousElementSibling - if (prevButton?.tagName === 'BUTTON') { - prevButton.setAttribute('aria-expanded', 'true') - - // Add 'open' class to parent
  • - const parentLi = parent.parentElement - if (parentLi?.tagName === 'LI') { - parentLi.classList.add('open') - } - - // Rotate the SVG arrow - const svg = prevButton.querySelector('svg') - if (svg) { - svg.classList.remove('x:ltr:rotate-0', 'x:rtl:-rotate-180') - svg.classList.add('x:ltr:rotate-90', 'x:rtl:-rotate-270') - } - } - } - - // Move up the DOM tree - parent = parent.parentElement - - // Stop at the sidebar container - if (parent?.tagName === 'ASIDE' || parent?.tagName === 'NAV') break - } - } - }) - } - - // Try multiple times with increasing delays - setTimeout(activateLink, 0) - setTimeout(activateLink, 100) - setTimeout(activateLink, 300) - setTimeout(activateLink, 500) - - // Watch for DOM changes - const observer = new MutationObserver(activateLink) - observer.observe(document.body, { - childList: true, - subtree: true - }) - - return () => observer.disconnect() - } - }, [pathname, directRouteMap]) - - return null -} diff --git a/src/components/docs/index.tsx b/src/components/docs/index.tsx index 026b0027..8e2bba51 100644 --- a/src/components/docs/index.tsx +++ b/src/components/docs/index.tsx @@ -2,4 +2,3 @@ export { default as DocsNavbar } from './DocsNavbar'; export { default as DocsFooter } from './DocsFooter'; export { DocsBanner } from './DocsBanner'; export { default as EditViewSourceButtons } from './EditViewSourceButtons'; -export { DirectRouteHighlighter } from './DirectRouteHighlighter';