@nyris/nyris-webapp 0.3.54 → 0.3.56

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.
Files changed (110) hide show
  1. package/build/asset-manifest.json +8 -7
  2. package/build/images/fav2/android-chrome-192x192.png +0 -0
  3. package/build/images/fav2/android-chrome-512x512.png +0 -0
  4. package/build/images/fav2/apple-touch-icon.png +0 -0
  5. package/build/images/fav2/browserconfig.xml +9 -0
  6. package/build/images/fav2/favicon-16x16.png +0 -0
  7. package/build/images/fav2/favicon-32x32.png +0 -0
  8. package/build/images/fav2/favicon.ico +0 -0
  9. package/build/images/fav2/mstile-144x144.png +0 -0
  10. package/build/images/fav2/mstile-150x150.png +0 -0
  11. package/build/images/fav2/mstile-310x150.png +0 -0
  12. package/build/images/fav2/mstile-310x310.png +0 -0
  13. package/build/images/fav2/mstile-70x70.png +0 -0
  14. package/build/images/fav2/safari-pinned-tab.svg +67 -0
  15. package/build/images/fav2/site.webmanifest +19 -0
  16. package/build/index.html +1 -1
  17. package/build/js/settings.example.js +1 -0
  18. package/build/manifest.json +13 -18
  19. package/build/static/css/main.abb86fa9.css +2 -0
  20. package/build/static/css/main.abb86fa9.css.map +1 -0
  21. package/build/static/js/main.2f1ab11c.js +3 -0
  22. package/build/static/js/{main.03fb1bc6.js.LICENSE.txt → main.2f1ab11c.js.LICENSE.txt} +1 -1
  23. package/build/static/js/main.2f1ab11c.js.map +1 -0
  24. package/build/static/media/path.b99a15de38340a04f80828bceeab9884.svg +3 -0
  25. package/package.json +3 -3
  26. package/public/images/fav2/android-chrome-192x192.png +0 -0
  27. package/public/images/fav2/android-chrome-512x512.png +0 -0
  28. package/public/images/fav2/apple-touch-icon.png +0 -0
  29. package/public/images/fav2/browserconfig.xml +9 -0
  30. package/public/images/fav2/favicon-16x16.png +0 -0
  31. package/public/images/fav2/favicon-32x32.png +0 -0
  32. package/public/images/fav2/favicon.ico +0 -0
  33. package/public/images/fav2/mstile-144x144.png +0 -0
  34. package/public/images/fav2/mstile-150x150.png +0 -0
  35. package/public/images/fav2/mstile-310x150.png +0 -0
  36. package/public/images/fav2/mstile-310x310.png +0 -0
  37. package/public/images/fav2/mstile-70x70.png +0 -0
  38. package/public/images/fav2/safari-pinned-tab.svg +67 -0
  39. package/public/images/fav2/site.webmanifest +19 -0
  40. package/public/index.html +8 -90
  41. package/public/js/settings.example.js +1 -0
  42. package/public/manifest.json +13 -18
  43. package/src/Store/Store.ts +0 -1
  44. package/src/Store/search/Search.ts +33 -74
  45. package/src/Store/search/search.initialState.ts +5 -4
  46. package/src/Store/search/types.ts +5 -4
  47. package/src/common/assets/icons/path.svg +3 -0
  48. package/src/components/AppMobile.tsx +0 -1
  49. package/src/components/DragDropFile.tsx +36 -28
  50. package/src/components/Experience-visual-search/ExperienceVisualSearch.scss +3 -4
  51. package/src/components/Experience-visual-search/ExperienceVisualSearch.tsx +14 -7
  52. package/src/components/Feedback.tsx +5 -5
  53. package/src/components/FooterMobile.tsx +4 -5
  54. package/src/components/GoBackButton.tsx +54 -0
  55. package/src/components/Header.tsx +27 -3
  56. package/src/components/HeaderMobile.tsx +29 -12
  57. package/src/components/ImagePreviewMobile.tsx +6 -3
  58. package/src/components/Inquiry/InquiryBanner.tsx +1 -1
  59. package/src/components/Layout.tsx +5 -14
  60. package/src/components/PanelResult/PostFilterAlgolia.tsx +3 -2
  61. package/src/components/ProductDetailView.tsx +338 -330
  62. package/src/components/ProductList/index.tsx +1 -1
  63. package/src/components/appMobile.scss +7 -0
  64. package/src/components/clear-refinements/clear-refinements.tsx +1 -1
  65. package/src/components/common.scss +18 -7
  66. package/src/components/current-refinements/current-refinements.tsx +11 -27
  67. package/src/components/drawer/cameraCustom.tsx +12 -1
  68. package/src/components/input/inputSearch.tsx +79 -21
  69. package/src/components/pre-filter/index.tsx +23 -7
  70. package/src/components/results/ItemResult.tsx +288 -285
  71. package/src/index.tsx +12 -14
  72. package/src/page/landingPage/AppMobile.tsx +3 -9
  73. package/src/page/landingPage/common.scss +170 -48
  74. package/src/page/result/index.tsx +114 -86
  75. package/src/translations.ts +3 -0
  76. package/src/types.ts +1 -0
  77. package/build/images/fav/android-icon-192x192.png +0 -0
  78. package/build/images/fav/apple-icon-114x114.png +0 -0
  79. package/build/images/fav/apple-icon-120x120.png +0 -0
  80. package/build/images/fav/apple-icon-144x144.png +0 -0
  81. package/build/images/fav/apple-icon-152x152.png +0 -0
  82. package/build/images/fav/apple-icon-180x180.png +0 -0
  83. package/build/images/fav/apple-icon-57x57.png +0 -0
  84. package/build/images/fav/apple-icon-60x60.png +0 -0
  85. package/build/images/fav/apple-icon-72x72.png +0 -0
  86. package/build/images/fav/apple-icon-76x76.png +0 -0
  87. package/build/images/fav/browserconfig.xml +0 -2
  88. package/build/images/fav/favicon-16x16.png +0 -0
  89. package/build/images/fav/favicon-32x32.png +0 -0
  90. package/build/images/fav/favicon-96x96.png +0 -0
  91. package/build/images/fav/manifest.json +0 -35
  92. package/build/static/css/main.8c0eb6c0.css +0 -2
  93. package/build/static/css/main.8c0eb6c0.css.map +0 -1
  94. package/build/static/js/main.03fb1bc6.js +0 -3
  95. package/build/static/js/main.03fb1bc6.js.map +0 -1
  96. package/public/images/fav/android-icon-192x192.png +0 -0
  97. package/public/images/fav/apple-icon-114x114.png +0 -0
  98. package/public/images/fav/apple-icon-120x120.png +0 -0
  99. package/public/images/fav/apple-icon-144x144.png +0 -0
  100. package/public/images/fav/apple-icon-152x152.png +0 -0
  101. package/public/images/fav/apple-icon-180x180.png +0 -0
  102. package/public/images/fav/apple-icon-57x57.png +0 -0
  103. package/public/images/fav/apple-icon-60x60.png +0 -0
  104. package/public/images/fav/apple-icon-72x72.png +0 -0
  105. package/public/images/fav/apple-icon-76x76.png +0 -0
  106. package/public/images/fav/browserconfig.xml +0 -2
  107. package/public/images/fav/favicon-16x16.png +0 -0
  108. package/public/images/fav/favicon-32x32.png +0 -0
  109. package/public/images/fav/favicon-96x96.png +0 -0
  110. package/public/images/fav/manifest.json +0 -35
