@nyris/nyris-webapp 0.3.57 → 0.3.59

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 (94) hide show
  1. package/build/asset-manifest.json +15 -16
  2. package/build/index.html +1 -1
  3. package/build/js/settings.example.js +1 -0
  4. package/build/static/css/main.cb6e2cfd.css +4 -0
  5. package/build/static/css/main.cb6e2cfd.css.map +1 -0
  6. package/build/static/js/main.a1e24447.js +3 -0
  7. package/build/static/js/{main.5143aa56.js.LICENSE.txt → main.a1e24447.js.LICENSE.txt} +55 -0
  8. package/build/static/js/main.a1e24447.js.map +1 -0
  9. package/build/static/media/camera_simple.bff4194954bbb5f4bc33bd99014a93e8.svg +3 -0
  10. package/build/static/media/collpase.50dae91fff891c46b10dfc281344d0ef.svg +6 -0
  11. package/build/static/media/crop.0676ebbbdc1375ed67e32bba890ce941.svg +3 -0
  12. package/build/static/media/{download.8007f7c72e2080a9ffa96fa63d480dcf.svg → download.a8452bc23334e9f8e53fe1225742d216.svg} +1 -1
  13. package/build/static/media/gallery.15d1f3308921480a8c9d96d9a77c9966.svg +3 -0
  14. package/build/static/media/{logout.b544fcd2969edf431a1e998333119834.svg → logout.bab56bd407f25eb34d6eff401a436ce1.svg} +1 -1
  15. package/build/static/media/next-arrow.b13263d05d107ceb5e99bc4fabb41279.svg +3 -0
  16. package/build/static/media/plus.329672cb2feb55345490589e91481b88.svg +3 -0
  17. package/package.json +8 -5
  18. package/public/index.html +0 -3
  19. package/public/js/settings.example.js +1 -0
  20. package/src/Router.tsx +2 -2
  21. package/src/Store/Store.ts +2 -0
  22. package/src/Store/requestStore.ts +70 -0
  23. package/src/Store/resultStore.ts +25 -0
  24. package/src/Store/search/Search.ts +2 -33
  25. package/src/Store/search/search.initialState.ts +1 -4
  26. package/src/Store/search/types.ts +0 -5
  27. package/src/common/assets/icons/arrow_enter.svg +3 -0
  28. package/src/common/assets/icons/camera_simple.svg +3 -0
  29. package/src/common/assets/icons/collpase.svg +6 -0
  30. package/src/common/assets/icons/crop.svg +3 -0
  31. package/src/common/assets/icons/download.svg +1 -1
  32. package/src/common/assets/icons/gallery.svg +3 -0
  33. package/src/common/assets/icons/logout.svg +1 -1
  34. package/src/common/assets/icons/next-arrow.svg +3 -0
  35. package/src/common/assets/icons/plus.svg +3 -0
  36. package/src/components/CadenasWebViewer.tsx +1 -1
  37. package/src/components/DragDropFile.tsx +17 -77
  38. package/src/components/Experience-visual-search/ExperienceVisualSearch.tsx +47 -71
  39. package/src/components/Feedback.tsx +23 -9
  40. package/src/components/GoBackButton.tsx +15 -18
  41. package/src/components/HeaderMobile.tsx +342 -246
  42. package/src/components/ImageCaptureHelpModal.tsx +63 -65
  43. package/src/components/ImagePreview.tsx +564 -0
  44. package/src/components/Inquiry/InquiryBanner.tsx +1 -1
  45. package/src/components/Inquiry/InquiryModal.tsx +4 -7
  46. package/src/components/Layout.tsx +9 -18
  47. package/src/components/MobileLayout.tsx +51 -0
  48. package/src/components/MobilePostFilter.tsx +9 -3
  49. package/src/components/PanelResult/PostFilterAlgolia.tsx +4 -32
  50. package/src/components/PanelResult/expandable-panel.tsx +3 -16
  51. package/src/components/PanelResult/virtual-state-results.ts +17 -22
  52. package/src/components/ProductDetailView.tsx +1 -1
  53. package/src/components/SidePanel.tsx +7 -97
  54. package/src/components/UploadDisclaimer.tsx +85 -0
  55. package/src/components/appMobile.scss +2 -2
  56. package/src/components/common.scss +57 -27
  57. package/src/components/drawer/cameraCustom.tsx +389 -231
  58. package/src/components/icon-label/icon-label.tsx +1 -1
  59. package/src/components/input/inputSearch.tsx +197 -338
  60. package/src/components/pre-filter/index.tsx +70 -72
  61. package/src/components/results/ItemResult.tsx +34 -17
  62. package/src/components/rfq/RfqBanner.tsx +1 -4
  63. package/src/components/rfq/RfqModal.tsx +10 -10
  64. package/src/hooks/useFilteredRegions.ts +1 -1
  65. package/src/hooks/useImageSearch.ts +189 -0
  66. package/src/hooks/useSearchOrRedirect.ts +84 -0
  67. package/src/index.css +4 -0
  68. package/src/page/landingPage/Home.tsx +49 -0
  69. package/src/page/landingPage/{AppMD.tsx → HomeDesktop.tsx} +7 -34
  70. package/src/page/landingPage/{AppMobile.tsx → HomeMobile.tsx} +8 -37
  71. package/src/page/landingPage/common.scss +9 -1
  72. package/src/page/result/index.tsx +118 -232
  73. package/src/services/Feedback.ts +4 -5
  74. package/src/services/image.ts +19 -0
  75. package/src/types.ts +9 -7
  76. package/src/utils.ts +44 -0
  77. package/tailwind.config.js +54 -0
  78. package/build/static/css/main.67965609.css +0 -2
  79. package/build/static/css/main.67965609.css.map +0 -1
  80. package/build/static/js/main.5143aa56.js +0 -3
  81. package/build/static/js/main.5143aa56.js.map +0 -1
  82. package/build/static/media/arrow_down.f417689ce292978a8292a7f00407fdd5.svg +0 -3
  83. package/build/static/media/arrow_left.73d03a534eaf9b99ab196e0fb67da602.svg +0 -3
  84. package/build/static/media/arrow_right.59a4594a3a1657037537dbae1eee0251.svg +0 -3
  85. package/build/static/media/arrow_up.85dbe70bc51ec32c8894a06499330f14.svg +0 -3
  86. package/build/static/media/home.9ffb65a9c0be8fc5a502ba05cf5f719c.svg +0 -3
  87. package/build/static/media/icon_camera_mobile.6772053c4dfef487255649d2a05cc9d4.svg +0 -3
  88. package/build/static/media/reverse_camera.cee0200b151941cc83c182167a85d667.svg +0 -5
  89. package/src/App.tsx +0 -18
  90. package/src/components/AppMobile.tsx +0 -117
  91. package/src/components/FooterMobile.tsx +0 -230
  92. package/src/components/ImagePreviewMobile.tsx +0 -237
  93. /package/build/static/media/{add.2b72cedb98c4c89c954266d2356c166c.svg → add-rounded.2b72cedb98c4c89c954266d2356c166c.svg} +0 -0
  94. /package/src/common/assets/icons/{add.svg → add-rounded.svg} +0 -0
