@nyris/nyris-webapp 0.3.34 → 0.3.36

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 (60) hide show
  1. package/build/asset-manifest.json +13 -13
  2. package/build/index.html +1 -1
  3. package/build/{precache-manifest.b85c7807a93875355f9f0f6490e6dc8c.js → precache-manifest.a2657ad49c132fb9c82629d37be15547.js} +14 -14
  4. package/build/service-worker.js +1 -1
  5. package/build/static/css/main.41fb4769.chunk.css +2 -0
  6. package/build/static/css/main.41fb4769.chunk.css.map +1 -0
  7. package/build/static/js/2.ff44260e.chunk.js +3 -0
  8. package/build/static/js/2.ff44260e.chunk.js.map +1 -0
  9. package/build/static/js/main.0b3b11fc.chunk.js +3 -0
  10. package/build/static/js/main.0b3b11fc.chunk.js.map +1 -0
  11. package/build/static/media/error.48b946a9.svg +3 -0
  12. package/package.json +3 -3
  13. package/public/index.html +13 -0
  14. package/src/Store/search/Search.ts +4 -4
  15. package/src/Store/search/search.initialState.ts +1 -1
  16. package/src/Store/search/types.ts +1 -1
  17. package/src/common/assets/icons/arrow_left.svg +3 -0
  18. package/src/common/assets/icons/arrow_right.svg +3 -0
  19. package/src/common/assets/icons/error.svg +3 -0
  20. package/src/components/AppMobile.tsx +111 -0
  21. package/src/components/DetailItem.tsx +21 -18
  22. package/src/components/DragDropFile.tsx +5 -4
  23. package/src/components/FooterMobile.tsx +9 -3
  24. package/src/components/Header.tsx +2 -1
  25. package/src/components/HeaderMobile.tsx +5 -3
  26. package/src/components/ImageCaptureHelpModal.tsx +7 -1
  27. package/src/components/ImagePreviewMobile.tsx +87 -0
  28. package/src/components/Layout.tsx +32 -92
  29. package/src/components/ProductList/index.tsx +4 -1
  30. package/src/components/RfqBanner.tsx +120 -0
  31. package/src/components/SidePanel.tsx +147 -0
  32. package/src/components/appMobile.scss +147 -142
  33. package/src/components/carousel/ImagePreviewCarousel.tsx +1 -7
  34. package/src/components/drawer/cameraCustom.tsx +5 -4
  35. package/src/components/input/inputSearch.tsx +12 -7
  36. package/src/components/modal/DefaultModal.tsx +1 -1
  37. package/src/components/pre-filter/index.tsx +144 -83
  38. package/src/components/results/ItemResult.tsx +9 -20
  39. package/src/components/rfq/RfqModal.tsx +262 -0
  40. package/src/helpers/ToastHelper.ts +10 -0
  41. package/src/helpers/getCroppedCanvas.ts +26 -0
  42. package/src/hooks/useFilteredRegions.ts +37 -0
  43. package/src/index.css +0 -4
  44. package/src/page/landingPage/AppMD.tsx +0 -11
  45. package/src/page/landingPage/AppMobile.tsx +1 -0
  46. package/src/page/landingPage/common.scss +44 -60
  47. package/src/page/result/index.tsx +256 -309
  48. package/src/translations.ts +2 -2
  49. package/src/types.ts +1 -0
  50. package/src/utils.ts +0 -1
  51. package/build/static/css/main.f2aa67fc.chunk.css +0 -2
  52. package/build/static/css/main.f2aa67fc.chunk.css.map +0 -1
  53. package/build/static/js/2.d1f7e826.chunk.js +0 -3
  54. package/build/static/js/2.d1f7e826.chunk.js.map +0 -1
  55. package/build/static/js/main.e9aec8a9.chunk.js +0 -3
  56. package/build/static/js/main.e9aec8a9.chunk.js.map +0 -1
  57. package/build/static/media/support3.4a17f96e.svg +0 -3
  58. package/src/hooks/useVisualSearch.tsx +0 -77
  59. /package/build/static/js/{2.d1f7e826.chunk.js.LICENSE.txt → 2.ff44260e.chunk.js.LICENSE.txt} +0 -0
  60. /package/build/static/js/{main.e9aec8a9.chunk.js.LICENSE.txt → main.0b3b11fc.chunk.js.LICENSE.txt} +0 -0