@@ -51,7 +51,7 @@ function ProductListComponent({
51
51
  !isSearchStalled
52
52
  ) {
53
53
  return (
54
- <div style={{ marginTop: '50px', width: '100%', textAlign: 'center' }}>
54
+ <div style={{ marginTop: '50px', width: '100%', textAlign: 'center', marginBottom: '12px' }}>
55
55
  {t('No products were found matching your search criteria.')}
56
56
  </div>
57
57
  );
@@ -691,6 +691,13 @@
691
691
  max-width: 180px !important;
692
692
  }
693
693
  }
694
+ .box-wrap-result-component {
695
+ .box-result {
696
+ div.go-back-mobile-container {
697
+ width: 360px;
698
+ }
699
+ }
700
+ }
694
701
  }
695
702
  .pre-filter-icon {
696
703
  display: flex;
@@ -32,7 +32,7 @@ function ClearRefinementsComponent({
32
32
  style={{
33
33
  color: settings.theme.secondaryColor,
34
34
  fontWeight: 'bold',
35
- textTransform: 'capitalize',
35
+ textTransform: 'none',
36
36
  padding: 0,
37
37
  }}
38
38
  >
@@ -49,8 +49,8 @@
49
49
  justify-content: space-between;
50
50
  overflow: hidden;
51
51
  .box-header-newVersion-main {
52
- height: 50px;
53
- min-height: 50px;
52
+ height: 58px;
53
+ min-height: 58px;
54
54
  border-bottom: 1px solid #E0E0E0;
55
55
 
56
56
  .box-content {
@@ -142,22 +142,33 @@
142
142
  }
143
143
 
144
144
  .feedback-floating {
145
- margin-left: -24px;
146
145
  height: fit-content;
147
- bottom: 35px;
148
- position: fixed;
146
+ right: 18px;
147
+ position: absolute;
149
148
  z-index: 201;
150
149
  display: flex;
151
150
  justify-content: flex-end;
152
151
 
152
+ .feedback-section {
153
+ position: fixed;
154
+ bottom: 40px;
155
+ @media screen and (max-width: 776px) {
156
+ margin-left: 0px;
157
+ // height: fit-content !important;
158
+ bottom: 125px;
159
+
160
+ }
161
+ }
162
+
153
163
  @media screen and (max-width: 776px) {
154
164
  margin-left: 0px;
155
165
  height: fit-content !important;
156
- bottom: 105px;
157
- justify-content: center !important;
166
+ right: 40px;
167
+
158
168
  }
159
169
  }
160
170
 
171
+
161
172
  .feedback-wrapper {
162
173
  background-color: #e4e3fff7;
163
174
  mix-blend-mode: multiply;
@@ -1,7 +1,5 @@
1
1
  import React, { useEffect, useState } from 'react';
2
2
  import classNames from 'classnames';
3
- import { m } from 'framer-motion';
4
- import { atom } from 'jotai';
5
3
  import { useMemo } from 'react';
6
4
  import type {
7
5
  CurrentRefinementsProvided,
@@ -10,8 +8,9 @@ import type {
10
8
  import { connectCurrentRefinements } from 'react-instantsearch-dom';
11
9
  import { getCurrentRefinement } from './getCurrentRefinement';
12
10
  import { ClearRefinements } from 'components/clear-refinements/clear-refinements';
13
- import ChipComponent from 'components/chip/chip';
14
11
  import { useAppSelector } from 'Store/Store';
12
+ import { useTranslation } from 'react-i18next';
13
+ import CloseOutlinedIcon from "@material-ui/icons/CloseOutlined";
15
14
 
16
15
  export type CurrentRefinementsProps = CurrentRefinementsProvided & {
17
16
  header?: string;
@@ -25,8 +24,6 @@ export type CurrentRefinement = {
25
24
  value: RefinementValue;
26
25
  };
27
26
 
28
- export const refinementCountAtom = atom(0);
29
-
30
27
  function CurrentRefinementsComponent({
31
28
  items,
32
29
  refine,
@@ -35,6 +32,7 @@ function CurrentRefinementsComponent({
35
32
  }: CurrentRefinementsProps) {
36
33
  const stateGlobal = useAppSelector(state => state);
37
34
  const { settings } = stateGlobal;
35
+ const { t } = useTranslation();
38
36
  const [newItems, setListItems] = useState<any[]>([]);
39
37
 
40
38
  useEffect(() => {
@@ -61,33 +59,19 @@ function CurrentRefinementsComponent({
61
59
  <div
62
60
  className={className}
63
61
  style={{
64
- marginBottom: refinements.length > 0 ? '10px' : '0px',
65
- marginTop: refinements.length > 0 ? '16px' : '0px',
62
+ marginBottom: '16px',
66
63
  }}
67
64
  >
68
65
  <ul className="flex flex-wrap gap-3">
69
66
  {refinements.map(refinement => {
70
67
  return (
71
- <m.li key={[refinement.category, refinement.label].join(':')}>
72
- <ChipComponent
73
- closeIcon={true}
68
+ <li key={[refinement.category, refinement.label].join(':')}>
69
+ {refinement.label}
70
+ <CloseOutlinedIcon
71
+ style={{ fontSize: '14px', fontWeight: 'bold', cursor: 'pointer' }}
74
72
  onClick={() => refine(refinement.value)}
75
- >
76
- {refinement.category && (
77
- <div className="text-f12">{refinement.category}:</div>
78
- )}
79
- <div
80
- className="capitalize fw-700"
81
- style={{
82
- marginLeft: 5,
83
- textTransform: 'capitalize',
84
- marginRight: 10,
85
- }}
86
- >
87
- {refinement.label}
88
- </div>
89
- </ChipComponent>
90
- </m.li>
73
+ />
74
+ </li>
91
75
  );
92
76
  })}
93
77
  <li
@@ -97,7 +81,7 @@ function CurrentRefinementsComponent({
97
81
  })}
98
82
  >
99
83
  <ClearRefinements className="text-f12 fw-600">
100
- Clear all
84
+ {t('Clear all')}
101
85
  </ClearRefinements>
102
86
  </li>
103
87
  </ul>
@@ -19,6 +19,11 @@ import {
19
19
  loadingActionResults,
20
20
  setRegions,
21
21
  setSelectedRegion,
22
+ setShowFeedback,
23
+ setFirstSearchResults,
24
+ setFirstSearchImage,
25
+ setFirstSearchPrefilters,
26
+ setFirstSearchThumbSearchInput
22
27
  } from 'Store/search/Search';
23
28
  import { useAppDispatch, useAppSelector } from 'Store/Store';
24
29
 
@@ -78,7 +83,7 @@ function CameraCustom(props: Props) {
78
83
  const preFilterValues = [
79
84
  {
80
85
  key: settings.visualSearchFilterKey,
81
- values: Object.keys(preFilter) as string[],
86
+ values: Object.keys(preFilter),
82
87
  },
83
88
  ];
84
89
  let filters: any[] = [];
@@ -102,6 +107,12 @@ function CameraCustom(props: Props) {
102
107
  };
103
108
  dispatch(setSearchResults(payload));
104
109
  dispatch(updateStatusLoading(false));
110
+ dispatch(setShowFeedback(true));
111
+ // go back
112
+ dispatch(setFirstSearchResults(payload));
113
+ dispatch(setFirstSearchImage(imageConvert));
114
+ dispatch(setFirstSearchPrefilters(preFilter));
115
+ dispatch(setFirstSearchThumbSearchInput(image));
105
116
  })
106
117
  .catch((e: any) => {
107
118
  console.log('error input search', e);
@@ -5,7 +5,14 @@ import CloseIcon from '@material-ui/icons/Close';
5
5
  import IconCamera from 'common/assets/icons/camera.svg';
6
6
  import { useQuery } from 'hooks/useQuery';
7
7
  import { debounce, isEmpty } from 'lodash';
8
- import React, { memo, useCallback, useEffect, useRef, useState } from 'react';
8
+ import React, {
9
+ memo,
10
+ useCallback,
11
+ useEffect,
12
+ useMemo,
13
+ useRef,
14
+ useState,
15
+ } from 'react';
9
16
  import { useDropzone } from 'react-dropzone';
10
17
  import { connectSearchBox } from 'react-instantsearch-dom';
11
18
  import { useMediaQuery } from 'react-responsive';
@@ -24,20 +31,30 @@ import {
24
31
  setRegions,
25
32
  setSelectedRegion,
26
33
  updateQueryText,
34
+ setShowFeedback,
35
+ setFirstSearchResults,
36
+ setFirstSearchImage,
37
+ setFirstSearchPrefilters,
38
+ setFirstSearchThumbSearchInput,
27
39
  } from 'Store/search/Search';
28
40
  import { useAppDispatch, useAppSelector } from 'Store/Store';
29
41
  import DefaultModal from 'components/modal/DefaultModal';
30
42
  import PreFilterComponent from 'components/pre-filter';
31
43
  import { RectCoords } from '@nyris/nyris-api';
32
44
  import { useTranslation } from 'react-i18next';
45
+ import { useAuth0 } from '@auth0/auth0-react';
33
46
 
34
47
  const SearchBox = (props: any) => {
35
48
  const { refine, onToggleFilterMobile }: any = props;
36
49
  // const containerRefInputMobile = useRef<HTMLDivElement>(null);
37
50
  const stateGlobal = useAppSelector(state => state);
38
51
  const { search, settings } = stateGlobal;
39
- const { imageThumbSearchInput, preFilter, requestImage, selectedRegion } =
40
- search;
52
+ const {
53
+ imageThumbSearchInput,
54
+ preFilter,
55
+ requestImage,
56
+ selectedRegion,
57
+ } = search;
41
58
  const focusInp: any = useRef<HTMLDivElement | null>(null);
42
59
  const history = useHistory();
43
60
  const [valueInput, setValueInput] = useState<string>('');
@@ -48,6 +65,9 @@ const SearchBox = (props: any) => {
48
65
  useState<boolean>(false);
49
66
  const { t } = useTranslation();
50
67
  const isAlgoliaEnabled = settings.algolia?.enabled;
68
+ const searchbar = useRef<HTMLDivElement | null>(null);
69
+
70
+ const { user } = useAuth0();
51
71
 
52
72
  useEffect(() => {
53
73
  if (focusInp?.current) {
@@ -55,6 +75,23 @@ const SearchBox = (props: any) => {
55
75
  }
56
76
  }, [focusInp]);
57
77
 
78
+ useEffect(() => {
79
+ const handleClick = (event: MouseEvent) => {
80
+ if (searchbar.current) {
81
+ if (searchbar.current.contains(event.target as Node)) {
82
+ searchbar.current.classList.add('active');
83
+ } else {
84
+ searchbar.current.classList.remove('active');
85
+ }
86
+ }
87
+ };
88
+
89
+ document.addEventListener('click', handleClick);
90
+ return () => {
91
+ document.removeEventListener('click', handleClick);
92
+ };
93
+ }, [searchbar]);
94
+
58
95
  useEffect(() => {
59
96
  const searchQuery = query.get('query') || '';
60
97
  if (!isEmpty(searchQuery)) {
@@ -82,6 +119,14 @@ const SearchBox = (props: any) => {
82
119
  // eslint-disable-next-line react-hooks/exhaustive-deps
83
120
  }, [imageThumbSearchInput, isAlgoliaEnabled]);
84
121
 
122
+ useEffect(() => {
123
+ if (history.location?.pathname === '/') {
124
+ setValueInput('');
125
+ dispatch(updateQueryText(''));
126
+ }
127
+ // eslint-disable-next-line react-hooks/exhaustive-deps
128
+ }, [history.location]);
129
+
85
130
  // eslint-disable-next-line react-hooks/exhaustive-deps
86
131
  const searchOrRedirect = useCallback(
87
132
  debounce((value: any, withImage = true) => {
@@ -92,7 +137,7 @@ const SearchBox = (props: any) => {
92
137
  const preFilterValues = [
93
138
  {
94
139
  key: settings.visualSearchFilterKey,
95
- values: Object.keys(preFilter) as string[],
140
+ values: Object.keys(preFilter),
96
141
  },
97
142
  ];
98
143
  if (value || requestImage) {
@@ -120,6 +165,7 @@ const SearchBox = (props: any) => {
120
165
 
121
166
  dispatch(setSearchResults(payload));
122
167
  dispatch(updateStatusLoading(false));
168
+ dispatch(setShowFeedback(true));
123
169
  })
124
170
  .catch((e: any) => {
125
171
  console.log('error input search', e);
@@ -160,13 +206,12 @@ const SearchBox = (props: any) => {
160
206
  const preFilterValues = [
161
207
  {
162
208
  key: settings.visualSearchFilterKey,
163
- values: Object.keys(preFilter) as string[],
209
+ values: Object.keys(preFilter),
164
210
  },
165
211
  ];
166
212
  try {
167
213
  if (settings.regions) {
168
214
  let res = await findRegions(image, settings);
169
- console.log(res);
170
215
 
171
216
  dispatch(setRegions(res.regions));
172
217
  region = res.selectedRegion;
@@ -193,6 +238,12 @@ const SearchBox = (props: any) => {
193
238
  };
194
239
  dispatch(setSearchResults(payload));
195
240
  dispatch(updateStatusLoading(false));
241
+ dispatch(setShowFeedback(true));
242
+ // go back
243
+ dispatch(setFirstSearchResults(payload));
244
+ dispatch(setFirstSearchImage(image));
245
+ dispatch(setFirstSearchPrefilters(preFilter));
246
+ dispatch(setFirstSearchThumbSearchInput(URL.createObjectURL(fs[0])));
196
247
  })
197
248
  .catch((e: any) => {
198
249
  console.log('error input search', e);
@@ -214,6 +265,17 @@ const SearchBox = (props: any) => {
214
265
  }
215
266
  };
216
267
 
268
+ const showPreFilter = useMemo(() => {
269
+ if (settings.shouldUseUserMetadata && user) {
270
+ if (settings.preFilterOption && !user['/user_metadata'].value) {
271
+ return true;
272
+ }
273
+ return false;
274
+ }
275
+
276
+ return settings.preFilterOption;
277
+ }, [settings.preFilterOption, settings.shouldUseUserMetadata, user]);
278
+
217
279
  return (
218
280
  <div className="wrap-input-search-field">
219
281
  <div className="box-input-search d-flex">
@@ -227,22 +289,20 @@ const SearchBox = (props: any) => {
227
289
  }
228
290
  placement="top"
229
291
  arrow={true}
230
- disableHoverListener={!settings.preFilterOption}
292
+ disableHoverListener={!showPreFilter}
231
293
  >
232
294
  <div
233
295
  className="pre-filter-icon"
234
296
  style={{
235
- cursor: settings.preFilterOption ? 'pointer' : 'default',
297
+ cursor: showPreFilter ? 'pointer' : 'default',
236
298
  }}
237
299
  onClick={() =>
238
- settings.preFilterOption
239
- ? setToggleModalFilterDesktop(true)
240
- : false
300
+ showPreFilter ? setToggleModalFilterDesktop(true) : false
241
301
  }
242
302
  >
243
- {settings.preFilterOption && (
303
+ {showPreFilter && (
244
304
  <div
245
- className="icon-hover"
305
+ className="icon-hover desktop"
246
306
  style={{
247
307
  ...(!isEmpty(preFilter)
248
308
  ? {
@@ -256,15 +316,13 @@ const SearchBox = (props: any) => {
256
316
  <IconFilter color="white" />
257
317
  </div>
258
318
  )}
259
- {!settings.preFilterOption && (
260
- <IconSearch width={16} height={16} />
261
- )}
262
- {!isEmpty(preFilter) && (
319
+ {!showPreFilter && <IconSearch width={16} height={16} />}
320
+ {!isEmpty(preFilter) && showPreFilter && (
263
321
  <div
264
322
  style={{
265
323
  position: 'absolute',
266
- top: '5px',
267
- left: '35px',
324
+ top: '1px',
325
+ left: '26px',
268
326
  display: 'flex',
269
327
  justifyContent: 'center',
270
328
  alignItems: 'center',
@@ -347,7 +405,7 @@ const SearchBox = (props: any) => {
347
405
  fontSize: 14,
348
406
  color: '#2B2C46',
349
407
  }}
350
- className="input-search"
408
+ className="input-search hhhh"
351
409
  placeholder={t('Search')}
352
410
  value={valueInput}
353
411
  onChange={onChangeText}
@@ -434,7 +492,7 @@ const SearchBox = (props: any) => {
434
492
  )}
435
493
  </div>
436
494
  </div>
437
- {settings.preFilterOption && (
495
+ {showPreFilter && (
438
496
  <DefaultModal
439
497
  openModal={isOpenModalFilterDesktop}
440
498
  handleClose={() => setToggleModalFilterDesktop(false)}
@@ -16,6 +16,7 @@ import { truncateString } from 'helpers/truncateString';
16
16
  import { find } from 'services/image';
17
17
  import { useQuery } from 'hooks/useQuery';
18
18
  import { useTranslation } from 'react-i18next';
19
+ import ClearOutlinedIcon from "@material-ui/icons/ClearOutlined";
19
20
 
20
21
  interface Props {
21
22
  handleClose?: any;
@@ -45,6 +46,7 @@ function PreFilterComponent(props: Props) {
45
46
  const [isLoading, setLoading] = useState<boolean>(false);
46
47
  const [columns, setColumns] = useState<number>(0);
47
48
  const isMobile = useMediaQuery({ query: '(max-width: 776px)' });
49
+ const [searchKey, setSearchKey] = useState<string>('');
48
50
 
49
51
  const selectedFilter = useMemo(
50
52
  () =>
@@ -57,6 +59,16 @@ function PreFilterComponent(props: Props) {
57
59
  [keyFilter],
58
60
  );
59
61
 
62
+ useEffect(() => {
63
+ getDataFilterDesktop();
64
+ // eslint-disable-next-line react-hooks/exhaustive-deps
65
+ }, []);
66
+
67
+ useEffect(() => {
68
+ filterSearchHandler(searchKey);
69
+ // eslint-disable-next-line react-hooks/exhaustive-deps
70
+ }, [searchKey]);
71
+
60
72
  const getDataFilterDesktop = async () => {
61
73
  setLoading(true);
62
74
  const dataResultFilter = getFilters(1000, settings)
@@ -85,11 +97,6 @@ function PreFilterComponent(props: Props) {
85
97
  return dataResultFilter;
86
98
  };
87
99
 
88
- useEffect(() => {
89
- getDataFilterDesktop();
90
- // eslint-disable-next-line react-hooks/exhaustive-deps
91
- }, []);
92
-
93
100
  const filterSearchHandler = async (value: any) => {
94
101
  if (!value) {
95
102
  getDataFilterDesktop();
@@ -128,7 +135,7 @@ function PreFilterComponent(props: Props) {
128
135
  const preFilterValues = [
129
136
  {
130
137
  key: settings.visualSearchFilterKey,
131
- values: Object.keys(preFilter) as string[],
138
+ values: Object.keys(preFilter),
132
139
  },
133
140
  ];
134
141
  dispatch(updateStatusLoading(true));
@@ -232,9 +239,18 @@ function PreFilterComponent(props: Props) {
232
239
  className="input-search-filter"
233
240
  placeholder={t('Search')}
234
241
  onChange={(e: any) => {
235
- filterSearchHandler(e.target.value);
242
+ setSearchKey(e.target.value);
236
243
  }}
244
+ value={searchKey}
237
245
  />
246
+ <Button
247
+ className="btn-clear-text"
248
+ onClick={() => {
249
+ setSearchKey('');
250
+ }}
251
+ >
252
+ <ClearOutlinedIcon style={{ fontSize: 16, color: '#2B2C46' }} />
253
+ </Button>
238
254
  </div>
239
255
  </div>
240
256