bug fix
This commit is contained in:
@@ -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'}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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'
|
||||
|
||||
Reference in New Issue
Block a user