@nyris/nyris-webapp 0.3.46 → 0.3.48
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 +16 -12
- package/build/index.html +1 -1
- package/build/js/settings.example.js +84 -13
- package/build/{precache-manifest.003c83b03ba38cefb9af2060ababe0b4.js → precache-manifest.87ecf17e376539dad2c663829130bfdc.js} +26 -10
- package/build/service-worker.js +1 -1
- package/build/static/css/main.24b5a712.chunk.css +2 -0
- package/build/static/css/main.24b5a712.chunk.css.map +1 -0
- package/build/static/js/2.f9395632.chunk.js +3 -0
- package/build/static/js/2.f9395632.chunk.js.map +1 -0
- package/build/static/js/main.e2a2eb38.chunk.js +3 -0
- package/build/static/js/main.e2a2eb38.chunk.js.map +1 -0
- package/build/static/media/add.ba46a4bf.svg +4 -0
- package/build/static/media/arrow_left.fd9d4390.svg +3 -0
- package/build/static/media/arrow_right.c6fdab0b.svg +3 -0
- package/build/static/media/minus.3fce6c0a.svg +3 -0
- package/package.json +4 -4
- package/public/js/settings.example.js +84 -13
- package/src/Store/Store.ts +1 -0
- package/src/Store/search/Search.ts +36 -0
- package/src/Store/search/search.initialState.ts +1 -0
- package/src/Store/search/types.ts +1 -0
- package/src/common/assets/icons/add.svg +4 -0
- package/src/common/assets/icons/minus.svg +3 -0
- package/src/components/HeaderMobile.tsx +33 -12
- package/src/components/ImagePreviewMobile.tsx +52 -134
- package/src/components/Inquiry/InquiryBanner.tsx +6 -3
- package/src/components/Layout.tsx +19 -1
- package/src/components/MobilePostFilter.tsx +14 -5
- package/src/components/PanelResult/PostFilter.tsx +314 -0
- package/src/components/PanelResult/{index.tsx → PostFilterAlgolia.tsx} +44 -15
- package/src/components/PanelResult/expandable-panel.tsx +20 -14
- package/src/components/ProductAttribute.tsx +38 -34
- package/src/components/ProductDetailView.tsx +37 -22
- package/src/components/ProductList/index.tsx +0 -3
- package/src/components/ProductList/useProductList.ts +6 -3
- package/src/components/SelectedPostFilter.tsx +103 -0
- package/src/components/SidePanel.tsx +40 -22
- package/src/components/appMobile.scss +7 -0
- package/src/components/common.scss +4 -0
- package/src/components/current-refinements/getCurrentRefinement.ts +10 -18
- package/src/components/drawer/cameraCustom.tsx +14 -64
- package/src/components/icon-label/icon-label.tsx +23 -18
- package/src/components/input/inputSearch.tsx +2 -2
- package/src/components/pre-filter/index.tsx +16 -10
- package/src/components/results/ItemResult.tsx +33 -22
- package/src/hooks/useFilter.ts +92 -0
- package/src/hooks/useFilteredResult.ts +29 -0
- package/src/index.css +2 -1
- package/src/page/landingPage/AppMD.tsx +1 -5
- package/src/page/landingPage/common.scss +10 -3
- package/src/page/result/index.tsx +37 -29
- package/src/services/image.ts +0 -5
- package/src/translations.ts +16 -0
- package/src/types.ts +1 -5
- package/build/static/css/main.5b89f23f.chunk.css +0 -2
- package/build/static/css/main.5b89f23f.chunk.css.map +0 -1
- package/build/static/js/2.f3840c8e.chunk.js +0 -3
- package/build/static/js/2.f3840c8e.chunk.js.map +0 -1
- package/build/static/js/main.d68884f6.chunk.js +0 -3
- package/build/static/js/main.d68884f6.chunk.js.map +0 -1
- /package/build/static/js/{2.f3840c8e.chunk.js.LICENSE.txt → 2.f9395632.chunk.js.LICENSE.txt} +0 -0
- /package/build/static/js/{main.d68884f6.chunk.js.LICENSE.txt → main.e2a2eb38.chunk.js.LICENSE.txt} +0 -0
|
@@ -15,6 +15,7 @@ import { Skeleton } from '@material-ui/lab';
|
|
|
15
15
|
import { truncateString } from 'helpers/truncateString';
|
|
16
16
|
import { find } from 'services/image';
|
|
17
17
|
import { useQuery } from 'hooks/useQuery';
|
|
18
|
+
import { useTranslation } from 'react-i18next';
|
|
18
19
|
|
|
19
20
|
interface Props {
|
|
20
21
|
handleClose?: any;
|
|
@@ -159,6 +160,7 @@ function PreFilterComponent(props: Props) {
|
|
|
159
160
|
}
|
|
160
161
|
handleClose();
|
|
161
162
|
};
|
|
163
|
+
const { t } = useTranslation();
|
|
162
164
|
|
|
163
165
|
return (
|
|
164
166
|
<Box
|
|
@@ -225,7 +227,7 @@ function PreFilterComponent(props: Props) {
|
|
|
225
227
|
|
|
226
228
|
<input
|
|
227
229
|
className="input-search-filter"
|
|
228
|
-
placeholder=
|
|
230
|
+
placeholder={t('Search')}
|
|
229
231
|
onChange={(e: any) => {
|
|
230
232
|
filterSearchHandler(e.target.value);
|
|
231
233
|
}}
|
|
@@ -285,7 +287,7 @@ function PreFilterComponent(props: Props) {
|
|
|
285
287
|
setKeyFilter({});
|
|
286
288
|
}}
|
|
287
289
|
>
|
|
288
|
-
Clear all
|
|
290
|
+
{t('Clear all')}
|
|
289
291
|
</Box>
|
|
290
292
|
</Box>
|
|
291
293
|
</Box>
|
|
@@ -410,17 +412,18 @@ function PreFilterComponent(props: Props) {
|
|
|
410
412
|
className="button-left"
|
|
411
413
|
style={{
|
|
412
414
|
width: '50%',
|
|
413
|
-
|
|
414
|
-
backgroundColor: '#2B2C46',
|
|
415
|
+
backgroundColor: settings.theme.secondaryColor,
|
|
415
416
|
color: '#fff',
|
|
416
417
|
borderRadius: 0,
|
|
417
418
|
justifyContent: 'flex-start',
|
|
418
419
|
textTransform: 'none',
|
|
419
420
|
paddingLeft: '16px',
|
|
421
|
+
paddingTop: '16px',
|
|
422
|
+
paddingBottom: '32px',
|
|
420
423
|
}}
|
|
421
424
|
onClick={() => handleClose()}
|
|
422
425
|
>
|
|
423
|
-
Cancel
|
|
426
|
+
{t('Cancel')}
|
|
424
427
|
</Button>
|
|
425
428
|
<Button
|
|
426
429
|
className="button-right"
|
|
@@ -432,10 +435,12 @@ function PreFilterComponent(props: Props) {
|
|
|
432
435
|
justifyContent: 'flex-start',
|
|
433
436
|
textTransform: 'none',
|
|
434
437
|
paddingLeft: '16px',
|
|
438
|
+
paddingTop: '16px',
|
|
439
|
+
paddingBottom: '32px',
|
|
435
440
|
}}
|
|
436
441
|
onClick={() => onHandlerSubmitData()}
|
|
437
442
|
>
|
|
438
|
-
Apply
|
|
443
|
+
{t('Apply')}
|
|
439
444
|
</Button>
|
|
440
445
|
</Box>
|
|
441
446
|
)}
|
|
@@ -456,14 +461,15 @@ function PreFilterComponent(props: Props) {
|
|
|
456
461
|
className="button-left"
|
|
457
462
|
style={{
|
|
458
463
|
width: '50%',
|
|
459
|
-
backgroundColor:
|
|
464
|
+
backgroundColor: settings.theme.secondaryColor,
|
|
460
465
|
color: '#fff',
|
|
461
466
|
borderRadius: 0,
|
|
462
467
|
justifyContent: 'flex-start',
|
|
468
|
+
textTransform: 'none',
|
|
463
469
|
}}
|
|
464
470
|
onClick={() => handleClose()}
|
|
465
471
|
>
|
|
466
|
-
Cancel
|
|
472
|
+
{t('Cancel')}
|
|
467
473
|
</Button>
|
|
468
474
|
<Button
|
|
469
475
|
className="button-right"
|
|
@@ -473,15 +479,15 @@ function PreFilterComponent(props: Props) {
|
|
|
473
479
|
color: '#fff',
|
|
474
480
|
borderRadius: 0,
|
|
475
481
|
justifyContent: 'flex-start',
|
|
482
|
+
textTransform: 'none',
|
|
476
483
|
}}
|
|
477
484
|
onClick={() => onHandlerSubmitData()}
|
|
478
485
|
>
|
|
479
|
-
Apply
|
|
486
|
+
{t('Apply')}
|
|
480
487
|
</Button>
|
|
481
488
|
</Box>
|
|
482
489
|
)}
|
|
483
490
|
</Box>
|
|
484
491
|
);
|
|
485
492
|
}
|
|
486
|
-
|
|
487
493
|
export default PreFilterComponent;
|
|
@@ -22,7 +22,7 @@ import { useMediaQuery } from 'react-responsive';
|
|
|
22
22
|
import { feedbackClickEpic, feedbackConversionEpic } from 'services/Feedback';
|
|
23
23
|
import ProductDetailView from 'components/ProductDetailView';
|
|
24
24
|
import ProductAttribute from '../ProductAttribute';
|
|
25
|
-
import { get } from 'lodash';
|
|
25
|
+
import { get, isUndefined } from 'lodash';
|
|
26
26
|
|
|
27
27
|
interface Props {
|
|
28
28
|
dataItem: any;
|
|
@@ -34,7 +34,6 @@ interface Props {
|
|
|
34
34
|
handlerFeedback?: any;
|
|
35
35
|
handlerGroupItem?: any;
|
|
36
36
|
isGroupItem?: boolean;
|
|
37
|
-
moreInfoText?: string;
|
|
38
37
|
handlerCloseGroup?: any;
|
|
39
38
|
main_image_link?: any;
|
|
40
39
|
}
|
|
@@ -274,25 +273,28 @@ function ItemResult(props: Props) {
|
|
|
274
273
|
</Typography>
|
|
275
274
|
</Tooltip>
|
|
276
275
|
|
|
277
|
-
{settings.warehouseVariant &&
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
>
|
|
284
|
-
<span
|
|
276
|
+
{settings.warehouseVariant &&
|
|
277
|
+
!isUndefined(
|
|
278
|
+
get(dataItem, settings.field.warehouseStockValue),
|
|
279
|
+
) && (
|
|
280
|
+
<Typography
|
|
281
|
+
className="text-f12 max-line-1 fw-400"
|
|
285
282
|
style={{
|
|
286
|
-
color:
|
|
287
|
-
? '#00C070'
|
|
288
|
-
: '#c54545',
|
|
289
|
-
fontWeight: 600,
|
|
283
|
+
color: '#2B2C46',
|
|
290
284
|
}}
|
|
291
285
|
>
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
286
|
+
<span
|
|
287
|
+
style={{
|
|
288
|
+
color: get(dataItem, settings.field.warehouseStockValue)
|
|
289
|
+
? '#00C070'
|
|
290
|
+
: '#c54545',
|
|
291
|
+
fontWeight: 600,
|
|
292
|
+
}}
|
|
293
|
+
>
|
|
294
|
+
{get(dataItem, settings.field.warehouseStockValue) || 0}
|
|
295
|
+
</span>
|
|
296
|
+
</Typography>
|
|
297
|
+
)}
|
|
296
298
|
</Box>
|
|
297
299
|
<Box
|
|
298
300
|
display="flex"
|
|
@@ -330,8 +332,13 @@ function ItemResult(props: Props) {
|
|
|
330
332
|
>
|
|
331
333
|
{settings.field.warehouseNumber && (
|
|
332
334
|
<ProductAttribute
|
|
333
|
-
title={
|
|
334
|
-
|
|
335
|
+
title={
|
|
336
|
+
get(dataItem, settings.field.warehouseNumber) ||
|
|
337
|
+
settings.field.warehouseNumber
|
|
338
|
+
}
|
|
339
|
+
value={
|
|
340
|
+
get(dataItem, settings.field.warehouseNumberValue) || 'N/A'
|
|
341
|
+
}
|
|
335
342
|
padding="4px 8px"
|
|
336
343
|
width={{ xs: '49%' }}
|
|
337
344
|
/>
|
|
@@ -339,9 +346,13 @@ function ItemResult(props: Props) {
|
|
|
339
346
|
|
|
340
347
|
{settings.field.warehouseShelfNumber && (
|
|
341
348
|
<ProductAttribute
|
|
342
|
-
title={
|
|
349
|
+
title={
|
|
350
|
+
get(dataItem, settings.field.warehouseShelfNumber) ||
|
|
351
|
+
settings.field.warehouseShelfNumber
|
|
352
|
+
}
|
|
343
353
|
value={
|
|
344
|
-
dataItem
|
|
354
|
+
get(dataItem, settings.field.warehouseShelfNumberValue) ||
|
|
355
|
+
'N/A'
|
|
345
356
|
}
|
|
346
357
|
padding="4px 8px"
|
|
347
358
|
width={{ xs: '49%' }}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { useAppSelector } from 'Store/Store';
|
|
2
|
+
import { useMemo } from 'react';
|
|
3
|
+
|
|
4
|
+
// Function to count occurrences and create array of objects
|
|
5
|
+
function countOccurrences(inputArray: any[]) {
|
|
6
|
+
const countMap: any = {};
|
|
7
|
+
inputArray.forEach((value: string | number) => {
|
|
8
|
+
countMap[value] = (countMap[value] || 0) + 1;
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
return Object.entries(countMap).map(([value, count]) => ({
|
|
12
|
+
value,
|
|
13
|
+
count,
|
|
14
|
+
}));
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const getNextFilters = (data: any[], postFilters: any): any => {
|
|
18
|
+
const nextFilters: any = {};
|
|
19
|
+
|
|
20
|
+
data?.forEach(element => {
|
|
21
|
+
const filters = element.filters || {};
|
|
22
|
+
const keys = Object.keys(filters);
|
|
23
|
+
|
|
24
|
+
for (let i = 0; i < keys.length; i++) {
|
|
25
|
+
const xKey = keys[i];
|
|
26
|
+
|
|
27
|
+
let isNextFilter = keys.every(yKey => {
|
|
28
|
+
if (xKey !== yKey) {
|
|
29
|
+
const postFilter = postFilters[yKey] || {};
|
|
30
|
+
const filter = filters[yKey] || {};
|
|
31
|
+
|
|
32
|
+
const postFilterValues = Object.keys(postFilter).filter(
|
|
33
|
+
key => postFilter[key],
|
|
34
|
+
);
|
|
35
|
+
|
|
36
|
+
if (postFilterValues?.length > 0) {
|
|
37
|
+
return postFilterValues?.some(element => {
|
|
38
|
+
return filter?.includes(element);
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
return true;
|
|
42
|
+
}
|
|
43
|
+
return true;
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
if (isNextFilter) {
|
|
47
|
+
if (nextFilters[xKey]) {
|
|
48
|
+
nextFilters[xKey] = [...nextFilters[xKey], ...filters[xKey]];
|
|
49
|
+
} else {
|
|
50
|
+
nextFilters[xKey] = filters[xKey];
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
return nextFilters;
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
export const useFilter = (data: any) => {
|
|
60
|
+
const { postFilter } = useAppSelector(state => state.search);
|
|
61
|
+
|
|
62
|
+
const filters = useMemo(() => {
|
|
63
|
+
return getNextFilters(data, postFilter);
|
|
64
|
+
}, [data, postFilter]);
|
|
65
|
+
|
|
66
|
+
const filterCount = useMemo(() => {
|
|
67
|
+
const resultObject: any = {};
|
|
68
|
+
for (const key in filters) {
|
|
69
|
+
if (filters.hasOwnProperty(key)) {
|
|
70
|
+
resultObject[key] = countOccurrences(filters[key]);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
return resultObject;
|
|
75
|
+
}, [filters]);
|
|
76
|
+
|
|
77
|
+
// If there is no item for a selected filter add the filter with count 0
|
|
78
|
+
Object.keys(postFilter).forEach(key => {
|
|
79
|
+
const filter = postFilter[key];
|
|
80
|
+
Object.keys(filter).forEach(value => {
|
|
81
|
+
const isNextFilter = filterCount[key].some((data: { value: string }) => {
|
|
82
|
+
return data.value === value;
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
if (!isNextFilter) {
|
|
86
|
+
filterCount[key].push({ value, count: 0 });
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
return filterCount;
|
|
92
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { useAppSelector } from 'Store/Store';
|
|
2
|
+
import { useMemo } from 'react';
|
|
3
|
+
|
|
4
|
+
function filterResultsBasedOnPostFilter(results: any, postFilter: any): any[] {
|
|
5
|
+
return results?.filter((result: { filters: { [x: string]: any } }) => {
|
|
6
|
+
return Object.keys(postFilter).every(filterType => {
|
|
7
|
+
const filter = postFilter[filterType];
|
|
8
|
+
|
|
9
|
+
const filterValues = Object.keys(filter).filter(key => filter[key]);
|
|
10
|
+
|
|
11
|
+
if (filterValues.length > 0) {
|
|
12
|
+
const resultFilterValues = result.filters[filterType];
|
|
13
|
+
if (resultFilterValues) {
|
|
14
|
+
return filterValues?.some((value: any) =>
|
|
15
|
+
resultFilterValues.includes(value),
|
|
16
|
+
);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
return true;
|
|
20
|
+
});
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export const useFilteredResult = (data: any) => {
|
|
25
|
+
const { postFilter } = useAppSelector(state => state.search);
|
|
26
|
+
return useMemo(() => {
|
|
27
|
+
return filterResultsBasedOnPostFilter(data, postFilter || {});
|
|
28
|
+
}, [data, postFilter]);
|
|
29
|
+
};
|
package/src/index.css
CHANGED
|
@@ -5,6 +5,7 @@ body {
|
|
|
5
5
|
sans-serif;
|
|
6
6
|
-webkit-font-smoothing: antialiased;
|
|
7
7
|
-moz-osx-font-smoothing: grayscale;
|
|
8
|
+
color: #2B2C46
|
|
8
9
|
}
|
|
9
10
|
|
|
10
11
|
|
|
@@ -403,7 +404,7 @@ button,
|
|
|
403
404
|
input,
|
|
404
405
|
select,
|
|
405
406
|
textarea {
|
|
406
|
-
color:
|
|
407
|
+
color: #2B2C46;
|
|
407
408
|
font-family: Roboto, Arial, Helvetica, sans-serif;
|
|
408
409
|
font-size: 17px;
|
|
409
410
|
line-height: 1.5;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { Box } from '@material-ui/core';
|
|
2
2
|
import React, { useState } from 'react';
|
|
3
3
|
import './common.scss';
|
|
4
|
-
import { cadExtensions } from '@nyris/nyris-api';
|
|
5
4
|
import algoliasearch from 'algoliasearch/lite';
|
|
6
5
|
import DragDropFile from 'components/DragDropFile';
|
|
7
6
|
import CustomSearchBox from 'components/input/inputSearch';
|
|
@@ -16,10 +15,7 @@ function AppMD() {
|
|
|
16
15
|
const searchClient = algoliasearch(appId, apiKey);
|
|
17
16
|
searchClient.initIndex(indexName);
|
|
18
17
|
|
|
19
|
-
const acceptTypes = ['image/*']
|
|
20
|
-
.concat(settings.cadSearch ? cadExtensions : [])
|
|
21
|
-
.join(',');
|
|
22
|
-
|
|
18
|
+
const acceptTypes = ['image/*'];
|
|
23
19
|
const InfiniteHits = ({ hits }: any) => {
|
|
24
20
|
return <div></div>;
|
|
25
21
|
};
|
|
@@ -1664,7 +1664,7 @@ button {
|
|
|
1664
1664
|
&.toggle {
|
|
1665
1665
|
// transition: all 0.1s ease-in-out;
|
|
1666
1666
|
// transition: all 0.5s ease-in;
|
|
1667
|
-
max-width:
|
|
1667
|
+
max-width: 32px;
|
|
1668
1668
|
> * {
|
|
1669
1669
|
display: none !important;
|
|
1670
1670
|
}
|
|
@@ -1679,7 +1679,6 @@ button {
|
|
|
1679
1679
|
z-index: 222;
|
|
1680
1680
|
}
|
|
1681
1681
|
.col-left__bottom {
|
|
1682
|
-
margin-top: 32px;
|
|
1683
1682
|
width: 100%;
|
|
1684
1683
|
padding: 0 24px;
|
|
1685
1684
|
button {
|
|
@@ -2052,7 +2051,7 @@ button {
|
|
|
2052
2051
|
height: 48px;
|
|
2053
2052
|
overflow: hidden;
|
|
2054
2053
|
padding-right: 12px !important;
|
|
2055
|
-
|
|
2054
|
+
.input-wrapper {
|
|
2056
2055
|
width: 100%;
|
|
2057
2056
|
display: flex;
|
|
2058
2057
|
justify-content: center;
|
|
@@ -2181,4 +2180,12 @@ button {
|
|
|
2181
2180
|
|
|
2182
2181
|
.product-image:hover{
|
|
2183
2182
|
transform: scale(1.1);
|
|
2183
|
+
}
|
|
2184
|
+
|
|
2185
|
+
.result-wrapper {
|
|
2186
|
+
max-width: calc(192px * 4 + 96px);
|
|
2187
|
+
width: 100%;
|
|
2188
|
+
@media screen and (min-width: 2047px) {
|
|
2189
|
+
max-width: 1300px;
|
|
2190
|
+
}
|
|
2184
2191
|
}
|
|
@@ -50,6 +50,7 @@ import InquiryBanner from 'components/Inquiry/InquiryBanner';
|
|
|
50
50
|
import { useQuery } from 'hooks/useQuery';
|
|
51
51
|
import { ReactComponent as PoweredByNyrisImage } from 'common/assets/images/powered_by_nyris.svg';
|
|
52
52
|
import Feedback from 'components/Feedback';
|
|
53
|
+
import { SelectedPostFilter } from 'components/SelectedPostFilter';
|
|
53
54
|
|
|
54
55
|
interface Props {
|
|
55
56
|
allSearchResults: any;
|
|
@@ -61,7 +62,7 @@ function ResultComponent(props: Props) {
|
|
|
61
62
|
const refBoxResult: any = useRef(null);
|
|
62
63
|
const stateGlobal = useAppSelector(state => state);
|
|
63
64
|
const { search, settings } = stateGlobal;
|
|
64
|
-
|
|
65
|
+
const { allSearchResults } = props;
|
|
65
66
|
const {
|
|
66
67
|
requestImage,
|
|
67
68
|
regions,
|
|
@@ -69,9 +70,9 @@ function ResultComponent(props: Props) {
|
|
|
69
70
|
preFilter,
|
|
70
71
|
loadingSearchAlgolia,
|
|
71
72
|
imageThumbSearchInput,
|
|
73
|
+
results,
|
|
72
74
|
} = search;
|
|
73
75
|
|
|
74
|
-
const moreInfoText = settings?.productCtaText;
|
|
75
76
|
const isMobile = useMediaQuery({ query: '(max-width: 776px)' });
|
|
76
77
|
const [imageSelection, setImageSelection] = useState<any>(null);
|
|
77
78
|
const executeScroll = () => refBoxResult.current.scrollIntoView('-100px');
|
|
@@ -311,11 +312,10 @@ function ResultComponent(props: Props) {
|
|
|
311
312
|
const showPostFilter = useMemo(() => {
|
|
312
313
|
return (
|
|
313
314
|
isPostFilterEnabled &&
|
|
314
|
-
|
|
315
|
-
|
|
315
|
+
((allSearchResults?.hits.length > 0 && isAlgoliaEnabled) ||
|
|
316
|
+
results?.length > 0)
|
|
316
317
|
);
|
|
317
|
-
|
|
318
|
-
}, [isPostFilterEnabled, props.allSearchResults?.hits, isAlgoliaEnabled]);
|
|
318
|
+
}, [isPostFilterEnabled, allSearchResults, isAlgoliaEnabled, results]);
|
|
319
319
|
|
|
320
320
|
const showSidePanel = useMemo(() => {
|
|
321
321
|
return requestImage || (isPostFilterEnabled && showPostFilter);
|
|
@@ -431,7 +431,7 @@ function ResultComponent(props: Props) {
|
|
|
431
431
|
flexDirection: 'column',
|
|
432
432
|
}}
|
|
433
433
|
>
|
|
434
|
-
{!isMobile && (
|
|
434
|
+
{!isMobile && settings.algolia.enabled && (
|
|
435
435
|
<Box className="wrap-box-refinements">
|
|
436
436
|
<CurrentRefinements statusSwitchButton={true} />
|
|
437
437
|
</Box>
|
|
@@ -482,27 +482,35 @@ function ResultComponent(props: Props) {
|
|
|
482
482
|
/>
|
|
483
483
|
</div>
|
|
484
484
|
)}
|
|
485
|
-
<
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
sendFeedBackAction={sendFeedBackAction}
|
|
489
|
-
moreInfoText={moreInfoText}
|
|
490
|
-
requestImage={requestImage}
|
|
491
|
-
searchQuery={searchQuery}
|
|
492
|
-
/>
|
|
493
|
-
<Box
|
|
494
|
-
className="pagination-result"
|
|
495
|
-
style={{
|
|
496
|
-
width: '100%',
|
|
497
|
-
margin: !isMobile ? '20px auto' : '',
|
|
498
|
-
marginBottom:
|
|
499
|
-
isMobile && !requestImage ? '64px' : '20px',
|
|
500
|
-
padding: '0 20%',
|
|
501
|
-
alignSelf: 'end',
|
|
502
|
-
}}
|
|
485
|
+
<div
|
|
486
|
+
className="box-item-result ml-auto mr-auto"
|
|
487
|
+
style={{ height: 'fit-content' }}
|
|
503
488
|
>
|
|
504
|
-
{
|
|
505
|
-
|
|
489
|
+
{!isMobile && !settings.algolia.enabled && (
|
|
490
|
+
<SelectedPostFilter />
|
|
491
|
+
)}
|
|
492
|
+
<ProductList
|
|
493
|
+
getUrlToCanvasFile={getUrlToCanvasFile}
|
|
494
|
+
setLoading={false}
|
|
495
|
+
sendFeedBackAction={sendFeedBackAction}
|
|
496
|
+
requestImage={requestImage}
|
|
497
|
+
searchQuery={searchQuery}
|
|
498
|
+
/>
|
|
499
|
+
</div>
|
|
500
|
+
|
|
501
|
+
{props.allSearchResults?.hits.length > 0 &&
|
|
502
|
+
(requestImage || searchQuery) && (
|
|
503
|
+
<Box
|
|
504
|
+
className="pagination-result"
|
|
505
|
+
style={{
|
|
506
|
+
width: '100%',
|
|
507
|
+
margin: !isMobile ? '20px auto' : '',
|
|
508
|
+
marginBottom:
|
|
509
|
+
isMobile && !requestImage ? '64px' : '20px',
|
|
510
|
+
padding: '0 20%',
|
|
511
|
+
alignSelf: 'end',
|
|
512
|
+
}}
|
|
513
|
+
>
|
|
506
514
|
<Pagination
|
|
507
515
|
showFirst={false}
|
|
508
516
|
translations={{
|
|
@@ -514,8 +522,8 @@ function ResultComponent(props: Props) {
|
|
|
514
522
|
),
|
|
515
523
|
}}
|
|
516
524
|
/>
|
|
517
|
-
|
|
518
|
-
|
|
525
|
+
</Box>
|
|
526
|
+
)}
|
|
519
527
|
|
|
520
528
|
{requestImage &&
|
|
521
529
|
!loadingSearchAlgolia &&
|
package/src/services/image.ts
CHANGED
package/src/translations.ts
CHANGED
|
@@ -25,6 +25,11 @@ export const translations = {
|
|
|
25
25
|
'No products were found matching your search criteria.',
|
|
26
26
|
'Please upload an image or enter a keyword to search.':
|
|
27
27
|
'Please upload an image or enter a keyword to search.',
|
|
28
|
+
'No matches found': 'No matches found',
|
|
29
|
+
'No matches found for your request': 'No matches found for your request',
|
|
30
|
+
'Clear all': 'Clear all',
|
|
31
|
+
Cancel: 'Cancel',
|
|
32
|
+
Apply: 'Apply',
|
|
28
33
|
},
|
|
29
34
|
},
|
|
30
35
|
de: {
|
|
@@ -53,6 +58,12 @@ export const translations = {
|
|
|
53
58
|
'Keine Produkte entsprechen Ihren Suchkriterien.',
|
|
54
59
|
'Please upload an image or enter a keyword to search.':
|
|
55
60
|
'Für die Suche bitte Bild hochladen oder Stichwort eingeben.',
|
|
61
|
+
'No matches found': 'Keine Treffer für Ihre Anfrage gefunden',
|
|
62
|
+
'No matches found for your request':
|
|
63
|
+
'Keine Treffer für Ihre Anfrage gefunden',
|
|
64
|
+
'Clear all': 'Alles löschen',
|
|
65
|
+
Cancel: 'Abbrechen',
|
|
66
|
+
Apply: 'Anwenden',
|
|
56
67
|
},
|
|
57
68
|
},
|
|
58
69
|
pt: {
|
|
@@ -82,6 +93,11 @@ export const translations = {
|
|
|
82
93
|
'Nenhum produto foi encontrado com estes critérios ',
|
|
83
94
|
'Please upload an image or enter a keyword to search.':
|
|
84
95
|
'Faça o upload de uma imagem ou busque via texto',
|
|
96
|
+
'No matches found': 'No matches found',
|
|
97
|
+
'No matches found for your request': 'No matches found for your request',
|
|
98
|
+
'Clear all': 'Clear all',
|
|
99
|
+
Cancel: 'Cancel',
|
|
100
|
+
Apply: 'Apply',
|
|
85
101
|
},
|
|
86
102
|
},
|
|
87
103
|
};
|
package/src/types.ts
CHANGED
|
@@ -53,8 +53,7 @@ export interface AppSettings extends NyrisAPISettings {
|
|
|
53
53
|
auth0: Auth0Settings;
|
|
54
54
|
brandName?: string;
|
|
55
55
|
cadenas?: Cadenas;
|
|
56
|
-
|
|
57
|
-
exampleImages?: string[]; // deprecated
|
|
56
|
+
CTAButtonText?: string;
|
|
58
57
|
field: Field;
|
|
59
58
|
headerText?: string;
|
|
60
59
|
instantRedirectPatterns: string[];
|
|
@@ -65,7 +64,6 @@ export interface AppSettings extends NyrisAPISettings {
|
|
|
65
64
|
preFilterOption?: boolean;
|
|
66
65
|
preFilterTitle?: string;
|
|
67
66
|
preview: boolean;
|
|
68
|
-
productCtaText?: string;
|
|
69
67
|
refinements?: any;
|
|
70
68
|
regions: boolean;
|
|
71
69
|
rfq?: Rfq;
|
|
@@ -73,13 +71,11 @@ export interface AppSettings extends NyrisAPISettings {
|
|
|
73
71
|
showFeedback?: boolean;
|
|
74
72
|
showFeedbackAndShare?: boolean;
|
|
75
73
|
showGroup?: boolean;
|
|
76
|
-
showMoreInfo?: boolean; // deprecated
|
|
77
74
|
showPoweredByNyris?: boolean;
|
|
78
75
|
support?: Support;
|
|
79
76
|
theme: SearchSuiteSettings;
|
|
80
77
|
visualSearchFilterKey?: string;
|
|
81
78
|
warehouseVariant?: boolean;
|
|
82
|
-
CTAButtonText?: string;
|
|
83
79
|
}
|
|
84
80
|
|
|
85
81
|
export interface SearchSuiteSettings {
|