chore(plugin-search): make the search case-insensitive
This commit is contained in:
parent
666c80456a
commit
5893795d59
|
@ -163,11 +163,13 @@ export function PluginPage() {
|
|||
const chatStore = useChatStore();
|
||||
|
||||
const currentLang = getLang();
|
||||
const supportedLangs = ['cn', 'ru'];
|
||||
const supportedLangs = ["cn", "ru"];
|
||||
const allPlugins = pluginStore
|
||||
.getAll()
|
||||
.filter(
|
||||
(m) => supportedLangs.includes(currentLang) ? m.lang === currentLang : m.lang === 'en'
|
||||
.filter((m) =>
|
||||
supportedLangs.includes(currentLang)
|
||||
? m.lang === currentLang
|
||||
: m.lang === "en",
|
||||
);
|
||||
|
||||
const [searchPlugins, setSearchPlugins] = useState<Plugin[]>([]);
|
||||
|
@ -178,7 +180,9 @@ export function PluginPage() {
|
|||
const onSearch = (text: string) => {
|
||||
setSearchText(text);
|
||||
if (text.length > 0) {
|
||||
const result = allPlugins.filter((m) => m.name.includes(text));
|
||||
const result = allPlugins.filter((m) =>
|
||||
m.name.toLowerCase().includes(text.toLowerCase()),
|
||||
);
|
||||
setSearchPlugins(result);
|
||||
} else {
|
||||
setSearchPlugins(allPlugins);
|
||||
|
|
Loading…
Reference in New Issue