@ludo.ninja/components 2.2.39 → 2.2.40
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -22,5 +22,5 @@ interface IUseSearch {
|
|
|
22
22
|
searchCloseButton: ReactNode;
|
|
23
23
|
}) => ReactNode;
|
|
24
24
|
}
|
|
25
|
-
export declare const SearchInputContainer: ({ onFocusHandler, isClearOnBlur, initializeInputComponent }: IUseSearch) => import("react/jsx-runtime").JSX.Element;
|
|
25
|
+
export declare const SearchInputContainer: ({ onFocusHandler, isClearOnBlur, initializeInputComponent, }: IUseSearch) => import("react/jsx-runtime").JSX.Element;
|
|
26
26
|
export {};
|
|
@@ -28,25 +28,25 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
29
|
exports.SearchInputContainer = void 0;
|
|
30
30
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
31
|
+
const react_1 = __importStar(require("react"));
|
|
32
|
+
// import { useRouter } from "next/router";
|
|
33
|
+
const lodash_debounce_1 = __importDefault(require("lodash.debounce"));
|
|
34
|
+
const styled_components_1 = __importStar(require("styled-components"));
|
|
35
|
+
const colors_1 = require("@ludo.ninja/ui/build/styles/colors");
|
|
36
|
+
const _4k_1 = require("@ludo.ninja/ui/build/utils/4k");
|
|
37
|
+
const utils_1 = require("@ludo.ninja/utils");
|
|
31
38
|
const useFetchFindAllTopEntitiesByName_1 = require("../../api/server-search/queries/useFetchFindAllTopEntitiesByName");
|
|
32
39
|
const searchCloseMoreButtons_1 = __importDefault(require("./searchCloseMoreButtons"));
|
|
33
40
|
const searchSuggestions_1 = __importDefault(require("./searchSuggestions"));
|
|
34
|
-
const back_svg_1 = __importDefault(require("../../public/search/back"));
|
|
35
41
|
const env_1 = require("../../store/env");
|
|
36
42
|
const ui_1 = require("../../store/ui");
|
|
37
43
|
const ScreenWidth_1 = require("../../styles/ScreenWidth");
|
|
38
44
|
const screen_1 = require("../../utils/screen");
|
|
39
45
|
const seacrhTabs_1 = require("../../utils/seacrhTabs");
|
|
46
|
+
const back_svg_1 = __importDefault(require("../../public/search/back"));
|
|
40
47
|
const ludoDomains_1 = require("@ludo.ninja/core/build/ludoDomains");
|
|
41
|
-
const colors_1 = require("@ludo.ninja/ui/build/styles/colors");
|
|
42
|
-
const _4k_1 = require("@ludo.ninja/ui/build/utils/4k");
|
|
43
|
-
const utils_1 = require("@ludo.ninja/utils");
|
|
44
|
-
// import { useRouter } from "next/router";
|
|
45
|
-
const lodash_debounce_1 = __importDefault(require("lodash.debounce"));
|
|
46
|
-
const react_1 = __importStar(require("react"));
|
|
47
|
-
const styled_components_1 = __importStar(require("styled-components"));
|
|
48
48
|
const enterKey = "Enter";
|
|
49
|
-
const SearchInputContainer = ({ onFocusHandler, isClearOnBlur, initializeInputComponent }) => {
|
|
49
|
+
const SearchInputContainer = ({ onFocusHandler, isClearOnBlur, initializeInputComponent, }) => {
|
|
50
50
|
const NEXT_PUBLIC_ENV_VALUE = (0, env_1.useEnvStore)((state) => state.NEXT_PUBLIC_ENV_VALUE);
|
|
51
51
|
const inputSearch = (0, react_1.useRef)(null);
|
|
52
52
|
const [searchValue, setSearchValue] = (0, react_1.useState)("");
|
|
@@ -84,8 +84,10 @@ const SearchInputContainer = ({ onFocusHandler, isClearOnBlur, initializeInputCo
|
|
|
84
84
|
}, [debouncedValue]);
|
|
85
85
|
const [isMobileOpen, setIsMobileOpen] = (0, react_1.useState)(false);
|
|
86
86
|
const Container = isMobileOpen ? SMobileContainer : react_1.default.Fragment;
|
|
87
|
-
const SearchContainer = isMobileOpen
|
|
88
|
-
|
|
87
|
+
const SearchContainer = isMobileOpen
|
|
88
|
+
? SMobileSearchContainer
|
|
89
|
+
: react_1.default.Fragment;
|
|
90
|
+
const searchSuggestion = ((0, jsx_runtime_1.jsx)(searchSuggestions_1.default, { isLoading: loading || isDebounceLoading, searchTerm: debouncedValue, assets: topEntities?.assets || [], profiles: topEntities?.profiles || [], collections: topEntities?.collections || [] }));
|
|
89
91
|
return ((0, jsx_runtime_1.jsxs)(Container, { children: [(0, jsx_runtime_1.jsxs)(SearchContainer, { children: [isMobileOpen && ((0, jsx_runtime_1.jsx)(back_svg_1.default, { onClick: () => {
|
|
90
92
|
setIsMobileOpen(false);
|
|
91
93
|
(0, utils_1.rootRemoveOverflow)();
|
|
@@ -143,7 +145,8 @@ const SearchInputContainer = ({ onFocusHandler, isClearOnBlur, initializeInputCo
|
|
|
143
145
|
const newSearchValue = value.length ? searchValue : "";
|
|
144
146
|
const searchDomain = ludoDomains_1.ludoDomains[NEXT_PUBLIC_ENV_VALUE]["search"];
|
|
145
147
|
const currentPath = window.location.pathname;
|
|
146
|
-
if (searchDomain === window.origin &&
|
|
148
|
+
if (searchDomain === window.origin &&
|
|
149
|
+
seacrhTabs_1.searchTabs.find((el) => currentPath.includes(el.link))) {
|
|
147
150
|
// await router.replace(
|
|
148
151
|
// {
|
|
149
152
|
// query: { ...router.query, term: newSearchValue },
|
|
@@ -171,13 +174,13 @@ const SearchInputContainer = ({ onFocusHandler, isClearOnBlur, initializeInputCo
|
|
|
171
174
|
}
|
|
172
175
|
},
|
|
173
176
|
},
|
|
174
|
-
searchSuggestion: !isMobile && searchValue && (0, jsx_runtime_1.jsx)("div", { className: "suggestionBar", children: searchSuggestion
|
|
177
|
+
searchSuggestion: !isMobile && searchValue && ((0, jsx_runtime_1.jsx)("div", { className: "suggestionBar", children: searchSuggestion })),
|
|
175
178
|
searchCloseButton: ((0, jsx_runtime_1.jsx)(searchCloseMoreButtons_1.default, { isNeedToShow: Boolean(searchValue.length), position: {
|
|
176
179
|
top: "50%",
|
|
177
180
|
right: "0",
|
|
178
181
|
transform: "translate(-50%, -50%)",
|
|
179
182
|
}, clearSearchValue: setSearchValue })),
|
|
180
|
-
})] }), isMobileOpen && searchValue && (0, jsx_runtime_1.jsx)(SSuggestions, { children: searchSuggestion
|
|
183
|
+
})] }), isMobileOpen && searchValue && ((0, jsx_runtime_1.jsx)(SSuggestions, { children: searchSuggestion }))] }));
|
|
181
184
|
};
|
|
182
185
|
exports.SearchInputContainer = SearchInputContainer;
|
|
183
186
|
const show = (0, styled_components_1.keyframes) `
|
|
@@ -71,11 +71,11 @@ const StyledSearchSuggestions = styled_components_1.default.div `
|
|
|
71
71
|
`;
|
|
72
72
|
// Components
|
|
73
73
|
const SearchSuggestions = ({ searchTerm, assets, profiles, collections, isLoading }) => {
|
|
74
|
-
const isNotFound = !assets?.length && !profiles?.length && !collections?.length;
|
|
75
74
|
const { getMediaENVDomain, NEXT_PUBLIC_ENV_VALUE } = (0, env_1.useEnvStore)((state) => ({
|
|
76
75
|
getMediaENVDomain: state.getMediaDomain,
|
|
77
76
|
NEXT_PUBLIC_ENV_VALUE: state.NEXT_PUBLIC_ENV_VALUE,
|
|
78
77
|
}));
|
|
78
|
+
const isNotFound = !assets?.length && !profiles?.length && !collections?.length;
|
|
79
79
|
return ((0, jsx_runtime_1.jsx)(StyledSearchSuggestions, { children: (0, jsx_runtime_1.jsxs)("div", { className: "content", children: [isLoading && (0, jsx_runtime_1.jsx)(searchSuggestionsItemSkeleton_1.SearchSuggestionsItemsSkeleton, {}), !isLoading &&
|
|
80
80
|
(isNotFound ? ((0, jsx_runtime_1.jsx)(searchSuggestionsNotFound_1.default, { notFoundText: searchTerm })) : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("div", { className: "scroller", children: [
|
|
81
81
|
...(assets?.length
|