From 1476e7f1c27b0c0292f86a70eca0f6ea773e05f3 Mon Sep 17 00:00:00 2001 From: Trance-0 <60459821+Trance-0@users.noreply.github.com> Date: Mon, 27 Oct 2025 15:12:02 -0500 Subject: [PATCH] bug fix --- app/layout.tsx | 13 +++++++------ components/docsearch.tsx | 8 ++++++-- components/navbar.client.tsx | 10 +++------- components/navbar.tsx | 2 -- 4 files changed, 16 insertions(+), 17 deletions(-) diff --git a/app/layout.tsx b/app/layout.tsx index 34372f8..28041a8 100644 --- a/app/layout.tsx +++ b/app/layout.tsx @@ -1,12 +1,13 @@ /* eslint-env node */ -import { Footer, Layout, Navbar, useThemeConfig } from 'nextra-theme-docs' -import { Banner, Head } from 'nextra/components' +import { Footer, Layout} from 'nextra-theme-docs' +import { Head } from 'nextra/components' import { getPageMap } from 'nextra/page-map' import 'nextra-theme-docs/style.css' import { SpeedInsights } from "@vercel/speed-insights/next" import { Analytics } from "@vercel/analytics/react" import 'katex/dist/katex.min.css' import AlgoliaSearch from '../components/docsearch' +import { Navbar } from '../components/navbar' export const metadata = { metadataBase: new URL('https://notenextra.trance-0.com'), @@ -31,12 +32,13 @@ export const metadata = { } export default async function RootLayout({ children }) { - const { darkMode } = useThemeConfig() + const pageMap = await getPageMap(); const navbar = ( - + @@ -47,7 +49,6 @@ export default async function RootLayout({ children }) { projectLink="https://github.com/Trance-0/NoteNextra" /> ) - const pageMap = await getPageMap() return ( } + search={} > {children} {/* SpeedInsights in vercel */} diff --git a/components/docsearch.tsx b/components/docsearch.tsx index 928b275..37c6d4d 100644 --- a/components/docsearch.tsx +++ b/components/docsearch.tsx @@ -2,16 +2,20 @@ // sample code from https://docsearch.algolia.com/docs/docsearch import { DocSearch } from '@docsearch/react'; +import {useTheme} from 'next-themes'; import '@docsearch/css'; -function AlgoliaSearch({ darkMode }: { darkMode: boolean }) { +function AlgoliaSearch () { + const {theme} = useTheme(); + const darkMode = theme === 'dark'; + console.log("darkMode", darkMode); return ( ); } diff --git a/components/navbar.client.tsx b/components/navbar.client.tsx index 9982626..e01ac4d 100644 --- a/components/navbar.client.tsx +++ b/components/navbar.client.tsx @@ -108,20 +108,16 @@ export const ClientNavbar: FC<{ item => !('href' in item) ).map(item => item.title) ) + console.log(existingCourseNames) - console.log('existingCourseNames', existingCourseNames) // filter out elements in topLevelNavbarItems with url but have title in existingCourseNames const filteredTopLevelNavbarItems = topLevelNavbarItems.filter(item => !('href' in item && existingCourseNames.has(item.title))) - console.log('filteredTopLevelNavbarItems', filteredTopLevelNavbarItems) - // or even better, remove all old doc page generated links - // this don't make sense because it will destroy the navbar structure highlight for children pages - // const filteredTopLevelNavbarItems = topLevelNavbarItems.filter(item => !('firstChildRoute' in item)) - // const items = topLevelNavbarItems // use filteredTopLevelNavbarItems to generate items const items = filteredTopLevelNavbarItems - + + console.log(filteredTopLevelNavbarItems) const themeConfig = useThemeConfig() const pathname = useFSRoute() diff --git a/components/navbar.tsx b/components/navbar.tsx index d63424b..f4173d4 100644 --- a/components/navbar.tsx +++ b/components/navbar.tsx @@ -4,10 +4,8 @@ 'use client' -import { usePathname } from 'next/navigation' import type { PageMapItem } from 'nextra' import { Anchor } from 'nextra/components' -import { normalizePages } from 'nextra/normalize-pages' import type { FC, ReactNode } from 'react' import cn from 'clsx'