@nyris/nyris-webapp 0.3.35 → 0.3.36

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.
Files changed (57) hide show
  1. package/build/asset-manifest.json +13 -13
  2. package/build/index.html +1 -1
  3. package/build/{precache-manifest.375ac411683570ee1df5aea6de03409d.js → precache-manifest.a2657ad49c132fb9c82629d37be15547.js} +14 -14
  4. package/build/service-worker.js +1 -1
  5. package/build/static/css/main.41fb4769.chunk.css +2 -0
  6. package/build/static/css/main.41fb4769.chunk.css.map +1 -0
  7. package/build/static/js/2.ff44260e.chunk.js +3 -0
  8. package/build/static/js/2.ff44260e.chunk.js.map +1 -0
  9. package/build/static/js/main.0b3b11fc.chunk.js +3 -0
  10. package/build/static/js/main.0b3b11fc.chunk.js.map +1 -0
  11. package/build/static/media/error.48b946a9.svg +3 -0
  12. package/package.json +3 -3
  13. package/public/index.html +13 -0
  14. package/src/Store/search/Search.ts +4 -4
  15. package/src/Store/search/search.initialState.ts +1 -1
  16. package/src/Store/search/types.ts +1 -1
  17. package/src/common/assets/icons/arrow_left.svg +3 -0
  18. package/src/common/assets/icons/arrow_right.svg +3 -0
  19. package/src/common/assets/icons/error.svg +3 -0
  20. package/src/components/AppMobile.tsx +111 -0
  21. package/src/components/DragDropFile.tsx +5 -4
  22. package/src/components/FooterMobile.tsx +8 -2
  23. package/src/components/Header.tsx +2 -1
  24. package/src/components/HeaderMobile.tsx +5 -3
  25. package/src/components/ImageCaptureHelpModal.tsx +7 -1
  26. package/src/components/ImagePreviewMobile.tsx +87 -0
  27. package/src/components/Layout.tsx +32 -92
  28. package/src/components/ProductList/index.tsx +4 -1
  29. package/src/components/RfqBanner.tsx +120 -0
  30. package/src/components/SidePanel.tsx +147 -0
  31. package/src/components/appMobile.scss +147 -142
  32. package/src/components/drawer/cameraCustom.tsx +5 -4
  33. package/src/components/input/inputSearch.tsx +12 -7
  34. package/src/components/modal/DefaultModal.tsx +1 -1
  35. package/src/components/pre-filter/index.tsx +108 -51
  36. package/src/components/results/ItemResult.tsx +1 -1
  37. package/src/components/rfq/RfqModal.tsx +262 -0
  38. package/src/helpers/ToastHelper.ts +10 -0
  39. package/src/helpers/getCroppedCanvas.ts +26 -0
  40. package/src/hooks/useFilteredRegions.ts +37 -0
  41. package/src/index.css +0 -4
  42. package/src/page/landingPage/AppMD.tsx +0 -11
  43. package/src/page/landingPage/AppMobile.tsx +1 -0
  44. package/src/page/landingPage/common.scss +41 -58
  45. package/src/page/result/index.tsx +256 -309
  46. package/src/translations.ts +2 -2
  47. package/src/types.ts +1 -0
  48. package/src/utils.ts +0 -1
  49. package/build/static/css/main.f5a1c730.chunk.css +0 -2
  50. package/build/static/css/main.f5a1c730.chunk.css.map +0 -1
  51. package/build/static/js/2.724f4cba.chunk.js +0 -3
  52. package/build/static/js/2.724f4cba.chunk.js.map +0 -1
  53. package/build/static/js/main.f579fa9f.chunk.js +0 -3
  54. package/build/static/js/main.f579fa9f.chunk.js.map +0 -1
  55. package/build/static/media/support3.4a17f96e.svg +0 -3
  56. /package/build/static/js/{2.724f4cba.chunk.js.LICENSE.txt → 2.ff44260e.chunk.js.LICENSE.txt} +0 -0
  57. /package/build/static/js/{main.f579fa9f.chunk.js.LICENSE.txt → main.0b3b11fc.chunk.js.LICENSE.txt} +0 -0
