@ludo.ninja/components 2.3.45 → 2.3.47
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.
|
@@ -29,12 +29,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
29
29
|
exports.SearchInputContainer = void 0;
|
|
30
30
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
31
31
|
const react_1 = __importStar(require("react"));
|
|
32
|
-
|
|
32
|
+
const router_1 = require("next/router");
|
|
33
33
|
const lodash_debounce_1 = __importDefault(require("lodash.debounce"));
|
|
34
34
|
const styled_components_1 = __importStar(require("styled-components"));
|
|
35
35
|
const colors_1 = require("@ludo.ninja/ui/build/styles/colors");
|
|
36
36
|
const _4k_1 = require("@ludo.ninja/ui/build/utils/4k");
|
|
37
37
|
const utils_1 = require("@ludo.ninja/utils");
|
|
38
|
+
// import { useFetchFindAllTopEntitiesByName } from "@/api/server-search/queries/useFetchFindAllTopEntitiesByName";
|
|
38
39
|
const searchCloseMoreButtons_1 = __importDefault(require("./searchCloseMoreButtons"));
|
|
39
40
|
const searchSuggestions_1 = __importDefault(require("./searchSuggestions"));
|
|
40
41
|
const env_1 = require("../../store/env");
|
|
@@ -62,10 +63,10 @@ const SearchInputContainer = ({ onFocusHandler, isClearOnBlur, initializeInputCo
|
|
|
62
63
|
// const { load, topEntities, loading, clearTopEntitiesState } =
|
|
63
64
|
// useFetchFindAllTopEntitiesByName();
|
|
64
65
|
const { load, projects, loading, clearProjectsState } = (0, useFetchProjectsByTerm_1.useFetchProjectsByTerm)();
|
|
65
|
-
|
|
66
|
+
const router = (0, router_1.useRouter)();
|
|
66
67
|
(0, react_1.useEffect)(() => {
|
|
67
|
-
|
|
68
|
-
const term = new URLSearchParams(window.location.search).get("term");
|
|
68
|
+
const term = router.query?.term;
|
|
69
|
+
// const term = new URLSearchParams(window.location.search).get("term");
|
|
69
70
|
if (term) {
|
|
70
71
|
setSearchValue(term);
|
|
71
72
|
}
|
|
@@ -146,7 +147,7 @@ const SearchInputContainer = ({ onFocusHandler, isClearOnBlur, initializeInputCo
|
|
|
146
147
|
clearProjectsState();
|
|
147
148
|
// clearTopEntitiesState();
|
|
148
149
|
}
|
|
149
|
-
},
|
|
150
|
+
}, 300);
|
|
150
151
|
},
|
|
151
152
|
async keyPress(e) {
|
|
152
153
|
if (e.key === enterKey) {
|
|
@@ -156,16 +157,12 @@ const SearchInputContainer = ({ onFocusHandler, isClearOnBlur, initializeInputCo
|
|
|
156
157
|
const currentPath = window.location.pathname;
|
|
157
158
|
if (searchDomain === window.origin &&
|
|
158
159
|
seacrhTabs_1.searchTabs.find((el) => currentPath.includes(el.link))) {
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
//
|
|
163
|
-
//
|
|
164
|
-
//
|
|
165
|
-
// );
|
|
166
|
-
const newUrl = new URL(window.location.href);
|
|
167
|
-
newUrl.searchParams.set("term", newSearchValue);
|
|
168
|
-
window.history.replaceState({}, "", newUrl.toString());
|
|
160
|
+
await router.replace({
|
|
161
|
+
query: { ...router.query, term: newSearchValue },
|
|
162
|
+
}, undefined, { shallow: true });
|
|
163
|
+
// const newUrl = new URL(window.location.href);
|
|
164
|
+
// newUrl.searchParams.set("term", newSearchValue);
|
|
165
|
+
// window.history.replaceState({}, "", newUrl.toString());
|
|
169
166
|
setSearchFocused(false);
|
|
170
167
|
onFocusHandler?.(false);
|
|
171
168
|
closeOverlay();
|
|
@@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
7
|
-
|
|
7
|
+
const router_1 = require("next/router");
|
|
8
8
|
const ScreenWidth_1 = require("../../../styles/ScreenWidth");
|
|
9
9
|
const scale_1 = require("../../../utils/adaptive/scale");
|
|
10
10
|
const screen_1 = require("../../../utils/screen");
|
|
@@ -41,21 +41,21 @@ const SearchCloseIconResize = () => {
|
|
|
41
41
|
};
|
|
42
42
|
// Components
|
|
43
43
|
const SearchCloseMoreButtons = ({ isNeedToShow, position, clearSearchValue, }) => {
|
|
44
|
-
|
|
44
|
+
const router = (0, router_1.useRouter)();
|
|
45
45
|
// const { term } = router.query;
|
|
46
46
|
return ((0, jsx_runtime_1.jsx)(StyledSearchCloseMoreButtons, { position: position, children: isNeedToShow ? ((0, jsx_runtime_1.jsx)(StyledCloseIcon, { onClick: () => {
|
|
47
47
|
const term = new URLSearchParams(window.location.search).get('term');
|
|
48
48
|
if (term) {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
const params = new URLSearchParams(window.location.search);
|
|
55
|
-
params.delete('term');
|
|
56
|
-
const newUrl = `${window.location.pathname}?${params.toString()}`;
|
|
57
|
-
window.history.pushState({}, '', newUrl);
|
|
58
|
-
clearSearchValue('');
|
|
49
|
+
router
|
|
50
|
+
.push({
|
|
51
|
+
query: { ...router.query, term: [] },
|
|
52
|
+
})
|
|
53
|
+
.then(() => clearSearchValue(''));
|
|
54
|
+
// const params = new URLSearchParams(window.location.search);
|
|
55
|
+
// params.delete('term');
|
|
56
|
+
// const newUrl = `${window.location.pathname}?${params.toString()}`;
|
|
57
|
+
// window.history.pushState({}, '', newUrl);
|
|
58
|
+
// clearSearchValue('');
|
|
59
59
|
}
|
|
60
60
|
clearSearchValue('');
|
|
61
61
|
}, children: (0, jsx_runtime_1.jsx)(SearchCloseIconResize, {}) })) : null }));
|