@nyris/nyris-webapp 0.3.47 → 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.694373c4d80fe3bb40d0d6526b473852.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 +3 -3
- 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 +1 -0
- 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 +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 +18 -7
- 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 +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 +9 -0
- package/src/types.ts +1 -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.f9395632.chunk.js.LICENSE.txt} +0 -0
- /package/build/static/js/{main.37e28702.chunk.js.LICENSE.txt → main.e2a2eb38.chunk.js.LICENSE.txt} +0 -0
|
@@ -0,0 +1,314 @@
|
|
|
1
|
+
import { Box, Button, Checkbox } from '@material-ui/core';
|
|
2
|
+
import { DynamicWidgetsCT } from 'components/dynamic-widgets/dynamic-widgets';
|
|
3
|
+
import IconLabel from 'components/icon-label/icon-label';
|
|
4
|
+
import { atom, useAtom } from 'jotai';
|
|
5
|
+
import React, { useCallback, useEffect, useMemo } from 'react';
|
|
6
|
+
import type { CurrentRefinementsProvided } from 'react-instantsearch-core';
|
|
7
|
+
import { useMediaQuery } from 'react-responsive';
|
|
8
|
+
import { useHistory } from 'react-router-dom';
|
|
9
|
+
import { useAppDispatch, useAppSelector } from 'Store/Store';
|
|
10
|
+
import { ExpandablePanelCustom } from './expandable-panel';
|
|
11
|
+
import { getPanelAttributes, getPanelId } from './refinements';
|
|
12
|
+
import { ReactComponent as CloseIcon } from 'common/assets/icons/close.svg';
|
|
13
|
+
import { useTranslation } from 'react-i18next';
|
|
14
|
+
import { setPostFilter } from 'Store/search/Search';
|
|
15
|
+
import { useFilter } from 'hooks/useFilter';
|
|
16
|
+
import { get } from 'lodash';
|
|
17
|
+
|
|
18
|
+
export type ExpandablePanelProps = CurrentRefinementsProvided & {
|
|
19
|
+
children: React.ReactNode;
|
|
20
|
+
className?: string;
|
|
21
|
+
header?: React.ReactNode | string;
|
|
22
|
+
attributes?: string[];
|
|
23
|
+
isOpened?: boolean;
|
|
24
|
+
onToggle?: any;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export type Panels = {
|
|
28
|
+
[key: string]: boolean;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
function togglePanels(panels: Panels, val: boolean) {
|
|
32
|
+
return Object.keys(panels).reduce(
|
|
33
|
+
(acc, panelKey) => ({ ...acc, [panelKey]: val }),
|
|
34
|
+
{},
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export const refinementsPanelsExpandedAtom = atom(
|
|
39
|
+
get =>
|
|
40
|
+
Boolean(Object.values(get(refinementsPanelsAtom)).find(v => v === true)),
|
|
41
|
+
(get, set, update: (prev: boolean) => boolean) => {
|
|
42
|
+
const expanded = update(get(refinementsPanelsExpandedAtom));
|
|
43
|
+
set(
|
|
44
|
+
refinementsPanelsAtom,
|
|
45
|
+
togglePanels(get(refinementsPanelsAtom), expanded),
|
|
46
|
+
);
|
|
47
|
+
},
|
|
48
|
+
);
|
|
49
|
+
|
|
50
|
+
export const refinementsPanelsAtom = atom<Panels>({});
|
|
51
|
+
|
|
52
|
+
function WidgetPanel({ children, onToggle, panelId, ...props }: any) {
|
|
53
|
+
const onToggleMemoized = useCallback(
|
|
54
|
+
() => onToggle(panelId),
|
|
55
|
+
[onToggle, panelId],
|
|
56
|
+
);
|
|
57
|
+
|
|
58
|
+
return (
|
|
59
|
+
<ExpandablePanelCustom onToggle={onToggleMemoized} {...props}>
|
|
60
|
+
{children}
|
|
61
|
+
</ExpandablePanelCustom>
|
|
62
|
+
);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export default function PostFilterPanel({
|
|
66
|
+
dynamicWidgets = true,
|
|
67
|
+
onApply,
|
|
68
|
+
}: any) {
|
|
69
|
+
const stateGlobal = useAppSelector(state => state);
|
|
70
|
+
const {
|
|
71
|
+
settings,
|
|
72
|
+
search: { postFilter, results },
|
|
73
|
+
} = stateGlobal;
|
|
74
|
+
const { refinements } = settings;
|
|
75
|
+
const [panels, setPanels] = useAtom(refinementsPanelsAtom);
|
|
76
|
+
const [refinementsPanelsExpanded, setRefinementsPanelsExpanded] = useAtom(
|
|
77
|
+
refinementsPanelsExpandedAtom,
|
|
78
|
+
);
|
|
79
|
+
const history = useHistory();
|
|
80
|
+
const isMobile = useMediaQuery({ query: '(max-width: 776px)' });
|
|
81
|
+
const { t } = useTranslation();
|
|
82
|
+
const dispatch = useAppDispatch();
|
|
83
|
+
|
|
84
|
+
const filter = useFilter(results);
|
|
85
|
+
|
|
86
|
+
// Set initial panels value
|
|
87
|
+
useEffect(() => {
|
|
88
|
+
setPanels(prevPanels => ({
|
|
89
|
+
...prevPanels,
|
|
90
|
+
...refinements.reduce(
|
|
91
|
+
(acc: any, current: any) => ({
|
|
92
|
+
...acc,
|
|
93
|
+
[getPanelId(current)]: Boolean(current.isExpanded),
|
|
94
|
+
}),
|
|
95
|
+
{},
|
|
96
|
+
),
|
|
97
|
+
}));
|
|
98
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
99
|
+
}, []);
|
|
100
|
+
|
|
101
|
+
const onToggle = useCallback(
|
|
102
|
+
(panelId: string) => {
|
|
103
|
+
setPanels(prevPanels => {
|
|
104
|
+
return {
|
|
105
|
+
...prevPanels,
|
|
106
|
+
[panelId]: !prevPanels[panelId],
|
|
107
|
+
};
|
|
108
|
+
});
|
|
109
|
+
},
|
|
110
|
+
[setPanels],
|
|
111
|
+
);
|
|
112
|
+
|
|
113
|
+
const widgets = useMemo(() => {
|
|
114
|
+
return refinements.map((refinement: any) => {
|
|
115
|
+
const filterList = filter?.[refinement.attribute];
|
|
116
|
+
|
|
117
|
+
return (
|
|
118
|
+
<div
|
|
119
|
+
style={{
|
|
120
|
+
display: 'flex',
|
|
121
|
+
flexDirection: 'column',
|
|
122
|
+
rowGap: '16px',
|
|
123
|
+
marginBottom: '8px',
|
|
124
|
+
}}
|
|
125
|
+
>
|
|
126
|
+
{filterList?.map((item: any, index: number) => {
|
|
127
|
+
return (
|
|
128
|
+
<div
|
|
129
|
+
key={index}
|
|
130
|
+
style={{
|
|
131
|
+
display: 'flex',
|
|
132
|
+
alignItems: 'center',
|
|
133
|
+
columnGap: '4px',
|
|
134
|
+
}}
|
|
135
|
+
>
|
|
136
|
+
<Checkbox
|
|
137
|
+
color="primary"
|
|
138
|
+
size="small"
|
|
139
|
+
style={{ padding: '0px' }}
|
|
140
|
+
checked={
|
|
141
|
+
!!get(postFilter, `${refinement.attribute}.${item.value}`)
|
|
142
|
+
}
|
|
143
|
+
onChange={() => {
|
|
144
|
+
dispatch(
|
|
145
|
+
setPostFilter({
|
|
146
|
+
[refinement.attribute]: item.value,
|
|
147
|
+
}),
|
|
148
|
+
);
|
|
149
|
+
}}
|
|
150
|
+
/>
|
|
151
|
+
<p style={{ fontSize: '14px', paddingTop: '3px' }}>
|
|
152
|
+
{item.value}
|
|
153
|
+
</p>
|
|
154
|
+
<p style={{ fontSize: '14px', paddingTop: '3px' }}>
|
|
155
|
+
({item.count})
|
|
156
|
+
</p>
|
|
157
|
+
</div>
|
|
158
|
+
);
|
|
159
|
+
})}
|
|
160
|
+
</div>
|
|
161
|
+
);
|
|
162
|
+
});
|
|
163
|
+
}, [refinements, filter, postFilter, dispatch]);
|
|
164
|
+
|
|
165
|
+
const widgetsPanels = useMemo(
|
|
166
|
+
() =>
|
|
167
|
+
widgets.map((widget: any, i: any) => {
|
|
168
|
+
const refinement = refinements[i];
|
|
169
|
+
const panelId = getPanelId(refinement);
|
|
170
|
+
const panelAttributes = getPanelAttributes(refinement);
|
|
171
|
+
|
|
172
|
+
return widget ? (
|
|
173
|
+
<WidgetPanel
|
|
174
|
+
key={panelId}
|
|
175
|
+
panelId={panelId}
|
|
176
|
+
attributes={panelAttributes}
|
|
177
|
+
header={refinement.header}
|
|
178
|
+
isOpened={isMobile ? !panels[panelId] : panels[panelId]}
|
|
179
|
+
onToggle={onToggle}
|
|
180
|
+
>
|
|
181
|
+
{widget}
|
|
182
|
+
</WidgetPanel>
|
|
183
|
+
) : (
|
|
184
|
+
<></>
|
|
185
|
+
);
|
|
186
|
+
}),
|
|
187
|
+
[widgets, refinements, onToggle, panels, isMobile],
|
|
188
|
+
);
|
|
189
|
+
|
|
190
|
+
const onTogglePanelsClick = useCallback(() => {
|
|
191
|
+
setRefinementsPanelsExpanded((expanded: boolean) => !expanded);
|
|
192
|
+
}, [setRefinementsPanelsExpanded]);
|
|
193
|
+
|
|
194
|
+
const handlerApplyfillter = () => {
|
|
195
|
+
onApply();
|
|
196
|
+
if (history.location.pathname !== '/result') {
|
|
197
|
+
history.push('/result');
|
|
198
|
+
}
|
|
199
|
+
};
|
|
200
|
+
|
|
201
|
+
return (
|
|
202
|
+
<>
|
|
203
|
+
{!isMobile && (
|
|
204
|
+
<div className="wrap-main-header-panel">
|
|
205
|
+
<Box
|
|
206
|
+
style={{
|
|
207
|
+
cursor: 'pointer',
|
|
208
|
+
paddingBottom: '8px',
|
|
209
|
+
}}
|
|
210
|
+
>
|
|
211
|
+
<div
|
|
212
|
+
onClick={onTogglePanelsClick}
|
|
213
|
+
style={{ display: 'flex', justifyContent: 'flex-end' }}
|
|
214
|
+
>
|
|
215
|
+
<IconLabel
|
|
216
|
+
icon={refinementsPanelsExpanded ? 'remove' : 'add'}
|
|
217
|
+
label={`${
|
|
218
|
+
refinementsPanelsExpanded
|
|
219
|
+
? t('Collapse all')
|
|
220
|
+
: t('Expand all')
|
|
221
|
+
} `}
|
|
222
|
+
/>
|
|
223
|
+
</div>
|
|
224
|
+
</Box>
|
|
225
|
+
</div>
|
|
226
|
+
)}
|
|
227
|
+
<Box>
|
|
228
|
+
{isMobile && (
|
|
229
|
+
<div
|
|
230
|
+
style={{
|
|
231
|
+
display: 'flex',
|
|
232
|
+
justifyContent: 'flex-end',
|
|
233
|
+
position: 'sticky',
|
|
234
|
+
top: '0px',
|
|
235
|
+
zIndex: 100,
|
|
236
|
+
background: 'white',
|
|
237
|
+
alignItems: 'center',
|
|
238
|
+
}}
|
|
239
|
+
>
|
|
240
|
+
<Button
|
|
241
|
+
onClick={onApply}
|
|
242
|
+
style={{
|
|
243
|
+
width: '32px',
|
|
244
|
+
height: '32px',
|
|
245
|
+
}}
|
|
246
|
+
>
|
|
247
|
+
<CloseIcon color="#2B2C46" />
|
|
248
|
+
</Button>
|
|
249
|
+
</div>
|
|
250
|
+
)}
|
|
251
|
+
<Box
|
|
252
|
+
className="box-center-filter"
|
|
253
|
+
style={{
|
|
254
|
+
...(isMobile
|
|
255
|
+
? {
|
|
256
|
+
paddingLeft: '24px',
|
|
257
|
+
paddingRight: '24px',
|
|
258
|
+
overflow: 'auto',
|
|
259
|
+
marginBottom: '12px',
|
|
260
|
+
}
|
|
261
|
+
: {}),
|
|
262
|
+
}}
|
|
263
|
+
>
|
|
264
|
+
<DynamicWidgetsCT enabled={dynamicWidgets}>
|
|
265
|
+
{widgetsPanels}
|
|
266
|
+
</DynamicWidgetsCT>
|
|
267
|
+
</Box>
|
|
268
|
+
</Box>
|
|
269
|
+
{isMobile && (
|
|
270
|
+
<Box
|
|
271
|
+
style={{
|
|
272
|
+
position: 'sticky',
|
|
273
|
+
bottom: 0,
|
|
274
|
+
width: '100%',
|
|
275
|
+
display: 'flex',
|
|
276
|
+
}}
|
|
277
|
+
>
|
|
278
|
+
<div
|
|
279
|
+
className="text-white"
|
|
280
|
+
style={{
|
|
281
|
+
width: '100%',
|
|
282
|
+
backgroundColor: settings.theme?.secondaryColor,
|
|
283
|
+
fontWeight: 500,
|
|
284
|
+
fontSize: 14,
|
|
285
|
+
borderRadius: 0,
|
|
286
|
+
height: '66px',
|
|
287
|
+
textTransform: 'none',
|
|
288
|
+
padding: '16px',
|
|
289
|
+
}}
|
|
290
|
+
onClick={handlerApplyfillter}
|
|
291
|
+
>
|
|
292
|
+
Cancel
|
|
293
|
+
</div>
|
|
294
|
+
<div
|
|
295
|
+
className="text-white"
|
|
296
|
+
style={{
|
|
297
|
+
width: '100%',
|
|
298
|
+
backgroundColor: settings.theme?.primaryColor,
|
|
299
|
+
fontWeight: 500,
|
|
300
|
+
fontSize: 14,
|
|
301
|
+
borderRadius: 0,
|
|
302
|
+
height: '66px',
|
|
303
|
+
textTransform: 'none',
|
|
304
|
+
padding: '16px',
|
|
305
|
+
}}
|
|
306
|
+
onClick={handlerApplyfillter}
|
|
307
|
+
>
|
|
308
|
+
Apply filters
|
|
309
|
+
</div>
|
|
310
|
+
</Box>
|
|
311
|
+
)}
|
|
312
|
+
</>
|
|
313
|
+
);
|
|
314
|
+
}
|
|
@@ -13,7 +13,7 @@ import { useHistory } from 'react-router-dom';
|
|
|
13
13
|
import { useAppSelector } from 'Store/Store';
|
|
14
14
|
import { ExpandablePanelCustom } from './expandable-panel';
|
|
15
15
|
import { getPanelAttributes, getPanelId } from './refinements';
|
|
16
|
-
import CloseIcon from '
|
|
16
|
+
import { ReactComponent as CloseIcon } from 'common/assets/icons/close.svg';
|
|
17
17
|
import { useTranslation } from 'react-i18next';
|
|
18
18
|
|
|
19
19
|
export type ExpandablePanelProps = CurrentRefinementsProvided & {
|
|
@@ -90,7 +90,7 @@ function WidgetPanel({ children, onToggle, panelId, ...props }: any) {
|
|
|
90
90
|
);
|
|
91
91
|
}
|
|
92
92
|
|
|
93
|
-
export default function
|
|
93
|
+
export default function PostFilterPanelAlgolia({
|
|
94
94
|
dynamicWidgets = true,
|
|
95
95
|
onApply,
|
|
96
96
|
disjunctiveFacets,
|
|
@@ -192,11 +192,15 @@ export default function ExpandablePanelComponent({
|
|
|
192
192
|
<>
|
|
193
193
|
{!isMobile && (
|
|
194
194
|
<div className="wrap-main-header-panel">
|
|
195
|
-
<Box
|
|
196
|
-
|
|
197
|
-
|
|
195
|
+
<Box
|
|
196
|
+
style={{
|
|
197
|
+
cursor: 'pointer',
|
|
198
|
+
paddingBottom: '8px',
|
|
199
|
+
}}
|
|
200
|
+
>
|
|
201
|
+
<div
|
|
198
202
|
onClick={onTogglePanelsClick}
|
|
199
|
-
style={{ justifyContent: 'flex-end' }}
|
|
203
|
+
style={{ display: 'flex', justifyContent: 'flex-end' }}
|
|
200
204
|
>
|
|
201
205
|
<IconLabel
|
|
202
206
|
icon={refinementsPanelsExpanded ? 'remove' : 'add'}
|
|
@@ -206,7 +210,7 @@ export default function ExpandablePanelComponent({
|
|
|
206
210
|
: t('Expand all')
|
|
207
211
|
} `}
|
|
208
212
|
/>
|
|
209
|
-
</
|
|
213
|
+
</div>
|
|
210
214
|
</Box>
|
|
211
215
|
</div>
|
|
212
216
|
)}
|
|
@@ -221,12 +225,16 @@ export default function ExpandablePanelComponent({
|
|
|
221
225
|
zIndex: 100,
|
|
222
226
|
background: 'white',
|
|
223
227
|
alignItems: 'center',
|
|
224
|
-
paddingTop: '10px',
|
|
225
|
-
paddingRight: '10px',
|
|
226
228
|
}}
|
|
227
229
|
>
|
|
228
|
-
<Button
|
|
229
|
-
|
|
230
|
+
<Button
|
|
231
|
+
onClick={onApply}
|
|
232
|
+
style={{
|
|
233
|
+
width: '32px',
|
|
234
|
+
height: '32px',
|
|
235
|
+
}}
|
|
236
|
+
>
|
|
237
|
+
<CloseIcon color="#2B2C46" />
|
|
230
238
|
</Button>
|
|
231
239
|
</div>
|
|
232
240
|
)}
|
|
@@ -238,6 +246,7 @@ export default function ExpandablePanelComponent({
|
|
|
238
246
|
paddingLeft: '24px',
|
|
239
247
|
paddingRight: '24px',
|
|
240
248
|
overflow: 'auto',
|
|
249
|
+
marginBottom: '12px',
|
|
241
250
|
}
|
|
242
251
|
: {}),
|
|
243
252
|
}}
|
|
@@ -253,21 +262,41 @@ export default function ExpandablePanelComponent({
|
|
|
253
262
|
position: 'sticky',
|
|
254
263
|
bottom: 0,
|
|
255
264
|
width: '100%',
|
|
265
|
+
display: 'flex',
|
|
256
266
|
}}
|
|
257
267
|
>
|
|
258
|
-
<
|
|
268
|
+
<div
|
|
269
|
+
className="text-white"
|
|
270
|
+
style={{
|
|
271
|
+
width: '100%',
|
|
272
|
+
backgroundColor: settings.theme?.secondaryColor,
|
|
273
|
+
fontWeight: 500,
|
|
274
|
+
fontSize: 14,
|
|
275
|
+
borderRadius: 0,
|
|
276
|
+
height: '66px',
|
|
277
|
+
textTransform: 'none',
|
|
278
|
+
padding: '16px',
|
|
279
|
+
}}
|
|
280
|
+
onClick={handlerApplyfillter}
|
|
281
|
+
>
|
|
282
|
+
Cancel
|
|
283
|
+
</div>
|
|
284
|
+
<div
|
|
259
285
|
className="text-white"
|
|
260
286
|
style={{
|
|
261
287
|
width: '100%',
|
|
262
288
|
backgroundColor: settings.theme?.primaryColor,
|
|
263
|
-
fontWeight:
|
|
289
|
+
fontWeight: 500,
|
|
264
290
|
fontSize: 14,
|
|
265
291
|
borderRadius: 0,
|
|
292
|
+
height: '66px',
|
|
293
|
+
textTransform: 'none',
|
|
294
|
+
padding: '16px',
|
|
266
295
|
}}
|
|
267
296
|
onClick={handlerApplyfillter}
|
|
268
297
|
>
|
|
269
|
-
|
|
270
|
-
</
|
|
298
|
+
Apply filters
|
|
299
|
+
</div>
|
|
271
300
|
</Box>
|
|
272
301
|
)}
|
|
273
302
|
</>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Box, Button
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import { Box, Button } from '@material-ui/core';
|
|
2
|
+
import { ReactComponent as RemoveIcon } from 'common/assets/icons/minus.svg';
|
|
3
|
+
import { ReactComponent as AddIcon } from 'common/assets/icons/add.svg';
|
|
4
4
|
import classNames from 'classnames';
|
|
5
5
|
import { Collapse } from 'components/collapse/collapse';
|
|
6
6
|
import { useAtomValue } from 'jotai/utils';
|
|
@@ -12,7 +12,7 @@ import type {
|
|
|
12
12
|
} from 'react-instantsearch-core';
|
|
13
13
|
import { connectCurrentRefinements } from 'react-instantsearch-dom';
|
|
14
14
|
import { useMediaQuery } from 'react-responsive';
|
|
15
|
-
import { useHasRefinements } from '
|
|
15
|
+
import { useHasRefinements } from './PostFilterAlgolia';
|
|
16
16
|
import { searchResultsAtom } from './virtual-state-results';
|
|
17
17
|
|
|
18
18
|
export type ExpandablePanelProps = CurrentRefinementsProvided & {
|
|
@@ -42,17 +42,26 @@ function ExpandablePanelComponent({
|
|
|
42
42
|
<Box>
|
|
43
43
|
<div
|
|
44
44
|
className={classNames(
|
|
45
|
-
'border-neutral-light',
|
|
46
45
|
{
|
|
47
46
|
hidden: !hasRefinements,
|
|
48
47
|
},
|
|
49
48
|
className,
|
|
50
49
|
)}
|
|
50
|
+
style={{
|
|
51
|
+
borderTop: !isMobile ? '1px solid #d3d4d8' : '',
|
|
52
|
+
}}
|
|
51
53
|
>
|
|
52
54
|
<Button
|
|
53
55
|
className="w-full flex items-center justify-between group"
|
|
54
56
|
aria-expanded={isOpened}
|
|
55
|
-
style={{
|
|
57
|
+
style={{
|
|
58
|
+
paddingLeft: '2px',
|
|
59
|
+
paddingRight: '2px',
|
|
60
|
+
paddingTop: !isMobile ? '8px' : '0px',
|
|
61
|
+
paddingBottom: '8px',
|
|
62
|
+
marginTop: '16px',
|
|
63
|
+
marginBottom: '16px',
|
|
64
|
+
}}
|
|
56
65
|
onClick={e => {
|
|
57
66
|
if (typeof onToggle === 'function') {
|
|
58
67
|
onToggle(e);
|
|
@@ -60,22 +69,19 @@ function ExpandablePanelComponent({
|
|
|
60
69
|
}}
|
|
61
70
|
>
|
|
62
71
|
<div className="flex items-center w-full subhead">
|
|
63
|
-
<
|
|
64
|
-
className="fw-700"
|
|
72
|
+
<p
|
|
65
73
|
style={{
|
|
66
74
|
textTransform: 'none',
|
|
67
75
|
fontFamily: 'Source Sans 3 !important',
|
|
68
76
|
fontSize: 14,
|
|
77
|
+
fontWeight: 'bold',
|
|
78
|
+
lineHeight: '16px',
|
|
69
79
|
}}
|
|
70
80
|
>
|
|
71
81
|
{header || attributes[0]}
|
|
72
|
-
</
|
|
82
|
+
</p>
|
|
73
83
|
</div>
|
|
74
|
-
{!isMobile &&
|
|
75
|
-
<div className="text-neutral-dark can-hover:transition-colors can-hover:group-hover:text-neutral-light">
|
|
76
|
-
{isOpened ? <RemoveIcon /> : <AddIcon />}
|
|
77
|
-
</div>
|
|
78
|
-
)}
|
|
84
|
+
{!isMobile && <>{isOpened ? <RemoveIcon /> : <AddIcon />}</>}
|
|
79
85
|
</Button>
|
|
80
86
|
|
|
81
87
|
<Collapse isCollapsed={!isOpened}>
|
|
@@ -17,40 +17,44 @@ function ProductAttribute(props: Props) {
|
|
|
17
17
|
} = props;
|
|
18
18
|
|
|
19
19
|
return (
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
20
|
+
<>
|
|
21
|
+
{title && (
|
|
22
|
+
<Box
|
|
23
|
+
display="flex"
|
|
24
|
+
flexDirection={'column'}
|
|
25
|
+
borderRadius={2}
|
|
26
|
+
width={width}
|
|
27
|
+
style={{
|
|
28
|
+
backgroundColor: '#E0E0E0',
|
|
29
|
+
padding: padding,
|
|
30
|
+
flexGrow: 1,
|
|
31
|
+
}}
|
|
32
|
+
>
|
|
33
|
+
<Typography
|
|
34
|
+
style={{
|
|
35
|
+
color: '#2B2C46',
|
|
36
|
+
overflow: 'hidden',
|
|
37
|
+
textOverflow: 'ellipsis',
|
|
38
|
+
whiteSpace: 'nowrap',
|
|
39
|
+
}}
|
|
40
|
+
className="text-f12 fw-700"
|
|
41
|
+
>
|
|
42
|
+
{title}
|
|
43
|
+
</Typography>
|
|
44
|
+
<Typography
|
|
45
|
+
style={{
|
|
46
|
+
color: '#2B2C46',
|
|
47
|
+
overflow: 'hidden',
|
|
48
|
+
textOverflow: 'ellipsis',
|
|
49
|
+
whiteSpace: 'nowrap',
|
|
50
|
+
}}
|
|
51
|
+
className="text-f12 fw-400"
|
|
52
|
+
>
|
|
53
|
+
{value}
|
|
54
|
+
</Typography>
|
|
55
|
+
</Box>
|
|
56
|
+
)}
|
|
57
|
+
</>
|
|
54
58
|
);
|
|
55
59
|
}
|
|
56
60
|
|
|
@@ -20,7 +20,7 @@ import { useTranslation } from 'react-i18next';
|
|
|
20
20
|
import ProductAttribute from './ProductAttribute';
|
|
21
21
|
import CadenasWebViewer from './CadenasWebViewer';
|
|
22
22
|
import { makeStyles } from '@material-ui/core/styles';
|
|
23
|
-
import { get } from 'lodash';
|
|
23
|
+
import { get, isUndefined } from 'lodash';
|
|
24
24
|
|
|
25
25
|
const useStyles = makeStyles(theme => ({
|
|
26
26
|
buttonStyle3D: {
|
|
@@ -321,25 +321,31 @@ function ProductDetailView(props: Props) {
|
|
|
321
321
|
{sku}
|
|
322
322
|
</Typography>
|
|
323
323
|
|
|
324
|
-
{settings.warehouseVariant &&
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
>
|
|
331
|
-
<span
|
|
324
|
+
{settings.warehouseVariant &&
|
|
325
|
+
!isUndefined(
|
|
326
|
+
get(dataItem, settings.field.warehouseStockValue),
|
|
327
|
+
) && (
|
|
328
|
+
<Typography
|
|
329
|
+
className="text-f12 max-line-1 fw-400"
|
|
332
330
|
style={{
|
|
333
|
-
color:
|
|
334
|
-
? '#00C070'
|
|
335
|
-
: '#c54545',
|
|
336
|
-
fontWeight: 600,
|
|
331
|
+
color: '#2B2C46',
|
|
337
332
|
}}
|
|
338
333
|
>
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
334
|
+
<span
|
|
335
|
+
style={{
|
|
336
|
+
color: get(
|
|
337
|
+
dataItem,
|
|
338
|
+
settings.field.warehouseStockValue,
|
|
339
|
+
)
|
|
340
|
+
? '#00C070'
|
|
341
|
+
: '#c54545',
|
|
342
|
+
fontWeight: 600,
|
|
343
|
+
}}
|
|
344
|
+
>
|
|
345
|
+
{get(dataItem, settings.field.warehouseStockValue) || 0}
|
|
346
|
+
</span>
|
|
347
|
+
</Typography>
|
|
348
|
+
)}
|
|
343
349
|
</Box>
|
|
344
350
|
)}
|
|
345
351
|
|
|
@@ -403,19 +409,28 @@ function ProductDetailView(props: Props) {
|
|
|
403
409
|
<>
|
|
404
410
|
{settings.field.warehouseNumber && (
|
|
405
411
|
<ProductAttribute
|
|
406
|
-
title={
|
|
412
|
+
title={
|
|
413
|
+
get(dataItem, settings.field.warehouseNumber) ||
|
|
414
|
+
settings.field.warehouseNumber
|
|
415
|
+
}
|
|
407
416
|
value={
|
|
408
|
-
dataItem
|
|
417
|
+
get(dataItem, settings.field.warehouseNumberValue) ||
|
|
418
|
+
'N/A'
|
|
409
419
|
}
|
|
410
420
|
width={{ xs: '49%', md: 'fit-content' }}
|
|
411
421
|
/>
|
|
412
422
|
)}
|
|
413
423
|
{settings.field.warehouseShelfNumber && (
|
|
414
424
|
<ProductAttribute
|
|
415
|
-
title={
|
|
425
|
+
title={
|
|
426
|
+
get(dataItem, settings.field.warehouseShelfNumber) ||
|
|
427
|
+
settings.field.warehouseShelfNumber
|
|
428
|
+
}
|
|
416
429
|
value={
|
|
417
|
-
|
|
418
|
-
|
|
430
|
+
get(
|
|
431
|
+
dataItem,
|
|
432
|
+
settings.field.warehouseShelfNumberValue,
|
|
433
|
+
) || 'N/A'
|
|
419
434
|
}
|
|
420
435
|
width={{ xs: '49%', md: 'fit-content' }}
|
|
421
436
|
/>
|