@@ -0,0 +1,3 @@
1
+ <svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="M10 0.000191037C8.68453 -0.0079651 7.38053 0.245119 6.16361 0.744768C4.94669 1.24442 3.84108 1.98069 2.91088 2.91088C1.98069 3.84108 1.24442 4.94669 0.744768 6.16361C0.245119 7.38053 -0.0079651 8.68453 0.000191037 10C-0.0079651 11.3155 0.245119 12.6195 0.744768 13.8364C1.24442 15.0533 1.98069 16.1589 2.91088 17.0891C3.84108 18.0193 4.94669 18.7556 6.16361 19.2552C7.38053 19.7549 8.68453 20.008 10 19.9998C11.3155 20.008 12.6195 19.7549 13.8364 19.2552C15.0533 18.7556 16.1589 18.0193 17.0891 17.0891C18.0193 16.1589 18.7556 15.0533 19.2552 13.8364C19.7549 12.6195 20.008 11.3155 19.9998 10C20.008 8.68453 19.7549 7.38053 19.2552 6.16361C18.7556 4.94669 18.0193 3.84108 17.0891 2.91088C16.1589 1.98069 15.0533 1.24442 13.8364 0.744768C12.6195 0.245119 11.3155 -0.0079651 10 0.000191037ZM13.8891 14.9999L5.0001 6.11129L6.11129 5.0001L14.9999 13.8891L13.8891 14.9999Z" fill="#E31B5D"/>
3
+ </svg>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nyris/nyris-webapp",
3
- "version": "0.3.35",
3
+ "version": "0.3.36",
4
4
  "homepage": "./",
