@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.
Files changed (83) hide show
  1. package/build/asset-manifest.json +28 -14
  2. package/build/index.html +1 -1
  3. package/build/js/settings.example.js +13 -25
  4. package/build/{precache-manifest.4cff5b8aafe3d00d59bc2c9725eb6ade.js → precache-manifest.375ac411683570ee1df5aea6de03409d.js} +70 -14
  5. package/build/service-worker.js +1 -1
  6. package/build/static/css/main.f5a1c730.chunk.css +2 -0
  7. package/build/static/css/main.f5a1c730.chunk.css.map +1 -0
  8. package/build/static/js/2.724f4cba.chunk.js +3 -0
  9. package/build/static/js/2.724f4cba.chunk.js.map +1 -0
  10. package/build/static/js/main.f579fa9f.chunk.js +3 -0
  11. package/build/static/js/main.f579fa9f.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 -3
  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 +62 -78
  52. package/src/components/FooterMobile.tsx +80 -41
  53. package/src/components/HeaderMobile.tsx +225 -227
  54. package/src/components/ImageCaptureHelpModal.tsx +90 -0
  55. package/src/components/Layout.tsx +39 -9
  56. package/src/components/MobilePostFilter.tsx +20 -0
  57. package/src/components/PanelResult/expandable-panel.tsx +21 -21
  58. package/src/components/PanelResult/index.tsx +52 -19
  59. package/src/components/ProductList/index.tsx +5 -3
  60. package/src/components/appMobile.scss +64 -32
  61. package/src/components/carousel/ImagePreviewCarousel.tsx +2 -8
  62. package/src/components/drawer/cameraCustom.tsx +8 -33
  63. package/src/components/input/inputSearch.tsx +68 -80
  64. package/src/components/pre-filter/index.tsx +70 -57
  65. package/src/components/results/ItemResult.tsx +73 -89
  66. package/src/constants.ts +56 -0
  67. package/src/page/landingPage/AppMobile.tsx +34 -104
  68. package/src/page/landingPage/common.scss +167 -38
  69. package/src/page/result/index.tsx +70 -56
  70. package/src/services/Feedback.ts +20 -2
  71. package/src/services/types.ts +0 -1
  72. package/src/translations.ts +4 -0
  73. package/src/types.ts +3 -2
  74. package/build/static/css/main.d0b21fa5.chunk.css +0 -2
  75. package/build/static/css/main.d0b21fa5.chunk.css.map +0 -1
  76. package/build/static/js/2.69ce0823.chunk.js +0 -3
  77. package/build/static/js/2.69ce0823.chunk.js.map +0 -1
  78. package/build/static/js/main.6122377b.chunk.js +0 -3
  79. package/build/static/js/main.6122377b.chunk.js.map +0 -1
  80. package/build/static/media/icon_search_image2.e46fdfc5.svg +0 -26
  81. package/src/hooks/useVisualSearch.tsx +0 -77
  82. /package/build/static/js/{2.69ce0823.chunk.js.LICENSE.txt → 2.724f4cba.chunk.js.LICENSE.txt} +0 -0
  83. /package/build/static/js/{main.6122377b.chunk.js.LICENSE.txt → main.f579fa9f.chunk.js.LICENSE.txt} +0 -0
