@nyris/nyris-webapp 0.3.32 → 0.3.34

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 (84) hide show
  1. package/build/asset-manifest.json +28 -15
  2. package/build/index.html +1 -1
  3. package/build/js/settings.example.js +13 -25
  4. package/build/{precache-manifest.a2c0b5a7cde6667444733c63d9fcb7d5.js → precache-manifest.b85c7807a93875355f9f0f6490e6dc8c.js} +68 -16
  5. package/build/service-worker.js +1 -1
  6. package/build/static/css/main.f2aa67fc.chunk.css +2 -0
  7. package/build/static/css/main.f2aa67fc.chunk.css.map +1 -0
  8. package/build/static/js/2.d1f7e826.chunk.js +3 -0
  9. package/build/static/js/2.d1f7e826.chunk.js.map +1 -0
  10. package/build/static/js/main.e9aec8a9.chunk.js +3 -0
  11. package/build/static/js/main.e9aec8a9.chunk.js.map +1 -0
  12. package/build/static/media/filter.bc412f08.svg +3 -0
  13. package/build/static/media/icon_search_image2.fab34be4.svg +3 -0
  14. package/build/static/media/img-1-1.6144e5f9.png +0 -0
  15. package/build/static/media/img-1-2.ad943f0f.png +0 -0
  16. package/build/static/media/img2-1.a87c79c7.png +0 -0
  17. package/build/static/media/img2-2.39c5b73f.png +0 -0
  18. package/build/static/media/img3-1.443b0c3a.png +0 -0
  19. package/build/static/media/img3-2.37db7999.png +0 -0
  20. package/build/static/media/img4-1.9c34c158.png +0 -0
  21. package/build/static/media/img4-2.9d280a04.png +0 -0
  22. package/build/static/media/img5-1.b61dbd4d.png +0 -0
  23. package/build/static/media/img5-2.1c77c093.png +0 -0
  24. package/build/static/media/img6-1.8b03dd21.png +0 -0
  25. package/build/static/media/img6-2.1e3e7fed.png +0 -0
  26. package/build/static/media/{info-tooltip.5feeef22.svg → info-tooltip.b98e8a9c.svg} +2 -2
  27. package/build/static/media/take_photo.76423216.svg +5 -0
  28. package/package.json +3 -4
  29. package/public/js/settings.example.js +13 -25
  30. package/src/Store/constants.ts +0 -1
  31. package/src/Store/search/Search.ts +32 -17
  32. package/src/Store/search/search.initialState.ts +17 -16
  33. package/src/Store/search/types.ts +15 -14
  34. package/src/common/assets/icons/expand.svg +3 -27
  35. package/src/common/assets/icons/filter.svg +3 -0
  36. package/src/common/assets/icons/icon_search_image2.svg +2 -25
  37. package/src/common/assets/icons/info-tooltip.svg +2 -2
  38. package/src/common/assets/icons/take_photo.svg +5 -0
  39. package/src/common/assets/images/imageCaptureHelp/img-1-1.png +0 -0
  40. package/src/common/assets/images/imageCaptureHelp/img-1-2.png +0 -0
  41. package/src/common/assets/images/imageCaptureHelp/img2-1.png +0 -0
  42. package/src/common/assets/images/imageCaptureHelp/img2-2.png +0 -0
  43. package/src/common/assets/images/imageCaptureHelp/img3-1.png +0 -0
  44. package/src/common/assets/images/imageCaptureHelp/img3-2.png +0 -0
  45. package/src/common/assets/images/imageCaptureHelp/img4-1.png +0 -0
  46. package/src/common/assets/images/imageCaptureHelp/img4-2.png +0 -0
  47. package/src/common/assets/images/imageCaptureHelp/img5-1.png +0 -0
  48. package/src/common/assets/images/imageCaptureHelp/img5-2.png +0 -0
  49. package/src/common/assets/images/imageCaptureHelp/img6-1.png +0 -0
  50. package/src/common/assets/images/imageCaptureHelp/img6-2.png +0 -0
  51. package/src/components/DetailItem.tsx +91 -104
  52. package/src/components/DragDropFile.tsx +46 -66
  53. package/src/components/FooterMobile.tsx +80 -41
  54. package/src/components/HeaderMobile.tsx +225 -227
  55. package/src/components/ImageCaptureHelpModal.tsx +90 -0
  56. package/src/components/Layout.tsx +39 -9
  57. package/src/components/MobilePostFilter.tsx +20 -0
  58. package/src/components/PanelResult/expandable-panel.tsx +21 -21
  59. package/src/components/PanelResult/index.tsx +52 -19
  60. package/src/components/ProductList/index.tsx +14 -7
  61. package/src/components/appMobile.scss +64 -32
  62. package/src/components/carousel/ImagePreviewCarousel.tsx +1 -1
  63. package/src/components/drawer/cameraCustom.tsx +8 -33
  64. package/src/components/input/inputSearch.tsx +116 -147
  65. package/src/components/pre-filter/index.tsx +31 -22
  66. package/src/components/results/ItemResult.tsx +127 -144
  67. package/src/constants.ts +56 -0
  68. package/src/page/landingPage/AppMobile.tsx +34 -104
  69. package/src/page/landingPage/common.scss +164 -36
  70. package/src/page/result/index.tsx +70 -56
  71. package/src/services/Feedback.ts +20 -2
  72. package/src/services/types.ts +0 -1
  73. package/src/translations.ts +4 -0
  74. package/src/types.ts +3 -2
  75. package/build/static/css/main.d0b21fa5.chunk.css +0 -2
  76. package/build/static/css/main.d0b21fa5.chunk.css.map +0 -1
  77. package/build/static/js/2.985a6e2d.chunk.js +0 -3
  78. package/build/static/js/2.985a6e2d.chunk.js.map +0 -1
  79. package/build/static/js/main.1e8d5e32.chunk.js +0 -3
  80. package/build/static/js/main.1e8d5e32.chunk.js.map +0 -1
  81. package/build/static/media/expand.06cebf40.svg +0 -27
  82. package/build/static/media/icon_search_image2.e46fdfc5.svg +0 -26
  83. /package/build/static/js/{2.985a6e2d.chunk.js.LICENSE.txt → 2.d1f7e826.chunk.js.LICENSE.txt} +0 -0
  84. /package/build/static/js/{main.1e8d5e32.chunk.js.LICENSE.txt → main.e9aec8a9.chunk.js.LICENSE.txt} +0 -0