5
5
  "dependencies": {
6
6
  "@algolia/autocomplete-js": "^1.7.1",
@@ -12,8 +12,8 @@
12
12
  "@material-ui/data-grid": "^4.0.0-alpha.37",
13
13
  "@material-ui/icons": "^4.4.1",
14
14
  "@material-ui/lab": "^4.0.0-alpha.60",
15
- "@nyris/nyris-api": "^0.3.35",
16
- "@nyris/nyris-react-components": "^0.3.35",
15
+ "@nyris/nyris-api": "^0.3.36",
16
+ "@nyris/nyris-react-components": "^0.3.36",
17
17
  "@reduxjs/toolkit": "^1.6.1",
18
18
  "@splidejs/react-splide": "^0.7.12",
19
19
  "@types/blueimp-load-image": "^2.23.4",
package/public/index.html CHANGED
@@ -107,6 +107,19 @@
107
107
  <script async src="https://www.google-analytics.com/analytics.js"></script>
108
108
  <!-- End Google Analytics -->
109
109
 
110
+ <!-- Piwik Analytics -->
111
+ <script type="text/javascript">
112
+ (function(window, document, dataLayerName, id) {
113
+ window[dataLayerName]=window[dataLayerName]||[],window[dataLayerName].push({start:(new Date).getTime(),event:"stg.start"});var scripts=document.getElementsByTagName('script')[0],tags=document.createElement('script');
114
+ function stgCreateCookie(a,b,c){var d="";if(c){var e=new Date;e.setTime(e.getTime()+24*c*60*60*1e3),d="; expires="+e.toUTCString();f="; SameSite=Strict"}document.cookie=a+"="+b+d+f+"; path=/"}
115
+ var isStgDebug=(window.location.href.match("stg_debug")||document.cookie.match("stg_debug"))&&!window.location.href.match("stg_disable_debug");stgCreateCookie("stg_debug",isStgDebug?1:"",isStgDebug?14:-1);
116
+ var qP=[];dataLayerName!=="dataLayer"&&qP.push("data_layer_name="+dataLayerName),isStgDebug&&qP.push("stg_debug");var qPString=qP.length>0?("?"+qP.join("&")):"";
117
+ tags.async=!0,tags.src="https://marium.containers.piwik.pro/"+id+".js"+qPString,scripts.parentNode.insertBefore(tags,scripts);
118
+ !function(a,n,i){a[n]=a[n]||{};for(var c=0;c<i.length;c++)!function(i){a[n][i]=a[n][i]||{},a[n][i].api=a[n][i].api||function(){var a=[].slice.call(arguments,0);"string"==typeof a[0]&&window[dataLayerName].push({event:n+"."+i+":"+a[0],parameters:[].slice.call(arguments,1)})}}(i[c])}(window,"ppms",["tm","cm"]);
119
+ })(window, document, 'dataLayer', '94dae4cc-0947-4fee-b515-08fc58c1e7bc');
120
+ </script>
121
+ <!-- End Piwik Analytics -->
122
+
110
123
  <script
111
124
  src="https://863a167094994e54bc22149eafac1699.js.ubembed.com"
112
125
  async
@@ -149,7 +149,7 @@ export const searchSlice = createSlice({
149
149
  imageThumbSearchInput: '',
150
150
  textSearchInputMobile: '',
151
151
  isShowModalDetailItemMobile: false,
152
- keyFilter: state.keyFilter || '',
152
+ preFilter: state.preFilter || {},
153
153
  preFilterDropdown: false,
154
154
  imageCaptureHelpModal: false,
155
155
  };
@@ -229,11 +229,11 @@ export const searchSlice = createSlice({
229
229
  isShowModalDetailItemMobile: payload,
230
230
  };
231
231
  },
232
- setUpdateKeyFilterDesktop: (state, data: PayloadAction<string>) => {
232
+ setPreFilter: (state, data: PayloadAction<Record<string, boolean>>) => {
233
233
  const { payload } = data;
234
234
  return {
235
235
  ...state,
236
- keyFilter: payload,
236
+ preFilter: payload,
237
237
  };
238
238
  },
239
239
  setPreFilterDropdown: (state, data: PayloadAction<boolean>) => {
@@ -277,7 +277,7 @@ export const {
277
277
  setRequestImage,
278
278
  setSearchResults,
279
279
  setSelectedRegion,
280
- setUpdateKeyFilterDesktop,
280
+ setPreFilter,
281
281
  setUpdateSession,
282
282
  updateResultChangePosition,
283
283
  updateResults,
@@ -11,7 +11,7 @@ export const initialState: SearchState = {
11
11
  filters: [],
12
12
  imageThumbSearchInput: '',
13
13
  isShowModalDetailItemMobile: false,
14
- keyFilter: '',
14
+ preFilter: {},
15
15
  loadingSearchAlgolia: false,
16
16
  preFilterDropdown: false,
17
17
  imageCaptureHelpModal: false,
@@ -18,7 +18,7 @@ export interface SearchState {
18
18
  filters: any[];
19
19
  imageThumbSearchInput?: any;
20
20
  isShowModalDetailItemMobile?: boolean;
21
- keyFilter?: string;
21
+ preFilter: Record<string, boolean>;
22
22
  loadingSearchAlgolia: boolean;
23
23
  preFilterDropdown?: boolean;
24
24
  imageCaptureHelpModal?: boolean;
@@ -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="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="M10 0.000191037C8.68453 -0.0079651 7.38053 0.245119 6.16361 0.744768C4.94669 1.24442 3.84108 1.98069 2.91088 2.91088C1.98069 3.84108 1.24442 4.94669 0.744768 6.16361C0.245119 7.38053 -0.0079651 8.68453 0.000191037 10C-0.0079651 11.3155 0.245119 12.6195 0.744768 13.8364C1.24442 15.0533 1.98069 16.1589 2.91088 17.0891C3.84108 18.0193 4.94669 18.7556 6.16361 19.2552C7.38053 19.7549 8.68453 20.008 10 19.9998C11.3155 20.008 12.6195 19.7549 13.8364 19.2552C15.0533 18.7556 16.1589 18.0193 17.0891 17.0891C18.0193 16.1589 18.7556 15.0533 19.2552 13.8364C19.7549 12.6195 20.008 11.3155 19.9998 10C20.008 8.68453 19.7549 7.38053 19.2552 6.16361C18.7556 4.94669 18.0193 3.84108 17.0891 2.91088C16.1589 1.98069 15.0533 1.24442 13.8364 0.744768C12.6195 0.245119 11.3155 -0.0079651 10 0.000191037ZM13.8891 14.9999L5.0001 6.11129L6.11129 5.0001L14.9999 13.8891L13.8891 14.9999Z" fill="#E31B5D"/>
3
+ </svg>
@@ -0,0 +1,111 @@
1
+ import React, { ReactNode, useState } from 'react';
2
+ import HeaderMobile from './HeaderMobile';
3
+ import { Box } from '@material-ui/core';
4
+ import {
5
+ setPreFilterDropdown,
6
+ setImageCaptureHelpModal,
7
+ } from 'Store/search/Search';
8
+ import { isUndefined } from 'lodash';
9
+ import ImageCaptureHelpModal from './ImageCaptureHelpModal';
10
+ import MobilePostFilter from './MobilePostFilter';
11
+ import PreFilterComponent from './pre-filter';
12
+ import { useAppDispatch, useAppSelector } from 'Store/Store';
13
+ import { AppState } from 'types';
14
+ import FooterMobile from './FooterMobile';
15
+
16
+ function AppMobile({ children }: { children: ReactNode }) {
17
+ const dispatch = useAppDispatch();
18
+ const { search } = useAppSelector<AppState>((state: any) => state);
19
+ const { preFilterDropdown, imageCaptureHelpModal } = search;
20
+ const [isOpenFilter, setOpenFilter] = useState<boolean>(false);
21
+
22
+ return (
23
+ <>
24
+ <div className="wrap-mobile">
25
+ <div className="box-header-mobile-main">
26
+ <HeaderMobile
27
+ onToggleFilterMobile={(show: boolean) => {
28
+ setOpenFilter(isUndefined(show) ? !isOpenFilter : show);
29
+ }}
30
+ />
31
+ </div>
32
+ <div
33
+ style={{
34
+ display: 'flex',
35
+ flexGrow: 1,
36
+ flexDirection: 'column',
37
+ overflowY: 'auto',
38
+ overflowX: 'hidden',
39
+ }}
40
+ >
41
+ {children}
42
+ </div>
43
+ <div
44
+ className="footer-wrap-main"
45
+ style={{
46
+ zIndex: 999,
47
+ }}
48
+ >
49
+ <FooterMobile />
50
+ </div>
51
+ </div>
52
+ <Box
53
+ className={`box-filter ${isOpenFilter ? 'open' : 'close'} `}
54
+ position={'absolute'}
55
+ style={{
56
+ top: '0px',
57
+ height: '100%',
58
+ width: '100%',
59
+ }}
60
+ >
61
+ <MobilePostFilter
62
+ onApply={() => {
63
+ setOpenFilter(!isOpenFilter);
64
+ }}
65
+ />
66
+ </Box>
67
+
68
+ {preFilterDropdown && (
69
+ <Box
70
+ className={`box-filter open`}
71
+ position={'absolute'}
72
+ style={{ top: '0px', height: '100%', width: '100%', zIndex: 999 }}
73
+ >
74
+ <div style={{ width: '100%' }} className={'wrap-filter-desktop'}>
75
+ <div className={'bg-white box-filter-desktop isMobile'}>
76
+ <PreFilterComponent
77
+ handleClose={() =>
78
+ dispatch(setPreFilterDropdown(!preFilterDropdown))
79
+ }
80
+ />
81
+ </div>
82
+ </div>
83
+ </Box>
84
+ )}
85
+
86
+ {imageCaptureHelpModal && (
87
+ <Box
88
+ className={`box-filter open`}
89
+ position={'absolute'}
90
+ style={{
91
+ top: '0px',
92
+ width: '100%',
93
+ zIndex: 100,
94
+ }}
95
+ >
96
+ <div style={{ width: '100%' }} className={'wrap-filter-desktop'}>
97
+ <div className={'bg-white box-filter-desktop isMobile'}>
98
+ <ImageCaptureHelpModal
99
+ handleClose={() =>
100
+ dispatch(setImageCaptureHelpModal(!imageCaptureHelpModal))
101
+ }
102
+ />
103
+ </div>
104
+ </div>
105
+ </Box>
106
+ )}
107
+ </>
108
+ );
109
+ }
110
+
111
+ export default AppMobile;
@@ -19,6 +19,7 @@ import { useState } from 'react';
19
19
  import IconUpload from 'common/assets/images/Icon_Upload.svg';
20
20
  import { RectCoords } from '@nyris/nyris-api';
21
21
  import { useTranslation } from 'react-i18next';
22
+ import { isEmpty } from 'lodash';
22
23
 
23
24
  interface Props {
24
25
  acceptTypes: any;
@@ -33,7 +34,7 @@ function DragDropFile(props: Props) {
33
34
  const searchState = useAppSelector(state => state);
34
35
  const {
35
36
  settings,
36
- search: { keyFilter },
37
+ search: { preFilter },
37
38
  } = searchState;
38
39
  const [isLoadingLoadFile, setLoadingLoadFile] = useState<any>(false);
39
40
  const { t } = useTranslation();
@@ -50,10 +51,10 @@ function DragDropFile(props: Props) {
50
51
  dispatch(setImageSearchInput(URL.createObjectURL(fs[0])));
51
52
  let image = await createImage(fs[0]);
52
53
  dispatch(setRequestImage(image));
53
- const preFilter = [
54
+ const preFilterValues = [
54
55
  {
55
56
  key: settings.visualSearchFilterKey,
56
- values: [`${keyFilter}`],
57
+ values: Object.keys(preFilter) as string[],
57
58
  },
58
59
  ];
59
60
  let region: RectCoords | undefined;
@@ -68,7 +69,7 @@ function DragDropFile(props: Props) {
68
69
  image,
69
70
  settings,
70
71
  region,
71
- filters: keyFilter ? preFilter : undefined,
72
+ filters: !isEmpty(preFilter) ? preFilterValues : undefined,
72
73
  }).then((res: any) => {
73
74
  res?.results.map((item: any) => {
74
75
  filters.push({
@@ -6,7 +6,11 @@ import { ReactComponent as Home } from 'common/assets/icons/home.svg';
6
6
  import { NavLink, useHistory } from 'react-router-dom';
7
7
  import { useAppDispatch, useAppSelector } from 'Store/Store';
8
8
  import { ReactComponent as IconInfo } from 'common/assets/icons/info-tooltip.svg';
9
- import { setImageCaptureHelpModal } from 'Store/search/Search';
9
+ import {
10
+ reset,
11
+ setImageCaptureHelpModal,
12
+ setPreFilter,
13
+ } from 'Store/search/Search';
10
14
 
11
15
  interface Props {
12
16
  onLoadingMobile?: any;
@@ -30,7 +34,7 @@ function FooterMobile(props: Props): JSX.Element {
30
34
  alignItems={'center'}
31
35
  height={'100%'}
32
36
  justifyContent={'space-between'}
33
- style={{ paddingLeft: '40px', paddingRight: '40px' }}
37
+ style={{ paddingLeft: '40px', paddingRight: '40px', height: '64px' }}
34
38
  >
35
39
  <NavLink
36
40
  style={{
@@ -49,6 +53,8 @@ function FooterMobile(props: Props): JSX.Element {
49
53
  to={'/'}
50
54
  className="nav-link p-0 menu-children rounded-0"
51
55
  onClick={() => {
56
+ dispatch(reset(''));
57
+ dispatch(setPreFilter({}));
52
58
  dispatch(setImageCaptureHelpModal(false));
53
59
  }}
54
60
  >
@@ -3,7 +3,7 @@ import React from 'react';
3
3
  import { NavLink } from 'react-router-dom';
4
4
  import './common.scss';
5
5
  import { useAppDispatch, useAppSelector } from 'Store/Store';
6
- import { reset } from 'Store/search/Search';
6
+ import { reset, setPreFilter } from 'Store/search/Search';
7
7
 
8
8
  function Header(): JSX.Element {
9
9
  const dispatch = useAppDispatch();
@@ -15,6 +15,7 @@ function Header(): JSX.Element {
15
15
  style={{ lineHeight: 0, paddingLeft: '10px' }}
16
16
  onClick={() => {
17
17
  dispatch(reset(''));
18
+ dispatch(setPreFilter({}));
18
19
  }}
19
20
  >
20
21
  <img
@@ -16,6 +16,7 @@ import {
16
16
  reset,
17
17
  updateValueTextSearchMobile,
18
18
  setPreFilterDropdown,
19
+ setPreFilter,
19
20
  } from 'Store/search/Search';
20
21
  import { useAppDispatch, useAppSelector } from 'Store/Store';
21
22
  import { AppState } from 'types';
@@ -39,7 +40,7 @@ function HeaderMobileComponent(props: Props): JSX.Element {
39
40
  const {
40
41
  imageThumbSearchInput,
41
42
  textSearchInputMobile,
42
- keyFilter,
43
+ preFilter,
43
44
  preFilterDropdown,
44
45
  valueTextSearch,
45
46
  } = search;
@@ -141,6 +142,7 @@ function HeaderMobileComponent(props: Props): JSX.Element {
141
142
  style={{ lineHeight: 0, paddingLeft: '10px' }}
142
143
  onClick={() => {
143
144
  dispatch(reset(''));
145
+ dispatch(setPreFilter({}));
144
146
  }}
145
147
  >
146
148
  <img
@@ -194,7 +196,7 @@ function HeaderMobileComponent(props: Props): JSX.Element {
194
196
  <div
195
197
  className="icon-hover"
196
198
  style={{
197
- ...(keyFilter
199
+ ...(!isEmpty(preFilter)
198
200
  ? {
199
201
  backgroundColor: `${settings.theme?.primaryColor}`,
200
202
  }
@@ -209,7 +211,7 @@ function HeaderMobileComponent(props: Props): JSX.Element {
209
211
  {!settings.preFilterOption && (
210
212
  <IconSearch width={16} height={16} />
211
213
  )}
212
- {keyFilter && (
214
+ {!isEmpty(preFilter) && (
213
215
  <div
214
216
  style={{
215
217
  position: 'absolute',
@@ -9,7 +9,13 @@ interface Props {
9
9
 
10
10
  function ImageCaptureHelpModal({ handleClose }: Props) {
11
11
  return (
12
- <Box style={{ paddingLeft: '24px', paddingRight: '24px' }}>
12
+ <Box
13
+ style={{
14
+ paddingLeft: '24px',
15
+ paddingRight: '24px',
16
+ paddingBottom: '24px',
17
+ }}
18
+ >
13
19
  <Box
14
20
  display={'flex'}
15
21
  justifyContent={'end'}
@@ -0,0 +1,87 @@
1
+ import React from 'react';
2
+ import { Box, Typography } from '@material-ui/core';
3
+ import { RectCoords } from '@nyris/nyris-api';
4
+ import { Preview } from '@nyris/nyris-react-components';
5
+ import { DEFAULT_REGION } from '../constants';
6
+ import { ReactComponent as IconInfo } from 'common/assets/icons/info-tooltip.svg';
7
+ import { useTranslation } from 'react-i18next';
8
+
9
+ function ImagePreviewMobile({
10
+ requestImage,
11
+ imageSelection,
12
+ setImageSelection,
13
+ debouncedOnImageSelectionChange,
14
+ filteredRegions,
15
+ showAdjustInfo,
16
+ showAdjustInfoBasedOnConfidence,
17
+ }: {
18
+ requestImage: any;
19
+ imageSelection: any;
20
+ setImageSelection: any;
21
+ debouncedOnImageSelectionChange: any;
22
+ filteredRegions: any;
23
+ showAdjustInfoBasedOnConfidence: any;
24
+ showAdjustInfo: any;
25
+ }) {
26
+ const { t } = useTranslation();
27
+
28
+ return (
29
+ <Box
30
+ className="col-left"
31
+ style={{
32
+ backgroundColor: '#AAABB5',
33
+ marginBottom: '15px',
34
+ }}
35
+ >
36
+ {
37
+ <Box className="box-preview">
38
+ <Box className="preview-item" style={{ backgroundColor: 'white' }}>
39
+ <Preview
40
+ key={requestImage?.id}
41
+ onSelectionChange={(r: RectCoords) => {
42
+ setImageSelection(r);
43
+ debouncedOnImageSelectionChange(r);
44
+ }}
45
+ image={requestImage?.canvas}
46
+ selection={imageSelection || DEFAULT_REGION}
47
+ regions={filteredRegions}
48
+ maxWidth={240}
49
+ maxHeight={240}
50
+ dotColor={'#FBD914'}
51
+ minCropWidth={60}
52
+ minCropHeight={60}
53
+ rounded={false}
54
+ />
55
+ </Box>
56
+ {(showAdjustInfoBasedOnConfidence || showAdjustInfo) && (
57
+ <Box
58
+ className="box-title_col-left"
59
+ alignItems="center"
60
+ style={{
61
+ backgroundColor: '#3E36DC',
62
+ display: 'flex',
63
+ columnGap: '6px',
64
+ padding: '5px',
65
+ width: 'fit-content',
66
+ }}
67
+ >
68
+ <IconInfo color="white" />
69
+ <Typography
70
+ style={{
71
+ fontSize: 10,
72
+ color: '#fff',
73
+ }}
74
+ >
75
+ {showAdjustInfo
76
+ ? t('Crop the image for better results')
77
+ : 'Crop the image for better results'}
78
+ </Typography>
79
+ </Box>
80
+ )}
81
+ </Box>
82
+ }
83
+ </Box>
84
+ );
85
+ }
86
+
87
+ export default ImagePreviewMobile;
@@ -9,8 +9,6 @@ import { useHistory } from 'react-router-dom';
9
9
  import {
10
10
  changeValueTextSearch,
11
11
  onResetRequestImage,
12
- setImageCaptureHelpModal,
13
- setPreFilterDropdown,
14
12
  setUpdateSession,
15
13
  } from 'Store/search/Search';
16
14
  import { useAppDispatch, useAppSelector } from 'Store/Store';
@@ -20,21 +18,14 @@ import './common.scss';
20
18
  import FooterMobile from './FooterMobile';
21
19
  import HeaderMobile from './HeaderMobile';
22
20
  import Header from './Header';
23
- import PreFilterComponent from 'components/pre-filter';
24
21
  import { createSessionByApi } from 'services/session';
25
22
  import { isUndefined } from 'lodash';
26
- import ImageCaptureHelpModal from './ImageCaptureHelpModal';
27
- import MobilePostFilter from './MobilePostFilter';
23
+ import AppMobile from './AppMobile';
28
24
 
29
25
  function Layout({ children }: ReactNode): JSX.Element {
30
26
  const dispatch = useAppDispatch();
31
27
  const { settings, search } = useAppSelector<AppState>((state: any) => state);
32
- const {
33
- valueTextSearch,
34
- loadingSearchAlgolia,
35
- preFilterDropdown,
36
- imageCaptureHelpModal,
37
- } = search;
28
+ const { valueTextSearch, loadingSearchAlgolia } = search;
38
29
  const { apiKey, appId, indexName } = settings.algolia as AlgoliaSettings;
39
30
  const isMobile = useMediaQuery({ query: '(max-width: 776px)' });
40
31
  const [isOpenFilter, setOpenFilter] = useState<boolean>(false);
@@ -102,7 +93,7 @@ function Layout({ children }: ReactNode): JSX.Element {
102
93
  }, [apiKey, appId, indexName]);
103
94
 
104
95
  return (
105
- <Box position={'relative'} className="wrap-mobile">
96
+ <div style={{ position: 'relative' }}>
106
97
  {loadingSearchAlgolia && (
107
98
  <Box className="box-wrap-loading" style={{ zIndex: 99999999 }}>
108
99
  <Box className="loadingSpinCT" style={{ top: 0, bottom: 0 }}>
@@ -120,93 +111,42 @@ function Layout({ children }: ReactNode): JSX.Element {
120
111
  }
121
112
  }}
122
113
  >
123
- <div className={`layout-main-${classNameBoxVersion}`}>
124
- <div
125
- className={
126
- !isMobile
127
- ? `box-header-${classNameBoxVersion}-main`
128
- : isShowHeaderMobile
129
- ? `box-header-${classNameBoxVersion}-main`
130
- : ''
131
- }
132
- style={{
133
- ...(classNameBoxVersion === 'newVersion'
134
- ? { background: settings.theme?.headerColor }
135
- : {}),
136
- }}
137
- >
138
- <HeaderApp
139
- onToggleFilterMobile={(show: boolean) => {
140
- setOpenFilter(isUndefined(show) ? !isOpenFilter : show);
141
- }}
142
- />
143
- </div>
144
-
145
- <div className={`box-body-${classNameBoxVersion}-wrap-main`}>
146
- {children}
147
- </div>
148
- {isMobile && (
149
- <div className="footer-wrap-main">
150
- <FooterApp />
151
- </div>
152
- )}
153
- </div>
154
- {isMobile && (
155
- <Box
156
- className={`box-fillter ${isOpenFilter ? 'open' : 'close'} `}
157
- position={'absolute'}
158
- style={{ top: isOpenFilter ? '0px' : '', height: '100%' }}
159
- >
160
- <MobilePostFilter
161
- onApply={() => {
162
- setOpenFilter(!isOpenFilter);
163
- }}
164
- />
165
- </Box>
166
- )}
167
- {isMobile && preFilterDropdown && (
168
- <Box
169
- className={`box-fillter open`}
170
- position={'absolute'}
171
- style={{ top: '0px', height: '100%' }}
172
- >
114
+ {isMobile && <AppMobile>{children}</AppMobile>}
115
+ {!isMobile && (
116
+ <div className={`layout-main-${classNameBoxVersion}`}>
173
117
  <div
174
- style={{ width: !isMobile ? '90%' : '100%' }}
175
- className={'wrap-filter-desktop'}
118
+ className={
119
+ !isMobile
120
+ ? `box-header-${classNameBoxVersion}-main`
121
+ : isShowHeaderMobile
122
+ ? `box-header-${classNameBoxVersion}-main`
123
+ : ''
124
+ }
125
+ style={{
126
+ ...(classNameBoxVersion === 'newVersion'
127
+ ? { background: settings.theme?.headerColor }
128
+ : {}),
129
+ }}
176
130
  >
177
- <div className={'bg-white box-filter-desktop isMobile'}>
178
- <PreFilterComponent
179
- handleClose={() =>
180
- dispatch(setPreFilterDropdown(!preFilterDropdown))
181
- }
182
- />
183
- </div>
131
+ <HeaderApp
132
+ onToggleFilterMobile={(show: boolean) => {
133
+ setOpenFilter(isUndefined(show) ? !isOpenFilter : show);
134
+ }}
135
+ />
184
136
  </div>
185
- </Box>
186
- )}
187
137
 
188
- {isMobile && imageCaptureHelpModal && (
189
- <Box
190
- className={`box-fillter open`}
191
- position={'absolute'}
192
- style={{ top: '0px', height: 'calc(100% - 64px)' }}
193
- >
194
- <div
195
- style={{ width: !isMobile ? '90%' : '100%' }}
196
- className={'wrap-filter-desktop'}
197
- >
198
- <div className={'bg-white box-filter-desktop isMobile'}>
199
- <ImageCaptureHelpModal
200
- handleClose={() =>
201
- dispatch(setImageCaptureHelpModal(!imageCaptureHelpModal))
202
- }
203
- />
204
- </div>
138
+ <div className={`box-body-${classNameBoxVersion}-wrap-main`}>
139
+ {children}
205
140
  </div>
206
- </Box>
141
+ {isMobile && (
142
+ <div className="footer-wrap-main">
143
+ <FooterApp />
144
+ </div>
145
+ )}
146
+ </div>
207
147
  )}
208
148
  </InstantSearch>
209
- </Box>
149
+ </div>
210
150
  );
211
151
  }
212
152
 
@@ -3,6 +3,7 @@ import ItemResult from 'components/results/ItemResult';
3
3
  import { groupBy, uniqueId } from 'lodash';
4
4
  import React, { memo, useEffect, useMemo, useState } from 'react';
5
5
  import { connectStateResults } from 'react-instantsearch-dom';
6
+ import { useMediaQuery } from 'react-responsive';
6
7
  import { useAppSelector } from 'Store/Store';
7
8
  import { AppState } from 'types';
8
9
 
@@ -30,6 +31,7 @@ function ProductListComponent({
30
31
  const [hitGroups, setHitGroups] = useState<any>({});
31
32
  const [itemShowDefault, setItemShowDefault] = useState<any[]>([]);
32
33
  const [algoliaRequest, setAlgoliaRequest] = useState(false);
34
+ const isMobile = useMediaQuery({ query: '(max-width: 776px)' });
33
35
 
34
36
  useEffect(() => {
35
37
  if (isSearchStalled) {
@@ -134,7 +136,7 @@ function ProductListComponent({
134
136
  }
135
137
  return itemShowDefault.map((hit: any, i: number) => {
136
138
  return (
137
- <Box key={i}>
139
+ <Box key={i} style={{ height: 'fit-content' }}>
138
140
  <ItemResult
139
141
  dataItem={hit}
140
142
  indexItem={i}
@@ -169,6 +171,7 @@ function ProductListComponent({
169
171
  isSearchStalled,
170
172
  algoliaRequest,
171
173
  loadingSearchAlgolia,
174
+ isMobile,
172
175
  ]);
173
176
 
174
177
  return <>{renderItem}</>;