@nyris/nyris-webapp 0.3.47 → 0.3.49
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 +17 -12
- package/build/index.html +1 -1
- package/build/js/settings.example.js +87 -13
- package/build/{precache-manifest.694373c4d80fe3bb40d0d6526b473852.js → precache-manifest.943318a8942503f5324468a411afba1b.js} +30 -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.3399db0d.chunk.js +3 -0
- package/build/static/js/2.3399db0d.chunk.js.map +1 -0
- package/build/static/js/main.42571815.chunk.js +3 -0
- package/build/static/js/main.42571815.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/build/static/media/settings.e3c8138b.svg +3 -0
- package/package.json +3 -3
- package/public/js/settings.example.js +87 -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/common/assets/icons/settings.svg +3 -0
- package/src/components/HeaderMobile.tsx +41 -12
- package/src/components/ImagePreviewMobile.tsx +4 -14
- package/src/components/Inquiry/InquiryBanner.tsx +1 -1
- 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 +92 -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 +18 -8
- package/src/components/common.scss +4 -0
- package/src/components/current-refinements/getCurrentRefinement.ts +10 -18
- 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 +99 -24
- 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 +39 -31
- package/src/services/image.ts +0 -5
- package/src/translations.ts +9 -0
- package/src/types.ts +3 -5
- package/build/static/css/main.21021ebe.chunk.css +0 -2
- package/build/static/css/main.21021ebe.chunk.css.map +0 -1
- package/build/static/js/2.3e652625.chunk.js +0 -3
- package/build/static/js/2.3e652625.chunk.js.map +0 -1
- package/build/static/js/main.37e28702.chunk.js +0 -3
- package/build/static/js/main.37e28702.chunk.js.map +0 -1
- /package/build/static/js/{2.3e652625.chunk.js.LICENSE.txt → 2.3399db0d.chunk.js.LICENSE.txt} +0 -0
- /package/build/static/js/{main.37e28702.chunk.js.LICENSE.txt → main.42571815.chunk.js.LICENSE.txt} +0 -0
|
@@ -9,6 +9,8 @@ import { ReactComponent as IconSearchImage } from 'common/assets/icons/icon_sear
|
|
|
9
9
|
import { ReactComponent as IconShare } from 'common/assets/icons/Fill.svg';
|
|
10
10
|
import { ReactComponent as IconDisLike } from 'common/assets/icons/icon_dislike.svg';
|
|
11
11
|
import { ReactComponent as IconLike } from 'common/assets/icons/icon_like.svg';
|
|
12
|
+
import { ReactComponent as IconSettings } from 'common/assets/icons/settings.svg';
|
|
13
|
+
|
|
12
14
|
import { AppState } from 'types';
|
|
13
15
|
import { useAppSelector } from 'Store/Store';
|
|
14
16
|
import { prepareImageList } from '../helpers/CommonHelper';
|
|
@@ -20,7 +22,7 @@ import { useTranslation } from 'react-i18next';
|
|
|
20
22
|
import ProductAttribute from './ProductAttribute';
|
|
21
23
|
import CadenasWebViewer from './CadenasWebViewer';
|
|
22
24
|
import { makeStyles } from '@material-ui/core/styles';
|
|
23
|
-
import { get } from 'lodash';
|
|
25
|
+
import { get, isUndefined } from 'lodash';
|
|
24
26
|
|
|
25
27
|
const useStyles = makeStyles(theme => ({
|
|
26
28
|
buttonStyle3D: {
|
|
@@ -76,6 +78,13 @@ function ProductDetailView(props: Props) {
|
|
|
76
78
|
settings.field?.ctaLinkField ? settings.field?.ctaLinkField : 'links.main',
|
|
77
79
|
);
|
|
78
80
|
|
|
81
|
+
const secondaryCTALink = get(
|
|
82
|
+
dataItem,
|
|
83
|
+
settings.field?.secondaryCTALinkField
|
|
84
|
+
? settings.field?.secondaryCTALinkField
|
|
85
|
+
: '',
|
|
86
|
+
);
|
|
87
|
+
|
|
79
88
|
useEffect(() => {
|
|
80
89
|
if (dataItem) {
|
|
81
90
|
checkDataItemResult(dataItem);
|
|
@@ -321,25 +330,31 @@ function ProductDetailView(props: Props) {
|
|
|
321
330
|
{sku}
|
|
322
331
|
</Typography>
|
|
323
332
|
|
|
324
|
-
{settings.warehouseVariant &&
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
>
|
|
331
|
-
<span
|
|
333
|
+
{settings.warehouseVariant &&
|
|
334
|
+
!isUndefined(
|
|
335
|
+
get(dataItem, settings.field.warehouseStockValue),
|
|
336
|
+
) && (
|
|
337
|
+
<Typography
|
|
338
|
+
className="text-f12 max-line-1 fw-400"
|
|
332
339
|
style={{
|
|
333
|
-
color:
|
|
334
|
-
? '#00C070'
|
|
335
|
-
: '#c54545',
|
|
336
|
-
fontWeight: 600,
|
|
340
|
+
color: '#2B2C46',
|
|
337
341
|
}}
|
|
338
342
|
>
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
+
<span
|
|
344
|
+
style={{
|
|
345
|
+
color: get(
|
|
346
|
+
dataItem,
|
|
347
|
+
settings.field.warehouseStockValue,
|
|
348
|
+
)
|
|
349
|
+
? '#00C070'
|
|
350
|
+
: '#c54545',
|
|
351
|
+
fontWeight: 600,
|
|
352
|
+
}}
|
|
353
|
+
>
|
|
354
|
+
{get(dataItem, settings.field.warehouseStockValue) || 0}
|
|
355
|
+
</span>
|
|
356
|
+
</Typography>
|
|
357
|
+
)}
|
|
343
358
|
</Box>
|
|
344
359
|
)}
|
|
345
360
|
|
|
@@ -403,19 +418,28 @@ function ProductDetailView(props: Props) {
|
|
|
403
418
|
<>
|
|
404
419
|
{settings.field.warehouseNumber && (
|
|
405
420
|
<ProductAttribute
|
|
406
|
-
title={
|
|
421
|
+
title={
|
|
422
|
+
get(dataItem, settings.field.warehouseNumber) ||
|
|
423
|
+
settings.field.warehouseNumber
|
|
424
|
+
}
|
|
407
425
|
value={
|
|
408
|
-
dataItem
|
|
426
|
+
get(dataItem, settings.field.warehouseNumberValue) ||
|
|
427
|
+
'N/A'
|
|
409
428
|
}
|
|
410
429
|
width={{ xs: '49%', md: 'fit-content' }}
|
|
411
430
|
/>
|
|
412
431
|
)}
|
|
413
432
|
{settings.field.warehouseShelfNumber && (
|
|
414
433
|
<ProductAttribute
|
|
415
|
-
title={
|
|
434
|
+
title={
|
|
435
|
+
get(dataItem, settings.field.warehouseShelfNumber) ||
|
|
436
|
+
settings.field.warehouseShelfNumber
|
|
437
|
+
}
|
|
416
438
|
value={
|
|
417
|
-
|
|
418
|
-
|
|
439
|
+
get(
|
|
440
|
+
dataItem,
|
|
441
|
+
settings.field.warehouseShelfNumberValue,
|
|
442
|
+
) || 'N/A'
|
|
419
443
|
}
|
|
420
444
|
width={{ xs: '49%', md: 'fit-content' }}
|
|
421
445
|
/>
|
|
@@ -431,6 +455,51 @@ function ProductDetailView(props: Props) {
|
|
|
431
455
|
backgroundColor: '#F3F3F5',
|
|
432
456
|
}}
|
|
433
457
|
>
|
|
458
|
+
{settings.secondaryCTAButtonText && (
|
|
459
|
+
<Box
|
|
460
|
+
style={{
|
|
461
|
+
background: '#2B2C46',
|
|
462
|
+
boxShadow: '0px 4px 4px rgba(0, 0, 0, 0.25)',
|
|
463
|
+
borderRadius: 4,
|
|
464
|
+
marginTop: 8,
|
|
465
|
+
}}
|
|
466
|
+
display={'flex'}
|
|
467
|
+
justifyContent={'space-between'}
|
|
468
|
+
alignItems={'center'}
|
|
469
|
+
className="btn-detail-item"
|
|
470
|
+
>
|
|
471
|
+
<Box
|
|
472
|
+
style={{
|
|
473
|
+
display: 'flex',
|
|
474
|
+
justifyContent: 'space-between',
|
|
475
|
+
alignItems: 'center',
|
|
476
|
+
width: '100%',
|
|
477
|
+
padding: '0px 12px',
|
|
478
|
+
minHeight: 64,
|
|
479
|
+
cursor: secondaryCTALink ? 'pointer' : 'normal',
|
|
480
|
+
}}
|
|
481
|
+
onClick={() => {
|
|
482
|
+
if (secondaryCTALink) {
|
|
483
|
+
window.open(`${secondaryCTALink}`, '_blank');
|
|
484
|
+
}
|
|
485
|
+
}}
|
|
486
|
+
>
|
|
487
|
+
<Typography
|
|
488
|
+
className="text-f18 fw-700 text-white max-line-2"
|
|
489
|
+
align="left"
|
|
490
|
+
style={{
|
|
491
|
+
letterSpacing: '0.55px',
|
|
492
|
+
maxWidth: '500px',
|
|
493
|
+
paddingRight: '4px',
|
|
494
|
+
}}
|
|
495
|
+
>
|
|
496
|
+
{settings.secondaryCTAButtonText}
|
|
497
|
+
</Typography>
|
|
498
|
+
{secondaryCTALink && <IconSettings color="white" />}
|
|
499
|
+
</Box>
|
|
500
|
+
</Box>
|
|
501
|
+
)}
|
|
502
|
+
|
|
434
503
|
<Box
|
|
435
504
|
style={{
|
|
436
505
|
background: settings.theme?.primaryColor,
|
|
@@ -481,6 +550,7 @@ function ProductDetailView(props: Props) {
|
|
|
481
550
|
)}
|
|
482
551
|
</Box>
|
|
483
552
|
</Box>
|
|
553
|
+
|
|
484
554
|
{productDetails && (
|
|
485
555
|
<Box className="w-100">
|
|
486
556
|
<Button
|
|
@@ -13,7 +13,6 @@ interface Props {
|
|
|
13
13
|
getUrlToCanvasFile: any;
|
|
14
14
|
setLoading?: any;
|
|
15
15
|
sendFeedBackAction: any;
|
|
16
|
-
moreInfoText: any;
|
|
17
16
|
requestImage?: any;
|
|
18
17
|
searchQuery?: string;
|
|
19
18
|
}
|
|
@@ -22,7 +21,6 @@ function ProductListComponent({
|
|
|
22
21
|
allSearchResults,
|
|
23
22
|
getUrlToCanvasFile,
|
|
24
23
|
sendFeedBackAction,
|
|
25
|
-
moreInfoText,
|
|
26
24
|
searchQuery,
|
|
27
25
|
requestImage,
|
|
28
26
|
isSearchStalled,
|
|
@@ -79,7 +77,6 @@ function ProductListComponent({
|
|
|
79
77
|
handlerCloseGroup(hitItem, index)
|
|
80
78
|
}
|
|
81
79
|
isGroupItem={settings.showGroup ? hit?.isGroup : false}
|
|
82
|
-
moreInfoText={moreInfoText}
|
|
83
80
|
main_image_link={
|
|
84
81
|
hit['image(main_similarity)'] || hit['main_image_link']
|
|
85
82
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { useAppSelector } from 'Store/Store';
|
|
2
|
+
import { useFilteredResult } from 'hooks/useFilteredResult';
|
|
2
3
|
import { groupBy, uniqueId } from 'lodash';
|
|
3
4
|
import { useEffect, useMemo, useState } from 'react';
|
|
4
5
|
|
|
@@ -91,14 +92,16 @@ export const useProductList = ({ allSearchResults, isSearchStalled }: any) => {
|
|
|
91
92
|
}
|
|
92
93
|
}, [isSearchStalled]);
|
|
93
94
|
|
|
95
|
+
const filteredResult = useFilteredResult(results);
|
|
96
|
+
|
|
94
97
|
const productList = useMemo(() => {
|
|
95
|
-
return
|
|
98
|
+
return filteredResult?.map((item: any) => {
|
|
96
99
|
return {
|
|
97
100
|
...item,
|
|
98
|
-
main_image_link: item.image || item.images ? item.images[0] : '',
|
|
101
|
+
main_image_link: item.image || (item.images ? item.images[0] : ''),
|
|
99
102
|
};
|
|
100
103
|
});
|
|
101
|
-
}, [
|
|
104
|
+
}, [filteredResult]);
|
|
102
105
|
|
|
103
106
|
return {
|
|
104
107
|
productList: algolia?.enabled ? itemShowDefault : productList || [],
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import classNames from 'classnames';
|
|
3
|
+
import { ReactComponent as IconClose } from 'common/assets/icons/close.svg';
|
|
4
|
+
import { atom } from 'jotai';
|
|
5
|
+
import { useMemo } from 'react';
|
|
6
|
+
import { useAppDispatch, useAppSelector } from 'Store/Store';
|
|
7
|
+
import { useFilter } from 'hooks/useFilter';
|
|
8
|
+
import { get } from 'lodash';
|
|
9
|
+
import { clearPostFilter, setPostFilter } from 'Store/search/Search';
|
|
10
|
+
import { Box } from '@material-ui/core';
|
|
11
|
+
|
|
12
|
+
export type CurrentRefinementsProps = {
|
|
13
|
+
className?: string;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export type CurrentRefinement = {
|
|
17
|
+
category?: string;
|
|
18
|
+
label: string;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export const refinementCountAtom = atom(0);
|
|
22
|
+
|
|
23
|
+
export function SelectedPostFilter({ className }: CurrentRefinementsProps) {
|
|
24
|
+
const stateGlobal = useAppSelector(state => state);
|
|
25
|
+
const dispatch = useAppDispatch();
|
|
26
|
+
const {
|
|
27
|
+
search: { postFilter, results },
|
|
28
|
+
} = stateGlobal;
|
|
29
|
+
const filter = useFilter(results);
|
|
30
|
+
|
|
31
|
+
const selectedFilters = useMemo(() => {
|
|
32
|
+
const selectedFilters: any[] = [];
|
|
33
|
+
Object.keys(filter).forEach(key => {
|
|
34
|
+
const values = filter[key];
|
|
35
|
+
values.forEach((data: { value: string }) => {
|
|
36
|
+
if (get(postFilter, `${key}.${data.value}`)) {
|
|
37
|
+
selectedFilters.push({ key, ...data });
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
});
|
|
41
|
+
return selectedFilters;
|
|
42
|
+
}, [filter, postFilter]);
|
|
43
|
+
|
|
44
|
+
if (!selectedFilters.length) {
|
|
45
|
+
return null;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
return (
|
|
49
|
+
<Box className="wrap-box-refinements">
|
|
50
|
+
<div style={{ display: 'flex', flexFlow: 'wrap', columnGap: '8px' }}>
|
|
51
|
+
{selectedFilters.map(filter => {
|
|
52
|
+
return (
|
|
53
|
+
<div
|
|
54
|
+
key={filter.value}
|
|
55
|
+
style={{
|
|
56
|
+
display: 'flex',
|
|
57
|
+
alignItems: 'center',
|
|
58
|
+
columnGap: '12px',
|
|
59
|
+
fontSize: '12px',
|
|
60
|
+
padding: '4px 8px 4px 8px',
|
|
61
|
+
backgroundColor: '#E9E9EC',
|
|
62
|
+
borderRadius: '18px',
|
|
63
|
+
width: 'fit-content',
|
|
64
|
+
}}
|
|
65
|
+
>
|
|
66
|
+
<p>
|
|
67
|
+
{filter.value} ({filter.count})
|
|
68
|
+
</p>
|
|
69
|
+
<div
|
|
70
|
+
style={{
|
|
71
|
+
padding: '2px',
|
|
72
|
+
display: 'flex',
|
|
73
|
+
alignItems: 'center',
|
|
74
|
+
justifyContent: 'center',
|
|
75
|
+
cursor: 'pointer',
|
|
76
|
+
}}
|
|
77
|
+
onClick={() => {
|
|
78
|
+
dispatch(
|
|
79
|
+
setPostFilter({
|
|
80
|
+
[filter.key]: filter.value,
|
|
81
|
+
}),
|
|
82
|
+
);
|
|
83
|
+
}}
|
|
84
|
+
>
|
|
85
|
+
<IconClose width={12} height={12} />
|
|
86
|
+
</div>
|
|
87
|
+
</div>
|
|
88
|
+
);
|
|
89
|
+
})}
|
|
90
|
+
<div
|
|
91
|
+
key="clear"
|
|
92
|
+
className={classNames('flex items-center')}
|
|
93
|
+
style={{ padding: '4px', cursor: 'pointer' }}
|
|
94
|
+
onClick={() => dispatch(clearPostFilter())}
|
|
95
|
+
>
|
|
96
|
+
<div className="text-f12" style={{ color: '#E31B5D' }}>
|
|
97
|
+
Clear all
|
|
98
|
+
</div>
|
|
99
|
+
</div>
|
|
100
|
+
</div>
|
|
101
|
+
</Box>
|
|
102
|
+
);
|
|
103
|
+
}
|
|
@@ -2,11 +2,14 @@ import { Box, Button, Typography } from '@material-ui/core';
|
|
|
2
2
|
import { RectCoords } from '@nyris/nyris-api';
|
|
3
3
|
import { Preview } from '@nyris/nyris-react-components';
|
|
4
4
|
import React, { useState } from 'react';
|
|
5
|
-
import
|
|
5
|
+
import PostFilterPanel from './PanelResult/PostFilter';
|
|
6
|
+
import PostFilterPanelAlgolia from './PanelResult/PostFilterAlgolia';
|
|
7
|
+
|
|
6
8
|
import { useTranslation } from 'react-i18next';
|
|
7
9
|
import { useAppSelector } from 'Store/Store';
|
|
8
|
-
import KeyboardArrowRightOutlinedIcon from '
|
|
9
|
-
import KeyboardArrowLeftOutlinedIcon from '
|
|
10
|
+
import { ReactComponent as KeyboardArrowRightOutlinedIcon } from 'common/assets/icons/arrow_right.svg';
|
|
11
|
+
import { ReactComponent as KeyboardArrowLeftOutlinedIcon } from 'common/assets/icons/arrow_left.svg';
|
|
12
|
+
|
|
10
13
|
import { DEFAULT_REGION } from '../constants';
|
|
11
14
|
import { ReactComponent as IconInfo } from 'common/assets/icons/info-tooltip.svg';
|
|
12
15
|
|
|
@@ -32,7 +35,7 @@ function SidePanel({
|
|
|
32
35
|
}) {
|
|
33
36
|
const { t } = useTranslation();
|
|
34
37
|
const [toggleColLeft, setToggleColLeft] = useState<boolean>(false);
|
|
35
|
-
const stateGlobal = useAppSelector(
|
|
38
|
+
const stateGlobal = useAppSelector(state => state);
|
|
36
39
|
const { search, settings } = stateGlobal;
|
|
37
40
|
|
|
38
41
|
const { requestImage } = search;
|
|
@@ -49,7 +52,7 @@ function SidePanel({
|
|
|
49
52
|
<Box
|
|
50
53
|
className="box-toggle-coloumn"
|
|
51
54
|
style={{
|
|
52
|
-
right:
|
|
55
|
+
right: '0px',
|
|
53
56
|
}}
|
|
54
57
|
>
|
|
55
58
|
<Button
|
|
@@ -99,7 +102,6 @@ function SidePanel({
|
|
|
99
102
|
<Preview
|
|
100
103
|
key={requestImage?.id}
|
|
101
104
|
onSelectionChange={(r: RectCoords) => {
|
|
102
|
-
setImageSelection(r);
|
|
103
105
|
debouncedOnImageSelectionChange(r);
|
|
104
106
|
}}
|
|
105
107
|
image={requestImage?.canvas}
|
|
@@ -142,8 +144,16 @@ function SidePanel({
|
|
|
142
144
|
)}
|
|
143
145
|
|
|
144
146
|
{showPostFilter && (
|
|
145
|
-
<Box
|
|
146
|
-
|
|
147
|
+
<Box
|
|
148
|
+
className="col-left__bottom"
|
|
149
|
+
style={{
|
|
150
|
+
marginTop: requestImage ? '16px' : '48px',
|
|
151
|
+
}}
|
|
152
|
+
>
|
|
153
|
+
{settings.algolia.enabled && (
|
|
154
|
+
<PostFilterPanelAlgolia disjunctiveFacets={disjunctiveFacets} />
|
|
155
|
+
)}
|
|
156
|
+
{!settings.algolia.enabled && <PostFilterPanel />}
|
|
147
157
|
</Box>
|
|
148
158
|
)}
|
|
149
159
|
</Box>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { CurrentRefinement } from
|
|
1
|
+
import type { CurrentRefinement } from './current-refinements';
|
|
2
2
|
|
|
3
3
|
function getRefinementConfig(r: any, refinement: any) {
|
|
4
4
|
const refinementOptions = r.attribute;
|
|
@@ -10,7 +10,7 @@ function getRefinementConfig(r: any, refinement: any) {
|
|
|
10
10
|
|
|
11
11
|
export function getCurrentRefinement(
|
|
12
12
|
refinement: any,
|
|
13
|
-
config: any
|
|
13
|
+
config: any,
|
|
14
14
|
): CurrentRefinement[] {
|
|
15
15
|
let refinementConfig: any;
|
|
16
16
|
config.forEach((r: any) => {
|
|
@@ -18,20 +18,12 @@ export function getCurrentRefinement(
|
|
|
18
18
|
refinementConfig = r;
|
|
19
19
|
}
|
|
20
20
|
});
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
value: item.value,
|
|
30
|
-
})) || []
|
|
31
|
-
);
|
|
32
|
-
}
|
|
33
|
-
default: {
|
|
34
|
-
return [];
|
|
35
|
-
}
|
|
36
|
-
}
|
|
21
|
+
|
|
22
|
+
return (
|
|
23
|
+
refinement?.items?.map((item: any) => ({
|
|
24
|
+
category: refinementConfig?.header,
|
|
25
|
+
label: item.label,
|
|
26
|
+
value: item.value,
|
|
27
|
+
})) || []
|
|
28
|
+
);
|
|
37
29
|
}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import React, { useEffect, useState } from
|
|
2
|
-
import RemoveIcon from
|
|
3
|
-
import AddIcon from
|
|
4
|
-
import { Typography } from "@material-ui/core";
|
|
1
|
+
import React, { useEffect, useState } from 'react';
|
|
2
|
+
import { ReactComponent as RemoveIcon } from 'common/assets/icons/minus.svg';
|
|
3
|
+
import { ReactComponent as AddIcon } from 'common/assets/icons/add.svg';
|
|
5
4
|
|
|
6
|
-
export type LabelPosition =
|
|
5
|
+
export type LabelPosition = 'bottom' | 'left' | 'right' | 'top';
|
|
7
6
|
|
|
8
7
|
export type IconLabelProps = {
|
|
9
8
|
icon?: any;
|
|
@@ -16,11 +15,11 @@ export type IconLabelProps = {
|
|
|
16
15
|
export default function IconLabel({
|
|
17
16
|
icon,
|
|
18
17
|
label,
|
|
19
|
-
labelPosition =
|
|
20
|
-
className =
|
|
21
|
-
classNameLabel =
|
|
18
|
+
labelPosition = 'bottom',
|
|
19
|
+
className = 'gap-1',
|
|
20
|
+
classNameLabel = '',
|
|
22
21
|
}: IconLabelProps) {
|
|
23
|
-
const [tagIcon, setTagIcon] = useState<string>(
|
|
22
|
+
const [tagIcon, setTagIcon] = useState<string>('');
|
|
24
23
|
// let classNamePosition: string;
|
|
25
24
|
// switch (labelPosition) {
|
|
26
25
|
// case "top":
|
|
@@ -42,25 +41,31 @@ export default function IconLabel({
|
|
|
42
41
|
}, [icon]);
|
|
43
42
|
|
|
44
43
|
return (
|
|
45
|
-
<div
|
|
44
|
+
<div
|
|
45
|
+
style={{
|
|
46
|
+
display: 'flex',
|
|
47
|
+
alignItems: 'center',
|
|
48
|
+
gap: '8px',
|
|
49
|
+
paddingRight: '2px',
|
|
50
|
+
}}
|
|
51
|
+
>
|
|
46
52
|
{label && (
|
|
47
53
|
<div className={classNameLabel}>
|
|
48
|
-
<
|
|
54
|
+
<p
|
|
49
55
|
style={{
|
|
50
|
-
textTransform: "none",
|
|
51
56
|
fontSize: 12,
|
|
52
|
-
color:
|
|
53
|
-
fontWeight:
|
|
57
|
+
color: '#2B2C46',
|
|
58
|
+
fontWeight: 500,
|
|
54
59
|
}}
|
|
55
60
|
>
|
|
56
61
|
{label}
|
|
57
|
-
</
|
|
62
|
+
</p>
|
|
58
63
|
</div>
|
|
59
64
|
)}
|
|
60
|
-
{tagIcon ===
|
|
61
|
-
<RemoveIcon
|
|
65
|
+
{tagIcon === 'remove' ? (
|
|
66
|
+
<RemoveIcon width={16} height={16} />
|
|
62
67
|
) : (
|
|
63
|
-
<AddIcon
|
|
68
|
+
<AddIcon width={16} height={16} />
|
|
64
69
|
)}
|
|
65
70
|
</div>
|
|
66
71
|
);
|
|
@@ -212,7 +212,7 @@ const SearchBox = (props: any) => {
|
|
|
212
212
|
return (
|
|
213
213
|
<div className="wrap-input-search-field">
|
|
214
214
|
<div className="box-input-search d-flex">
|
|
215
|
-
<
|
|
215
|
+
<div className="input-wrapper">
|
|
216
216
|
<Box className="box-inp">
|
|
217
217
|
<Tooltip
|
|
218
218
|
title={
|
|
@@ -426,7 +426,7 @@ const SearchBox = (props: any) => {
|
|
|
426
426
|
</Button>
|
|
427
427
|
</Box>
|
|
428
428
|
)}
|
|
429
|
-
</
|
|
429
|
+
</div>
|
|
430
430
|
</div>
|
|
431
431
|
{settings.preFilterOption && (
|
|
432
432
|
<DefaultModal
|
|
@@ -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;
|