@@ -1,9 +1,8 @@
1
- import { Box, Button, Tooltip, Typography } from '@material-ui/core';
1
+ import { Box, 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
4
  import CloseIcon from '@material-ui/icons/Close';
5
5
  import IconCamera from 'common/assets/icons/camera.svg';
6
- import IconSearch from 'common/assets/icons/icon_search.svg';
7
6
  import { useQuery } from 'hooks/useQuery';
8
7
  import { debounce, isEmpty } from 'lodash';
9
8
  import React, { memo, useCallback, useEffect, useRef, useState } from 'react';
@@ -13,6 +12,7 @@ import { useMediaQuery } from 'react-responsive';
13
12
  import { useHistory } from 'react-router-dom';
14
13
  import { createImage, findByImage, findRegions } from 'services/image';
15
14
  import { ReactComponent as IconFilter } from 'common/assets/icons/filter_settings.svg';
15
+ import { ReactComponent as IconSearch } from 'common/assets/icons/icon_search.svg';
16
16
 
17
17
  import {
18
18
  reset,
@@ -20,7 +20,6 @@ import {
20
20
  setRequestImage,
21
21
  setSearchResults,
22
22
  updateStatusLoading,
23
- setUpdateKeyFilterDesktop,
24
23
  loadingActionResults,
25
24
  setRegions,
26
25
  setSelectedRegion,
@@ -29,7 +28,6 @@ import { useAppDispatch, useAppSelector } from 'Store/Store';
29
28
  import DefaultModal from 'components/modal/DefaultModal';
30
29
  import PreFilterComponent from 'components/pre-filter';
31
30
  import { RectCoords } from '@nyris/nyris-api';
32
- import { truncateString } from 'helpers/truncateString';
33
31
  import { useTranslation } from 'react-i18next';
34
32
 
35
33
  const SearchBox = (props: any) => {
@@ -153,16 +151,75 @@ const SearchBox = (props: any) => {
153
151
  };
154
152
 
155
153
  return (
156
- <Box className="wrap-input-search">
157
- <div style={{ padding: 10 }} className="box-input-search d-flex">
154
+ <div className="wrap-input-search-field">
155
+ <div className="box-input-search d-flex">
158
156
  <form noValidate action="" role="search">
159
157
  <Box className="box-inp">
158
+ <Tooltip
159
+ title={keyFilter ? keyFilter : 'Add pre-filter'}
160
+ placement="top"
161
+ arrow={true}
162
+ disableHoverListener={!settings.preFilterOption}
163
+ >
164
+ <Box
165
+ className="pre-filter-icon"
166
+ style={{
167
+ cursor: settings.preFilterOption ? 'pointer' : 'default',
168
+ }}
169
+ onClick={() =>
170
+ settings.preFilterOption
171
+ ? setToggleModalFilterDesktop(true)
172
+ : false
173
+ }
174
+ >
175
+ {settings.preFilterOption && (
176
+ <div
177
+ className="icon-hover"
178
+ style={{
179
+ ...(keyFilter
180
+ ? {
181
+ backgroundColor: `${settings.theme?.secondaryColor}26`,
182
+ }
183
+ : {}),
184
+ }}
185
+ >
186
+ <IconFilter color="black" />
187
+ </div>
188
+ )}
189
+ {!settings.preFilterOption && (
190
+ <IconSearch width={16} height={16} />
191
+ )}
192
+ {keyFilter && (
193
+ <div
194
+ style={{
195
+ position: 'absolute',
196
+ top: '6px',
197
+ left: '31px',
198
+ display: 'flex',
199
+ justifyContent: 'center',
200
+ alignItems: 'center',
201
+ background: 'white',
202
+ width: '10px',
203
+ height: '10px',
204
+ borderRadius: '100%',
205
+ }}
206
+ >
207
+ <div
208
+ style={{
209
+ width: '8px',
210
+ height: '8px',
211
+ background: settings.theme?.secondaryColor,
212
+ borderRadius: '100%',
213
+ }}
214
+ ></div>
215
+ </div>
216
+ )}
217
+ </Box>
218
+ </Tooltip>
160
219
  <Box
161
220
  style={{
162
221
  height: '75%',
163
222
  order: 1,
164
- paddingLeft: imageThumbSearchInput || keyFilter ? 0 : 10,
165
- marginLeft: keyFilter ? 0 : 5,
166
223
  }}
167
224
  >
168
225
  {imageThumbSearchInput && (
@@ -208,60 +265,12 @@ const SearchBox = (props: any) => {
208
265
  )}
209
266
  </Box>
210
267
 
211
- {!valueInput && (
212
- <Box
213
- className="icon-search"
214
- style={
215
- imageThumbSearchInput
216
- ? { order: 2, marginLeft: 5 }
217
- : { order: 2 }
218
- }
219
- >
220
- <img src={IconSearch} alt="" width={24} height={24} />
221
- </Box>
222
- )}
223
-
224
- {keyFilter && !isMobile && (
225
- <Box
226
- className="box-key-filter"
227
- style={{
228
- order: 0,
229
- marginRight: 5,
230
- border: `2px solid ${settings.theme?.secondaryColor}c7`,
231
- }}
232
- >
233
- <Tooltip
234
- title={keyFilter}
235
- placement="top"
236
- arrow={true}
237
- disableHoverListener={keyFilter.length < 16}
238
- >
239
- <Typography>{truncateString(keyFilter, 15)}</Typography>
240
- </Tooltip>
241
-
242
- <Tooltip title="Remove pre-filter" placement="top" arrow={true}>
243
- <Button
244
- onClick={() => dispatch(setUpdateKeyFilterDesktop(''))}
245
- style={{ padding: '6px 2px' }}
246
- >
247
- <CloseIcon
248
- style={{
249
- fontSize: 20,
250
- color: settings.theme?.secondaryColor,
251
- }}
252
- />
253
- </Button>
254
- </Tooltip>
255
- </Box>
256
- )}
257
-
258
268
  <input
259
269
  style={{
260
270
  border: '0px',
261
271
  width: '100%',
262
272
  fontSize: 14,
263
273
  color: '#2B2C46',
264
- fontStyle: 'italic',
265
274
  }}
266
275
  className="input-search"
267
276
  placeholder={t('Search')}
@@ -297,26 +306,6 @@ const SearchBox = (props: any) => {
297
306
  )}
298
307
  {!isMobile ? (
299
308
  <div className="wrap-box-input-mobile d-flex">
300
- {settings.preFilterOption && (
301
- <Tooltip
302
- title="Add or change pre-filter"
303
- placement="top"
304
- arrow={true}
305
- style={{ backgroundColor: '#000000' }}
306
- >
307
- <Button
308
- onClick={() => setToggleModalFilterDesktop(true)}
309
- style={{
310
- width: 32,
311
- height: 32,
312
- borderRadius: '100%',
313
- marginRight: 10,
314
- }}
315
- >
316
- <IconFilter />
317
- </Button>
318
- </Tooltip>
319
- )}
320
309
  <input
321
310
  accept="image/*"
322
311
  id="icon-button-file"
@@ -362,20 +351,19 @@ const SearchBox = (props: any) => {
362
351
  )}
363
352
  </form>
364
353
  </div>
365
-
366
354
  {settings.preFilterOption && (
367
355
  <DefaultModal
368
356
  openModal={isOpenModalFilterDesktop}
369
357
  handleClose={() => setToggleModalFilterDesktop(false)}
370
- classNameModal="wrap-filter-destop"
371
- classNameComponentChild="bg-white box-filter-destop"
358
+ classNameModal="wrap-filter-desktop"
359
+ classNameComponentChild="bg-white box-filter-desktop"
372
360
  >
373
361
  <PreFilterComponent
374
362
  handleClose={() => setToggleModalFilterDesktop(false)}
375
363
  />
376
364
  </DefaultModal>
377
365
  )}
378
- </Box>
366
+ </div>
379
367
  );
380
368
  };
381
369
 
@@ -5,7 +5,6 @@ import IconSearch from 'common/assets/icons/icon_search.svg';
5
5
  import { getFilters, searchFilters } from 'services/filter';
6
6
  import { useAppDispatch, useAppSelector } from 'Store/Store';
7
7
  import { setUpdateKeyFilterDesktop } from 'Store/search/Search';
8
- import { ToggleButton, ToggleButtonGroup } from '@material-ui/lab';
9
8
  import { useMediaQuery } from 'react-responsive';
10
9
  import { isEmpty } from 'lodash';
11
10
  import { Skeleton } from '@material-ui/lab';
@@ -37,8 +36,10 @@ function PreFilterComponent(props: Props) {
37
36
  const arrResult =
38
37
  res.find(value => value.key === settings.visualSearchFilterKey)
39
38
  ?.values || [];
39
+
40
40
  const newResult = arrResult.sort().reduce((a: any, c: any) => {
41
- let k = c[0].toLocaleUpperCase();
41
+ if (!c[0]) return a;
42
+ let k = c[0]?.toLocaleUpperCase();
42
43
  if (a[k]) a[k].push(c);
43
44
  else a[k] = [c];
44
45
  return a;
@@ -61,13 +62,6 @@ function PreFilterComponent(props: Props) {
61
62
  // eslint-disable-next-line react-hooks/exhaustive-deps
62
63
  }, []);
63
64
 
64
- const handleAlignment = (
65
- event: React.MouseEvent<HTMLElement>,
66
- value: any,
67
- ) => {
68
- setKeyFilter(value);
69
- };
70
-
71
65
  const filterSearchHandler = async (value: any) => {
72
66
  if (!value) {
73
67
  getDataFilterDesktop();
@@ -109,22 +103,37 @@ function PreFilterComponent(props: Props) {
109
103
  flexDirection={'column'}
110
104
  style={{ position: 'relative' }}
111
105
  >
112
- <Typography
106
+ <div
113
107
  style={{
114
- color: '#000',
115
- fontSize: '24px',
116
- fontWeight: 700,
117
- paddingLeft: isMobile ? '0px' : '14px',
118
- marginBottom: isMobile ? '0px' : '-8px',
119
- marginTop: isMobile ? '0px' : '24px',
108
+ background: 'white',
109
+ width: '100%',
110
+ display: 'flex',
111
+ justifyContent: 'space-between',
112
+ position: 'sticky',
113
+ top: 0,
114
+ zIndex: 100,
120
115
  }}
121
116
  >
122
- {settings.preFilterTitle}
123
- </Typography>
117
+ <Typography
118
+ style={{
119
+ color: '#000',
120
+ fontSize: '24px',
121
+ fontWeight: 700,
122
+ paddingLeft: isMobile ? '0px' : '14px',
123
+ marginBottom: isMobile ? '0px' : '-8px',
124
+ marginTop: isMobile ? '0px' : '24px',
125
+ }}
126
+ >
127
+ {settings.preFilterTitle}
128
+ </Typography>
124
129
 
130
+ <Button onClick={handleClose}>
131
+ <CloseIcon />
132
+ </Button>
133
+ </div>
125
134
  <Box
126
135
  className="box-top"
127
- style={isMobile ? { padding: 0 } : undefined}
136
+ style={isMobile ? { padding: 0, marginTop: '16px' } : undefined}
128
137
  display={'flex'}
129
138
  justifyContent={'space-between'}
130
139
  alignItems={'center'}
@@ -172,28 +181,24 @@ function PreFilterComponent(props: Props) {
172
181
  }}
173
182
  />
174
183
  </Box>
175
-
176
- {!isMobile && (
177
- <Button onClick={handleClose}>
178
- <CloseIcon />
179
- </Button>
180
- )}
181
184
  </Box>
182
185
 
183
- <Box style={{ margin: '10px 16px' }}>
184
- {keyFilter && isMobile && (
186
+ {keyFilter && isMobile && (
187
+ <Box style={{ margin: '10px 16px' }}>
185
188
  <Box
186
189
  display={'flex'}
187
190
  className="box-keyFilter"
188
191
  style={{ display: 'inline-flex' }}
189
192
  >
190
- <Typography className="keyFilter">{keyFilter}</Typography>
193
+ <Typography className="keyFilter max-line-1">
194
+ {keyFilter}
195
+ </Typography>
191
196
  <Button style={{ padding: 0 }} onClick={() => setKeyFilter('')}>
192
197
  <CloseIcon style={{ fontSize: 12, color: '#2B2C46' }} />
193
198
  </Button>
194
199
  </Box>
195
- )}
196
- </Box>
200
+ </Box>
201
+ )}
197
202
  <Box
198
203
  className="box-bottom"
199
204
  height={'100%'}
@@ -207,25 +212,25 @@ function PreFilterComponent(props: Props) {
207
212
  >
208
213
  {Object.entries(resultFilter).map(([key, value]: any, i: any) => {
209
214
  return (
210
- <Box
211
- className="box-group-items"
212
- style={
213
- columns <= 4 ? { width: 'fit-content' } : { width: '100%' }
214
- }
215
- >
216
- <Typography
217
- style={{ fontWeight: 'bold', color: '#000', paddingLeft: 11 }}
215
+ <Box className="box-group-items" key={key}>
216
+ <Box
217
+ style={{
218
+ display: 'flex',
219
+ flexDirection: 'column',
220
+ rowGap: '12px',
221
+ width: '100%',
222
+ }}
218
223
  >
219
- {key}
220
- </Typography>
224
+ <Typography
225
+ style={{
226
+ fontWeight: 'bold',
227
+ color: '#000',
228
+ fontSize: '12px',
229
+ }}
230
+ >
231
+ {key}
232
+ </Typography>
221
233
 
222
- <ToggleButtonGroup
223
- value={keyFilter}
224
- exclusive
225
- onChange={handleAlignment}
226
- aria-label=""
227
- className="box-btn-group"
228
- >
229
234
  {value.map((item: any, index: any) => {
230
235
  return (
231
236
  <Tooltip
@@ -233,22 +238,30 @@ function PreFilterComponent(props: Props) {
233
238
  title={item}
234
239
  placement="top"
235
240
  arrow={true}
236
- disableHoverListener={item.length < 20}
241
+ disableHoverListener={item.length < 35}
237
242
  >
238
- <ToggleButton
239
- value={item}
243
+ <Box
240
244
  aria-label={item}
241
- className="item-btn"
242
- onChange={() => {
245
+ style={{
246
+ cursor: 'pointer',
247
+ fontSize: '12px',
248
+ minHeight: '20px',
249
+ color: '#2B2C46',
250
+ width: '100%',
251
+ overflow: 'hidden',
252
+ textOverflow: 'ellipsis',
253
+ whiteSpace: 'nowrap',
254
+ }}
255
+ onClick={() => {
243
256
  setKeyFilter(item);
244
257
  }}
245
258
  >
246
- {truncateString(item, !isMobile ? 20 : 35)}
247
- </ToggleButton>
259
+ {truncateString(item, !isMobile ? 35 : 35)}
260
+ </Box>
248
261
  </Tooltip>
249
262
  );
250
263
  })}
251
- </ToggleButtonGroup>
264
+ </Box>
252
265
  </Box>
253
266
  );
254
267
  })}
@@ -274,7 +287,7 @@ function PreFilterComponent(props: Props) {
274
287
  <Typography>No result found</Typography>
275
288
  )}
276
289
  </Box>
277
- {keyFilter && !isMobile && (
290
+ {!isMobile && (
278
291
  <Box
279
292
  className="footer"
280
293
  style={{ height: 64, marginTop: 'auto' }}
@@ -308,7 +321,7 @@ function PreFilterComponent(props: Props) {
308
321
  </Button>
309
322
  </Box>
310
323
  )}
311
- {keyFilter && isMobile && (
324
+ {isMobile && (
312
325
  <Box
313
326
  className="footer"
314
327
  style={{