@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.
- package/build/asset-manifest.json +15 -16
- package/build/index.html +1 -1
- package/build/js/settings.example.js +1 -0
- package/build/static/css/main.cb6e2cfd.css +4 -0
- package/build/static/css/main.cb6e2cfd.css.map +1 -0
- package/build/static/js/main.a1e24447.js +3 -0
- package/build/static/js/{main.5143aa56.js.LICENSE.txt → main.a1e24447.js.LICENSE.txt} +55 -0
- package/build/static/js/main.a1e24447.js.map +1 -0
- package/build/static/media/camera_simple.bff4194954bbb5f4bc33bd99014a93e8.svg +3 -0
- package/build/static/media/collpase.50dae91fff891c46b10dfc281344d0ef.svg +6 -0
- package/build/static/media/crop.0676ebbbdc1375ed67e32bba890ce941.svg +3 -0
- package/build/static/media/{download.8007f7c72e2080a9ffa96fa63d480dcf.svg → download.a8452bc23334e9f8e53fe1225742d216.svg} +1 -1
- package/build/static/media/gallery.15d1f3308921480a8c9d96d9a77c9966.svg +3 -0
- package/build/static/media/{logout.b544fcd2969edf431a1e998333119834.svg → logout.bab56bd407f25eb34d6eff401a436ce1.svg} +1 -1
- package/build/static/media/next-arrow.b13263d05d107ceb5e99bc4fabb41279.svg +3 -0
- package/build/static/media/plus.329672cb2feb55345490589e91481b88.svg +3 -0
- package/package.json +8 -5
- package/public/index.html +0 -3
- package/public/js/settings.example.js +1 -0
- package/src/Router.tsx +2 -2
- package/src/Store/Store.ts +2 -0
- package/src/Store/requestStore.ts +70 -0
- package/src/Store/resultStore.ts +25 -0
- package/src/Store/search/Search.ts +2 -33
- package/src/Store/search/search.initialState.ts +1 -4
- package/src/Store/search/types.ts +0 -5
- package/src/common/assets/icons/arrow_enter.svg +3 -0
- package/src/common/assets/icons/camera_simple.svg +3 -0
- package/src/common/assets/icons/collpase.svg +6 -0
- package/src/common/assets/icons/crop.svg +3 -0
- package/src/common/assets/icons/download.svg +1 -1
- package/src/common/assets/icons/gallery.svg +3 -0
- package/src/common/assets/icons/logout.svg +1 -1
- package/src/common/assets/icons/next-arrow.svg +3 -0
- package/src/common/assets/icons/plus.svg +3 -0
- package/src/components/CadenasWebViewer.tsx +1 -1
- package/src/components/DragDropFile.tsx +17 -77
- package/src/components/Experience-visual-search/ExperienceVisualSearch.tsx +47 -71
- package/src/components/Feedback.tsx +23 -9
- package/src/components/GoBackButton.tsx +15 -18
- package/src/components/HeaderMobile.tsx +342 -246
- package/src/components/ImageCaptureHelpModal.tsx +63 -65
- package/src/components/ImagePreview.tsx +564 -0
- package/src/components/Inquiry/InquiryBanner.tsx +1 -1
- package/src/components/Inquiry/InquiryModal.tsx +4 -7
- package/src/components/Layout.tsx +9 -18
- package/src/components/MobileLayout.tsx +51 -0
- package/src/components/MobilePostFilter.tsx +9 -3
- package/src/components/PanelResult/PostFilterAlgolia.tsx +4 -32
- package/src/components/PanelResult/expandable-panel.tsx +3 -16
- package/src/components/PanelResult/virtual-state-results.ts +17 -22
- package/src/components/ProductDetailView.tsx +1 -1
- package/src/components/SidePanel.tsx +7 -97
- package/src/components/UploadDisclaimer.tsx +85 -0
- package/src/components/appMobile.scss +2 -2
- package/src/components/common.scss +57 -27
- package/src/components/drawer/cameraCustom.tsx +389 -231
- package/src/components/icon-label/icon-label.tsx +1 -1
- package/src/components/input/inputSearch.tsx +197 -338
- package/src/components/pre-filter/index.tsx +70 -72
- package/src/components/results/ItemResult.tsx +34 -17
- package/src/components/rfq/RfqBanner.tsx +1 -4
- package/src/components/rfq/RfqModal.tsx +10 -10
- package/src/hooks/useFilteredRegions.ts +1 -1
- package/src/hooks/useImageSearch.ts +189 -0
- package/src/hooks/useSearchOrRedirect.ts +84 -0
- package/src/index.css +4 -0
- package/src/page/landingPage/Home.tsx +49 -0
- package/src/page/landingPage/{AppMD.tsx → HomeDesktop.tsx} +7 -34
- package/src/page/landingPage/{AppMobile.tsx → HomeMobile.tsx} +8 -37
- package/src/page/landingPage/common.scss +9 -1
- package/src/page/result/index.tsx +118 -232
- package/src/services/Feedback.ts +4 -5
- package/src/services/image.ts +19 -0
- package/src/types.ts +9 -7
- package/src/utils.ts +44 -0
- package/tailwind.config.js +54 -0
- package/build/static/css/main.67965609.css +0 -2
- package/build/static/css/main.67965609.css.map +0 -1
- package/build/static/js/main.5143aa56.js +0 -3
- package/build/static/js/main.5143aa56.js.map +0 -1
- package/build/static/media/arrow_down.f417689ce292978a8292a7f00407fdd5.svg +0 -3
- package/build/static/media/arrow_left.73d03a534eaf9b99ab196e0fb67da602.svg +0 -3
- package/build/static/media/arrow_right.59a4594a3a1657037537dbae1eee0251.svg +0 -3
- package/build/static/media/arrow_up.85dbe70bc51ec32c8894a06499330f14.svg +0 -3
- package/build/static/media/home.9ffb65a9c0be8fc5a502ba05cf5f719c.svg +0 -3
- package/build/static/media/icon_camera_mobile.6772053c4dfef487255649d2a05cc9d4.svg +0 -3
- package/build/static/media/reverse_camera.cee0200b151941cc83c182167a85d667.svg +0 -5
- package/src/App.tsx +0 -18
- package/src/components/AppMobile.tsx +0 -117
- package/src/components/FooterMobile.tsx +0 -230
- package/src/components/ImagePreviewMobile.tsx +0 -237
- /package/build/static/media/{add.2b72cedb98c4c89c954266d2356c166c.svg → add-rounded.2b72cedb98c4c89c954266d2356c166c.svg} +0 -0
- /package/src/common/assets/icons/{add.svg → add-rounded.svg} +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { useEffect, useState } from 'react';
|
|
2
2
|
import { ReactComponent as RemoveIcon } from 'common/assets/icons/minus.svg';
|
|
3
|
-
import { ReactComponent as AddIcon } from 'common/assets/icons/add.svg';
|
|
3
|
+
import { ReactComponent as AddIcon } from 'common/assets/icons/add-rounded.svg';
|
|
4
4
|
|
|
5
5
|
export type LabelPosition = 'bottom' | 'left' | 'right' | 'top';
|
|
6
6
|
|
|
@@ -1,73 +1,56 @@
|
|
|
1
1
|
import { Button, Tooltip } from '@material-ui/core';
|
|
2
2
|
import IconButton from '@material-ui/core/IconButton';
|
|
3
3
|
import ClearOutlinedIcon from '@material-ui/icons/ClearOutlined';
|
|
4
|
-
import CloseIcon from '@material-ui/icons/Close';
|
|
5
4
|
import IconCamera from 'common/assets/icons/camera.svg';
|
|
6
5
|
import { useQuery } from 'hooks/useQuery';
|
|
7
|
-
import {
|
|
8
|
-
import
|
|
9
|
-
memo,
|
|
10
|
-
useCallback,
|
|
11
|
-
useEffect,
|
|
12
|
-
useMemo,
|
|
13
|
-
useRef,
|
|
14
|
-
useState,
|
|
15
|
-
} from 'react';
|
|
16
|
-
import { useDropzone } from 'react-dropzone';
|
|
6
|
+
import { isEmpty } from 'lodash';
|
|
7
|
+
import { memo, useEffect, useMemo, useRef, useState } from 'react';
|
|
17
8
|
import { connectSearchBox } from 'react-instantsearch-dom';
|
|
18
|
-
import { useMediaQuery } from 'react-responsive';
|
|
19
9
|
import { useHistory } from 'react-router-dom';
|
|
20
|
-
import { createImage, find, findRegions } from 'services/image';
|
|
21
10
|
import { ReactComponent as IconFilter } from 'common/assets/icons/filter_settings.svg';
|
|
22
11
|
import { ReactComponent as IconSearch } from 'common/assets/icons/icon_search.svg';
|
|
23
12
|
|
|
24
13
|
import {
|
|
25
14
|
reset,
|
|
26
|
-
setImageSearchInput,
|
|
27
|
-
setRequestImage,
|
|
28
|
-
setSearchResults,
|
|
29
15
|
updateStatusLoading,
|
|
30
16
|
loadingActionResults,
|
|
31
|
-
setRegions,
|
|
32
|
-
setSelectedRegion,
|
|
33
17
|
updateQueryText,
|
|
34
|
-
setShowFeedback,
|
|
35
|
-
setFirstSearchResults,
|
|
36
|
-
setFirstSearchImage,
|
|
37
|
-
setFirstSearchPrefilters,
|
|
38
|
-
setFirstSearchThumbSearchInput,
|
|
39
18
|
} from 'Store/search/Search';
|
|
40
19
|
import { useAppDispatch, useAppSelector } from 'Store/Store';
|
|
41
20
|
import DefaultModal from 'components/modal/DefaultModal';
|
|
42
21
|
import PreFilterComponent from 'components/pre-filter';
|
|
43
|
-
import { RectCoords } from '@nyris/nyris-api';
|
|
44
22
|
import { useTranslation } from 'react-i18next';
|
|
45
23
|
import { useAuth0 } from '@auth0/auth0-react';
|
|
24
|
+
import { useImageSearch } from 'hooks/useImageSearch';
|
|
25
|
+
import UploadDisclaimer from 'components/UploadDisclaimer';
|
|
26
|
+
import useRequestStore from 'Store/requestStore';
|
|
27
|
+
import { useSearchOrRedirect } from 'hooks/useSearchOrRedirect';
|
|
46
28
|
|
|
47
29
|
const SearchBox = (props: any) => {
|
|
48
|
-
const { refine
|
|
30
|
+
const { refine }: any = props;
|
|
49
31
|
// const containerRefInputMobile = useRef<HTMLDivElement>(null);
|
|
50
|
-
const
|
|
51
|
-
const
|
|
52
|
-
|
|
53
|
-
imageThumbSearchInput,
|
|
54
|
-
preFilter,
|
|
55
|
-
requestImage,
|
|
56
|
-
selectedRegion,
|
|
57
|
-
} = search;
|
|
32
|
+
const preFilter = useAppSelector(state => state.search.preFilter);
|
|
33
|
+
const settings = useAppSelector(state => state.settings);
|
|
34
|
+
|
|
58
35
|
const focusInp: any = useRef<HTMLDivElement | null>(null);
|
|
59
36
|
const history = useHistory();
|
|
60
37
|
const [valueInput, setValueInput] = useState<string>('');
|
|
61
38
|
const dispatch = useAppDispatch();
|
|
62
|
-
const isMobile = useMediaQuery({ query: '(max-width: 776px)' });
|
|
63
39
|
const query = useQuery();
|
|
64
40
|
const [isOpenModalFilterDesktop, setToggleModalFilterDesktop] =
|
|
65
41
|
useState<boolean>(false);
|
|
66
42
|
const { t } = useTranslation();
|
|
67
43
|
const isAlgoliaEnabled = settings.algolia?.enabled;
|
|
68
44
|
const searchbar = useRef<HTMLDivElement | null>(null);
|
|
69
|
-
|
|
45
|
+
const { singleImageSearch } = useImageSearch();
|
|
70
46
|
const { user } = useAuth0();
|
|
47
|
+
const [showDisclaimer, setShowDisclaimer] = useState(false);
|
|
48
|
+
|
|
49
|
+
const { requestImages } = useRequestStore(state => ({
|
|
50
|
+
requestImages: state.requestImages,
|
|
51
|
+
}));
|
|
52
|
+
|
|
53
|
+
const visualSearch = useMemo(() => requestImages.length > 0, [requestImages]);
|
|
71
54
|
|
|
72
55
|
useEffect(() => {
|
|
73
56
|
if (focusInp?.current) {
|
|
@@ -109,7 +92,7 @@ const SearchBox = (props: any) => {
|
|
|
109
92
|
}, [query, refine, dispatch, isAlgoliaEnabled]);
|
|
110
93
|
|
|
111
94
|
useEffect(() => {
|
|
112
|
-
if (
|
|
95
|
+
if (visualSearch) {
|
|
113
96
|
setValueInput('');
|
|
114
97
|
if (isAlgoliaEnabled) {
|
|
115
98
|
refine('');
|
|
@@ -117,7 +100,7 @@ const SearchBox = (props: any) => {
|
|
|
117
100
|
history.push('/result');
|
|
118
101
|
}
|
|
119
102
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
120
|
-
}, [
|
|
103
|
+
}, [visualSearch, isAlgoliaEnabled]);
|
|
121
104
|
|
|
122
105
|
useEffect(() => {
|
|
123
106
|
if (history.location?.pathname === '/') {
|
|
@@ -128,130 +111,24 @@ const SearchBox = (props: any) => {
|
|
|
128
111
|
}, [history.location]);
|
|
129
112
|
|
|
130
113
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
131
|
-
const searchOrRedirect =
|
|
132
|
-
debounce((value: any, withImage = true) => {
|
|
133
|
-
if (!isAlgoliaEnabled) {
|
|
134
|
-
dispatch(updateQueryText(value));
|
|
135
|
-
let payload: any;
|
|
136
|
-
let filters: any[] = [];
|
|
137
|
-
const preFilterValues = [
|
|
138
|
-
{
|
|
139
|
-
key: settings.visualSearchFilterKey,
|
|
140
|
-
values: Object.keys(preFilter),
|
|
141
|
-
},
|
|
142
|
-
];
|
|
143
|
-
if (value || requestImage) {
|
|
144
|
-
dispatch(updateStatusLoading(true));
|
|
145
|
-
find({
|
|
146
|
-
image: withImage
|
|
147
|
-
? (requestImage?.canvas as HTMLCanvasElement)
|
|
148
|
-
: undefined,
|
|
149
|
-
settings,
|
|
150
|
-
filters: !isEmpty(preFilter) ? preFilterValues : undefined,
|
|
151
|
-
region: withImage ? selectedRegion : undefined,
|
|
152
|
-
text: value,
|
|
153
|
-
})
|
|
154
|
-
.then((res: any) => {
|
|
155
|
-
res?.results.forEach((item: any) => {
|
|
156
|
-
filters.push({
|
|
157
|
-
sku: item.sku,
|
|
158
|
-
score: item.score,
|
|
159
|
-
});
|
|
160
|
-
});
|
|
161
|
-
payload = {
|
|
162
|
-
...res,
|
|
163
|
-
filters,
|
|
164
|
-
};
|
|
165
|
-
|
|
166
|
-
dispatch(setSearchResults(payload));
|
|
167
|
-
dispatch(updateStatusLoading(false));
|
|
168
|
-
dispatch(setShowFeedback(true));
|
|
169
|
-
})
|
|
170
|
-
.catch((e: any) => {
|
|
171
|
-
console.log('error input search', e);
|
|
172
|
-
dispatch(updateStatusLoading(false));
|
|
173
|
-
});
|
|
174
|
-
} else {
|
|
175
|
-
dispatch(setSearchResults([]));
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
if (value) {
|
|
180
|
-
history.push({
|
|
181
|
-
pathname: '/result',
|
|
182
|
-
search: `?query=${value}`,
|
|
183
|
-
});
|
|
184
|
-
} else {
|
|
185
|
-
history.push('/result');
|
|
186
|
-
}
|
|
187
|
-
}, 500),
|
|
188
|
-
[requestImage, preFilter, selectedRegion, isAlgoliaEnabled],
|
|
189
|
-
);
|
|
114
|
+
const searchOrRedirect = useSearchOrRedirect();
|
|
190
115
|
|
|
191
|
-
const
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
history.push('/result');
|
|
198
|
-
}
|
|
199
|
-
let payload: any;
|
|
200
|
-
let filters: any[] = [];
|
|
201
|
-
let region: RectCoords | undefined;
|
|
202
|
-
|
|
203
|
-
dispatch(setImageSearchInput(URL.createObjectURL(fs[0])));
|
|
204
|
-
let image = await createImage(fs[0]);
|
|
205
|
-
dispatch(setRequestImage(image));
|
|
206
|
-
const preFilterValues = [
|
|
207
|
-
{
|
|
208
|
-
key: settings.visualSearchFilterKey,
|
|
209
|
-
values: Object.keys(preFilter),
|
|
210
|
-
},
|
|
211
|
-
];
|
|
212
|
-
try {
|
|
213
|
-
if (settings.regions) {
|
|
214
|
-
let res = await findRegions(image, settings);
|
|
116
|
+
const onImageUpload = async (fs: any) => {
|
|
117
|
+
dispatch(updateStatusLoading(true));
|
|
118
|
+
dispatch(loadingActionResults());
|
|
119
|
+
if (history.location.pathname !== '/result') {
|
|
120
|
+
history.push('/result');
|
|
121
|
+
}
|
|
215
122
|
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
filters: !isEmpty(preFilter) ? preFilterValues : undefined,
|
|
226
|
-
region,
|
|
227
|
-
})
|
|
228
|
-
.then((res: any) => {
|
|
229
|
-
res?.results.forEach((item: any) => {
|
|
230
|
-
filters.push({
|
|
231
|
-
sku: item.sku,
|
|
232
|
-
score: item.score,
|
|
233
|
-
});
|
|
234
|
-
});
|
|
235
|
-
payload = {
|
|
236
|
-
...res,
|
|
237
|
-
filters,
|
|
238
|
-
};
|
|
239
|
-
dispatch(setSearchResults(payload));
|
|
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])));
|
|
247
|
-
})
|
|
248
|
-
.catch((e: any) => {
|
|
249
|
-
console.log('error input search', e);
|
|
250
|
-
dispatch(updateStatusLoading(false));
|
|
251
|
-
});
|
|
252
|
-
}
|
|
253
|
-
},
|
|
254
|
-
});
|
|
123
|
+
singleImageSearch({
|
|
124
|
+
image: fs,
|
|
125
|
+
settings,
|
|
126
|
+
showFeedback: true,
|
|
127
|
+
newSearch: true,
|
|
128
|
+
}).then(() => {
|
|
129
|
+
dispatch(updateStatusLoading(false));
|
|
130
|
+
});
|
|
131
|
+
};
|
|
255
132
|
|
|
256
133
|
const onChangeText = (event: any) => {
|
|
257
134
|
setValueInput(event.currentTarget.value);
|
|
@@ -276,194 +153,185 @@ const SearchBox = (props: any) => {
|
|
|
276
153
|
return settings.preFilterOption;
|
|
277
154
|
}, [settings.preFilterOption, settings.shouldUseUserMetadata, user]);
|
|
278
155
|
|
|
156
|
+
const showDisclaimerDisabled = useMemo(() => {
|
|
157
|
+
const disclaimer = localStorage.getItem('upload-disclaimer-webapp');
|
|
158
|
+
if (requestImages.length === 0) return true;
|
|
159
|
+
if (!disclaimer) return false;
|
|
160
|
+
return disclaimer === 'dont-show';
|
|
161
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
162
|
+
}, [showDisclaimer, requestImages]);
|
|
163
|
+
|
|
279
164
|
return (
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
<
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
165
|
+
<>
|
|
166
|
+
{showDisclaimer && (
|
|
167
|
+
<UploadDisclaimer
|
|
168
|
+
onClose={() => {
|
|
169
|
+
setShowDisclaimer(false);
|
|
170
|
+
}}
|
|
171
|
+
onContinue={({
|
|
172
|
+
file,
|
|
173
|
+
dontShowAgain,
|
|
174
|
+
}: {
|
|
175
|
+
file: any;
|
|
176
|
+
dontShowAgain: any;
|
|
177
|
+
}) => {
|
|
178
|
+
if (dontShowAgain) {
|
|
179
|
+
localStorage.setItem('upload-disclaimer-webapp', 'dont-show');
|
|
180
|
+
}
|
|
181
|
+
onImageUpload(file);
|
|
182
|
+
|
|
183
|
+
setShowDisclaimer(false);
|
|
184
|
+
}}
|
|
185
|
+
isMobile={false}
|
|
186
|
+
/>
|
|
187
|
+
)}
|
|
188
|
+
<div className="wrap-input-search-field">
|
|
189
|
+
<div className="box-input-search d-flex">
|
|
190
|
+
<div className="input-wrapper">
|
|
191
|
+
<div className="box-inp">
|
|
192
|
+
<Tooltip
|
|
193
|
+
title={
|
|
194
|
+
!isEmpty(preFilter)
|
|
195
|
+
? Object.keys(preFilter).join(', ')
|
|
196
|
+
: t('Add or change pre-filter')
|
|
301
197
|
}
|
|
198
|
+
placement="top"
|
|
199
|
+
arrow={true}
|
|
200
|
+
disableHoverListener={!showPreFilter}
|
|
302
201
|
>
|
|
303
|
-
{showPreFilter && (
|
|
304
|
-
<div
|
|
305
|
-
className="icon-hover desktop"
|
|
306
|
-
style={{
|
|
307
|
-
...(!isEmpty(preFilter)
|
|
308
|
-
? {
|
|
309
|
-
backgroundColor: `${settings.theme?.primaryColor}`,
|
|
310
|
-
}
|
|
311
|
-
: {
|
|
312
|
-
backgroundColor: '#2B2C46',
|
|
313
|
-
}),
|
|
314
|
-
}}
|
|
315
|
-
>
|
|
316
|
-
<IconFilter color="white" />
|
|
317
|
-
</div>
|
|
318
|
-
)}
|
|
319
|
-
{!showPreFilter && <IconSearch width={16} height={16} />}
|
|
320
|
-
{!isEmpty(preFilter) && showPreFilter && (
|
|
321
|
-
<div
|
|
322
|
-
style={{
|
|
323
|
-
position: 'absolute',
|
|
324
|
-
top: '1px',
|
|
325
|
-
left: '26px',
|
|
326
|
-
display: 'flex',
|
|
327
|
-
justifyContent: 'center',
|
|
328
|
-
alignItems: 'center',
|
|
329
|
-
background: 'white',
|
|
330
|
-
width: '12px',
|
|
331
|
-
height: '12px',
|
|
332
|
-
borderRadius: '100%',
|
|
333
|
-
}}
|
|
334
|
-
>
|
|
335
|
-
<div
|
|
336
|
-
style={{
|
|
337
|
-
width: '8px',
|
|
338
|
-
height: '8px',
|
|
339
|
-
background: settings.theme?.primaryColor,
|
|
340
|
-
borderRadius: '100%',
|
|
341
|
-
strokeWidth: '2px',
|
|
342
|
-
}}
|
|
343
|
-
></div>
|
|
344
|
-
</div>
|
|
345
|
-
)}
|
|
346
|
-
</div>
|
|
347
|
-
</Tooltip>
|
|
348
|
-
<div
|
|
349
|
-
style={{
|
|
350
|
-
height: '75%',
|
|
351
|
-
order: 1,
|
|
352
|
-
}}
|
|
353
|
-
>
|
|
354
|
-
{imageThumbSearchInput && (
|
|
355
202
|
<div
|
|
203
|
+
className="pre-filter-icon"
|
|
356
204
|
style={{
|
|
357
|
-
|
|
358
|
-
backgroundColor: `${settings.theme?.primaryColor}26`,
|
|
359
|
-
marginRight: '5px',
|
|
360
|
-
display: 'flex',
|
|
205
|
+
cursor: showPreFilter ? 'pointer' : 'default',
|
|
361
206
|
}}
|
|
362
|
-
|
|
207
|
+
onClick={() =>
|
|
208
|
+
showPreFilter ? setToggleModalFilterDesktop(true) : false
|
|
209
|
+
}
|
|
363
210
|
>
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
type="button"
|
|
376
|
-
onClick={() => {
|
|
377
|
-
if (!valueInput) {
|
|
378
|
-
dispatch(reset(''));
|
|
379
|
-
history.push('/');
|
|
380
|
-
}
|
|
381
|
-
dispatch(reset(''));
|
|
382
|
-
if (isAlgoliaEnabled) {
|
|
383
|
-
refine(valueInput);
|
|
384
|
-
} else {
|
|
385
|
-
searchOrRedirect(valueInput, false);
|
|
386
|
-
}
|
|
211
|
+
{showPreFilter && (
|
|
212
|
+
<div
|
|
213
|
+
className="icon-hover desktop"
|
|
214
|
+
style={{
|
|
215
|
+
...(!isEmpty(preFilter)
|
|
216
|
+
? {
|
|
217
|
+
backgroundColor: `${settings.theme?.primaryColor}`,
|
|
218
|
+
}
|
|
219
|
+
: {
|
|
220
|
+
backgroundColor: '#2B2C46',
|
|
221
|
+
}),
|
|
387
222
|
}}
|
|
388
223
|
>
|
|
389
|
-
<
|
|
224
|
+
<IconFilter color="white" />
|
|
225
|
+
</div>
|
|
226
|
+
)}
|
|
227
|
+
{!showPreFilter && <IconSearch width={16} height={16} />}
|
|
228
|
+
{!isEmpty(preFilter) && showPreFilter && (
|
|
229
|
+
<div
|
|
230
|
+
style={{
|
|
231
|
+
position: 'absolute',
|
|
232
|
+
top: '1px',
|
|
233
|
+
left: '26px',
|
|
234
|
+
display: 'flex',
|
|
235
|
+
justifyContent: 'center',
|
|
236
|
+
alignItems: 'center',
|
|
237
|
+
background: 'white',
|
|
238
|
+
width: '12px',
|
|
239
|
+
height: '12px',
|
|
240
|
+
borderRadius: '100%',
|
|
241
|
+
}}
|
|
242
|
+
>
|
|
243
|
+
<div
|
|
390
244
|
style={{
|
|
391
|
-
|
|
392
|
-
|
|
245
|
+
width: '8px',
|
|
246
|
+
height: '8px',
|
|
247
|
+
background: settings.theme?.primaryColor,
|
|
248
|
+
borderRadius: '100%',
|
|
249
|
+
strokeWidth: '2px',
|
|
393
250
|
}}
|
|
394
|
-
|
|
395
|
-
</
|
|
396
|
-
|
|
251
|
+
></div>
|
|
252
|
+
</div>
|
|
253
|
+
)}
|
|
397
254
|
</div>
|
|
398
|
-
|
|
399
|
-
</div>
|
|
255
|
+
</Tooltip>
|
|
400
256
|
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
257
|
+
<input
|
|
258
|
+
style={{
|
|
259
|
+
border: '0px',
|
|
260
|
+
width: '100%',
|
|
261
|
+
fontSize: 14,
|
|
262
|
+
color: '#2B2C46',
|
|
263
|
+
}}
|
|
264
|
+
className="input-search hhhh"
|
|
265
|
+
placeholder={t('Search')}
|
|
266
|
+
value={valueInput}
|
|
267
|
+
onChange={onChangeText}
|
|
268
|
+
ref={focusInp}
|
|
269
|
+
/>
|
|
270
|
+
</div>
|
|
415
271
|
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
272
|
+
{history.location.pathname === '/result' && valueInput && (
|
|
273
|
+
<Button
|
|
274
|
+
className="btn-clear-text"
|
|
275
|
+
onClick={() => {
|
|
276
|
+
if (visualSearch) {
|
|
277
|
+
history.push('/result');
|
|
278
|
+
if (!isAlgoliaEnabled) {
|
|
279
|
+
searchOrRedirect('');
|
|
280
|
+
}
|
|
281
|
+
setValueInput('');
|
|
282
|
+
if (isAlgoliaEnabled) {
|
|
283
|
+
refine('');
|
|
284
|
+
}
|
|
285
|
+
return;
|
|
424
286
|
}
|
|
425
287
|
setValueInput('');
|
|
426
288
|
if (isAlgoliaEnabled) {
|
|
427
289
|
refine('');
|
|
428
290
|
}
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
if (isAlgoliaEnabled) {
|
|
433
|
-
refine('');
|
|
434
|
-
}
|
|
435
|
-
dispatch(reset(''));
|
|
436
|
-
history.push('/');
|
|
437
|
-
}}
|
|
438
|
-
>
|
|
439
|
-
<Tooltip
|
|
440
|
-
title={t('Clear text search')}
|
|
441
|
-
placement="top"
|
|
442
|
-
arrow={true}
|
|
291
|
+
dispatch(reset(''));
|
|
292
|
+
history.push('/');
|
|
293
|
+
}}
|
|
443
294
|
>
|
|
444
|
-
<
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
295
|
+
<Tooltip
|
|
296
|
+
title={t('Clear text search')}
|
|
297
|
+
placement="top"
|
|
298
|
+
arrow={true}
|
|
299
|
+
>
|
|
300
|
+
<ClearOutlinedIcon
|
|
301
|
+
style={{ fontSize: 16, color: '#2B2C46' }}
|
|
302
|
+
/>
|
|
303
|
+
</Tooltip>
|
|
304
|
+
</Button>
|
|
305
|
+
)}
|
|
449
306
|
<div className="wrap-box-input-mobile d-flex">
|
|
450
307
|
<input
|
|
451
308
|
accept="image/*"
|
|
452
309
|
id="icon-button-file"
|
|
453
310
|
type="file"
|
|
454
311
|
style={{ display: 'none' }}
|
|
455
|
-
{
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
312
|
+
onClick={e => {
|
|
313
|
+
e.stopPropagation();
|
|
314
|
+
}}
|
|
315
|
+
onChange={e => {
|
|
316
|
+
if (e?.target?.files) {
|
|
317
|
+
const file = e?.target?.files[0];
|
|
318
|
+
onImageUpload(file);
|
|
319
|
+
}
|
|
320
|
+
}}
|
|
460
321
|
/>
|
|
461
322
|
<Tooltip
|
|
462
323
|
title={t('Search with an image')}
|
|
463
324
|
placement="top"
|
|
464
325
|
arrow={true}
|
|
465
326
|
>
|
|
466
|
-
<label
|
|
327
|
+
<label
|
|
328
|
+
htmlFor={showDisclaimerDisabled ? 'icon-button-file' : ''}
|
|
329
|
+
onClick={e => {
|
|
330
|
+
if (!showDisclaimerDisabled) {
|
|
331
|
+
setShowDisclaimer(true);
|
|
332
|
+
}
|
|
333
|
+
}}
|
|
334
|
+
>
|
|
467
335
|
<IconButton
|
|
468
336
|
color="primary"
|
|
469
337
|
aria-label="upload picture"
|
|
@@ -480,31 +348,22 @@ const SearchBox = (props: any) => {
|
|
|
480
348
|
</label>
|
|
481
349
|
</Tooltip>
|
|
482
350
|
</div>
|
|
483
|
-
|
|
484
|
-
<div>
|
|
485
|
-
<Button
|
|
486
|
-
className="btn-mobile-filter"
|
|
487
|
-
onClick={onToggleFilterMobile}
|
|
488
|
-
>
|
|
489
|
-
<IconFilter width={18} height={18} />
|
|
490
|
-
</Button>
|
|
491
|
-
</div>
|
|
492
|
-
)}
|
|
351
|
+
</div>
|
|
493
352
|
</div>
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
openModal={isOpenModalFilterDesktop}
|
|
498
|
-
handleClose={() => setToggleModalFilterDesktop(false)}
|
|
499
|
-
classNameModal="wrap-filter-desktop"
|
|
500
|
-
classNameComponentChild="bg-white box-filter-desktop"
|
|
501
|
-
>
|
|
502
|
-
<PreFilterComponent
|
|
353
|
+
{showPreFilter && (
|
|
354
|
+
<DefaultModal
|
|
355
|
+
openModal={isOpenModalFilterDesktop}
|
|
503
356
|
handleClose={() => setToggleModalFilterDesktop(false)}
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
357
|
+
classNameModal="wrap-filter-desktop"
|
|
358
|
+
classNameComponentChild="bg-white box-filter-desktop"
|
|
359
|
+
>
|
|
360
|
+
<PreFilterComponent
|
|
361
|
+
handleClose={() => setToggleModalFilterDesktop(false)}
|
|
362
|
+
/>
|
|
363
|
+
</DefaultModal>
|
|
364
|
+
)}
|
|
365
|
+
</div>
|
|
366
|
+
</>
|
|
508
367
|
);
|
|
509
368
|
};
|
|
510
369
|
|