@nyris/nyris-webapp 0.3.33 → 0.3.35
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 +28 -14
- package/build/index.html +1 -1
- package/build/js/settings.example.js +13 -25
- package/build/{precache-manifest.4cff5b8aafe3d00d59bc2c9725eb6ade.js → precache-manifest.375ac411683570ee1df5aea6de03409d.js} +70 -14
- package/build/service-worker.js +1 -1
- package/build/static/css/main.f5a1c730.chunk.css +2 -0
- package/build/static/css/main.f5a1c730.chunk.css.map +1 -0
- package/build/static/js/2.724f4cba.chunk.js +3 -0
- package/build/static/js/2.724f4cba.chunk.js.map +1 -0
- package/build/static/js/main.f579fa9f.chunk.js +3 -0
- package/build/static/js/main.f579fa9f.chunk.js.map +1 -0
- package/build/static/media/filter.bc412f08.svg +3 -0
- package/build/static/media/icon_search_image2.fab34be4.svg +3 -0
- package/build/static/media/img-1-1.6144e5f9.png +0 -0
- package/build/static/media/img-1-2.ad943f0f.png +0 -0
- package/build/static/media/img2-1.a87c79c7.png +0 -0
- package/build/static/media/img2-2.39c5b73f.png +0 -0
- package/build/static/media/img3-1.443b0c3a.png +0 -0
- package/build/static/media/img3-2.37db7999.png +0 -0
- package/build/static/media/img4-1.9c34c158.png +0 -0
- package/build/static/media/img4-2.9d280a04.png +0 -0
- package/build/static/media/img5-1.b61dbd4d.png +0 -0
- package/build/static/media/img5-2.1c77c093.png +0 -0
- package/build/static/media/img6-1.8b03dd21.png +0 -0
- package/build/static/media/img6-2.1e3e7fed.png +0 -0
- package/build/static/media/{info-tooltip.5feeef22.svg → info-tooltip.b98e8a9c.svg} +2 -2
- package/build/static/media/take_photo.76423216.svg +5 -0
- package/package.json +3 -3
- package/public/js/settings.example.js +13 -25
- package/src/Store/constants.ts +0 -1
- package/src/Store/search/Search.ts +32 -17
- package/src/Store/search/search.initialState.ts +17 -16
- package/src/Store/search/types.ts +15 -14
- package/src/common/assets/icons/expand.svg +3 -27
- package/src/common/assets/icons/filter.svg +3 -0
- package/src/common/assets/icons/icon_search_image2.svg +2 -25
- package/src/common/assets/icons/info-tooltip.svg +2 -2
- package/src/common/assets/icons/take_photo.svg +5 -0
- package/src/common/assets/images/imageCaptureHelp/img-1-1.png +0 -0
- package/src/common/assets/images/imageCaptureHelp/img-1-2.png +0 -0
- package/src/common/assets/images/imageCaptureHelp/img2-1.png +0 -0
- package/src/common/assets/images/imageCaptureHelp/img2-2.png +0 -0
- package/src/common/assets/images/imageCaptureHelp/img3-1.png +0 -0
- package/src/common/assets/images/imageCaptureHelp/img3-2.png +0 -0
- package/src/common/assets/images/imageCaptureHelp/img4-1.png +0 -0
- package/src/common/assets/images/imageCaptureHelp/img4-2.png +0 -0
- package/src/common/assets/images/imageCaptureHelp/img5-1.png +0 -0
- package/src/common/assets/images/imageCaptureHelp/img5-2.png +0 -0
- package/src/common/assets/images/imageCaptureHelp/img6-1.png +0 -0
- package/src/common/assets/images/imageCaptureHelp/img6-2.png +0 -0
- package/src/components/DetailItem.tsx +62 -78
- package/src/components/FooterMobile.tsx +80 -41
- package/src/components/HeaderMobile.tsx +225 -227
- package/src/components/ImageCaptureHelpModal.tsx +90 -0
- package/src/components/Layout.tsx +39 -9
- package/src/components/MobilePostFilter.tsx +20 -0
- package/src/components/PanelResult/expandable-panel.tsx +21 -21
- package/src/components/PanelResult/index.tsx +52 -19
- package/src/components/ProductList/index.tsx +5 -3
- package/src/components/appMobile.scss +64 -32
- package/src/components/carousel/ImagePreviewCarousel.tsx +2 -8
- package/src/components/drawer/cameraCustom.tsx +8 -33
- package/src/components/input/inputSearch.tsx +68 -80
- package/src/components/pre-filter/index.tsx +70 -57
- package/src/components/results/ItemResult.tsx +73 -89
- package/src/constants.ts +56 -0
- package/src/page/landingPage/AppMobile.tsx +34 -104
- package/src/page/landingPage/common.scss +167 -38
- package/src/page/result/index.tsx +70 -56
- package/src/services/Feedback.ts +20 -2
- package/src/services/types.ts +0 -1
- package/src/translations.ts +4 -0
- package/src/types.ts +3 -2
- package/build/static/css/main.d0b21fa5.chunk.css +0 -2
- package/build/static/css/main.d0b21fa5.chunk.css.map +0 -1
- package/build/static/js/2.69ce0823.chunk.js +0 -3
- package/build/static/js/2.69ce0823.chunk.js.map +0 -1
- package/build/static/js/main.6122377b.chunk.js +0 -3
- package/build/static/js/main.6122377b.chunk.js.map +0 -1
- package/build/static/media/icon_search_image2.e46fdfc5.svg +0 -26
- package/src/hooks/useVisualSearch.tsx +0 -77
- /package/build/static/js/{2.69ce0823.chunk.js.LICENSE.txt → 2.724f4cba.chunk.js.LICENSE.txt} +0 -0
- /package/build/static/js/{main.6122377b.chunk.js.LICENSE.txt → main.f579fa9f.chunk.js.LICENSE.txt} +0 -0
|
@@ -7,8 +7,7 @@ import { ReactComponent as IconLike } from 'common/assets/icons/icon_like.svg';
|
|
|
7
7
|
import { ReactComponent as IconSearchImage } from 'common/assets/icons/icon_search_image2.svg';
|
|
8
8
|
import React, { memo, useEffect, useState } from 'react';
|
|
9
9
|
import NoImage from 'common/assets/images/unnamed.png';
|
|
10
|
-
import {
|
|
11
|
-
import { useAppDispatch, useAppSelector } from 'Store/Store';
|
|
10
|
+
import { RootState, useAppDispatch, useAppSelector } from 'Store/Store';
|
|
12
11
|
import DefaultModal from 'components/modal/DefaultModal';
|
|
13
12
|
import DetailItem from 'components/DetailItem';
|
|
14
13
|
import {
|
|
@@ -18,13 +17,15 @@ import {
|
|
|
18
17
|
import { ShareModal } from '../ShareModal';
|
|
19
18
|
import { truncateString } from 'helpers/truncateString';
|
|
20
19
|
import { useTranslation } from 'react-i18next';
|
|
20
|
+
import { useMediaQuery } from 'react-responsive';
|
|
21
|
+
import { feedbackClickEpic, feedbackConversionEpic } from 'services/Feedback';
|
|
21
22
|
|
|
22
23
|
interface Props {
|
|
23
24
|
dataItem: any;
|
|
24
25
|
handlerToggleModal?: any;
|
|
25
26
|
handleClose?: () => void;
|
|
26
27
|
isHover?: boolean;
|
|
27
|
-
indexItem
|
|
28
|
+
indexItem: number;
|
|
28
29
|
onSearchImage?: any;
|
|
29
30
|
handlerFeedback?: any;
|
|
30
31
|
handlerGroupItem?: any;
|
|
@@ -48,13 +49,15 @@ function ItemResult(props: Props) {
|
|
|
48
49
|
} = props;
|
|
49
50
|
const dispatch = useAppDispatch();
|
|
50
51
|
const [urlImage, setUrlImage] = useState<string>('');
|
|
51
|
-
const
|
|
52
|
+
const state = useAppSelector<RootState>((state: any) => state);
|
|
53
|
+
const { settings } = state;
|
|
52
54
|
const [isOpenModalImage, setOpenModalImage] = useState<boolean>(false);
|
|
53
55
|
const [isOpenModalShare, setOpenModalShare] = useState<boolean>(false);
|
|
54
56
|
const [feedback, setFeedback] = useState('none');
|
|
55
57
|
const { t } = useTranslation();
|
|
56
58
|
const { sku, collap } = dataItem;
|
|
57
59
|
const brand = dataItem[settings.field.productTag];
|
|
60
|
+
const isMobile = useMediaQuery({ query: '(max-width: 776px)' });
|
|
58
61
|
|
|
59
62
|
useEffect(() => {
|
|
60
63
|
if (main_image_link) {
|
|
@@ -92,6 +95,7 @@ function ItemResult(props: Props) {
|
|
|
92
95
|
};
|
|
93
96
|
|
|
94
97
|
const handlerToggleModal = (item: any) => {
|
|
98
|
+
feedbackClickEpic(state, indexItem, item.sku);
|
|
95
99
|
setOpenModalImage(true);
|
|
96
100
|
dispatch(onToggleModalItemDetail(true));
|
|
97
101
|
dispatch(updateStatusLoading(true));
|
|
@@ -99,6 +103,7 @@ function ItemResult(props: Props) {
|
|
|
99
103
|
dispatch(updateStatusLoading(false));
|
|
100
104
|
}, 400);
|
|
101
105
|
};
|
|
106
|
+
const ctaLink = dataItem[settings.field?.ctaLinkField];
|
|
102
107
|
return (
|
|
103
108
|
<Box className="wrap-main-item-result">
|
|
104
109
|
<DefaultModal
|
|
@@ -144,17 +149,15 @@ function ItemResult(props: Props) {
|
|
|
144
149
|
</Box>
|
|
145
150
|
)}
|
|
146
151
|
{!isHover && main_image_link && (
|
|
147
|
-
<Box
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
<IconSearchImage color={settings.theme?.secondaryColor} />
|
|
157
|
-
</Button>
|
|
152
|
+
<Box
|
|
153
|
+
className="box-icon-modal"
|
|
154
|
+
onClick={() => {
|
|
155
|
+
if (urlImage.length > 1) {
|
|
156
|
+
onSearchImage(main_image_link);
|
|
157
|
+
}
|
|
158
|
+
}}
|
|
159
|
+
>
|
|
160
|
+
<IconSearchImage width={16} height={16} color={'#AAABB5'} />
|
|
158
161
|
</Box>
|
|
159
162
|
)}
|
|
160
163
|
<Box className="box-image">
|
|
@@ -182,11 +185,6 @@ function ItemResult(props: Props) {
|
|
|
182
185
|
/>
|
|
183
186
|
)}
|
|
184
187
|
</Button>
|
|
185
|
-
{isHover && (
|
|
186
|
-
<Box className="box-hover">
|
|
187
|
-
<Button>View item</Button>
|
|
188
|
-
</Box>
|
|
189
|
-
)}
|
|
190
188
|
</Box>
|
|
191
189
|
</Box>
|
|
192
190
|
|
|
@@ -199,7 +197,7 @@ function ItemResult(props: Props) {
|
|
|
199
197
|
flexGrow: 1,
|
|
200
198
|
}}
|
|
201
199
|
>
|
|
202
|
-
<Box className="box-top"
|
|
200
|
+
<Box className="box-top">
|
|
203
201
|
<Grid container justifyContent="space-between">
|
|
204
202
|
<Grid item xs={12}>
|
|
205
203
|
<Tooltip
|
|
@@ -219,7 +217,7 @@ function ItemResult(props: Props) {
|
|
|
219
217
|
<span style={{ marginRight: 3 }}>
|
|
220
218
|
{settings.itemIdLabel || 'SKU'}:
|
|
221
219
|
</span>
|
|
222
|
-
{truncateString(sku,
|
|
220
|
+
{truncateString(sku, 20)}
|
|
223
221
|
</Typography>
|
|
224
222
|
</Tooltip>
|
|
225
223
|
|
|
@@ -283,85 +281,71 @@ function ItemResult(props: Props) {
|
|
|
283
281
|
</Box>
|
|
284
282
|
</Tooltip>
|
|
285
283
|
)}
|
|
286
|
-
{!settings.warehouseVariant && (
|
|
287
|
-
<Typography
|
|
288
|
-
className="text-f13 fw-600 max-line-3"
|
|
289
|
-
style={{ color: '#1E1F31', marginTop: 12 }}
|
|
290
|
-
>
|
|
291
|
-
{dataItem[settings.field.productName]}
|
|
292
|
-
</Typography>
|
|
293
|
-
)}
|
|
294
284
|
</Grid>
|
|
295
285
|
</Grid>
|
|
296
286
|
</Box>
|
|
297
287
|
<div>
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
288
|
+
<Tooltip
|
|
289
|
+
title={dataItem[settings.field.productName]}
|
|
290
|
+
placement="top"
|
|
291
|
+
arrow={true}
|
|
292
|
+
disableHoverListener={
|
|
293
|
+
dataItem[settings.field.productName]?.length < 45
|
|
294
|
+
}
|
|
295
|
+
>
|
|
296
|
+
<Box
|
|
297
|
+
style={{
|
|
298
|
+
boxShadow: '-2px 2px 4px rgba(170, 171, 181, 0.5)',
|
|
299
|
+
// marginBottom: 22,
|
|
300
|
+
height: 40,
|
|
301
|
+
background: `linear-gradient(270deg, ${settings.theme?.primaryColor}bb 0%, ${settings.theme?.primaryColor} 100%)`,
|
|
302
|
+
borderRadius: 4,
|
|
303
|
+
padding: '0px 8px',
|
|
304
|
+
marginTop: '12px',
|
|
305
|
+
}}
|
|
306
|
+
display={'flex'}
|
|
307
|
+
justifyItems={'center'}
|
|
308
|
+
alignItems={'center'}
|
|
309
|
+
justifyContent={'space-between'}
|
|
307
310
|
>
|
|
308
311
|
<Box
|
|
309
312
|
style={{
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
313
|
+
display: 'flex',
|
|
314
|
+
justifyContent: 'space-between',
|
|
315
|
+
width: '100%',
|
|
316
|
+
padding: 0,
|
|
317
|
+
cursor: ctaLink ? 'pointer' : 'normal',
|
|
318
|
+
}}
|
|
319
|
+
onClick={() => {
|
|
320
|
+
if (ctaLink) {
|
|
321
|
+
feedbackConversionEpic(state, indexItem, dataItem.sku);
|
|
322
|
+
window.open(`${ctaLink}`, '_blank');
|
|
323
|
+
}
|
|
317
324
|
}}
|
|
318
|
-
display={'flex'}
|
|
319
|
-
justifyItems={'center'}
|
|
320
|
-
alignItems={'center'}
|
|
321
|
-
justifyContent={'space-between'}
|
|
322
325
|
>
|
|
323
|
-
<
|
|
326
|
+
<Typography
|
|
327
|
+
className="text-white max-line-2"
|
|
324
328
|
style={{
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
+
overflow: 'hidden',
|
|
330
|
+
textOverflow: 'ellipsis',
|
|
331
|
+
fontWeight: 500,
|
|
332
|
+
fontSize: '11px',
|
|
333
|
+
letterSpacing: '0.27px',
|
|
334
|
+
wordBreak: 'break-all',
|
|
335
|
+
maxWidth: !isMobile && ctaLink ? '136px' : '164x',
|
|
336
|
+
paddingRight: '8px',
|
|
329
337
|
}}
|
|
330
|
-
|
|
331
|
-
window.open(
|
|
332
|
-
`${dataItem[settings.field.ctaLinkField]}`,
|
|
333
|
-
'_blank',
|
|
334
|
-
)
|
|
335
|
-
}
|
|
338
|
+
align="left"
|
|
336
339
|
>
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
textTransform: !settings.warehouseVariant
|
|
341
|
-
? 'uppercase'
|
|
342
|
-
: 'none',
|
|
343
|
-
overflow: 'hidden',
|
|
344
|
-
textOverflow: 'ellipsis',
|
|
345
|
-
fontWeight: !settings.warehouseVariant ? 700 : 500,
|
|
346
|
-
fontSize: !settings.warehouseVariant ? '12px' : '11px',
|
|
347
|
-
letterSpacing: '0.27px',
|
|
348
|
-
wordBreak: !settings.warehouseVariant
|
|
349
|
-
? 'normal'
|
|
350
|
-
: 'break-all',
|
|
351
|
-
maxWidth: '136px',
|
|
352
|
-
paddingRight: '8px',
|
|
353
|
-
}}
|
|
354
|
-
align="left"
|
|
355
|
-
>
|
|
356
|
-
{settings.warehouseVariant
|
|
357
|
-
? truncateString(dataItem[settings.field.productName], 35)
|
|
358
|
-
: settings.productCtaText || 'MORE INFO'}
|
|
359
|
-
</Typography>
|
|
340
|
+
{truncateString(dataItem[settings.field.productName], 45)}
|
|
341
|
+
</Typography>
|
|
342
|
+
{!isMobile && ctaLink && (
|
|
360
343
|
<img src={IconOpenLink} alt="more-info" width={20} />
|
|
361
|
-
|
|
344
|
+
)}
|
|
362
345
|
</Box>
|
|
363
|
-
</
|
|
364
|
-
|
|
346
|
+
</Box>
|
|
347
|
+
</Tooltip>
|
|
348
|
+
|
|
365
349
|
{settings.warehouseVariant && (
|
|
366
350
|
<Box
|
|
367
351
|
display="flex"
|
|
@@ -478,9 +462,9 @@ function ItemResult(props: Props) {
|
|
|
478
462
|
<Button
|
|
479
463
|
style={{ padding: '6px' }}
|
|
480
464
|
className="btn-item"
|
|
481
|
-
onClick={() =>
|
|
465
|
+
onClick={() => setOpenModalShare(true)}
|
|
482
466
|
>
|
|
483
|
-
<IconShare width={16} height={16} color="#
|
|
467
|
+
<IconShare width={16} height={16} color="#000000" />
|
|
484
468
|
</Button>
|
|
485
469
|
</Box>
|
|
486
470
|
</Grid>
|
package/src/constants.ts
CHANGED
|
@@ -1,3 +1,16 @@
|
|
|
1
|
+
import img1 from 'common/assets/images/imageCaptureHelp/img-1-1.png';
|
|
2
|
+
import img2 from 'common/assets/images/imageCaptureHelp/img-1-2.png';
|
|
3
|
+
import img3 from 'common/assets/images/imageCaptureHelp/img2-1.png';
|
|
4
|
+
import img4 from 'common/assets/images/imageCaptureHelp/img2-2.png';
|
|
5
|
+
import img5 from 'common/assets/images/imageCaptureHelp/img3-1.png';
|
|
6
|
+
import img6 from 'common/assets/images/imageCaptureHelp/img3-2.png';
|
|
7
|
+
import img7 from 'common/assets/images/imageCaptureHelp/img4-1.png';
|
|
8
|
+
import img8 from 'common/assets/images/imageCaptureHelp/img4-2.png';
|
|
9
|
+
import img9 from 'common/assets/images/imageCaptureHelp/img5-1.png';
|
|
10
|
+
import img10 from 'common/assets/images/imageCaptureHelp/img5-2.png';
|
|
11
|
+
import img11 from 'common/assets/images/imageCaptureHelp/img6-1.png';
|
|
12
|
+
import img12 from 'common/assets/images/imageCaptureHelp/img6-2.png';
|
|
13
|
+
|
|
1
14
|
export const DEFAULT_REGION = { x1: 0, x2: 1, y1: 0, y2: 1 };
|
|
2
15
|
export const showHits = [
|
|
3
16
|
{ value: 10, label: '10' },
|
|
@@ -11,3 +24,46 @@ export const showHits = [
|
|
|
11
24
|
{ value: 90, label: '90' },
|
|
12
25
|
{ value: 100, label: '100' },
|
|
13
26
|
];
|
|
27
|
+
export const visualSearchHelp = [
|
|
28
|
+
{
|
|
29
|
+
title: 'SELECT THE RIGHT IMAGE AREA',
|
|
30
|
+
description:
|
|
31
|
+
'The main object should occupy the major part of the image. Use the cropping tool available to crop the image and remove excess background.',
|
|
32
|
+
imageLeft: img1,
|
|
33
|
+
imageRight: img2,
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
title: 'PICTURE CLARITY',
|
|
37
|
+
description: 'The image should not be blurred or out of focus.',
|
|
38
|
+
imageLeft: img3,
|
|
39
|
+
imageRight: img4,
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
title: 'OPTIMAL LIGHTING',
|
|
43
|
+
description:
|
|
44
|
+
'The images should be taken in a bright area or use your camera’s flash to take a well-lit picture.',
|
|
45
|
+
imageLeft: img5,
|
|
46
|
+
imageRight: img6,
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
title: 'MONOCHROME BACKGROUND',
|
|
50
|
+
description:
|
|
51
|
+
'The object should be placed on a plain and light background and patterned background should be avoided.',
|
|
52
|
+
imageLeft: img7,
|
|
53
|
+
imageRight: img8,
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
title: 'VISIBILITY OF THE OBJECT',
|
|
57
|
+
description:
|
|
58
|
+
'Click an image encapsulating most of the object’s key components.',
|
|
59
|
+
imageLeft: img9,
|
|
60
|
+
imageRight: img10,
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
title: 'OCR CAPTURE',
|
|
64
|
+
description:
|
|
65
|
+
'It is recommended to take a clear picture of the text on the typeplate etc, to ensure that the model can detect the text and give accurate results.',
|
|
66
|
+
imageLeft: img11,
|
|
67
|
+
imageRight: img12,
|
|
68
|
+
},
|
|
69
|
+
];
|
|
@@ -1,126 +1,56 @@
|
|
|
1
|
-
import { Box
|
|
2
|
-
import { RectCoords } from '@nyris/nyris-api';
|
|
1
|
+
import { Box } from '@material-ui/core';
|
|
3
2
|
import CameraCustom from 'components/drawer/cameraCustom';
|
|
4
|
-
import ExampleImages from 'components/ExampleImages';
|
|
5
3
|
import React, { useEffect, useState } from 'react';
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import { showFeedback, showResults } from 'Store/nyris/Nyris';
|
|
10
|
-
import {
|
|
11
|
-
loadingActionResults,
|
|
12
|
-
reset,
|
|
13
|
-
setImageSearchInput,
|
|
14
|
-
setRegions,
|
|
15
|
-
setRequestImage,
|
|
16
|
-
setSearchResults,
|
|
17
|
-
setSelectedRegion,
|
|
18
|
-
updateStatusLoading,
|
|
19
|
-
} from 'Store/search/Search';
|
|
20
|
-
import { useAppDispatch, useAppSelector } from 'Store/Store';
|
|
4
|
+
import { reset } from 'Store/search/Search';
|
|
5
|
+
import { useAppDispatch } from 'Store/Store';
|
|
6
|
+
import { ReactComponent as CameraIcon } from 'common/assets/icons/take_photo.svg';
|
|
21
7
|
|
|
22
8
|
function AppMobile(): JSX.Element {
|
|
23
|
-
const history = useHistory();
|
|
24
9
|
const dispatch = useAppDispatch();
|
|
25
|
-
const searchState = useAppSelector(state => state);
|
|
26
|
-
const {
|
|
27
|
-
settings,
|
|
28
|
-
search: { keyFilter },
|
|
29
|
-
} = searchState;
|
|
30
10
|
const [isOpenModalCamera, setOpenModalCamera] = useState<boolean>(false);
|
|
31
11
|
|
|
32
12
|
useEffect(() => {
|
|
33
13
|
dispatch(reset(''));
|
|
34
14
|
}, [dispatch]);
|
|
35
15
|
|
|
36
|
-
const getUrlToCanvasFile = async (url: string, position?: number) => {
|
|
37
|
-
if (history.location?.pathname === '/') {
|
|
38
|
-
history.push('/result');
|
|
39
|
-
}
|
|
40
|
-
dispatch(updateStatusLoading(true));
|
|
41
|
-
dispatch(showResults());
|
|
42
|
-
dispatch(loadingActionResults());
|
|
43
|
-
dispatch(setImageSearchInput(url));
|
|
44
|
-
if (position) {
|
|
45
|
-
feedbackClickEpic(searchState, position);
|
|
46
|
-
}
|
|
47
|
-
let image = await createImage(url);
|
|
48
|
-
dispatch(setRequestImage(image));
|
|
49
|
-
let searchRegion: RectCoords | undefined = undefined;
|
|
50
|
-
if (settings.regions) {
|
|
51
|
-
let res = await findRegions(image, settings);
|
|
52
|
-
dispatch(setRegions(res.regions));
|
|
53
|
-
searchRegion = res.selectedRegion;
|
|
54
|
-
dispatch(setSelectedRegion(searchRegion));
|
|
55
|
-
}
|
|
56
|
-
const preFilter = [
|
|
57
|
-
{
|
|
58
|
-
key: settings.visualSearchFilterKey,
|
|
59
|
-
values: [`${keyFilter}`],
|
|
60
|
-
},
|
|
61
|
-
];
|
|
62
|
-
findByImage({
|
|
63
|
-
image,
|
|
64
|
-
settings,
|
|
65
|
-
region: searchRegion,
|
|
66
|
-
filters: keyFilter ? preFilter : undefined,
|
|
67
|
-
})
|
|
68
|
-
.then(res => {
|
|
69
|
-
dispatch(setSearchResults(res));
|
|
70
|
-
dispatch(updateStatusLoading(false));
|
|
71
|
-
dispatch(showFeedback());
|
|
72
|
-
return;
|
|
73
|
-
})
|
|
74
|
-
.catch((err: any) => {
|
|
75
|
-
console.log('err getUrlToCanvasFile mobile', err);
|
|
76
|
-
});
|
|
77
|
-
};
|
|
78
|
-
|
|
79
16
|
return (
|
|
80
|
-
|
|
81
|
-
|
|
17
|
+
<div
|
|
18
|
+
style={{
|
|
19
|
+
display: 'flex',
|
|
20
|
+
flexDirection: 'column',
|
|
21
|
+
justifyContent: 'center',
|
|
22
|
+
alignItems: 'center',
|
|
23
|
+
width: '100%',
|
|
24
|
+
}}
|
|
25
|
+
>
|
|
26
|
+
<div className="take-photo">
|
|
82
27
|
<div
|
|
28
|
+
className="take-photo-wrapper"
|
|
83
29
|
style={{
|
|
84
|
-
|
|
85
|
-
top: '1px',
|
|
86
|
-
height: '100%',
|
|
87
|
-
width: '100%',
|
|
88
|
-
zIndex: 1,
|
|
89
|
-
background: `${settings.theme?.mobileFooterImageColor}`,
|
|
30
|
+
background: 'linear-gradient(90deg, #55566B 0%, #2B2C46 100%)',
|
|
90
31
|
}}
|
|
91
|
-
></div>
|
|
92
|
-
<Box style={{ position: 'inherit', zIndex: 100 }} className="title-top">
|
|
93
|
-
<Typography className="text-center text-white">
|
|
94
|
-
Snap a photo or attach any image in the <br /> following formats:
|
|
95
|
-
</Typography>
|
|
96
|
-
<Typography className="text-center text-white">
|
|
97
|
-
jpg, png, svg, pdf or tiff
|
|
98
|
-
</Typography>
|
|
99
|
-
</Box>
|
|
100
|
-
<Box
|
|
101
|
-
style={{ position: 'inherit', zIndex: 100 }}
|
|
102
|
-
className="box-drag-mobile"
|
|
103
32
|
>
|
|
104
|
-
<
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
return getUrlToCanvasFile(url);
|
|
108
|
-
}}
|
|
109
|
-
onToggleModalCamera={() => {
|
|
33
|
+
<div
|
|
34
|
+
className="outer"
|
|
35
|
+
onClick={() => {
|
|
110
36
|
setOpenModalCamera(!isOpenModalCamera);
|
|
111
37
|
}}
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
38
|
+
>
|
|
39
|
+
<div className="inner">
|
|
40
|
+
<CameraIcon color={'#2B2C46'} />
|
|
41
|
+
</div>
|
|
42
|
+
</div>
|
|
43
|
+
</div>
|
|
44
|
+
</div>
|
|
45
|
+
<Box className="box-screenshot-camera">
|
|
46
|
+
<CameraCustom
|
|
47
|
+
isToggle={isOpenModalCamera}
|
|
48
|
+
onToggleModal={() => {
|
|
49
|
+
setOpenModalCamera(!isOpenModalCamera);
|
|
50
|
+
}}
|
|
51
|
+
/>
|
|
122
52
|
</Box>
|
|
123
|
-
|
|
53
|
+
</div>
|
|
124
54
|
);
|
|
125
55
|
}
|
|
126
56
|
|