@@ -9,8 +9,6 @@ import { useHistory } from 'react-router-dom';
9
9
  import {
10
10
  changeValueTextSearch,
11
11
  onResetRequestImage,
12
- setImageCaptureHelpModal,
13
- setPreFilterDropdown,
14
12
  setUpdateSession,
15
13
  } from 'Store/search/Search';
16
14
  import { useAppDispatch, useAppSelector } from 'Store/Store';
@@ -20,21 +18,14 @@ import './common.scss';
20
18
  import FooterMobile from './FooterMobile';
21
19
  import HeaderMobile from './HeaderMobile';
22
20
  import Header from './Header';
23
- import PreFilterComponent from 'components/pre-filter';
24
21
  import { createSessionByApi } from 'services/session';
25
22
  import { isUndefined } from 'lodash';
26
- import ImageCaptureHelpModal from './ImageCaptureHelpModal';
27
- import MobilePostFilter from './MobilePostFilter';
23
+ import AppMobile from './AppMobile';
28
24
 
29
25
  function Layout({ children }: ReactNode): JSX.Element {
30
26
  const dispatch = useAppDispatch();
31
27
  const { settings, search } = useAppSelector<AppState>((state: any) => state);
32
- const {
33
- valueTextSearch,
34
- loadingSearchAlgolia,
35
- preFilterDropdown,
36
- imageCaptureHelpModal,
37
- } = search;
28
+ const { valueTextSearch, loadingSearchAlgolia } = search;
38
29
  const { apiKey, appId, indexName } = settings.algolia as AlgoliaSettings;
39
30
  const isMobile = useMediaQuery({ query: '(max-width: 776px)' });
40
31
  const [isOpenFilter, setOpenFilter] = useState<boolean>(false);
@@ -102,7 +93,7 @@ function Layout({ children }: ReactNode): JSX.Element {
102
93
  }, [apiKey, appId, indexName]);
103
94
 
