mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-08-20 01:50:58 +00:00
3c087f6fd9
fumadocs-core 16.14.5 switched its search engine from Orama to zbsearch 4,
so the panel docs follow it up to the same major.
zbsearch 4 still rejects locale codes as tokenizer languages ("en" throws,
only "english" is accepted), so the custom search dialog that forces an
English index stays necessary — verified by loading the built static index
for all four locales and searching it through fumadocs' own client.
Around that:
- use `staticClient`, as `oramaStaticClient` is now a deprecated alias
- drop @orama/orama, which nothing depends on or imports any more
- correct the two comments that still described Orama and pointed at its
docs and tokenizer package, one of them suggesting a language zbsearch
does not have
- restore the corepack integrity hash on `packageManager`, which CI reads
through pnpm/action-setup
- prune minimumReleaseAgeExclude entries for versions no longer installed
The API reference MDX changes are serialization-only: fumadocs-openapi
11.2.4 emits plain scalars where it used folded ones. Parsed frontmatter
and page bodies are unchanged.
53 lines
1.5 KiB
TypeScript
53 lines
1.5 KiB
TypeScript
'use client';
|
|
|
|
import { create } from 'zbsearch';
|
|
import { useDocsSearch } from 'fumadocs-core/search/client';
|
|
import { staticClient } from 'fumadocs-core/search/client/orama-static';
|
|
import {
|
|
SearchDialog,
|
|
SearchDialogClose,
|
|
SearchDialogContent,
|
|
SearchDialogHeader,
|
|
SearchDialogIcon,
|
|
SearchDialogInput,
|
|
SearchDialogList,
|
|
SearchDialogOverlay,
|
|
} from 'fumadocs-ui/components/dialog/search';
|
|
import { useI18n } from 'fumadocs-ui/contexts/i18n';
|
|
import { useMemo } from 'react';
|
|
|
|
interface SharedProps {
|
|
open: boolean;
|
|
onOpenChange: (open: boolean) => void;
|
|
}
|
|
|
|
// Fumadocs' default dialog passes the index's locale code as a tokenizer language,
|
|
// and zbsearch throws on anything but a full name — so force "english" everywhere.
|
|
export default function SearchDialogClient(props: SharedProps) {
|
|
const { locale } = useI18n();
|
|
const client = useMemo(
|
|
() =>
|
|
staticClient({
|
|
from: '/api/search',
|
|
locale,
|
|
initDB: () => create({ schema: { _: 'string' }, language: 'english' }),
|
|
}),
|
|
[locale],
|
|
);
|
|
const { search, setSearch, query } = useDocsSearch({ client });
|
|
|
|
return (
|
|
<SearchDialog search={search} onSearchChange={setSearch} isLoading={query.isLoading} {...props}>
|
|
<SearchDialogOverlay />
|
|
<SearchDialogContent>
|
|
<SearchDialogHeader>
|
|
<SearchDialogIcon />
|
|
<SearchDialogInput />
|
|
<SearchDialogClose />
|
|
</SearchDialogHeader>
|
|
<SearchDialogList items={query.data !== 'empty' ? query.data : null} />
|
|
</SearchDialogContent>
|
|
</SearchDialog>
|
|
);
|
|
}
|