This commit is contained in:
Trance-0
2025-10-27 15:12:02 -05:00
parent f634254bca
commit 1476e7f1c2
4 changed files with 16 additions and 17 deletions

View File

@@ -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 (
<DocSearch
appId={process.env.NEXT_SEARCH_ALGOLIA_APP_ID || 'NKGLZZZUBC'}
indexName={process.env.NEXT_SEARCH_ALGOLIA_INDEX_NAME || 'notenextra_trance_0'}
apiKey={process.env.NEXT_SEARCH_ALGOLIA_API_KEY || '727b389a61e862e590dfab9ce9df31a2'}
theme={darkMode ? 'dark' : 'light'}
theme={darkMode===false ? 'light' : 'dark'}
/>
);
}

View File

@@ -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()

View File

@@ -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'