@@ -1,37 +1,30 @@
1
- import { Button } from '@material-ui/core';
2
- import CloseIcon from '@material-ui/icons/Close';
3
- import { ReactComponent as IconFilter } from 'common/assets/icons/filter_settings.svg';
4
-
5
- import React, {
6
- memo,
7
- useCallback,
8
- useEffect,
9
- useMemo,
10
- useRef,
11
- useState,
12
- } from 'react';
1
+ import { memo, useEffect, useMemo, useState } from 'react';
2
+
13
3
  import { connectSearchBox, connectStateResults } from 'react-instantsearch-dom';
14
4
  import { NavLink, useHistory } from 'react-router-dom';
15
- import {
16
- reset,
17
- updateValueTextSearchMobile,
18
- setPreFilterDropdown,
19
- setPreFilter,
20
- updateQueryText,
21
- updateStatusLoading,
22
- setSearchResults,
23
- setShowFeedback,
24
- } from 'Store/search/Search';
5
+
6
+ import classNames from 'classnames';
7
+ import { isEmpty } from 'lodash';
8
+ import { useTranslation } from 'react-i18next';
9
+ import { useAuth0 } from '@auth0/auth0-react';
10
+
11
+ import { reset, setPreFilter, updateQueryText } from 'Store/search/Search';
25
12
  import { useAppDispatch, useAppSelector } from 'Store/Store';