104
95
  return (
105
- <Box position={'relative'} className="wrap-mobile">
96
+ <div style={{ position: 'relative' }}>
106
97
  {loadingSearchAlgolia && (
107
98
  <Box className="box-wrap-loading" style={{ zIndex: 99999999 }}>
108
99
  <Box className="loadingSpinCT" style={{ top: 0, bottom: 0 }}>
@@ -120,93 +111,42 @@ function Layout({ children }: ReactNode): JSX.Element {
120
111
  }
121
112
  }}
122
113
  >
123
- <div className={`layout-main-${classNameBoxVersion}`}>
124
- <div
125
- className={
126
- !isMobile
127
- ? `box-header-${classNameBoxVersion}-main`
128
- : isShowHeaderMobile
129
- ? `box-header-${classNameBoxVersion}-main`
130
- : ''
131
- }
132
- style={{
133
- ...(classNameBoxVersion === 'newVersion'
134
- ? { background: settings.theme?.headerColor }
135
- : {}),
136
- }}
137
- >
138
- <HeaderApp
139
- onToggleFilterMobile={(show: boolean) => {
140
- setOpenFilter(isUndefined(show) ? !isOpenFilter : show);
141
- }}
142
- />
143
- </div>
144
-
145
- <div className={`box-body-${classNameBoxVersion}-wrap-main`}>
146
- {children}
147
- </div>
148
- {isMobile && (
149
- <div className="footer-wrap-main">
150
- <FooterApp />
151
- </div>
152
- )}
153
- </div>
154
- {isMobile && (
155
- <Box
156
- className={`box-fillter ${isOpenFilter ? 'open' : 'close'} `}
157
- position={'absolute'}
158
- style={{ top: isOpenFilter ? '0px' : '', height: '100%' }}
159
- >
160
- <MobilePostFilter
161
- onApply={() => {
162
- setOpenFilter(!isOpenFilter);
163
- }}
164
- />
165
- </Box>
166
- )}
167
- {isMobile && preFilterDropdown && (
168
- <Box
169
- className={`box-fillter open`}
170
- position={'absolute'}
171
- style={{ top: '0px', height: '100%' }}
172
- >
114
+ {isMobile && <AppMobile>{children}</AppMobile>}
115
+ {!isMobile && (
116
+ <div className={`layout-main-${classNameBoxVersion}`}>
173
117
  <div
174
- style={{ width: !isMobile ? '90%' : '100%' }}
175
- className={'wrap-filter-desktop'}
118
+ className={
119
+ !isMobile
120
+ ? `box-header-${classNameBoxVersion}-main`
121
+ : isShowHeaderMobile
122
+ ? `box-header-${classNameBoxVersion}-main`
123
+ : ''
124
+ }
125
+ style={{
126
+ ...(classNameBoxVersion === 'newVersion'
127
+ ? { background: settings.theme?.headerColor }
128
+ : {}),
129
+ }}
176
130
  >
177
- <div className={'bg-white box-filter-desktop isMobile'}>
178
- <PreFilterComponent
179
- handleClose={() =>
180
- dispatch(setPreFilterDropdown(!preFilterDropdown))
181
- }
182
- />
183
- </div>
131
+ <HeaderApp
132
+ onToggleFilterMobile={(show: boolean) => {
133
+ setOpenFilter(isUndefined(show) ? !isOpenFilter : show);
134
+ }}
135
+ />
184
136
  </div>
185
- </Box>
186
- )}
187
137
 
188
- {isMobile && imageCaptureHelpModal && (
189
- <Box
190
- className={`box-fillter open`}
191
- position={'absolute'}
192
- style={{ top: '0px', height: '100%' }}
193
- >
194
- <div
195
- style={{ width: !isMobile ? '90%' : '100%' }}
196
- className={'wrap-filter-desktop'}
197
- >
198
- <div className={'bg-white box-filter-desktop isMobile'}>
199
- <ImageCaptureHelpModal
200
- handleClose={() =>
201
- dispatch(setImageCaptureHelpModal(!imageCaptureHelpModal))
202
- }
203
- />
204
- </div>
138
+ <div className={`box-body-${classNameBoxVersion}-wrap-main`}>
139
+ {children}
205
140
  </div>
206
- </Box>
141
+ {isMobile && (
142
+ <div className="footer-wrap-main">
143
+ <FooterApp />
144
+ </div>
145
+ )}
146
+ </div>
207
147
  )}
208
148
  </InstantSearch>
209
- </Box>
149
+ </div>
210
150
  );
211
151
  }
212
152
 
@@ -3,6 +3,7 @@ import ItemResult from 'components/results/ItemResult';
3
3
  import { groupBy, uniqueId } from 'lodash';
4
4
  import React, { memo, useEffect, useMemo, useState } from 'react';
5
5
  import { connectStateResults } from 'react-instantsearch-dom';
6
+ import { useMediaQuery } from 'react-responsive';
6
7
  import { useAppSelector } from 'Store/Store';
7
8
  import { AppState } from 'types';
8
9
 
@@ -30,6 +31,7 @@ function ProductListComponent({
30
31
  const [hitGroups, setHitGroups] = useState<any>({});
31
32
  const [itemShowDefault, setItemShowDefault] = useState<any[]>([]);
32
33
  const [algoliaRequest, setAlgoliaRequest] = useState(false);
34
+ const isMobile = useMediaQuery({ query: '(max-width: 776px)' });
33
35
 
34
36
  useEffect(() => {
35
37
  if (isSearchStalled) {
@@ -134,7 +136,7 @@ function ProductListComponent({
134
136
  }
135
137
  return itemShowDefault.map((hit: any, i: number) => {
136
138
  return (
137
- <Box key={i}>
139
+ <Box key={i} style={{ height: 'fit-content' }}>
138
140
  <ItemResult
139
141
  dataItem={hit}
140
142
  indexItem={i}
@@ -169,6 +171,7 @@ function ProductListComponent({
169
171
  isSearchStalled,
170
172
  algoliaRequest,
171
173
  loadingSearchAlgolia,
174
+ isMobile,
172
175
  ]);
173
176
 
174
177
  return <>{renderItem}</>;
@@ -0,0 +1,120 @@
1
+ import { Box } from '@material-ui/core';
2
+ import { getCroppedCanvas } from 'helpers/getCroppedCanvas';
3
+ import React from 'react';
4
+ import { useMediaQuery } from 'react-responsive';
5
+
6
+ function RfqBanner({
7
+ requestImage,
8
+ rfqRef,
9
+ rfqStatus,
10
+ selectedRegion,
11
+ setIsRfqModalOpen,
12
+ }: {
13
+ rfqRef: any;
14
+ rfqStatus: any;
15
+ setIsRfqModalOpen: any;
16
+ requestImage: any;
17
+ selectedRegion: any;
18
+ }) {
19
+ const isMobile = useMediaQuery({ query: '(max-width: 776px)' });
20
+
21
+ return (
22
+ <Box
23
+ style={{
24
+ padding: '0px 16px 0px 16px',
25
+ backgroundColor: '#F6F3F1',
26
+ width: '100%',
27
+ marginBottom: !isMobile ? '32px' : '0px',
28
+ alignSelf: 'end',
29
+ height: '248px',
30
+ display: 'flex',
31
+ alignItems: 'center',
32
+ }}
33
+ className="rfq-box"
34
+ ref={rfqRef}
35
+ >
36
+ <Box
37
+ style={{
38
+ width: '100%',
39
+ display: 'flex',
40
+ columnGap: '16px',
41
+ alignItems: 'center',
42
+ justifyContent: 'space-around',
43
+ }}
44
+ >
45
+ <Box>
46
+ <Box
47
+ style={{
48
+ paddingBottom: '12px',
49
+ }}
50
+ >
51
+ <Box
52
+ style={{
53
+ fontSize: '14px',
54
+ color: rfqStatus === 'inactive' ? '#4B4B4A' : '#CACAD1',
55
+ fontWeight: 'bold',
56
+ }}
57
+ >
58
+ {isMobile
59
+ ? 'No matches found?'
60
+ : 'No matches found for your request?'}
61
+ </Box>
62
+ <Box
63
+ style={{
64
+ fontSize: '12px',
65
+ maxWidth: '320x',
66
+ lineHeight: '14.1px',
67
+ color: rfqStatus === 'inactive' ? '#4B4B4A' : '#CACAD1',
68
+ fontWeight: 'normal',
69
+ }}
70
+ >
71
+ Get personalised help from our team of product experts.
72
+ </Box>
73
+ </Box>
74
+ <button
75
+ style={{
76
+ maxWidth: '200px',
77
+ background: rfqStatus === 'inactive' ? '#4B4B4A' : '#E9E9EC',
78
+ boxShadow:
79
+ rfqStatus === 'inactive'
80
+ ? '0px 0px 4px 0px rgba(0, 0, 0, 0.25)'
81
+ : '',
82
+ borderRadius: '2px',
83
+ padding: '16px 16px 16px 16px',
84
+ display: 'flex',
85
+ alignItems: 'center',
86
+ color: rfqStatus === 'inactive' ? '#fff' : '#CACAD1',
87
+ fontSize: '14px',
88
+ height: '48px',
89
+ cursor: rfqStatus === 'inactive' ? 'pointer' : 'default',
90
+ border: 'none',
91
+ }}
92
+ disabled={rfqStatus !== 'inactive'}
93
+ onClick={() => {
94
+ setIsRfqModalOpen(true);
95
+ }}
96
+ >
97
+ Request a Quote
98
+ </button>
99
+ </Box>
100
+ <div>
101
+ <img
102
+ src={getCroppedCanvas(
103
+ requestImage?.canvas,
104
+ selectedRegion,
105
+ )?.toDataURL()}
106
+ alt="request_image"
107
+ style={{
108
+ mixBlendMode: rfqStatus !== 'inactive' ? 'overlay' : 'unset',
109
+ maxHeight: '181px',
110
+ maxWidth: '181px',
111
+ borderRadius: '2px',
112
+ }}
113
+ />
114
+ </div>
115
+ </Box>
116
+ </Box>
117
+ );
118
+ }
119
+
120
+ export default RfqBanner;
@@ -0,0 +1,147 @@
1
+ import { Box, Button, Typography } from '@material-ui/core';
2
+ import { RectCoords } from '@nyris/nyris-api';
3
+ import { Preview } from '@nyris/nyris-react-components';
4
+ import React, { useState } from 'react';
5
+ import ExpandablePanelComponent from './PanelResult';
6
+ import { useTranslation } from 'react-i18next';
7
+ import { useAppSelector } from 'Store/Store';
8
+ import KeyboardArrowRightOutlinedIcon from '@material-ui/icons/KeyboardArrowRightOutlined';
9
+ import KeyboardArrowLeftOutlinedIcon from '@material-ui/icons/KeyboardArrowLeftOutlined';
10
+ import { DEFAULT_REGION } from '../constants';
11
+ import { ReactComponent as IconInfo } from 'common/assets/icons/info-tooltip.svg';
12
+
13
+ function SidePanel({
14
+ setImageSelection,
15
+ imageSelection,
16
+ debouncedOnImageSelectionChange,
17
+ filteredRegions,
18
+ showAdjustInfoBasedOnConfidence,
19
+ showAdjustInfo,
20
+ showPostFilter,
21
+ disjunctiveFacets,
22
+ }: {
23
+ setImageSelection: any;
24
+ imageSelection: any;
25
+ debouncedOnImageSelectionChange: any;
26
+ filteredRegions: any;
27
+ showAdjustInfoBasedOnConfidence: any;
28
+ showAdjustInfo: any;
29
+ showPostFilter: any;
30
+ allSearchResults: any;
31
+ disjunctiveFacets: any;
32
+ }) {
33
+ const { t } = useTranslation();
34
+ const [toggleColLeft, setToggleColLeft] = useState<boolean>(false);
35
+ const stateGlobal = useAppSelector((state: any) => state);
36
+ const { search, settings } = stateGlobal;
37
+
38
+ const { requestImage } = search;
39
+
40
+ return (
41
+ <Box
42
+ className={`wrap-main-col-left ${toggleColLeft ? 'toggle' : ''}`}
43
+ style={{
44
+ display: 'flex',
45
+ flexDirection: 'column',
46
+ justifyContent: 'space-between',
47
+ }}
48
+ >
49
+ <Box
50
+ className="box-toggle-coloumn"
51
+ style={{
52
+ right: requestImage || toggleColLeft ? '0px' : '16px',
53
+ }}
54
+ >
55
+ <Button
56
+ style={{
57
+ color: '#55566b',
58
+ height: '32px',
59
+ }}
60
+ onClick={() => {
61
+ setToggleColLeft(!toggleColLeft);
62
+ }}
63
+ >
64
+ {toggleColLeft ? (
65
+ <KeyboardArrowRightOutlinedIcon />
66
+ ) : (
67
+ <KeyboardArrowLeftOutlinedIcon />
68
+ )}
69
+ </Button>
70
+ </Box>
71
+ <Box>
72
+ {settings.preview && requestImage && (
73
+ <Box className="col-left">
74
+ <Box className="box-preview">
75
+ <Box
76
+ className="preview-item"
77
+ style={{
78
+ backgroundColor: 'white',
79
+ paddingTop: '32px',
80
+ width: '100%',
81
+ }}
82
+ >
83
+ <div
84
+ style={{
85
+ backgroundColor: '#F3F3F5',
86
+ width: '100%',
87
+ paddingTop: '16px',
88
+ paddingBottom: '16px',
89
+ }}
90
+ >
91
+ <Preview
92
+ key={requestImage?.id}
93
+ onSelectionChange={(r: RectCoords) => {
94
+ setImageSelection(r);
95
+ debouncedOnImageSelectionChange(r);
96
+ }}
97
+ image={requestImage?.canvas}
98
+ selection={imageSelection || DEFAULT_REGION}
99
+ regions={filteredRegions}
100
+ maxWidth={288}
101
+ maxHeight={288}
102
+ dotColor={'#FBD914'}
103
+ minCropWidth={60}
104
+ minCropHeight={60}
105
+ rounded={true}
106
+ />
107
+ </div>
108
+ </Box>
109
+ </Box>
110
+ {(showAdjustInfoBasedOnConfidence || showAdjustInfo) && (
111
+ <Box
112
+ className="box-title_col-left"
113
+ alignItems="center"
114
+ style={{
115
+ backgroundColor: '#3E36DC',
116
+ display: 'flex',
117
+ columnGap: '6px',
118
+ padding: '5px',
119
+ }}
120
+ >
121
+ <IconInfo color="white" />
122
+ <Typography
123
+ style={{
124
+ fontSize: 10,
125
+ color: '#fff',
126
+ }}
127
+ >
128
+ {showAdjustInfo
129
+ ? t('Crop the image for better results')
130
+ : 'Crop the image for better results'}
131
+ </Typography>
132
+ </Box>
133
+ )}
134
+ </Box>
135
+ )}
136
+
137
+ {showPostFilter && (
138
+ <Box className="col-left__bottom">
139
+ <ExpandablePanelComponent disjunctiveFacets={disjunctiveFacets} />
140
+ </Box>
141
+ )}
142
+ </Box>
143
+ </Box>
144
+ );
145
+ }
146
+
147
+ export default SidePanel;