@@ -2,13 +2,12 @@ import { Box, Button, Grid, Tooltip, Typography } from '@material-ui/core';
2
2
  import ChevronRightOutlinedIcon from '@material-ui/icons/ChevronRightOutlined';
3
3
  import IconOpenLink from 'common/assets/icons/Union.svg';
4
4
  import { ReactComponent as IconShare } from 'common/assets/icons/Fill.svg';
5
- import { ReactComponent as Expand } from 'common/assets/icons/expand.svg';
6
5
  import { ReactComponent as IconDisLike } from 'common/assets/icons/icon_dislike.svg';
7
6
  import { ReactComponent as IconLike } from 'common/assets/icons/icon_like.svg';
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 { AppState } from 'types';
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?: number;
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 { settings } = useAppSelector<AppState>((state: any) => state);
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
+
102
107
  return (
103
108
  <Box className="wrap-main-item-result">
104
109
  <DefaultModal
@@ -143,14 +148,16 @@ function ItemResult(props: Props) {
143
148
  </Button>
144
149
  </Box>
145
150
  )}
146
- {!isHover && (
147
- <Box className="box-icon-modal">
148
- <Button
149
- style={{ width: '100%', height: '100%', padding: 0, zIndex: 9 }}
150
- onClick={() => handlerToggleModal(dataItem)}
151
- >
152
- <Expand color={settings.theme?.secondaryColor} />
153
- </Button>
151
+ {!isHover && main_image_link && (
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'} />
154
161
  </Box>
155
162
  )}
156
163
  <Box className="box-image">
@@ -158,9 +165,7 @@ function ItemResult(props: Props) {
158
165
  style={{ width: '100%', height: '100%' }}
159
166
  onClick={(e: any) => {
160
167
  e.preventDefault();
161
- if (urlImage.length > 1) {
162
- onSearchImage(main_image_link);
163
- }
168
+ handlerToggleModal(dataItem);
164
169
  }}
165
170
  >
166
171
  {main_image_link ? (
@@ -197,7 +202,7 @@ function ItemResult(props: Props) {
197
202
  flexGrow: 1,
198
203
  }}
199
204
  >
200
- <Box className="box-top" style={{ minHeight: '90px' }}>
205
+ <Box className="box-top">
201
206
  <Grid container justifyContent="space-between">
202
207
  <Grid item xs={12}>
203
208
  <Tooltip
@@ -217,7 +222,7 @@ function ItemResult(props: Props) {
217
222
  <span style={{ marginRight: 3 }}>
218
223
  {settings.itemIdLabel || 'SKU'}:
219
224
  </span>
220
- {truncateString(sku, 16)}
225
+ {truncateString(sku, 20)}
221
226
  </Typography>
222
227
  </Tooltip>
223
228
 
@@ -281,85 +286,77 @@ function ItemResult(props: Props) {
281
286
  </Box>
282
287
  </Tooltip>
283
288
  )}
284
- {!settings.warehouseVariant && (
285
- <Typography
286
- className="text-f13 fw-600 max-line-3"
287
- style={{ color: '#1E1F31', marginTop: 12 }}
288
- >
289
- {dataItem[settings.field.productName]}
290
- </Typography>
291
- )}
292
289
  </Grid>
293
290
  </Grid>
294
291
  </Box>
295
292
  <div>
296
- {(settings.showMoreInfo || settings.warehouseVariant) && (
297
- <Tooltip
298
- title={dataItem[settings.field.productName]}
299
- placement="top"
300
- arrow={true}
301
- disableHoverListener={
302
- dataItem[settings.field.productName]?.length < 35 ||
303
- !settings.warehouseVariant
304
- }
293
+ <Tooltip
294
+ title={dataItem[settings.field.productName]}
295
+ placement="top"
296
+ arrow={true}
297
+ disableHoverListener={
298
+ dataItem[settings.field.productName]?.length < 45
299
+ }
300
+ >
301
+ <Box
302
+ style={{
303
+ boxShadow: '-2px 2px 4px rgba(170, 171, 181, 0.5)',
304
+ // marginBottom: 22,
305
+ height: 40,
306
+ background: `linear-gradient(270deg, ${settings.theme?.primaryColor}bb 0%, ${settings.theme?.primaryColor} 100%)`,
307
+ borderRadius: 4,
308
+ padding: '0px 8px',
309
+ marginTop: '12px',
310
+ }}
311
+ display={'flex'}
312
+ justifyItems={'center'}
313
+ alignItems={'center'}
314
+ justifyContent={'space-between'}
305
315
  >
306
316
  <Box
307
317
  style={{
308
- boxShadow: '-2px 2px 4px rgba(170, 171, 181, 0.5)',
309
- // marginBottom: 22,
310
- height: 40,
311
- background: `linear-gradient(270deg, ${settings.theme?.primaryColor}bb 0%, ${settings.theme?.primaryColor} 100%)`,
312
- borderRadius: 4,
313
- padding: '0px 8px',
314
- marginTop: '12px',
318
+ display: 'flex',
319
+ justifyContent: 'space-between',
320
+ width: '100%',
321
+ padding: 0,
322
+ cursor: dataItem[settings.field?.ctaLinkField]
323
+ ? 'pointer'
324
+ : 'normal',
325
+ }}
326
+ onClick={() => {
327
+ feedbackConversionEpic(state, indexItem, dataItem.sku);
328
+ window.open(
329
+ `${dataItem[settings.field.ctaLinkField]}`,
330
+ '_blank',
331
+ );
315
332
  }}
316
- display={'flex'}
317
- justifyItems={'center'}
318
- alignItems={'center'}
319
- justifyContent={'space-between'}
320
333
  >
321
- <Button
334
+ <Typography
335
+ className="text-white max-line-2"
322
336
  style={{
323
- display: 'flex',
324
- justifyContent: 'space-between',
325
- width: '100%',
326
- padding: 0,
337
+ overflow: 'hidden',
338
+ textOverflow: 'ellipsis',
339
+ fontWeight: 500,
340
+ fontSize: '11px',
341
+ letterSpacing: '0.27px',
342
+ wordBreak: 'break-all',
343
+ maxWidth:
344
+ !isMobile && dataItem[settings.field?.ctaLinkField]
345
+ ? '136px'
346
+ : '164x',
347
+ paddingRight: '8px',
327
348
  }}
328
- onClick={() =>
329
- window.open(
330
- `${dataItem[settings.field.ctaLinkField]}`,
331
- '_blank',
332
- )
333
- }
349
+ align="left"
334
350
  >
335
- <Typography
336
- className="text-white max-line-2"
337
- style={{
338
- textTransform: !settings.warehouseVariant
339
- ? 'uppercase'
340
- : 'none',
341
- overflow: 'hidden',
342
- textOverflow: 'ellipsis',
343
- fontWeight: !settings.warehouseVariant ? 700 : 500,
344
- fontSize: !settings.warehouseVariant ? '12px' : '11px',
345
- letterSpacing: '0.27px',
346
- wordBreak: !settings.warehouseVariant
347
- ? 'normal'
348
- : 'break-all',
349
- maxWidth: '136px',
350
- paddingRight: '8px',
351
- }}
352
- align="left"
353
- >
354
- {settings.warehouseVariant
355
- ? truncateString(dataItem[settings.field.productName], 35)
356
- : settings.productCtaText || 'MORE INFO'}
357
- </Typography>
351
+ {truncateString(dataItem[settings.field.productName], 45)}
352
+ </Typography>
353
+ {!isMobile && dataItem[settings.field?.ctaLinkField] && (
358
354
  <img src={IconOpenLink} alt="more-info" width={20} />
359
- </Button>
355
+ )}
360
356
  </Box>
361
- </Tooltip>
362
- )}
357
+ </Box>
358
+ </Tooltip>
359
+
363
360
  {settings.warehouseVariant && (
364
361
  <Box
365
362
  display="flex"
@@ -367,53 +364,58 @@ function ItemResult(props: Props) {
367
364
  style={{ color: '#2B2C46', marginTop: '12px' }}
368
365
  gridGap={10}
369
366
  >
370
- <Box
371
- style={{
372
- backgroundColor: `${settings.theme?.secondaryColor}26`,
373
- padding: '5px 10px',
374
- borderRadius: 4,
375
- width: '100%',
376
- }}
377
- >
378
- <div style={{ fontSize: 10, fontWeight: 500 }}>
379
- {dataItem.custom_id_key_2}
380
- </div>
381
- <div
367
+ {settings.field.warehouseNumber && (
368
+ <Box
382
369
  style={{
383
- fontSize: 13,
384
- fontWeight: 700,
385
- whiteSpace: 'nowrap',
386
- overflow: 'hidden',
387
- textOverflow: 'ellipsis',
370
+ backgroundColor: `${settings.theme?.secondaryColor}26`,
371
+ padding: '5px 10px',
372
+ borderRadius: 4,
373
+ width: '100%',
388
374
  }}
389
375
  >
390
- {dataItem.custom_id_value_2 || 'N/A'}
391
- </div>
392
- </Box>
376
+ <div style={{ fontSize: 10, fontWeight: 500 }}>
377
+ {dataItem[settings.field.warehouseNumber]}
378
+ </div>
379
+ <div
380
+ style={{
381
+ fontSize: 13,
382
+ fontWeight: 700,
383
+ whiteSpace: 'nowrap',
384
+ overflow: 'hidden',
385
+ textOverflow: 'ellipsis',
386
+ }}
387
+ >
388
+ {dataItem[settings.field.warehouseNumberValue] || 'N/A'}
389
+ </div>
390
+ </Box>
391
+ )}
393
392
 
394
- <Box
395
- style={{
396
- backgroundColor: `${settings.theme?.secondaryColor}26`,
397
- padding: '5px 10px',
398
- borderRadius: 4,
399
- width: '100%',
400
- }}
401
- >
402
- <div style={{ fontSize: 10, fontWeight: 500 }}>
403
- {dataItem.custom_id_key_1}
404
- </div>
405
- <div
393
+ {settings.field.warehouseShelfNumber && (
394
+ <Box
406
395
  style={{
407
- fontSize: 13,
408
- fontWeight: 700,
409
- whiteSpace: 'nowrap',
410
- overflow: 'hidden',
411
- textOverflow: 'ellipsis',
396
+ backgroundColor: `${settings.theme?.secondaryColor}26`,
397
+ padding: '5px 10px',
398
+ borderRadius: 4,
399
+ width: '100%',
412
400
  }}
413
401
  >
414
- {dataItem.custom_id_value_1 || 'N/A'}
415
- </div>
416
- </Box>
402
+ <div style={{ fontSize: 10, fontWeight: 500 }}>
403
+ {dataItem[settings.field.warehouseShelfNumber]}
404
+ </div>
405
+ <div
406
+ style={{
407
+ fontSize: 13,
408
+ fontWeight: 700,
409
+ whiteSpace: 'nowrap',
410
+ overflow: 'hidden',
411
+ textOverflow: 'ellipsis',
412
+ }}
413
+ >
414
+ {dataItem[settings.field.warehouseShelfNumberValue] ||
415
+ 'N/A'}
416
+ </div>
417
+ </Box>
418
+ )}
417
419
  </Box>
418
420
  )}
419
421
 
@@ -471,32 +473,13 @@ function ItemResult(props: Props) {
471
473
  <Button
472
474
  style={{ padding: '6px' }}
473
475
  className="btn-item"
474
- onClick={() => false}
476
+ onClick={() => setOpenModalShare(true)}
475
477
  >
476
- <IconShare width={16} height={16} color="#808080" />
478
+ <IconShare width={16} height={16} color="#000000" />
477
479
  </Button>
478
480
  </Box>
479
481
  </Grid>
480
482
  )}
481
- {/* <Grid item>
482
- <Box display={'flex'} alignItems={'center'}>
483
- <Button className="btn-item">
484
- <Box
485
- className=""
486
- display={'flex'}
487
- justifyContent={'center'}
488
- alignItems={'center'}
489
- >
490
- <img
491
- src={IconShare}
492
- alt="image_item"
493
- className="icon_support"
494
- style={{ width: '1rem' }}
495
- />
496
- </Box>
497
- </Button>
498
- </Box>
499
- </Grid> */}
500
483
  </Grid>
501
484
  </Box>
502
485
  )}
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, Typography } from '@material-ui/core';
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 { useHistory } from 'react-router-dom';
7
- import { feedbackClickEpic } from 'services/Feedback';
8
- import { createImage, findByImage, findRegions } from 'services/image';
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
- <Box className="wrap-content-body" style={{ position: 'relative' }}>
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
- position: 'absolute',
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
- <ExampleImages
105
- images={settings.exampleImages}
106
- onExampleImageClicked={(url: string) => {
107
- return getUrlToCanvasFile(url);
108
- }}
109
- onToggleModalCamera={() => {
33
+ <div
34
+ className="outer"
35
+ onClick={() => {
110
36
  setOpenModalCamera(!isOpenModalCamera);
111
37
  }}
112
- />
113
- </Box>
114
- <Box className="box-screenshot-camera">
115
- <CameraCustom
116
- isToggle={isOpenModalCamera}
117
- onToggleModal={() => {
118
- setOpenModalCamera(!isOpenModalCamera);
119
- }}
120
- />
121
- </Box>
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