fixed docsearch!!!
This commit is contained in:
@@ -7,8 +7,8 @@ import {useTheme} from 'next-themes';
|
|||||||
import '@docsearch/css';
|
import '@docsearch/css';
|
||||||
|
|
||||||
function AlgoliaSearch () {
|
function AlgoliaSearch () {
|
||||||
const {theme} = useTheme();
|
const {theme, systemTheme} = useTheme();
|
||||||
const darkMode = theme === 'dark';
|
const darkMode = theme === 'dark' || (theme === 'system' && systemTheme === 'dark');
|
||||||
console.log("darkMode", darkMode);
|
console.log("darkMode", darkMode);
|
||||||
return (
|
return (
|
||||||
<DocSearch
|
<DocSearch
|
||||||
@@ -16,6 +16,22 @@ function AlgoliaSearch () {
|
|||||||
indexName={process.env.NEXT_SEARCH_ALGOLIA_INDEX_NAME || 'notenextra_trance_0'}
|
indexName={process.env.NEXT_SEARCH_ALGOLIA_INDEX_NAME || 'notenextra_trance_0'}
|
||||||
apiKey={process.env.NEXT_SEARCH_ALGOLIA_API_KEY || '727b389a61e862e590dfab9ce9df31a2'}
|
apiKey={process.env.NEXT_SEARCH_ALGOLIA_API_KEY || '727b389a61e862e590dfab9ce9df31a2'}
|
||||||
theme={darkMode===false ? 'light' : 'dark'}
|
theme={darkMode===false ? 'light' : 'dark'}
|
||||||
|
// this is the first time that AI is solving some problem that I have no idea how to solve
|
||||||
|
// BEGIN OF CODE GENERATED BY AI
|
||||||
|
transformItems={(items) =>
|
||||||
|
// DocSearch lets you sanitize results before render. Filter out hits that don’t have a URL and give lvl0 a safe fallback.
|
||||||
|
items
|
||||||
|
.filter((i) => typeof i.url === 'string' && i.url) // drop records with null/empty url
|
||||||
|
.map((i) => ({
|
||||||
|
...i,
|
||||||
|
hierarchy: {
|
||||||
|
...i.hierarchy,
|
||||||
|
// ensure strings for all places DocSearch prints text
|
||||||
|
lvl0: i.hierarchy?.lvl0 ?? i.hierarchy?.lvl1 ?? 'Documentation',
|
||||||
|
},
|
||||||
|
}))
|
||||||
|
}
|
||||||
|
// END OF CODE GENERATED BY AI
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
1
next-env.d.ts
vendored
1
next-env.d.ts
vendored
@@ -1,5 +1,6 @@
|
|||||||
/// <reference types="next" />
|
/// <reference types="next" />
|
||||||
/// <reference types="next/image-types/global" />
|
/// <reference types="next/image-types/global" />
|
||||||
|
import "./.next/dev/types/routes.d.ts";
|
||||||
|
|
||||||
// NOTE: This file should not be edited
|
// NOTE: This file should not be edited
|
||||||
// see https://nextjs.org/docs/app/api-reference/config/typescript for more information.
|
// see https://nextjs.org/docs/app/api-reference/config/typescript for more information.
|
||||||
|
|||||||
22
package.json
22
package.json
@@ -8,23 +8,23 @@
|
|||||||
"start": "next start"
|
"start": "next start"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@docsearch/react": "^4.0.0-beta.2",
|
"@docsearch/react": "^4.3.1",
|
||||||
"@napi-rs/simple-git": "^0.1.22",
|
"@napi-rs/simple-git": "^0.1.22",
|
||||||
"@next/bundle-analyzer": "^15.3.5",
|
"@next/bundle-analyzer": "^16.0.1",
|
||||||
"@vercel/analytics": "^1.5.0",
|
"@vercel/analytics": "^1.5.0",
|
||||||
"@vercel/speed-insights": "^1.2.0",
|
"@vercel/speed-insights": "^1.2.0",
|
||||||
"cross-env": "^7.0.3",
|
"cross-env": "^10.1.0",
|
||||||
"katex": "^0.16.22",
|
"katex": "^0.16.25",
|
||||||
"next": "^15.5.2",
|
"next": "^16.0.1",
|
||||||
"next-sitemap": "^4.2.3",
|
"next-sitemap": "^4.2.3",
|
||||||
"nextra": "^4.2.17",
|
"nextra": "^4.6.0",
|
||||||
"nextra-theme-docs": "^4.2.17",
|
"nextra-theme-docs": "^4.6.0",
|
||||||
"pagefind": "^1.4.0",
|
"pagefind": "^1.4.0",
|
||||||
"react": "^19.1.0",
|
"react": "^19.2.0",
|
||||||
"react-dom": "^19.1.0"
|
"react-dom": "^19.2.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/node": "24.0.10",
|
"@types/node": "24.10.0",
|
||||||
"@types/react": "19.1.8"
|
"@types/react": "19.2.2"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
"moduleResolution": "bundler",
|
"moduleResolution": "bundler",
|
||||||
"resolveJsonModule": true,
|
"resolveJsonModule": true,
|
||||||
"isolatedModules": true,
|
"isolatedModules": true,
|
||||||
"jsx": "preserve",
|
"jsx": "react-jsx",
|
||||||
"plugins": [
|
"plugins": [
|
||||||
{
|
{
|
||||||
"name": "next"
|
"name": "next"
|
||||||
@@ -28,7 +28,8 @@
|
|||||||
"**/*.ts",
|
"**/*.ts",
|
||||||
"**/*.tsx",
|
"**/*.tsx",
|
||||||
"next-env.d.ts",
|
"next-env.d.ts",
|
||||||
".next/types/**/*.ts"
|
".next/types/**/*.ts",
|
||||||
|
".next/dev/types/**/*.ts"
|
||||||
],
|
],
|
||||||
"exclude": [
|
"exclude": [
|
||||||
"node_modules"
|
"node_modules"
|
||||||
|
|||||||
Reference in New Issue
Block a user