@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
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
|
|
2
|
+
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
3
|
+
<path d="M8.625 7.375V3.625C8.625 3.27982 8.34518 3 8 3C7.65482 3 7.375 3.27982 7.375 3.625V7.375H3.625C3.27982 7.375 3 7.65482 3 8C3 8.34518 3.27982 8.625 3.625 8.625H7.375V12.375C7.375 12.7202 7.65482 13 8 13C8.34518 13 8.625 12.7202 8.625 12.375V8.625H12.375C12.7202 8.625 13 8.34518 13 8C13 7.65482 12.7202 7.375 12.375 7.375H8.625Z" fill="#2B2C46"/>
|
|
4
|
+
</svg>
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path d="M6.07845 9.15944C5.74747 8.78211 5.74747 8.21789 6.07845 7.84056L9.53895 3.8956C9.72281 3.68599 10.0491 3.68599 10.233 3.8956C10.3858 4.06978 10.3858 4.33022 10.233 4.5044L7.30652 7.84056C6.97554 8.21789 6.97554 8.78211 7.30652 9.15944L10.233 12.4956C10.3858 12.6698 10.3858 12.9302 10.233 13.1044C10.0491 13.314 9.72281 13.314 9.53895 13.1044L6.07845 9.15944Z" fill="#2B2C46"/>
|
|
3
|
+
</svg>
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path d="M9.92155 9.15944C10.2525 8.78211 10.2525 8.21789 9.92155 7.84056L6.46105 3.8956C6.27719 3.68599 5.95088 3.68599 5.76702 3.8956C5.61423 4.06978 5.61423 4.33022 5.76702 4.5044L8.69348 7.84056C9.02446 8.21789 9.02446 8.78211 8.69348 9.15944L5.76702 12.4956C5.61423 12.6698 5.61423 12.9302 5.76702 13.1044C5.95088 13.314 6.27719 13.314 6.46105 13.1044L9.92155 9.15944Z" fill="#2B2C46"/>
|
|
3
|
+
</svg>
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M14.3007 8.43552V8V7.55875L15.4009 6.59603C15.8197 6.22695 15.9116 5.60988 15.6187 5.13475L14.2663 2.84254C14.0618 2.4883 13.684 2.26991 13.2749 2.26949C13.1504 2.26854 13.0265 2.28789 12.9082 2.3268L11.5157 2.7967C11.2752 2.63694 11.0244 2.49336 10.765 2.36691L10.4727 0.922825C10.3645 0.378294 9.88166 -0.0104241 9.3266 0.000213077H6.64472C6.08966 -0.0104241 5.60678 0.378294 5.49862 0.922825L5.20636 2.36691C4.94501 2.49333 4.69232 2.6369 4.44994 2.7967L3.08608 2.30388C2.96648 2.27272 2.84263 2.26111 2.71932 2.26949C2.31028 2.26991 1.93247 2.4883 1.72795 2.84254L0.375548 5.13475C0.0996813 5.60867 0.198168 6.2116 0.610498 6.5731L1.69356 7.56448V8V8.44125L0.610498 9.40397C0.186011 9.76843 0.0866989 10.3861 0.375548 10.8653L1.72795 13.1575C1.93247 13.5117 2.31028 13.7301 2.71932 13.7305C2.84388 13.7315 2.96775 13.7121 3.08608 13.6732L4.47859 13.2033C4.71901 13.3631 4.96979 13.5066 5.22929 13.6331L5.52154 15.0772C5.6297 15.6217 6.11258 16.0104 6.66764 15.9998H9.37244C9.92751 16.0104 10.4104 15.6217 10.5185 15.0772L10.8108 13.6331C11.0721 13.5067 11.3248 13.3631 11.5672 13.2033L12.954 13.6732C13.0723 13.7121 13.1962 13.7315 13.3208 13.7305C13.7298 13.7301 14.1076 13.5117 14.3121 13.1575L15.6187 10.8653C15.8946 10.3913 15.7961 9.7884 15.3837 9.4269L14.3007 8.43552ZM13.2749 12.5844L11.3094 11.9197C10.8492 12.3094 10.3234 12.6141 9.75639 12.8194L9.34952 14.8766H6.64472L6.23786 12.8423C5.67536 12.6312 5.15234 12.327 4.69062 11.9426L2.71932 12.5844L1.36693 10.2922L2.92562 8.91688C2.81966 8.32369 2.81966 7.71642 2.92562 7.12323L1.36693 5.7078L2.71932 3.41559L4.68489 4.08033C5.14501 3.6906 5.67088 3.38594 6.23786 3.18064L6.64472 1.12339H9.34952L9.75639 3.15772C10.3189 3.36885 10.8419 3.67298 11.3036 4.05741L13.2749 3.41559L14.6273 5.7078L13.0686 7.08312C13.1746 7.67631 13.1746 8.28358 13.0686 8.87677L14.6273 10.2922L13.2749 12.5844ZM7.99712 11.4383C6.0982 11.4383 4.55882 9.89892 4.55882 8C4.55882 6.10108 6.0982 4.5617 7.99712 4.5617C9.89604 4.5617 11.4354 6.10108 11.4354 8C11.4447 8.91471 11.0854 9.79466 10.4386 10.4415C9.79178 11.0883 8.91183 11.4476 7.99712 11.4383ZM7.99712 5.7078C7.38493 5.69354 6.79358 5.93045 6.36058 6.36345C5.92757 6.79646 5.69066 7.38781 5.70492 8C5.69066 8.61219 5.92757 9.20354 6.36058 9.63655C6.79358 10.0695 7.38493 10.3065 7.99712 10.2922C8.60931 10.3065 9.20066 10.0695 9.63367 9.63655C10.0667 9.20354 10.3036 8.61219 10.2893 8C10.3036 7.38781 10.0667 6.79646 9.63367 6.36345C9.20066 5.93045 8.60931 5.69354 7.99712 5.7078Z" fill="currentColor"/>
|
|
3
|
+
</svg>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nyris/nyris-webapp",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.49",
|
|
4
4
|
"homepage": "./",
|
|
5
5
|
"dependencies": {
|
|
6
6
|
"@algolia/autocomplete-js": "^1.7.1",
|
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
"@material-ui/data-grid": "^4.0.0-alpha.37",
|
|
14
14
|
"@material-ui/icons": "^4.4.1",
|
|
15
15
|
"@material-ui/lab": "^4.0.0-alpha.60",
|
|
16
|
-
"@nyris/nyris-api": "^0.3.
|
|
17
|
-
"@nyris/nyris-react-components": "^0.3.
|
|
16
|
+
"@nyris/nyris-api": "^0.3.49",
|
|
17
|
+
"@nyris/nyris-react-components": "^0.3.49",
|
|
18
18
|
"@reduxjs/toolkit": "^1.6.1",
|
|
19
19
|
"@splidejs/react-splide": "^0.7.12",
|
|
20
20
|
"@types/blueimp-load-image": "^2.23.4",
|
|
@@ -1,19 +1,93 @@
|
|
|
1
1
|
var settings = {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
auth0: {
|
|
3
|
+
enabled: '',
|
|
4
|
+
domain: '',
|
|
5
|
+
clientId: '',
|
|
6
|
+
supportEmail: '',
|
|
7
|
+
},
|
|
8
|
+
algolia: {
|
|
9
|
+
apiKey: '',
|
|
10
|
+
appId: '',
|
|
11
|
+
indexName: '',
|
|
12
|
+
},
|
|
13
|
+
alogoliaFilterField: 'keyword',
|
|
14
|
+
refinements: [
|
|
15
|
+
{
|
|
16
|
+
attribute: 'brand',
|
|
17
|
+
header: 'Brands',
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
attribute: 'keyword_0',
|
|
21
|
+
header: 'Category',
|
|
22
|
+
},
|
|
23
|
+
],
|
|
24
|
+
// Nyris - visual search
|
|
25
|
+
apiKey: '',
|
|
26
|
+
baseUrl: 'https://api.nyris.io',
|
|
5
27
|
jpegQuality: 0.9,
|
|
28
|
+
maxHeight: 1024,
|
|
29
|
+
maxWidth: 1024,
|
|
6
30
|
regions: true,
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
'
|
|
12
|
-
'
|
|
13
|
-
'
|
|
14
|
-
'
|
|
15
|
-
'
|
|
16
|
-
|
|
31
|
+
responseFormat: 'application/offers.complete+json',
|
|
32
|
+
visualSearchFilterKey: '',
|
|
33
|
+
// UI - theme
|
|
34
|
+
theme: {
|
|
35
|
+
appBarLogoUrl: '',
|
|
36
|
+
headerColor: '',
|
|
37
|
+
logoHeight: '',
|
|
38
|
+
logoWidth: '',
|
|
39
|
+
primaryColor: '',
|
|
40
|
+
secondaryColor: '',
|
|
41
|
+
},
|
|
42
|
+
language: 'en',
|
|
43
|
+
// features
|
|
44
|
+
shareOption: '',
|
|
45
|
+
showFeedbackAndShare: '',
|
|
46
|
+
showPoweredByNyris: '',
|
|
47
|
+
warehouseVariant: false,
|
|
48
|
+
postFilterOption: '',
|
|
49
|
+
preFilterOption: '',
|
|
50
|
+
rfq: {
|
|
51
|
+
enabled: '',
|
|
52
|
+
emailTemplateId: '',
|
|
53
|
+
},
|
|
54
|
+
support: {
|
|
55
|
+
enabled: '',
|
|
56
|
+
emailInquiry: '',
|
|
57
|
+
emailTemplateId: '',
|
|
58
|
+
supportNumber: '',
|
|
59
|
+
description: '',
|
|
60
|
+
},
|
|
61
|
+
cadenas: {
|
|
62
|
+
catalog: '',
|
|
63
|
+
cadenasAPIKey: '',
|
|
64
|
+
cadenas3dWebView: '',
|
|
65
|
+
},
|
|
66
|
+
//UI - labels
|
|
67
|
+
appTitle: '',
|
|
68
|
+
brandName: '',
|
|
69
|
+
headerText: '',
|
|
70
|
+
itemIdLabel: 'SKU',
|
|
71
|
+
preFilterTitle: '',
|
|
72
|
+
CTAButtonText: 'View More',
|
|
73
|
+
secondaryCTAButtonText: 'Configure Now',
|
|
74
|
+
|
|
75
|
+
//field mappins
|
|
76
|
+
field: {
|
|
77
|
+
ctaLinkField: 'main_offer_link',
|
|
78
|
+
secondaryCTALinkField: 'main_offer_link',
|
|
79
|
+
productName: 'title',
|
|
80
|
+
productDetails: 'keyword_1',
|
|
81
|
+
manufacturerNumber: 'keyword_0',
|
|
82
|
+
productTag: 'brand',
|
|
83
|
+
//WarehouseVariant
|
|
84
|
+
warehouseNumber: 'custom_id_key_2',
|
|
85
|
+
warehouseNumberValue: 'custom_id_value_2',
|
|
86
|
+
warehouseShelfNumber: 'custom_id_key_1',
|
|
87
|
+
warehouseShelfNumberValue: 'custom_id_value_1',
|
|
88
|
+
warehouseStock: 'custom_id_key_3',
|
|
89
|
+
warehouseStockValue: 'custom_id_value_3',
|
|
90
|
+
},
|
|
17
91
|
};
|
|
18
92
|
settings['customSearchRequest'] = null;
|
|
19
93
|
settings['responseHook'] = null;
|
package/src/Store/Store.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { RectCoords, Region } from '@nyris/nyris-api';
|
|
|
2
2
|
import { createSlice, PayloadAction } from '@reduxjs/toolkit';
|
|
3
3
|
import { DEFAULT_REGION } from '../../constants';
|
|
4
4
|
import { initialState } from './search.initialState';
|
|
5
|
+
import { isUndefined } from 'lodash';
|
|
5
6
|
|
|
6
7
|
export const searchSlice = createSlice({
|
|
7
8
|
name: 'search',
|
|
@@ -156,6 +157,7 @@ export const searchSlice = createSlice({
|
|
|
156
157
|
textSearchInputMobile: '',
|
|
157
158
|
isShowModalDetailItemMobile: false,
|
|
158
159
|
preFilter: state.preFilter || {},
|
|
160
|
+
postFilter: {},
|
|
159
161
|
preFilterDropdown: false,
|
|
160
162
|
imageCaptureHelpModal: false,
|
|
161
163
|
};
|
|
@@ -260,11 +262,44 @@ export const searchSlice = createSlice({
|
|
|
260
262
|
filter: data.payload,
|
|
261
263
|
};
|
|
262
264
|
},
|
|
265
|
+
setPostFilter: (state, data: PayloadAction<Record<string, string>>) => {
|
|
266
|
+
const { payload } = data;
|
|
267
|
+
|
|
268
|
+
let filter = { ...state.postFilter } || {};
|
|
269
|
+
const key = Object.keys(payload)[0];
|
|
270
|
+
|
|
271
|
+
if (
|
|
272
|
+
!isUndefined(filter[key]) &&
|
|
273
|
+
!isUndefined(filter[key][payload[key]])
|
|
274
|
+
) {
|
|
275
|
+
filter[key] = {
|
|
276
|
+
...filter[key],
|
|
277
|
+
[payload[key]]: !filter[key][payload[key]],
|
|
278
|
+
};
|
|
279
|
+
} else if (!filter[key]) {
|
|
280
|
+
filter = { ...filter, [key]: { [payload[key]]: true } };
|
|
281
|
+
} else {
|
|
282
|
+
filter[key] = { ...filter[key], [payload[key]]: true };
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
return {
|
|
286
|
+
...state,
|
|
287
|
+
postFilter: { ...filter },
|
|
288
|
+
};
|
|
289
|
+
},
|
|
290
|
+
|
|
291
|
+
clearPostFilter: state => {
|
|
292
|
+
return {
|
|
293
|
+
...state,
|
|
294
|
+
postFilter: {},
|
|
295
|
+
};
|
|
296
|
+
},
|
|
263
297
|
},
|
|
264
298
|
});
|
|
265
299
|
|
|
266
300
|
export const {
|
|
267
301
|
changeValueTextSearch,
|
|
302
|
+
clearPostFilter,
|
|
268
303
|
configureFilter,
|
|
269
304
|
loadFileSelectRegion,
|
|
270
305
|
loadingActionRegions,
|
|
@@ -279,6 +314,7 @@ export const {
|
|
|
279
314
|
setFilter,
|
|
280
315
|
setImageCaptureHelpModal,
|
|
281
316
|
setImageSearchInput,
|
|
317
|
+
setPostFilter,
|
|
282
318
|
setPreFilter,
|
|
283
319
|
setPreFilterDropdown,
|
|
284
320
|
setRegions,
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
|
|
2
|
+
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
3
|
+
<path d="M8.625 7.375V3.625C8.625 3.27982 8.34518 3 8 3C7.65482 3 7.375 3.27982 7.375 3.625V7.375H3.625C3.27982 7.375 3 7.65482 3 8C3 8.34518 3.27982 8.625 3.625 8.625H7.375V12.375C7.375 12.7202 7.65482 13 8 13C8.34518 13 8.625 12.7202 8.625 12.375V8.625H12.375C12.7202 8.625 13 8.34518 13 8C13 7.65482 12.7202 7.375 12.375 7.375H8.625Z" fill="#2B2C46"/>
|
|
4
|
+
</svg>
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M14.3007 8.43552V8V7.55875L15.4009 6.59603C15.8197 6.22695 15.9116 5.60988 15.6187 5.13475L14.2663 2.84254C14.0618 2.4883 13.684 2.26991 13.2749 2.26949C13.1504 2.26854 13.0265 2.28789 12.9082 2.3268L11.5157 2.7967C11.2752 2.63694 11.0244 2.49336 10.765 2.36691L10.4727 0.922825C10.3645 0.378294 9.88166 -0.0104241 9.3266 0.000213077H6.64472C6.08966 -0.0104241 5.60678 0.378294 5.49862 0.922825L5.20636 2.36691C4.94501 2.49333 4.69232 2.6369 4.44994 2.7967L3.08608 2.30388C2.96648 2.27272 2.84263 2.26111 2.71932 2.26949C2.31028 2.26991 1.93247 2.4883 1.72795 2.84254L0.375548 5.13475C0.0996813 5.60867 0.198168 6.2116 0.610498 6.5731L1.69356 7.56448V8V8.44125L0.610498 9.40397C0.186011 9.76843 0.0866989 10.3861 0.375548 10.8653L1.72795 13.1575C1.93247 13.5117 2.31028 13.7301 2.71932 13.7305C2.84388 13.7315 2.96775 13.7121 3.08608 13.6732L4.47859 13.2033C4.71901 13.3631 4.96979 13.5066 5.22929 13.6331L5.52154 15.0772C5.6297 15.6217 6.11258 16.0104 6.66764 15.9998H9.37244C9.92751 16.0104 10.4104 15.6217 10.5185 15.0772L10.8108 13.6331C11.0721 13.5067 11.3248 13.3631 11.5672 13.2033L12.954 13.6732C13.0723 13.7121 13.1962 13.7315 13.3208 13.7305C13.7298 13.7301 14.1076 13.5117 14.3121 13.1575L15.6187 10.8653C15.8946 10.3913 15.7961 9.7884 15.3837 9.4269L14.3007 8.43552ZM13.2749 12.5844L11.3094 11.9197C10.8492 12.3094 10.3234 12.6141 9.75639 12.8194L9.34952 14.8766H6.64472L6.23786 12.8423C5.67536 12.6312 5.15234 12.327 4.69062 11.9426L2.71932 12.5844L1.36693 10.2922L2.92562 8.91688C2.81966 8.32369 2.81966 7.71642 2.92562 7.12323L1.36693 5.7078L2.71932 3.41559L4.68489 4.08033C5.14501 3.6906 5.67088 3.38594 6.23786 3.18064L6.64472 1.12339H9.34952L9.75639 3.15772C10.3189 3.36885 10.8419 3.67298 11.3036 4.05741L13.2749 3.41559L14.6273 5.7078L13.0686 7.08312C13.1746 7.67631 13.1746 8.28358 13.0686 8.87677L14.6273 10.2922L13.2749 12.5844ZM7.99712 11.4383C6.0982 11.4383 4.55882 9.89892 4.55882 8C4.55882 6.10108 6.0982 4.5617 7.99712 4.5617C9.89604 4.5617 11.4354 6.10108 11.4354 8C11.4447 8.91471 11.0854 9.79466 10.4386 10.4415C9.79178 11.0883 8.91183 11.4476 7.99712 11.4383ZM7.99712 5.7078C7.38493 5.69354 6.79358 5.93045 6.36058 6.36345C5.92757 6.79646 5.69066 7.38781 5.70492 8C5.69066 8.61219 5.92757 9.20354 6.36058 9.63655C6.79358 10.0695 7.38493 10.3065 7.99712 10.2922C8.60931 10.3065 9.20066 10.0695 9.63367 9.63655C10.0667 9.20354 10.3036 8.61219 10.2893 8C10.3036 7.38781 10.0667 6.79646 9.63367 6.36345C9.20066 5.93045 8.60931 5.69354 7.99712 5.7078Z" fill="currentColor"/>
|
|
3
|
+
</svg>
|
|
@@ -55,6 +55,8 @@ function HeaderMobileComponent(props: Props): JSX.Element {
|
|
|
55
55
|
queryText,
|
|
56
56
|
requestImage,
|
|
57
57
|
selectedRegion,
|
|
58
|
+
results,
|
|
59
|
+
postFilter,
|
|
58
60
|
} = search;
|
|
59
61
|
|
|
60
62
|
const query = useQuery();
|
|
@@ -86,7 +88,15 @@ function HeaderMobileComponent(props: Props): JSX.Element {
|
|
|
86
88
|
dispatch(updateQueryText(''));
|
|
87
89
|
setValueInput('');
|
|
88
90
|
}
|
|
91
|
+
} else {
|
|
92
|
+
if (settings.algolia?.enabled) {
|
|
93
|
+
// not an ideal solution: fixes text search not working after removing image
|
|
94
|
+
setTimeout(() => {
|
|
95
|
+
refine(searchQuery);
|
|
96
|
+
}, 100);
|
|
97
|
+
}
|
|
89
98
|
}
|
|
99
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
90
100
|
}, [imageThumbSearchInput, dispatch, refine, history, settings.algolia]);
|
|
91
101
|
|
|
92
102
|
useEffect(() => {
|
|
@@ -162,16 +172,30 @@ function HeaderMobileComponent(props: Props): JSX.Element {
|
|
|
162
172
|
);
|
|
163
173
|
const isPostFilterApplied = useMemo(() => {
|
|
164
174
|
let isApplied = false;
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
if (
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
175
|
+
|
|
176
|
+
if (settings.algolia.enabled) {
|
|
177
|
+
if (!valueTextSearch?.refinementList) return false;
|
|
178
|
+
Object.keys(valueTextSearch?.refinementList).forEach(key => {
|
|
179
|
+
if (typeof valueTextSearch.refinementList[key] === 'object') {
|
|
180
|
+
isApplied = true;
|
|
181
|
+
return;
|
|
182
|
+
}
|
|
183
|
+
});
|
|
184
|
+
} else {
|
|
185
|
+
Object.keys(postFilter).forEach(key => {
|
|
186
|
+
const filter = postFilter[key];
|
|
187
|
+
Object.keys(filter).forEach(value => {
|
|
188
|
+
if (filter[value]) {
|
|
189
|
+
isApplied = true;
|
|
190
|
+
return;
|
|
191
|
+
}
|
|
192
|
+
});
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
|
|
172
196
|
return isApplied;
|
|
173
197
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
174
|
-
}, [valueTextSearch?.refinementList]);
|
|
198
|
+
}, [valueTextSearch?.refinementList, settings, postFilter]);
|
|
175
199
|
|
|
176
200
|
const onChangeText = (event: any) => {
|
|
177
201
|
// debounceSearch(event.currentTarget.value);
|
|
@@ -184,11 +208,16 @@ function HeaderMobileComponent(props: Props): JSX.Element {
|
|
|
184
208
|
}
|
|
185
209
|
};
|
|
186
210
|
const disablePostFilter = useMemo(() => {
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
211
|
+
if (settings.algolia.enabled) {
|
|
212
|
+
return settings.postFilterOption &&
|
|
213
|
+
props.allSearchResults?.hits.length > 0
|
|
214
|
+
? false
|
|
215
|
+
: true;
|
|
216
|
+
} else {
|
|
217
|
+
return settings.postFilterOption && results?.length > 0 ? false : true;
|
|
218
|
+
}
|
|
190
219
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
191
|
-
}, [settings
|
|
220
|
+
}, [settings, results, props.allSearchResults?.hits]);
|
|
192
221
|
|
|
193
222
|
return (
|
|
194
223
|
<div style={{ width: '100%', background: '#fff' }}>
|
|
@@ -16,14 +16,12 @@ import {
|
|
|
16
16
|
updateStatusLoading,
|
|
17
17
|
} from 'Store/search/Search';
|
|
18
18
|
import { useHistory } from 'react-router-dom';
|
|
19
|
-
import { connectSearchBox } from 'react-instantsearch-dom';
|
|
20
19
|
import { find } from 'services/image';
|
|
21
20
|
import { isEmpty } from 'lodash';
|
|
22
21
|
|
|
23
22
|
function ImagePreviewMobileComponent({
|
|
24
23
|
requestImage,
|
|
25
24
|
imageSelection,
|
|
26
|
-
setImageSelection,
|
|
27
25
|
debouncedOnImageSelectionChange,
|
|
28
26
|
filteredRegions,
|
|
29
27
|
showAdjustInfo,
|
|
@@ -32,14 +30,13 @@ function ImagePreviewMobileComponent({
|
|
|
32
30
|
}: {
|
|
33
31
|
requestImage: any;
|
|
34
32
|
imageSelection: any;
|
|
35
|
-
|
|
33
|
+
|
|
36
34
|
debouncedOnImageSelectionChange: any;
|
|
37
35
|
filteredRegions: any;
|
|
38
36
|
showAdjustInfoBasedOnConfidence: any;
|
|
39
37
|
showAdjustInfo: any;
|
|
40
38
|
}) {
|
|
41
39
|
const { t } = useTranslation();
|
|
42
|
-
const { refine }: any = rest;
|
|
43
40
|
const [editActive, setEditActive] = useState(false);
|
|
44
41
|
const settings = useAppSelector(state => state.settings);
|
|
45
42
|
const { preFilter } = useAppSelector(state => state.search);
|
|
@@ -60,12 +57,7 @@ function ImagePreviewMobileComponent({
|
|
|
60
57
|
history.push('/');
|
|
61
58
|
}
|
|
62
59
|
dispatch(reset(''));
|
|
63
|
-
|
|
64
|
-
// not an ideal solution: fixes text search not working after removing image
|
|
65
|
-
setTimeout(() => {
|
|
66
|
-
refine(searchQuery);
|
|
67
|
-
}, 100);
|
|
68
|
-
}
|
|
60
|
+
|
|
69
61
|
if (!isAlgoliaEnabled) {
|
|
70
62
|
let payload: any;
|
|
71
63
|
let filters: any[] = [];
|
|
@@ -127,7 +119,6 @@ function ImagePreviewMobileComponent({
|
|
|
127
119
|
<Preview
|
|
128
120
|
key={requestImage?.id}
|
|
129
121
|
onSelectionChange={(r: RectCoords) => {
|
|
130
|
-
setImageSelection(r);
|
|
131
122
|
debouncedOnImageSelectionChange(r);
|
|
132
123
|
}}
|
|
133
124
|
image={requestImage?.canvas}
|
|
@@ -147,6 +138,7 @@ function ImagePreviewMobileComponent({
|
|
|
147
138
|
setEditActive(true);
|
|
148
139
|
}}
|
|
149
140
|
showGrip={editActive}
|
|
141
|
+
draggable={editActive ? true : false}
|
|
150
142
|
/>
|
|
151
143
|
</div>
|
|
152
144
|
</Box>
|
|
@@ -234,7 +226,5 @@ function ImagePreviewMobileComponent({
|
|
|
234
226
|
</Box>
|
|
235
227
|
);
|
|
236
228
|
}
|
|
237
|
-
const ImagePreviewMobile =
|
|
238
|
-
memo(ImagePreviewMobileComponent),
|
|
239
|
-
);
|
|
229
|
+
const ImagePreviewMobile = memo(ImagePreviewMobileComponent);
|
|
240
230
|
export default ImagePreviewMobile;
|
|
@@ -3,7 +3,11 @@ import { ReactNode } from 'components/common';
|
|
|
3
3
|
import React, { memo, useEffect, useState } from 'react';
|
|
4
4
|
import { useMediaQuery } from 'react-responsive';
|
|
5
5
|
import { useHistory } from 'react-router-dom';
|
|
6
|
-
import {
|
|
6
|
+
import {
|
|
7
|
+
clearPostFilter,
|
|
8
|
+
onResetRequestImage,
|
|
9
|
+
setUpdateSession,
|
|
10
|
+
} from 'Store/search/Search';
|
|
7
11
|
import { useAppDispatch, useAppSelector } from 'Store/Store';
|
|
8
12
|
import { AppState } from '../types';
|
|
9
13
|
import './appMobile.scss';
|
|
@@ -22,6 +26,7 @@ import { translations } from 'translations';
|
|
|
22
26
|
import { useAuth0 } from '@auth0/auth0-react';
|
|
23
27
|
import InstantSearchProvider from './Provider/InstantSearchProvider';
|
|
24
28
|
import PoweredByNyris from './PoweredByNyris';
|
|
29
|
+
import { useQuery } from 'hooks/useQuery';
|
|
25
30
|
|
|
26
31
|
declare var psol: any;
|
|
27
32
|
|
|
@@ -64,6 +69,9 @@ function Layout({ children }: ReactNode): JSX.Element {
|
|
|
64
69
|
const isMobile = useMediaQuery({ query: '(max-width: 776px)' });
|
|
65
70
|
const [isOpenFilter, setOpenFilter] = useState<boolean>(false);
|
|
66
71
|
const history = useHistory();
|
|
72
|
+
const query = useQuery();
|
|
73
|
+
const searchQuery = query.get('query') || '';
|
|
74
|
+
|
|
67
75
|
let isShowHeaderMobile =
|
|
68
76
|
(isMobile && history.location?.pathname === '/result') ||
|
|
69
77
|
history.location?.pathname === '/';
|
|
@@ -120,6 +128,16 @@ function Layout({ children }: ReactNode): JSX.Element {
|
|
|
120
128
|
};
|
|
121
129
|
}, []);
|
|
122
130
|
|
|
131
|
+
useEffect(() => {
|
|
132
|
+
if (!(search.requestImage && searchQuery)) {
|
|
133
|
+
dispatch(clearPostFilter());
|
|
134
|
+
}
|
|
135
|
+
}, [search.requestImage, searchQuery, dispatch, search.regions]);
|
|
136
|
+
|
|
137
|
+
useEffect(() => {
|
|
138
|
+
dispatch(clearPostFilter());
|
|
139
|
+
}, [dispatch, search.selectedRegion]);
|
|
140
|
+
|
|
123
141
|
return (
|
|
124
142
|
<div style={{ position: 'relative' }}>
|
|
125
143
|
{loadingSearchAlgolia && (
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import React, { memo } from 'react';
|
|
2
|
-
|
|
2
|
+
|
|
3
|
+
import PostFilterPanel from './PanelResult/PostFilter';
|
|
4
|
+
import PostFilterPanelAlgolia from './PanelResult/PostFilterAlgolia';
|
|
3
5
|
|
|
4
6
|
import { connectStateResults } from 'react-instantsearch-dom';
|
|
7
|
+
import { useAppSelector } from 'Store/Store';
|
|
5
8
|
|
|
6
9
|
interface Props {
|
|
7
10
|
allSearchResults: any;
|
|
@@ -9,11 +12,17 @@ interface Props {
|
|
|
9
12
|
}
|
|
10
13
|
|
|
11
14
|
function MobilePostFilter(props: Props) {
|
|
15
|
+
const settings = useAppSelector(state => state.settings);
|
|
12
16
|
return (
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
+
<>
|
|
18
|
+
{settings.algolia.enabled && (
|
|
19
|
+
<PostFilterPanelAlgolia
|
|
20
|
+
disjunctiveFacets={props?.allSearchResults?.disjunctiveFacets}
|
|
21
|
+
onApply={props.onApply}
|
|
22
|
+
/>
|
|
23
|
+
)}
|
|
24
|
+
{!settings.algolia.enabled && <PostFilterPanel onApply={props.onApply} />}
|
|
25
|
+
</>
|
|
17
26
|
);
|
|
18
27
|
}
|
|
19
28
|
|