26
- import { AppState } from 'types';
27
- import { ReactComponent as IconSearch } from 'common/assets/icons/icon_search.svg';
13
+
28
14
  import { ReactComponent as FilterIcon } from 'common/assets/icons/filter.svg';
15
+ import { ReactComponent as LogoutIcon } from 'common/assets/icons/logout.svg';
16
+ import { ReactComponent as CameraSimpleIcon } from 'common/assets/icons/camera_simple.svg';
17
+ import { ReactComponent as PreFilterIcon } from 'common/assets/icons/filter_settings.svg';
18
+ import { ReactComponent as CloseIcon } from 'common/assets/icons/close.svg';
29
19
 
30
- import { debounce, isEmpty } from 'lodash';
31
20
  import { useQuery } from 'hooks/useQuery';
32
- import { useTranslation } from 'react-i18next';
33
- import { find } from 'services/image';
34
- import { useAuth0 } from '@auth0/auth0-react';
21
+ import DefaultModal from './modal/DefaultModal';
22
+ import useRequestStore from 'Store/requestStore';
23
+ import CameraCustom from './drawer/cameraCustom';
24
+ import UploadDisclaimer from './UploadDisclaimer';
25
+ import PreFilterComponent from './pre-filter';
26
+ import { useSearchOrRedirect } from 'hooks/useSearchOrRedirect';
27
+ import MobilePostFilter from './MobilePostFilter';
35
28
 
36
29
  interface Props {
37
30
  onToggleFilterMobile?: any;
@@ -40,56 +33,63 @@ interface Props {
40
33
  }
41
34
 
42
35
  function HeaderMobileComponent(props: Props): JSX.Element {
43
- const { user } = useAuth0();
44
- const { auth0 } = useAppSelector(state => state.settings);
36
+ const { refine } = props;
45
37
 
46
- const { onToggleFilterMobile, refine } = props;
47
- const dispatch = useAppDispatch();
48
- const stateGlobal = useAppSelector(state => state);
49
- const { search } = stateGlobal;
50
- const {
51
- imageThumbSearchInput,
52
- preFilter,
53
- preFilterDropdown,
54
- valueTextSearch,
55
- queryText,
56
- requestImage,
57
- selectedRegion,
58
- results,
59
- postFilter,
60
- } = search;
38
+ const { user, isAuthenticated, logout } = useAuth0();
61
39
 
40
+ const dispatch = useAppDispatch();
62
41
  const query = useQuery();
63
- const containerRefInputMobile = useRef<HTMLDivElement>(null);
64
- const [isShowFilter, setShowFilter] = useState<boolean>(false);
65
42
  const history = useHistory();
66
- const { settings } = useAppSelector<AppState>((state: any) => state);
43
+
44
+ const auth0 = useAppSelector(state => state.settings.auth0);
45
+
46
+ const preFilter = useAppSelector(state => state.search.preFilter);
47
+ const valueTextSearch = useAppSelector(state => state.search.valueTextSearch);
48
+ const queryText = useAppSelector(state => state.search.queryText);
49
+ const results = useAppSelector(state => state.search.results);
50
+ const postFilter = useAppSelector(state => state.search.postFilter);
51
+ const settings = useAppSelector(state => state.settings);
52
+
53
+ const isAlgoliaEnabled = settings.algolia?.enabled;
54
+
55
+ const { resetRequestState, requestImages } = useRequestStore(state => ({
56
+ resetRequestState: state.reset,
57
+ requestImages: state.requestImages,
58
+ }));
59
+
60
+ const [isShowFilter, setShowFilter] = useState<boolean>(false);
61
+ const [showLogoutModal, setShowLogoutModal] = useState(false);
62
+ const [isOpenModalCamera, setOpenModalCamera] = useState<boolean>(false);
63
+ const [showDisclaimer, setShowDisclaimer] = useState(false);
64
+ const [preFilterDropdown, setPreFilterDropdown] = useState(false);
65
+ const [isOpenFilter, setOpenFilter] = useState<boolean>(false);
66
+
67
67
  const [valueInput, setValueInput] = useState<string>(queryText || '');
68
68
  const searchQuery = query.get('query') || '';
69
+ const visualSearch = useMemo(() => requestImages.length > 0, [requestImages]);
69
70
 
70
71
  useEffect(() => {
71
72
  if (
72
73
  history.location?.pathname === '/result' &&
73
- (imageThumbSearchInput || valueInput)
74
+ (visualSearch || valueInput)
74
75
  ) {
75
76
  setShowFilter(true);
76
77
  } else {
77
78
  setShowFilter(false);
78
79
  }
79
- }, [imageThumbSearchInput, history.location, valueInput]);
80
+ }, [history.location, valueInput, visualSearch]);
80
81
 
