@nyris/nyris-webapp 0.3.70 → 0.3.72

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/package.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "@nyris/nyris-webapp",
3
- "version": "0.3.70",
3
+ "version": "0.3.72",
4
4
  "dependencies": {
5
5
  "@auth0/auth0-react": "^2.2.4",
6
6
  "@emailjs/browser": "^4.3.3",
7
7
  "@material-ui/core": "^4.12.4",
8
8
  "@material-ui/icons": "^4.11.3",
9
9
  "@material-ui/lab": "^4.0.0-alpha.61",
10
- "@nyris/nyris-api": "^0.3.70",
11
- "@nyris/nyris-react-components": "^0.3.70",
10
+ "@nyris/nyris-api": "^0.3.72",
11
+ "@nyris/nyris-react-components": "^0.3.72",
12
12
  "@reduxjs/toolkit": "^2.2.1",
13
13
  "@splidejs/react-splide": "^0.7.12",
14
14
  "@testing-library/jest-dom": "^5.17.0",
@@ -97,6 +97,7 @@ var settings = {
97
97
  emailTemplateId: '',
98
98
  supportNumber: '',
99
99
  description: '',
100
+ prefilterFieldName: '',
100
101
  },
101
102
  cadenas: {
102
103
  catalog: '',
@@ -11,6 +11,7 @@ import {
11
11
  import { useImageSearch } from 'hooks/useImageSearch';
12
12
  import { useHistory } from 'react-router-dom';
13
13
  import { Icon } from '@nyris/nyris-react-components';
14
+ import { useTranslation } from 'react-i18next';
14
15
 
15
16
  function ExperienceVisualSearch({
16
17
  experienceVisualSearchBlobs,
@@ -26,28 +27,26 @@ function ExperienceVisualSearch({
26
27
 
27
28
  const { singleImageSearch } = useImageSearch();
28
29
 
30
+ const { t } = useTranslation();
31
+
32
+ const [expand, setExpand] = useState(false);
33
+
29
34
  useEffect(() => {
35
+ let intervalId: any;
30
36
  if (document.body.getBoundingClientRect().width >= 776) {
31
37
  if (!showModal) {
32
- interval.current = setInterval(() => {
33
- if (button?.current) {
34
- (button.current as HTMLElement).classList.toggle('hover');
35
- }
38
+ intervalId = setInterval(() => {
39
+ setExpand(s => !s);
36
40
  }, 3000);
37
41
  } else if (interval?.current) {
38
42
  clearInterval(interval?.current);
39
- if (
40
- button?.current &&
41
- !(button.current as HTMLElement).classList.contains('hover')
42
- ) {
43
- (button.current as HTMLElement).classList.toggle('hover');
44
- }
43
+ setExpand(false);
45
44
  }
46
45
  return () => {
47
- if (interval?.current) {
48
- clearInterval(interval?.current);
49
- }
46
+ clearInterval(intervalId);
50
47
  };
48
+ } else {
49
+ setExpand(true);
51
50
  }
52
51
  }, [showModal]);
53
52
 
@@ -72,13 +71,25 @@ function ExperienceVisualSearch({
72
71
 
73
72
  return (
74
73
  <>
75
- <div
76
- ref={button}
77
- className="experience-visual-button"
78
- onClick={() => modalToggle(true)}
79
- >
80
- <span />
81
- <ExperienceIcon />
74
+ <div className="flex flex-col items-center">
75
+ <div
76
+ ref={button}
77
+ className={`group bg-[#3E36DC] w-[215px] desktop:w-10 hover:w-[215px] hover:gap-2 ${
78
+ expand ? 'desktop:w-[215px] gap-2' : ''
79
+ } h-10 flex flex-row justify-center items-center rounded-full cursor-pointer my-8 transition-all duration-300`}
80
+ onClick={() => modalToggle(true)}
81
+ >
82
+ <span
83
+ className={`${
84
+ expand ? 'flex-grow max-w-fit' : 'flex-grow-0 w-0'
85
+ } group-hover:flex-grow group-hover:max-w-fit overflow-hidden whitespace-nowrap text-sm font-semibold leading-4 text-center text-white break-keep transition-all duration-300`}
86
+ >
87
+ {t('Experience Visual Search')}
88
+ </span>
89
+ <div className="flex flex-grow-0">
90
+ <ExperienceIcon className="" />
91
+ </div>
92
+ </div>
82
93
  </div>
83
94
  {showModal &&
84
95
  createPortal(
@@ -104,10 +115,10 @@ function ExperienceVisualSearch({
104
115
  }}
105
116
  />
106
117
  <div className="custom-modal-body-title">
107
- Experience Visual Search
118
+ {t('Experience Visual Search')}
108
119
  </div>
109
120
  <div className="custom-modal-body-subtitle">
110
- Start your visual search by selecting an image below.
121
+ {t('Start your visual search by selecting an image below.')}
111
122
  </div>
112
123
  <div className="custom-modal-body-content experience-visual-search-images">
113
124
  {new Array(4).fill(1).map((val, index) => {
@@ -1,5 +1,6 @@
1
1
  import { Icon } from '@nyris/nyris-react-components';
2
2
  import { useState } from 'react';
3
+ import { useTranslation } from 'react-i18next';
3
4
 
4
5
  function Feedback({
5
6
  submitFeedback,
@@ -10,6 +11,8 @@ function Feedback({
10
11
  }) {
11
12
  const [isHovered, setIsHovered] = useState(false);
12
13
 
14
+ const { t } = useTranslation();
15
+
13
16
  return (
14
17
  <div
15
18
  className={`feedback-wrapper`}
@@ -18,7 +21,7 @@ function Feedback({
18
21
  transition: 'background-color 0.3s ease',
19
22
  }}
20
23
  >
21
- <p className="desktop:w-[146px]">Are these results useful?</p>
24
+ <p className="desktop:w-[146px]">{t('Are these results useful?')}</p>
22
25
  <div
23
26
  className="feedback-icon-wrapper"
24
27
  onClick={() => submitFeedback(false)}
@@ -294,6 +294,7 @@ function ImagePreviewComponent({
294
294
  borderRadius: '16px',
295
295
  zIndex: 1000,
296
296
  height: 'fit-content',
297
+ alignItems: 'center',
297
298
  }}
298
299
  >
299
300
  <Icon name="info" color="white" width={12} height={12} />
@@ -306,7 +307,7 @@ function ImagePreviewComponent({
306
307
  >
307
308
  {showAdjustInfo
308
309
  ? t('Crop the image for better results')
309
- : 'Crop the image for better results'}
310
+ : t('Adjust the selection frame for better results')}
310
311
  </p>
311
312
  </div>
312
313
  )}
@@ -396,7 +397,7 @@ function ImagePreviewComponent({
396
397
  >
397
398
  {showAdjustInfo
398
399
  ? t('Crop the image for better results')
399
- : 'Crop the image for better results'}
400
+ : t('Adjust the selection frame for better results')}
400
401
  </p>
401
402
  </div>
402
403
  )}
@@ -155,7 +155,7 @@ function InquiryBanner({
155
155
  justifyContent: 'space-between',
156
156
  }}
157
157
  >
158
- <p>Inquiry</p>
158
+ <p>{t('Inquiry')}</p>
159
159
  <Icon name="email" color="#fff" width={16} height={12} />
160
160
  </div>
161
161
  </div>
@@ -188,10 +188,17 @@ function InquiryBanner({
188
188
  display: 'flex',
189
189
  alignItems: 'center',
190
190
  justifyContent: 'space-between',
191
+ gap: '5px',
191
192
  }}
192
193
  >
193
- <p> Call us</p>
194
- <Icon name="call" color="#fff" width={16} height={16} />
194
+ <p> {t('Call us')}</p>
195
+ <Icon
196
+ name="call"
197
+ color="#fff"
198
+ width={16}
199
+ height={16}
200
+ className="min-w-4"
201
+ />
195
202
  </div>
196
203
  </a>
197
204
  )}
@@ -11,6 +11,7 @@ import toast from 'react-hot-toast';
11
11
  import { useAppSelector } from 'Store/Store';
12
12
  import { useMediaQuery } from 'react-responsive';
13
13
  import { Icon } from '@nyris/nyris-react-components';
14
+ import { useTranslation } from 'react-i18next';
14
15
  interface Props {
15
16
  requestImage: any;
16
17
  selectedRegion: any;
@@ -60,6 +61,7 @@ export default function InquiryModal({
60
61
  },
61
62
  [setInformation],
62
63
  );
64
+ const { t } = useTranslation();
63
65
 
64
66
  useEffect(() => emailjs.init('SMGihPnuEGcYLm0V4'), []);
65
67
  useEffect(() => {
@@ -86,7 +88,7 @@ export default function InquiryModal({
86
88
  ? preFilterValues.join(', ')
87
89
  : '<not specified>',
88
90
  });
89
- ToastHelper.success('Request sent successfully');
91
+ ToastHelper.success(t('Request sent successfully'));
90
92
  } catch (error) {
91
93
  toast(
92
94
  t => {
@@ -173,8 +175,8 @@ export default function InquiryModal({
173
175
  }}
174
176
  >
175
177
  {requestImage
176
- ? 'Submit your image for inquiry'
177
- : 'Submit your inquiry'}
178
+ ? t('Submit your image for inquiry')
179
+ : t('Submit your inquiry')}
178
180
  </p>
179
181
  <div
180
182
  onClick={() => setIsInquiryModalOpen(false)}
@@ -223,7 +225,7 @@ export default function InquiryModal({
223
225
  marginBottom: '8px',
224
226
  }}
225
227
  >
226
- Your email (required)
228
+ {t('Your email (required)')}
227
229
  </p>
228
230
  <input
229
231
  value={email}
@@ -239,7 +241,7 @@ export default function InquiryModal({
239
241
  />
240
242
  {!emailValid && !isUndefined(emailValid) && (
241
243
  <p style={{ color: 'red', fontSize: '12px', paddingTop: '8px' }}>
242
- Please enter a valid email.
244
+ {t('Please enter a valid email.')}
243
245
  </p>
244
246
  )}
245
247
  </div>
@@ -259,21 +261,23 @@ export default function InquiryModal({
259
261
  color: '#2B2C46',
260
262
  }}
261
263
  >
262
- Machine
264
+ {settings.support.prefilterFieldName}
263
265
  </p>
264
266
  <Tooltip
265
- title={
266
- 'Please select a pre-filter before search request to refine and yield accurate results.'
267
- }
267
+ title={t(
268
+ 'Please select a search criteria before search request to refine and yield accurate results.',
269
+ )}
268
270
  placement="top"
269
271
  arrow={true}
270
272
  >
271
- <Icon
272
- name="info"
273
- style={{ cursor: 'pointer' }}
274
- width={12}
275
- height={12}
276
- />
273
+ <div>
274
+ <Icon
275
+ name="info"
276
+ style={{ cursor: 'pointer' }}
277
+ width={12}
278
+ height={12}
279
+ />
280
+ </div>
277
281
  </Tooltip>
278
282
  </div>
279
283
 
@@ -288,7 +292,8 @@ export default function InquiryModal({
288
292
  backgroundColor: '#fff',
289
293
  }}
290
294
  >
291
- {preFilterValues.join(', ') || 'Pre-filter is not selected'}
295
+ {preFilterValues.join(', ') ||
296
+ t('Search criteria is not selected')}
292
297
  </div>
293
298
  </div>
294
299
  )}
@@ -303,7 +308,7 @@ export default function InquiryModal({
303
308
  color: '#2B2C46',
304
309
  }}
305
310
  >
306
- <p>Additional information</p>
311
+ <p>{t('Additional information')}</p>
307
312
  <p>{`${information.length}/150`}</p>
308
313
  </div>
309
314
  <TextareaAutosize
@@ -337,7 +342,7 @@ export default function InquiryModal({
337
342
  }}
338
343
  onClick={() => setIsInquiryModalOpen(false)}
339
344
  >
340
- Cancel
345
+ {t('Cancel')}
341
346
  </button>
342
347
  <button
343
348
  style={{
@@ -357,7 +362,7 @@ export default function InquiryModal({
357
362
  disabled={!emailValid}
358
363
  onClick={handleInquiry}
359
364
  >
360
- Send
365
+ {t('Send')}
361
366
  </button>
362
367
  </div>
363
368
  </div>
@@ -289,7 +289,7 @@ export default function PostFilterPanel({
289
289
  }}
290
290
  onClick={handlerApplyfillter}
291
291
  >
292
- Cancel
292
+ {t('Cancel')}
293
293
  </div>
294
294
  <div
295
295
  className="text-white"
@@ -305,7 +305,7 @@ export default function PostFilterPanel({
305
305
  }}
306
306
  onClick={handlerApplyfillter}
307
307
  >
308
- Apply filters
308
+ {t('Apply')}
309
309
  </div>
310
310
  </div>
311
311
  )}
@@ -252,7 +252,7 @@ export default function PostFilterPanelAlgolia({
252
252
  }}
253
253
  onClick={handlerApplyfillter}
254
254
  >
255
- Cancel
255
+ {t('Cancel')}
256
256
  </div>
257
257
  <div
258
258
  className="text-white"
@@ -268,7 +268,7 @@ export default function PostFilterPanelAlgolia({
268
268
  }}
269
269
  onClick={handlerApplyfillter}
270
270
  >
271
- Apply filters
271
+ {t('Apply')}
272
272
  </div>
273
273
  </div>
274
274
  )}
@@ -2,6 +2,7 @@ import React, { useState } from 'react';
2
2
  import { createPortal } from 'react-dom';
3
3
 
4
4
  import { Icon, makeFileHandler } from '@nyris/nyris-react-components';
5
+ import { useTranslation } from 'react-i18next';
5
6
 
6
7
  function UploadDisclaimer({
7
8
  onClose,
@@ -13,7 +14,7 @@ function UploadDisclaimer({
13
14
  isMobile: boolean;
14
15
  }) {
15
16
  const [dontShowAgain, setDontShowAgain] = useState(false);
16
-
17
+ const { t } = useTranslation();
17
18
  return (
18
19
  <>
19
20
  {createPortal(
@@ -21,7 +22,9 @@ function UploadDisclaimer({
21
22
  <div className="bg-white w-80">
22
23
  <div className="p-4">
23
24
  <div className="flex justify-between items-center">
24
- <div className="font-bold text-xl">Replace Current Data?</div>
25
+ <div className="font-bold text-xl">
26
+ {t('Replace Current Data?')}
27
+ </div>
25
28
  <Icon
26
29
  name="close"
27
30
  className="cursor-pointer"
@@ -31,8 +34,9 @@ function UploadDisclaimer({
31
34
  />
32
35
  </div>
33
36
  <p className="text-sm mt-4">
34
- Uploading a new image will overwrite your current search
35
- parameters, text, and results. Are you sure you want to proceed?
37
+ {t(
38
+ `Uploading a new image will overwrite your current search parameters, text, and results. Are you sure you want to proceed?`,
39
+ )}
36
40
  </p>
37
41
  <div className="mt-4 gap-x-2 flex">
38
42
  <input
@@ -42,7 +46,7 @@ function UploadDisclaimer({
42
46
  setDontShowAgain(e.target.checked);
43
47
  }}
44
48
  />
45
- Don't show this again
49
+ {t(`Don't show this again`)}
46
50
  </div>
47
51
  </div>
48
52
  <div className="flex">
@@ -50,7 +54,7 @@ function UploadDisclaimer({
50
54
  className="w-1/2 h-16 p-4 text-start text-sm text-white bg-[#2B2C46]"
51
55
  onClick={() => onClose()}
52
56
  >
53
- Cancel
57
+ {t(`Cancel`)}
54
58
  </button>
55
59
  <label
56
60
  className="w-1/2 h-16 p-4 text-start text-sm text-white bg-[#E31B5D] cursor-pointer"
@@ -61,7 +65,7 @@ function UploadDisclaimer({
61
65
  }
62
66
  }}
63
67
  >
64
- Continue
68
+ {t(`Continue`)}
65
69
  </label>
66
70
  <input
67
71
  type="file"
@@ -456,7 +456,7 @@ function PreFilterComponent(props: Props) {
456
456
  </div>
457
457
  )}
458
458
  {isEmpty(resultFilter) && !isLoading && (
459
- <Typography>No result found</Typography>
459
+ <Typography>{t('No result found')}</Typography>
460
460
  )}
461
461
  </div>
462
462
  {!isMobile && (
@@ -1,6 +1,7 @@
1
1
  import React from 'react';
2
2
  import { getCroppedCanvas } from 'helpers/getCroppedCanvas';
3
3
  import { useMediaQuery } from 'react-responsive';
4
+ import { useTranslation } from 'react-i18next';
4
5
 
5
6
  function RfqBanner({
6
7
  requestImage,
@@ -16,7 +17,7 @@ function RfqBanner({
16
17
  selectedRegion: any;
17
18
  }) {
18
19
  const isMobile = useMediaQuery({ query: '(max-width: 776px)' });
19
-
20
+ const { t } = useTranslation();
20
21
  return (
21
22
  <div
22
23
  style={{
@@ -66,8 +67,8 @@ function RfqBanner({
66
67
  }}
67
68
  >
68
69
  {isMobile
69
- ? 'No matches found?'
70
- : 'No matches found for your request?'}
70
+ ? `${t('No matches found')}?`
71
+ : `${t('No matches found for your request')}?`}
71
72
  </div>
72
73
  <div
73
74
  style={{
@@ -78,7 +79,7 @@ function RfqBanner({
78
79
  fontWeight: 'normal',
79
80
  }}
80
81
  >
81
- Get personalised help from our team of product experts.
82
+ {t('Get personalised help from our team of product experts.')}
82
83
  </div>
83
84
  </div>
84
85
  <button
@@ -11,6 +11,7 @@ import { useMediaQuery } from 'react-responsive';
11
11
  import { useAppSelector } from '../../Store/Store';
12
12
  import useRequestStore from 'Store/requestStore';
13
13
  import { Icon } from '@nyris/nyris-react-components';
14
+ import { useTranslation } from 'react-i18next';
14
15
  interface Props {
15
16
  setIsRfqModalOpen: any;
16
17
  isRfqModalOpen?: any;
@@ -79,7 +80,7 @@ export default function RfqModal({
79
80
  request_image: croppedImage?.toDataURL(),
80
81
  });
81
82
  setRfqStatus('sent');
82
- ToastHelper.success('Request sent successfully');
83
+ ToastHelper.success(t('Request sent successfully'));
83
84
  } catch (error) {
84
85
  setRfqStatus('inactive');
85
86
 
@@ -132,6 +133,8 @@ export default function RfqModal({
132
133
  }
133
134
  };
134
135
 
136
+ const { t } = useTranslation();
137
+
135
138
  return (
136
139
  <DefaultModal
137
140
  openModal={isRfqModalOpen}
@@ -263,7 +266,7 @@ export default function RfqModal({
263
266
  }}
264
267
  onClick={() => setIsRfqModalOpen(false)}
265
268
  >
266
- Cancel
269
+ {t('Cancel')}
267
270
  </button>
268
271
  <button
269
272
  style={{
@@ -281,7 +284,7 @@ export default function RfqModal({
281
284
  disabled={!emailValid}
282
285
  onClick={handleRfq}
283
286
  >
284
- Send
287
+ {t('Send')}
285
288
  </button>
286
289
  </div>
287
290
  </div>
@@ -400,7 +400,7 @@ function ResultComponent(props: Props) {
400
400
  <div className={'feedback-floating'}>
401
401
  <div className="feedback-section">
402
402
  <div className="feedback-success">
403
- Thanks for your feedback!
403
+ {t('Thank you for your feedback')}
404
404
  </div>
405
405
  </div>
406
406
  </div>