-
+
+ {t("search.menu_header_text")}
}
+ />
{autocomplete.map((item) => {
return (
- {
- e.preventDefault();
- e.stopPropagation();
- }}
- value={JSON.stringify(item)}
- onSelect={(_) => {
- if (item.incomplete) {
- console.log("autocompleteItem - incomplete", item);
- updateSearch(
- t(`search.class.${item.type}`, item.type) + ":",
- );
- return;
- }
-
- if (
- JSON_SCHEMA[item.type].validation === undefined ||
- JSON_SCHEMA[item.type].validation?.(item, query)
- ) {
- console.log("autocompleteItem - trigger", item);
- if (item.replace) {
- setQuery((q) =>
- q
- .filter((i) => i.type !== item.type)
- .concat(item),
- );
- } else {
- setQueryPieces({
- type: "insert",
- value: item,
- });
- }
-
- updateSearch("");
- } // onClick?.(e);
- }}
- className={"cursor-pointer"}
- >
- {item.type} : {item.text}
-
+ handleItemSelect(item)}
+ />
);
})}
diff --git a/packages/react/src/components/header/searchbar/SearchBarAtoms.tsx b/packages/react/src/components/header/searchbar/hooks/useAutocomplete.tsx
similarity index 96%
rename from packages/react/src/components/header/searchbar/SearchBarAtoms.tsx
rename to packages/react/src/components/header/searchbar/hooks/useAutocomplete.tsx
index 22acab2ec..d60631065 100644
--- a/packages/react/src/components/header/searchbar/SearchBarAtoms.tsx
+++ b/packages/react/src/components/header/searchbar/hooks/useAutocomplete.tsx
@@ -2,8 +2,8 @@ import { atom, useAtomValue } from "jotai";
import { splitAtom } from "jotai/utils";
import { useMemo, useState } from "react";
import { useTranslation } from "react-i18next";
-import { splitSearchClassTerms } from "./helper";
-import { JSON_SCHEMA, QueryItem } from "./types";
+import { splitSearchClassTerms } from "../helper";
+import { JSON_SCHEMA, QueryItem } from "../types";
import { useClientAutocomplete } from "./useClientAutocomplete";
import { useServerAutocomplete } from "./useServerAutocomplete";
diff --git a/packages/react/src/components/header/searchbar/useClientAutocomplete.tsx b/packages/react/src/components/header/searchbar/hooks/useClientAutocomplete.tsx
similarity index 96%
rename from packages/react/src/components/header/searchbar/useClientAutocomplete.tsx
rename to packages/react/src/components/header/searchbar/hooks/useClientAutocomplete.tsx
index 26dcc55ae..4d3eff43d 100644
--- a/packages/react/src/components/header/searchbar/useClientAutocomplete.tsx
+++ b/packages/react/src/components/header/searchbar/hooks/useClientAutocomplete.tsx
@@ -1,7 +1,7 @@
import { useMemo } from "react";
-import { JSON_SCHEMA, QueryItem, VideoQueryModel } from "./types";
+import { JSON_SCHEMA, QueryItem, VideoQueryModel } from "../types";
import { useOrgs } from "@/services/orgs.service";
-import { FIRST_SEARCH } from "./helper";
+import { FIRST_SEARCH } from "../helper";
import type { TFunction } from "i18next";
import { CLIPPER_LANGS } from "@/lib/consts";
diff --git a/packages/react/src/components/header/searchbar/useServerAutocomplete.tsx b/packages/react/src/components/header/searchbar/hooks/useServerAutocomplete.tsx
similarity index 96%
rename from packages/react/src/components/header/searchbar/useServerAutocomplete.tsx
rename to packages/react/src/components/header/searchbar/hooks/useServerAutocomplete.tsx
index 5686ead05..960ca828d 100644
--- a/packages/react/src/components/header/searchbar/useServerAutocomplete.tsx
+++ b/packages/react/src/components/header/searchbar/hooks/useServerAutocomplete.tsx
@@ -1,4 +1,4 @@
-import { AC_Response, QueryItem, VideoQueryModel } from "./types";
+import { AC_Response, QueryItem, VideoQueryModel } from "../types";
import { useQuery } from "@tanstack/react-query";
import { useClient } from "@/hooks/useClient";
diff --git a/packages/react/src/shadcn/ui/command.tsx b/packages/react/src/shadcn/ui/command.tsx
index 93f533754..7f1044201 100644
--- a/packages/react/src/shadcn/ui/command.tsx
+++ b/packages/react/src/shadcn/ui/command.tsx
@@ -13,7 +13,7 @@ const Command = React.forwardRef<