81
82
  useEffect(() => {
82
- if (imageThumbSearchInput !== '') {
83
+ if (visualSearch) {
83
84
  history.push('/result');
84
- dispatch(updateValueTextSearchMobile(''));
85
85
  setValueInput('');
86
- if (settings.algolia?.enabled) {
86
+ if (isAlgoliaEnabled) {
87
87
  refine('');
88
88
  } else {
89
89
  dispatch(updateQueryText(''));
90
90
  }
91
91
  } else {
92
- if (settings.algolia?.enabled) {
92
+ if (isAlgoliaEnabled) {
93
93
  // not an ideal solution: fixes text search not working after removing image
94
94
  setTimeout(() => {
95
95
  refine(searchQuery);
@@ -97,13 +97,12 @@ function HeaderMobileComponent(props: Props): JSX.Element {
97
97
  }
98
98
  }
99
99
  // eslint-disable-next-line react-hooks/exhaustive-deps
100
- }, [imageThumbSearchInput, dispatch, refine, history, settings.algolia]);
100
+ }, [visualSearch, dispatch, refine, history, isAlgoliaEnabled]);
101
101
 
102
102
  useEffect(() => {
103
103
  if (!isEmpty(searchQuery)) {
104
104
  setValueInput(searchQuery);
105
- dispatch(updateValueTextSearchMobile(searchQuery));
106
- if (settings.algolia?.enabled) {
105
+ if (isAlgoliaEnabled) {
107
106
  refine(searchQuery);
108
107
  // not an ideal solution: fixes text search not working from landing page
109
108
  setTimeout(() => {
@@ -113,69 +112,15 @@ function HeaderMobileComponent(props: Props): JSX.Element {
113
112
  dispatch(updateQueryText(searchQuery));
114
113
  }
115
114
  }
116
- }, [query, refine, dispatch, searchQuery, settings.algolia]);
115
+ }, [query, refine, dispatch, searchQuery, isAlgoliaEnabled]);
117
116
 
118
117
  // eslint-disable-next-line react-hooks/exhaustive-deps
119
- const searchOrRedirect = useCallback(
120
- debounce((value: any) => {
121
- if (!settings.algolia?.enabled) {
122
- dispatch(updateQueryText(value));
123
- let payload: any;
124
- let filters: any[] = [];
125
- const preFilterValues = [
126
- {
127
- key: settings.visualSearchFilterKey,
128
- values: Object.keys(preFilter),
129
- },
130
- ];
131
- if (value || requestImage) {
132
- dispatch(updateStatusLoading(true));
133
- find({
134
- image: requestImage?.canvas as HTMLCanvasElement,
135
- settings,
136
- filters: !isEmpty(preFilter) ? preFilterValues : undefined,
137
- region: selectedRegion,
138
- text: value,
139
- })
140
- .then((res: any) => {
141
- res?.results.forEach((item: any) => {
142
- filters.push({
143
- sku: item.sku,
144
- score: item.score,
145
- });
146
- });
147
- payload = {
148
- ...res,
149
- filters,
150
- };
151
- dispatch(setSearchResults(payload));
152
- dispatch(updateStatusLoading(false));
153
- dispatch(setShowFeedback(true));
154
- })
155
- .catch((e: any) => {
156
- console.log('error input search', e);
157
- dispatch(updateStatusLoading(false));
158
- });
159
- } else {
160
- dispatch(setSearchResults([]));
161
- }
162
- }
118
+ const searchOrRedirect = useSearchOrRedirect();
163
119
 
164
- if (value) {
165
- history.push({
166
- pathname: '/result',
167
- search: `?query=${value}`,
168
- });
169
- } else {
170
- history.push('/result');
171
- }
172
- }, 500),
173
- [requestImage],
174
- );
175
120
  const isPostFilterApplied = useMemo(() => {
176
121
  let isApplied = false;
177
122
 
178
- if (settings.algolia.enabled) {
123
+ if (isAlgoliaEnabled) {
179
124
  if (!valueTextSearch?.refinementList) return false;
180
125
  Object.keys(valueTextSearch?.refinementList).forEach(key => {
181
126
  if (typeof valueTextSearch.refinementList[key] === 'object') {
@@ -201,18 +146,17 @@ function HeaderMobileComponent(props: Props): JSX.Element {
201
146
 
202
147
  const onChangeText = (event: any) => {
203
148
  setValueInput(event.currentTarget.value);
204
- // debounceSearch(event.currentTarget.value);
205
149
  searchOrRedirect(event.currentTarget.value);
206
150
  if (event.currentTarget.value === '') {
207
- dispatch(updateValueTextSearchMobile(''));
208
- refine('');
209
- } else {
210
- dispatch(updateValueTextSearchMobile(event.currentTarget.value));
151
+ setValueInput('');
152
+ if (isAlgoliaEnabled) {
153
+ refine('');
154
+ }
211
155
  }
212
156
  };
213
157
 
214
158
  const disablePostFilter = useMemo(() => {
215
- if (settings.algolia.enabled) {
159
+ if (isAlgoliaEnabled) {
216
160
  return settings.postFilterOption &&
217
161
  props.allSearchResults?.hits.length > 0
218
162
  ? false
@@ -234,24 +178,143 @@ function HeaderMobileComponent(props: Props): JSX.Element {
234
178
  return settings.preFilterOption;
235
179
  }, [settings.preFilterOption, settings.shouldUseUserMetadata, user]);
236
180
 
181
+ const showDisclaimerDisabled = useMemo(() => {
182
+ const disclaimer = localStorage.getItem('upload-disclaimer-webapp');
183
+ if (requestImages.length === 0) return true;
184
+ if (!disclaimer) return false;
185
+ return disclaimer === 'dont-show';
186
+ // eslint-disable-next-line react-hooks/exhaustive-deps
187
+ }, [showDisclaimer, requestImages]);
188
+
237
189
  return (
238
- <div style={{ width: '100%', background: '#fff' }}>
239
- {history.location?.pathname !== '/result' && (
190
+ <>
191
+ {preFilterDropdown && (
192
+ <div
193
+ className={`box-filter open`}
194
+ style={{
195
+ top: '0px',
196
+ height: '100%',
197
+ width: '100%',
198
+ zIndex: 999,
199
+ position: 'absolute',
200
+ }}
201
+ >
202
+ <div style={{ width: '100%' }} className={'wrap-filter-desktop'}>
203
+ <div className={'bg-white box-filter-desktop isMobile'}>
204
+ <PreFilterComponent
205
+ handleClose={() => setPreFilterDropdown(s => !s)}
206
+ />
207
+ </div>
208
+ </div>
209
+ </div>
210
+ )}
211
+ <DefaultModal
212
+ openModal={showLogoutModal}
213
+ handleClose={() => {
214
+ setShowLogoutModal(false);
215
+ }}
216
+ >
217
+ <div
218
+ style={{
219
+ backgroundColor: 'white',
220
+ width: '360px',
221
+ padding: '24px',
222
+ }}
223
+ >
224
+ <div
225
+ style={{
226
+ display: 'flex',
227
+ justifyContent: 'flex-end',
228
+ }}
229
+ onClick={() => setShowLogoutModal(false)}
230
+ >
231
+ <CloseIcon
232
+ width={'16px'}
233
+ height={'16px'}
234
+ fontSize={'16px'}
235
+ color="black"
236
+ />
237
+ </div>
238
+ <p style={{ fontSize: '36px', fontWeight: 'bold', color: '#2B2C46' }}>
239
+ Logout
240
+ </p>
241
+ <p style={{ fontSize: '13px', color: '#2B2C46', paddingTop: '16px' }}>
242
+ Are you sure you want to log out? Your session will be securely
243
+ closed.
244
+ </p>
245
+ <p style={{ fontSize: '13px', color: '#2B2C46', paddingTop: '16px' }}>
246
+ Email
247
+ </p>
248
+ <div
249
+ style={{
250
+ backgroundColor: '#FAFAFA',
251
+ height: '32px',
252
+ paddingLeft: '16px',
253
+ paddingRight: '16px',
254
+ marginTop: '8px',
255
+ }}
256
+ >
257
+ {user?.email}
258
+ </div>
259
+ <div style={{ display: 'flex', width: '100%', marginTop: '16px' }}>
260
+ <div
261
+ style={{
262
+ width: '50%',
263
+ backgroundColor: '#2B2C46',
264
+ color: 'white',
265
+ padding: '16px',
266
+ }}
267
+ onClick={() => {
268
+ logout({
269
+ logoutParams: { returnTo: window.location.origin },
270
+ });
271
+ }}
272
+ >
273
+ Confirm log out
274
+ </div>
275
+ </div>
276
+ </div>
277
+ </DefaultModal>
278
+ {showDisclaimer && (
279
+ <UploadDisclaimer
280
+ onClose={() => {
281
+ setShowDisclaimer(false);
282
+ }}
283
+ onContinue={({
284
+ file,
285
+ dontShowAgain,
286
+ }: {
287
+ file: any;
288
+ dontShowAgain: any;
289
+ }) => {
290
+ if (dontShowAgain) {
291
+ localStorage.setItem('upload-disclaimer-webapp', 'dont-show');
292
+ }
293
+ setOpenModalCamera(true);
294
+
295
+ setShowDisclaimer(false);
296
+ }}
297
+ isMobile={true}
298
+ />
299
+ )}
300
+ <div style={{ width: '100%', background: '#fff' }}>
240
301
  <div
241
- className="box-content"
302
+ className={`box-content flex items-center justify-between h-12 pr-6 pl-4 ${
303
+ history.location?.pathname === '/result'
304
+ ? 'border-solid border-b border-[#afafaf52] '
305
+ : ''
306
+ }`}
242
307
  style={{
243
- display: 'flex',
244
- alignItems: 'center',
245
- height: '48px',
246
308
  background: settings.theme?.headerColor,
247
309
  }}
248
310
  >
249
311
  <NavLink
250
312
  to="/"
251
- style={{ lineHeight: 0, paddingLeft: '10px' }}
313
+ style={{ lineHeight: 0 }}
252
314
  onClick={() => {
253
315
  dispatch(reset(''));
254
316
  dispatch(setPreFilter({}));
317
+ resetRequestState();
255
318
  }}
256
319
  >
257
320
  <img
@@ -264,122 +327,121 @@ function HeaderMobileComponent(props: Props): JSX.Element {
264
327
  }}
265
328
  />
266
329
  </NavLink>
330
+ {auth0.enabled && isAuthenticated && (
331
+ <div
332
+ onClick={() => {
333
+ setShowLogoutModal(true);
334
+ }}
335
+ >
336
+ <LogoutIcon className="text-[#AAABB5]" />
337
+ </div>
338
+ )}
267
339
  </div>
268
- )}
269
340
 
270
- {((auth0.enabled && user?.email_verified) || !auth0.enabled) && (
271
341
  <div
272
- style={{
273
- margin: '16px 8px',
274
- display: 'flex',
275
- columnGap: '8px',
276
- alignItems: 'center',
277
- }}
342
+ className={classNames([
343
+ 'flex',
344
+ 'md:hidden',
345
+ 'fixed',
346
+ history.location?.pathname !== '/' ? 'bottom-4' : 'bottom-12',
347
+ 'w-full',
348
+ 'px-2',
349
+ 'gap-2',
350
+ ])}
278
351
  >
279
- <div className="wrap-header-mobile" style={{ height: '56px' }}>
352
+ <div className={classNames(['flex-grow'])}>
280
353
  <div
281
- style={{
282
- display: 'flex',
283
- alignItems: 'center',
284
- height: '100%',
285
- }}
354
+ className={classNames([
355
+ 'h-12',
356
+ 'rounded-3xl',
357
+ 'shadow-outer',
358
+ 'w-full',
359
+ 'bg-white',
360
+ 'px-2',
361
+ 'flex',
362
+ 'items-center',
363
+ 'justify-between',
364
+ ])}
286
365
  >
287
- <div
288
- ref={containerRefInputMobile}
289
- id="box-input-search"
290
- className="d-flex w-100"
291
- style={{
292
- alignItems: 'center',
293
- height: '100%',
294
- }}
366
+ <div className="flex flex-1 gap-x-2">
367
+ {showPreFilter && (
368
+ <button
369
+ className={classNames([
370
+ '!min-w-8',
371
+ 'min-h-8',
372
+ 'rounded-3xl',
373
+ 'flex',
374
+ 'justify-center',
375
+ 'items-center',
376
+ 'bg-[#F3F3F5]',
377
+ 'relative',
378
+ ])}
379
+ onClick={() => {
380
+ setPreFilterDropdown(s => !s);
381
+ }}
382
+ title="pre-filter"
383
+ >
384
+ <div
385
+ className={classNames([
386
+ !isEmpty(preFilter) ? 'block' : 'hidden',
387
+ 'absolute',
388
+ 'top-0',
389
+ 'right-0',
390
+ 'w-2',
391
+ 'min-w-2',
392
+ 'h-2',
393
+ 'bg-[#3E36DC]',
394
+ 'border-2',
395
+ 'border-white',
396
+ 'rounded-full',
397
+ ])}
398
+ />
399
+ <PreFilterIcon
400
+ className={classNames(
401
+ !isEmpty(preFilter) ? 'text-[#3E36DC]' : 'text-black',
402
+ )}
403
+ />
404
+ </button>
405
+ )}
406
+
407
+ <Input value={valueInput} onChange={onChangeText} />
408
+ </div>
409
+ <div className="flex gap-x-2">
410
+ {/* <div
411
+ className={classNames([
412
+ 'w-8',
413
+ 'h-8',
414
+ 'rounded-3xl',
415
+ 'flex',
416
+ 'justify-center',
417
+ 'items-center',
418
+ valueInput.length > 0 ? 'bg-[#2B2C46]' : 'bg-[#F3F3F5]',
419
+ valueInput.length > 0 ? 'cursor-pointer' : 'cursor-default',
420
+ ])}
295
421
  >
422
+ <ArrowEnter className="text-white" />
423
+
424
+ </div> */}
296
425
  <div
297
- className="pre-filter-icon"
426
+ className={classNames([
427
+ history.location?.pathname !== '/' ? 'flex' : 'hidden',
428
+ 'w-8',
429
+ 'h-8',
430
+ 'rounded-3xl',
431
+ 'justify-center',
432
+ 'items-center',
433
+ 'bg-[#F3F3F5]',
434
+ ])}
298
435
  onClick={() => {
299
- if (showPreFilter) {
300
- onToggleFilterMobile(false);
301
- dispatch(setPreFilterDropdown(!preFilterDropdown));
436
+ if (!showDisclaimerDisabled) {
437
+ setShowDisclaimer(true);
438
+ } else {
439
+ setOpenModalCamera(true);
302
440
  }
303
441
  }}
304
- style={{ cursor: showPreFilter ? 'pointer' : '' }}
305
442
  >
306
- {showPreFilter && (
307
- <div
308
- className="icon-hover"
309
- style={{
310
- ...(!isEmpty(preFilter)
311
- ? {
312
- backgroundColor: settings.theme?.primaryColor,
313
- }
314
- : {
315
- backgroundColor: `#2B2C46`,
316
- }),
317
- }}
318
- >
319
- <IconFilter color="white" />
320
- </div>
321
- )}
322
- {!showPreFilter && <IconSearch width={16} height={16} />}
323
- {!isEmpty(preFilter) && showPreFilter && (
324
- <div
325
- style={{
326
- position: 'absolute',
327
- top: '7px',
328
- left: '35px',
329
- display: 'flex',
330
- justifyContent: 'center',
331
- alignItems: 'center',
332
- background: 'white',
333
- width: '10px',
334
- height: '10px',
335
- borderRadius: '100%',
336
- }}
337
- >
338
- <div
339
- style={{
340
- width: '8px',
341
- height: '8px',
342
- background: settings.theme?.primaryColor,
343
- borderRadius: '100%',
344
- }}
345
- ></div>
346
- </div>
347
- )}
443
+ <CameraSimpleIcon />
348
444
  </div>
349
-
350
- <Input value={valueInput} onChange={onChangeText} />
351
-
352
- {history.location?.pathname !== '/' && valueInput && (
353
- <Button
354
- onClick={() => {
355
- setValueInput('');
356
- if (imageThumbSearchInput) {
357
- history.push('/result');
358
- dispatch(updateValueTextSearchMobile(''));
359
- refine('');
360
- return;
361
- }
362
- dispatch(updateValueTextSearchMobile(''));
363
- dispatch(reset(''));
364
- refine('');
365
- history.push('/');
366
- }}
367
- style={{
368
- // background: '#fff',
369
- marginRight: '8px',
370
- border: 0,
371
- width: '40px',
372
- height: '40px',
373
- }}
374
- >
375
- <CloseIcon
376
- style={{
377
- fontSize: 16,
378
- color: settings.theme?.secondaryColor,
379
- }}
380
- />
381
- </Button>
382
- )}
383
445
  </div>
384
446
  </div>
385
447
  </div>
@@ -387,8 +449,8 @@ function HeaderMobileComponent(props: Props): JSX.Element {
387
449
  <div
388
450
  style={{
389
451
  position: 'relative',
390
- width: '56px',
391
- height: '56px',
452
+ width: '48px',
453
+ height: '48px',
392
454
  padding: ' 8px',
393
455
  flexShrink: 0,
394
456
  borderRadius: '32px',
@@ -396,9 +458,10 @@ function HeaderMobileComponent(props: Props): JSX.Element {
396
458
  boxShadow: ' 0px 0px 8px 0px rgba(0, 0, 0, 0.15)',
397
459
  }}
398
460
  onClick={() => {
399
- if (disablePostFilter) return;
400
- onToggleFilterMobile();
401
- dispatch(setPreFilterDropdown(false));
461
+ if (disablePostFilter && !isPostFilterApplied) return;
462
+ setOpenFilter(true);
463
+
464
+ setPreFilterDropdown(false);
402
465
  }}
403
466
  >
404
467
  <div
@@ -408,18 +471,24 @@ function HeaderMobileComponent(props: Props): JSX.Element {
408
471
  disablePostFilter
409
472
  ? '#F3F3F5'
410
473
  : isPostFilterApplied
411
- ? settings.theme?.primaryColor
412
- : '#2B2C46'
474
+ ? '#F0EFFF'
475
+ : '#F3F3F5'
413
476
  }`,
414
477
  borderRadius: '40px',
415
- width: '40px',
416
- height: '40px',
478
+ width: '32px',
479
+ height: '32px',
417
480
  justifyContent: 'center',
418
481
  alignItems: 'center',
419
482
  }}
420
483
  >
421
484
  <FilterIcon
422
- color={`${disablePostFilter ? '#E0E0E0' : 'white'}`}
485
+ className={classNames([
486
+ isPostFilterApplied
487
+ ? 'text-[#3E36DC]'
488
+ : disablePostFilter
489
+ ? 'text-[#E0E0E0]'
490
+ : 'text-[#2B2C46]',
491
+ ])}
423
492
  />
424
493
  </div>
425
494
 
@@ -428,7 +497,7 @@ function HeaderMobileComponent(props: Props): JSX.Element {
428
497
  style={{
429
498
  position: 'absolute',
430
499
  top: '8px',
431
- left: '37px',
500
+ left: '35px',
432
501
  display: 'flex',
433
502
  justifyContent: 'center',
434
503
  alignItems: 'center',
@@ -442,19 +511,46 @@ function HeaderMobileComponent(props: Props): JSX.Element {
442
511
  style={{
443
512
  width: '8px',
444
513
  height: '8px',
445
- background: disablePostFilter
446
- ? '#E0E0E0'
447
- : settings.theme?.primaryColor,
448
514
  borderRadius: '100%',
449
515
  }}
516
+ className={classNames([
517
+ isPostFilterApplied
518
+ ? 'bg-[#3E36DC]'
519
+ : disablePostFilter
520
+ ? 'bg-[#E0E0E0]'
521
+ : 'bg-[#2B2C46]',
522
+ ])}
450
523
  ></div>
451
524
  </div>
452
525
  )}
453
526
  </div>
454
527
  )}
455
528
  </div>
456
- )}
457
- </div>
529
+ <CameraCustom
530
+ show={isOpenModalCamera}
531
+ onClose={() => {
532
+ setOpenModalCamera(!isOpenModalCamera);
533
+ }}
534
+ newSearch={true}
535
+ />
536
+ <div
537
+ className={`box-filter ${isOpenFilter ? '' : '!hidden'}`}
538
+ style={{
539
+ top: '0px',
540
+ height: '100%',
541
+ width: '100%',
542
+ position: 'absolute',
543
+ }}
544
+ >
545
+ <MobilePostFilter
546
+ isOpenFilter={isOpenFilter}
547
+ onApply={() => {
548
+ setOpenFilter(false);
549
+ }}
550
+ />
551
+ </div>
552
+ </div>
553
+ </>
458
554
  );
459
555
  }
460
556