@nyris/nyris-webapp 0.3.57 → 0.3.59

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 (94) hide show
  1. package/build/asset-manifest.json +15 -16
  2. package/build/index.html +1 -1
  3. package/build/js/settings.example.js +1 -0
  4. package/build/static/css/main.cb6e2cfd.css +4 -0
  5. package/build/static/css/main.cb6e2cfd.css.map +1 -0
  6. package/build/static/js/main.a1e24447.js +3 -0
  7. package/build/static/js/{main.5143aa56.js.LICENSE.txt → main.a1e24447.js.LICENSE.txt} +55 -0
  8. package/build/static/js/main.a1e24447.js.map +1 -0
  9. package/build/static/media/camera_simple.bff4194954bbb5f4bc33bd99014a93e8.svg +3 -0
  10. package/build/static/media/collpase.50dae91fff891c46b10dfc281344d0ef.svg +6 -0
  11. package/build/static/media/crop.0676ebbbdc1375ed67e32bba890ce941.svg +3 -0
  12. package/build/static/media/{download.8007f7c72e2080a9ffa96fa63d480dcf.svg → download.a8452bc23334e9f8e53fe1225742d216.svg} +1 -1
  13. package/build/static/media/gallery.15d1f3308921480a8c9d96d9a77c9966.svg +3 -0
  14. package/build/static/media/{logout.b544fcd2969edf431a1e998333119834.svg → logout.bab56bd407f25eb34d6eff401a436ce1.svg} +1 -1
  15. package/build/static/media/next-arrow.b13263d05d107ceb5e99bc4fabb41279.svg +3 -0
  16. package/build/static/media/plus.329672cb2feb55345490589e91481b88.svg +3 -0
  17. package/package.json +8 -5
  18. package/public/index.html +0 -3
  19. package/public/js/settings.example.js +1 -0
  20. package/src/Router.tsx +2 -2
  21. package/src/Store/Store.ts +2 -0
  22. package/src/Store/requestStore.ts +70 -0
  23. package/src/Store/resultStore.ts +25 -0
  24. package/src/Store/search/Search.ts +2 -33
  25. package/src/Store/search/search.initialState.ts +1 -4
  26. package/src/Store/search/types.ts +0 -5
  27. package/src/common/assets/icons/arrow_enter.svg +3 -0
  28. package/src/common/assets/icons/camera_simple.svg +3 -0
  29. package/src/common/assets/icons/collpase.svg +6 -0
  30. package/src/common/assets/icons/crop.svg +3 -0
  31. package/src/common/assets/icons/download.svg +1 -1
  32. package/src/common/assets/icons/gallery.svg +3 -0
  33. package/src/common/assets/icons/logout.svg +1 -1
  34. package/src/common/assets/icons/next-arrow.svg +3 -0
  35. package/src/common/assets/icons/plus.svg +3 -0
  36. package/src/components/CadenasWebViewer.tsx +1 -1
  37. package/src/components/DragDropFile.tsx +17 -77
  38. package/src/components/Experience-visual-search/ExperienceVisualSearch.tsx +47 -71
  39. package/src/components/Feedback.tsx +23 -9
  40. package/src/components/GoBackButton.tsx +15 -18
  41. package/src/components/HeaderMobile.tsx +342 -246
  42. package/src/components/ImageCaptureHelpModal.tsx +63 -65
  43. package/src/components/ImagePreview.tsx +564 -0
  44. package/src/components/Inquiry/InquiryBanner.tsx +1 -1
  45. package/src/components/Inquiry/InquiryModal.tsx +4 -7
  46. package/src/components/Layout.tsx +9 -18
  47. package/src/components/MobileLayout.tsx +51 -0
  48. package/src/components/MobilePostFilter.tsx +9 -3
  49. package/src/components/PanelResult/PostFilterAlgolia.tsx +4 -32
  50. package/src/components/PanelResult/expandable-panel.tsx +3 -16
  51. package/src/components/PanelResult/virtual-state-results.ts +17 -22
  52. package/src/components/ProductDetailView.tsx +1 -1
  53. package/src/components/SidePanel.tsx +7 -97
  54. package/src/components/UploadDisclaimer.tsx +85 -0
  55. package/src/components/appMobile.scss +2 -2
  56. package/src/components/common.scss +57 -27
  57. package/src/components/drawer/cameraCustom.tsx +389 -231
  58. package/src/components/icon-label/icon-label.tsx +1 -1
  59. package/src/components/input/inputSearch.tsx +197 -338
  60. package/src/components/pre-filter/index.tsx +70 -72
  61. package/src/components/results/ItemResult.tsx +34 -17
  62. package/src/components/rfq/RfqBanner.tsx +1 -4
  63. package/src/components/rfq/RfqModal.tsx +10 -10
  64. package/src/hooks/useFilteredRegions.ts +1 -1
  65. package/src/hooks/useImageSearch.ts +189 -0
  66. package/src/hooks/useSearchOrRedirect.ts +84 -0
  67. package/src/index.css +4 -0
  68. package/src/page/landingPage/Home.tsx +49 -0
  69. package/src/page/landingPage/{AppMD.tsx → HomeDesktop.tsx} +7 -34
  70. package/src/page/landingPage/{AppMobile.tsx → HomeMobile.tsx} +8 -37
  71. package/src/page/landingPage/common.scss +9 -1
  72. package/src/page/result/index.tsx +118 -232
  73. package/src/services/Feedback.ts +4 -5
  74. package/src/services/image.ts +19 -0
  75. package/src/types.ts +9 -7
  76. package/src/utils.ts +44 -0
  77. package/tailwind.config.js +54 -0
  78. package/build/static/css/main.67965609.css +0 -2
  79. package/build/static/css/main.67965609.css.map +0 -1
  80. package/build/static/js/main.5143aa56.js +0 -3
  81. package/build/static/js/main.5143aa56.js.map +0 -1
  82. package/build/static/media/arrow_down.f417689ce292978a8292a7f00407fdd5.svg +0 -3
  83. package/build/static/media/arrow_left.73d03a534eaf9b99ab196e0fb67da602.svg +0 -3
  84. package/build/static/media/arrow_right.59a4594a3a1657037537dbae1eee0251.svg +0 -3
  85. package/build/static/media/arrow_up.85dbe70bc51ec32c8894a06499330f14.svg +0 -3
  86. package/build/static/media/home.9ffb65a9c0be8fc5a502ba05cf5f719c.svg +0 -3
  87. package/build/static/media/icon_camera_mobile.6772053c4dfef487255649d2a05cc9d4.svg +0 -3
  88. package/build/static/media/reverse_camera.cee0200b151941cc83c182167a85d667.svg +0 -5
  89. package/src/App.tsx +0 -18
  90. package/src/components/AppMobile.tsx +0 -117
  91. package/src/components/FooterMobile.tsx +0 -230
  92. package/src/components/ImagePreviewMobile.tsx +0 -237
  93. /package/build/static/media/{add.2b72cedb98c4c89c954266d2356c166c.svg → add-rounded.2b72cedb98c4c89c954266d2356c166c.svg} +0 -0
  94. /package/src/common/assets/icons/{add.svg → add-rounded.svg} +0 -0
@@ -1,3 +0,0 @@
1
- <svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
2
- <path d="M8.65944 10.4215C8.28211 10.7525 7.71789 10.7525 7.34056 10.4215L3.3956 6.96105C3.18599 6.77719 3.18599 6.45088 3.3956 6.26702C3.56978 6.11423 3.83022 6.11423 4.0044 6.26702L7.34056 9.19348C7.71789 9.52446 8.28211 9.52446 8.65944 9.19348L11.9956 6.26702C12.1698 6.11423 12.4302 6.11423 12.6044 6.26702C12.814 6.45088 12.814 6.77719 12.6044 6.96105L8.65944 10.4215Z" fill="#currentColor"/>
3
- </svg>
@@ -1,3 +0,0 @@
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>
@@ -1,3 +0,0 @@
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>
@@ -1,3 +0,0 @@
1
- <svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
2
- <path d="M8.65944 6.57845C8.28211 6.24747 7.71789 6.24747 7.34056 6.57845L3.3956 10.0389C3.18599 10.2228 3.18599 10.5491 3.3956 10.733C3.56978 10.8858 3.83022 10.8858 4.0044 10.733L7.34056 7.80652C7.71789 7.47554 8.28211 7.47554 8.65944 7.80652L11.9956 10.733C12.1698 10.8858 12.4302 10.8858 12.6044 10.733C12.814 10.5491 12.814 10.2228 12.6044 10.0389L8.65944 6.57845Z" fill="currentColor"/>
3
- </svg>
@@ -1,3 +0,0 @@
1
- <svg width="24" height="22" viewBox="0 0 22 21" style="enable-background:new 0 0 22 20.28;" xmlns="http://www.w3.org/2000/svg">
2
- <path class="st3" d="M 10.959 1.845 C 11.109 1.845 11.266 1.886 11.408 1.96 L 19.66 6.661 C 19.935 6.825 20.101 7.112 20.101 7.424 L 20.101 15.776 C 20.101 16.111 19.91 16.415 19.61 16.562 L 15.912 18.384 C 15.787 18.449 15.646 18.474 15.513 18.474 C 15.347 18.474 15.189 18.433 15.048 18.343 C 14.782 18.178 14.624 17.9 14.624 17.596 L 14.624 10.041 L 10.959 7.957 L 7.294 10.041 L 7.294 17.605 C 7.294 17.908 7.136 18.196 6.87 18.351 C 6.728 18.441 6.562 18.483 6.405 18.483 C 6.272 18.483 6.13 18.449 6.006 18.392 L 2.307 16.57 C 2.008 16.415 1.817 16.111 1.817 15.776 L 1.817 7.424 C 1.817 7.112 1.983 6.817 2.265 6.661 L 10.519 1.96 C 10.651 1.886 10.801 1.845 10.959 1.845 M 10.959 0.205 C 10.51 0.205 10.069 0.32 9.679 0.541 L 1.426 5.242 C 0.645 5.693 0.155 6.529 0.155 7.424 L 0.155 15.776 C 0.155 16.735 0.695 17.596 1.568 18.031 L 5.266 19.852 C 5.615 20.025 6.014 20.115 6.405 20.115 C 6.878 20.115 7.343 19.984 7.742 19.738 C 8.499 19.278 8.956 18.474 8.956 17.596 L 8.956 10.984 L 10.959 9.844 L 12.962 10.984 L 12.962 17.596 C 12.962 18.474 13.41 19.278 14.175 19.738 C 14.583 19.984 15.039 20.115 15.522 20.115 C 15.912 20.115 16.311 20.025 16.66 19.852 L 20.359 18.031 C 21.231 17.605 21.771 16.735 21.771 15.776 L 21.771 7.424 C 21.771 6.529 21.281 5.693 20.492 5.242 L 12.239 0.541 C 11.848 0.32 11.408 0.205 10.959 0.205 Z" fill="currentColor" transform="matrix(0.999999, 0.00121, -0.00121, 0.999999, 0.012302, -0.013258)"/>
3
- </svg>
@@ -1,3 +0,0 @@
1
- <svg width="28" height="28" viewBox="0 0 28 28" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
2
- <path fill-rule="evenodd" clip-rule="evenodd" d="M28 24C28 24.5523 27.5523 25 27 25H1C0.447715 25 0 24.5523 0 24V7C0 6.44772 0.447715 6 1 6H7.46L9.17 3.45C9.35398 3.17061 9.66548 3.00173 10 3H18C18.3345 3.00173 18.646 3.17061 18.83 3.45L20.54 6H27C27.5523 6 28 6.44772 28 7V24ZM2 23H26V8H20C19.6655 7.99827 19.354 7.82939 19.17 7.55L17.46 5H10.54L8.83 7.55C8.64602 7.82939 8.33452 7.99827 8 8H2V23ZM14 21C10.6863 21 8 18.3137 8 15C8 11.6863 10.6863 9 14 9C17.3137 9 20 11.6863 20 15C20 18.3137 17.3137 21 14 21ZM14 11C11.7909 11 10 12.7909 10 15C10 17.2091 11.7909 19 14 19C16.2091 19 18 17.2091 18 15C18 12.7909 16.2091 11 14 11Z" fill="currentColor"/>
3
- </svg>
@@ -1,5 +0,0 @@
1
- <svg width="55" height="56" viewBox="0 0 55 56" fill="none" xmlns="http://www.w3.org/2000/svg">
2
- <circle opacity="0.6" cx="27.5" cy="28" r="27" fill="#2B2C46"/>
3
- <circle cx="27.5" cy="28" r="25.92" stroke="white" stroke-width="3"/>
4
- <path fill-rule="evenodd" clip-rule="evenodd" d="M19.276 23.5276L20.0465 25.1191L15.5975 27.2727L13.5 22.94L15.0914 22.1696L15.7765 23.5846C16.5115 21.6558 17.725 19.9218 19.3162 18.561C21.56 16.6421 24.4242 15.5852 27.381 15.5852C30.3379 15.5852 33.2022 16.6421 35.4462 18.5609C37.6654 20.4586 39.1501 23.0816 39.6269 25.9468L37.8828 26.237C37.4742 23.7814 36.2007 21.5325 34.2971 19.9047C32.3731 18.2594 29.9169 17.3533 27.381 17.3533C24.8452 17.3533 22.3891 18.2594 20.4653 19.9047C19.0307 21.1316 17.9543 22.7115 17.336 24.4668L19.276 23.5276ZM39.0725 28.6991L41.5 32.8558L39.9732 33.7475L39.0672 32.1959C38.3417 34.2126 37.0971 36.0268 35.4456 37.4392C33.2015 39.358 30.3374 40.4148 27.381 40.4148C24.4246 40.4148 21.5607 39.358 19.3168 37.4391C17.0981 35.5416 15.6133 32.9186 15.136 30.0535L16.88 29.763C17.2891 32.2187 18.5627 34.4676 20.466 36.0954C22.3899 37.7407 24.8456 38.6468 27.381 38.6468C29.9165 38.6468 32.3725 37.7407 34.2965 36.0954C35.6707 34.9203 36.7164 33.4214 37.3458 31.7549L35.6958 32.7185L34.8042 31.1917L39.0725 28.6991Z" fill="white"/>
5
- </svg>
package/src/App.tsx DELETED
@@ -1,18 +0,0 @@
1
- import 'react-app-polyfill/ie11';
2
- import 'react-app-polyfill/stable';
3
- import React from 'react';
4
- import 'typeface-roboto';
5
- import 'index.css';
6
-
7
- import { useMediaQuery } from 'react-responsive';
8
- import AppMD from 'page/landingPage/AppMD';
9
- import AppMobile from 'page/landingPage/AppMobile';
10
-
11
- function App(): JSX.Element {
12
- const isMobile = useMediaQuery({ query: '(max-width: 776px)' });
13
- let SelectedApp: any = isMobile ? AppMobile : AppMD;
14
-
15
- return <SelectedApp />;
16
- }
17
-
18
- export default App;
@@ -1,117 +0,0 @@
1
- import React, { ReactNode, useState } from 'react';
2
- import HeaderMobile from './HeaderMobile';
3
- import {
4
- setPreFilterDropdown,
5
- setImageCaptureHelpModal,
6
- } from 'Store/search/Search';
7
- import { isUndefined } from 'lodash';
8
- import ImageCaptureHelpModal from './ImageCaptureHelpModal';
9
- import MobilePostFilter from './MobilePostFilter';
10
- import PreFilterComponent from './pre-filter';
11
- import { useAppDispatch, useAppSelector } from 'Store/Store';
12
- import { AppState } from 'types';
13
- import FooterMobile from './FooterMobile';
14
-
15
- function AppMobile({ children }: { children: ReactNode }) {
16
- const dispatch = useAppDispatch();
17
- const { search } = useAppSelector<AppState>((state: any) => state);
18
- const { preFilterDropdown, imageCaptureHelpModal } = search;
19
- const [isOpenFilter, setOpenFilter] = useState<boolean>(false);
20
-
21
- return (
22
- <>
23
- <div className="wrap-mobile">
24
- <div className="box-header-mobile-main">
25
- <HeaderMobile
26
- onToggleFilterMobile={(show: boolean) => {
27
- setOpenFilter(isUndefined(show) ? !isOpenFilter : show);
28
- }}
29
- />
30
- </div>
31
- <div
32
- style={{
33
- display: 'flex',
34
- flexGrow: 1,
35
- flexDirection: 'column',
36
- overflowY: 'auto',
37
- overflowX: 'hidden',
38
- height: '100%',
39
- backgroundColor: '#fff',
40
- }}
41
- >
42
- {children}
43
- </div>
44
- <div
45
- className="footer-wrap-main"
46
- style={{
47
- zIndex: 999,
48
- }}
49
- >
50
- <FooterMobile />
51
- </div>
52
- </div>
53
- <div
54
- className={`box-filter ${isOpenFilter ? 'open' : 'close'} `}
55
- style={{
56
- top: '0px',
57
- height: '100%',
58
- width: '100%',
59
- position: 'absolute',
60
- }}
61
- >
62
- <MobilePostFilter
63
- onApply={() => {
64
- setOpenFilter(!isOpenFilter);
65
- }}
66
- />
67
- </div>
68
-
69
- {preFilterDropdown && (
70
- <div
71
- className={`box-filter open`}
72
- style={{
73
- top: '0px',
74
- height: '100%',
75
- width: '100%',
76
- zIndex: 999,
77
- position: 'absolute',
78
- }}
79
- >
80
- <div style={{ width: '100%' }} className={'wrap-filter-desktop'}>
81
- <div className={'bg-white box-filter-desktop isMobile'}>
82
- <PreFilterComponent
83
- handleClose={() =>
84
- dispatch(setPreFilterDropdown(!preFilterDropdown))
85
- }
86
- />
87
- </div>
88
- </div>
89
- </div>
90
- )}
91
-
92
- {imageCaptureHelpModal && (
93
- <div
94
- className={`box-filter open`}
95
- style={{
96
- top: '0px',
97
- width: '100%',
98
- zIndex: 100,
99
- position: 'absolute',
100
- }}
101
- >
102
- <div style={{ width: '100%' }} className={'wrap-filter-desktop'}>
103
- <div className={'bg-white box-filter-desktop isMobile'}>
104
- <ImageCaptureHelpModal
105
- handleClose={() =>
106
- dispatch(setImageCaptureHelpModal(!imageCaptureHelpModal))
107
- }
108
- />
109
- </div>
110
- </div>
111
- </div>
112
- )}
113
- </>
114
- );
115
- }
116
-
117
- export default AppMobile;
@@ -1,230 +0,0 @@
1
- import { Button } from '@material-ui/core';
2
- import React, { useState } from 'react';
3
- import { ReactComponent as IconCameraMobile } from 'common/assets/icons/icon_camera_mobile.svg';
4
- import CameraCustom from './drawer/cameraCustom';
5
- import { ReactComponent as Home } from 'common/assets/icons/home.svg';
6
- import { useHistory } from 'react-router-dom';
7
- import { useAppDispatch, useAppSelector } from 'Store/Store';
8
- import { ReactComponent as IconInfo } from 'common/assets/icons/info-tooltip.svg';
9
- import { ReactComponent as IconLogout } from 'common/assets/icons/logout.svg';
10
- import { ReactComponent as CloseIcon } from 'common/assets/icons/close.svg';
11
- import { ReactComponent as PoweredByNyrisImage } from 'common/assets/images/powered_by_nyris.svg';
12
-
13
- import {
14
- reset,
15
- setImageCaptureHelpModal,
16
- setPreFilter,
17
- } from 'Store/search/Search';
18
- import { useAuth0 } from '@auth0/auth0-react';
19
- import DefaultModal from './modal/DefaultModal';
20
-
21
- interface Props {
22
- onLoadingMobile?: any;
23
- }
24
-
25
- function FooterMobile(props: Props): JSX.Element {
26
- const [isOpenModalCamera, setOpenModalCamera] = useState<boolean>(false);
27
- const history = useHistory();
28
- const {
29
- search: { imageCaptureHelpModal },
30
- } = useAppSelector(state => state);
31
- const dispatch = useAppDispatch();
32
-
33
- const { settings } = useAppSelector(state => state);
34
- const { user, isAuthenticated, logout } = useAuth0();
35
- const auth0 = settings.auth0;
36
-
37
- const [showLogoutModal, setShowLogoutModal] = useState(false);
38
-
39
- return (
40
- <>
41
- <DefaultModal
42
- openModal={showLogoutModal}
43
- handleClose={() => {
44
- setShowLogoutModal(false);
45
- }}
46
- >
47
- <div
48
- style={{
49
- backgroundColor: 'white',
50
- width: '360px',
51
- padding: '24px',
52
- }}
53
- >
54
- <div
55
- style={{
56
- display: 'flex',
57
- justifyContent: 'flex-end',
58
- }}
59
- onClick={() => setShowLogoutModal(false)}
60
- >
61
- <CloseIcon
62
- width={'16px'}
63
- height={'16px'}
64
- fontSize={'16px'}
65
- color="black"
66
- />
67
- </div>
68
- <p style={{ fontSize: '36px', fontWeight: 'bold', color: '#2B2C46' }}>
69
- Logout
70
- </p>
71
- <p style={{ fontSize: '13px', color: '#2B2C46', paddingTop: '16px' }}>
72
- Are you sure you want to log out? Your session will be securely
73
- closed.
74
- </p>
75
- <p style={{ fontSize: '13px', color: '#2B2C46', paddingTop: '16px' }}>
76
- Email
77
- </p>
78
- <div
79
- style={{
80
- backgroundColor: '#FAFAFA',
81
- height: '32px',
82
- paddingLeft: '16px',
83
- paddingRight: '16px',
84
- marginTop: '8px',
85
- }}
86
- >
87
- {user?.email}
88
- </div>
89
- <div style={{ display: 'flex', width: '100%', marginTop: '16px' }}>
90
- <div
91
- style={{
92
- width: '50%',
93
- backgroundColor: '#2B2C46',
94
- color: 'white',
95
- padding: '16px',
96
- }}
97
- onClick={() => {
98
- logout({
99
- logoutParams: { returnTo: window.location.origin },
100
- });
101
- }}
102
- >
103
- Confirm log out
104
- </div>
105
- </div>
106
- </div>
107
- </DefaultModal>
108
- {history.location?.pathname === '/' && settings.showPoweredByNyris && (
109
- <div
110
- style={{
111
- backgroundColor: '#fff',
112
- display: 'flex',
113
- justifyContent: 'center',
114
- padding: '16px 0px 16px 0px',
115
- }}
116
- >
117
- <PoweredByNyrisImage
118
- style={{ cursor: 'pointer' }}
119
- onClick={() => {
120
- window.open('https://www.nyris.io', '_blank');
121
- }}
122
- color="#AAABB5"
123
- />
124
- </div>
125
- )}
126
- <div
127
- className="box-footer-mobile"
128
- style={{
129
- paddingLeft: '16px',
130
- paddingRight: '16px',
131
- height: '64px',
132
- display: 'flex',
133
- position: 'relative',
134
- alignItems: 'center',
135
- justifyContent: 'space-between',
136
- }}
137
- >
138
- <a
139
- style={{
140
- width: '48px',
141
- height: '48px',
142
- display: 'flex',
143
- alignItems: 'center',
144
- justifyContent: 'center',
145
- borderRadius: '100%',
146
- backgroundColor:
147
- history.location.pathname === '/' && !imageCaptureHelpModal
148
- ? `#E0E0E0`
149
- : '',
150
- }}
151
- href="/"
152
- className="nav-link p-0 menu-children rounded-0"
153
- onClick={() => {
154
- dispatch(reset(''));
155
- dispatch(setPreFilter({}));
156
- dispatch(setImageCaptureHelpModal(false));
157
- }}
158
- >
159
- <Home
160
- color={
161
- history.location.pathname === '/' && !imageCaptureHelpModal
162
- ? '#2B2C46'
163
- : '#AAABB5'
164
- }
165
- />
166
- </a>
167
- {history.location?.pathname !== '/' && !imageCaptureHelpModal && (
168
- <div className="box-icon-camera-mobile">
169
- <Button
170
- onClick={() => {
171
- setOpenModalCamera(!isOpenModalCamera);
172
- }}
173
- >
174
- <IconCameraMobile color="#55566B" />
175
- </Button>
176
- </div>
177
- )}
178
- <div style={{ display: 'flex', gap: '24px' }}>
179
- {history.location?.pathname !== '/' && (
180
- <div
181
- style={{
182
- width: '48px',
183
- height: '48px',
184
- display: 'flex',
185
- alignItems: 'center',
186
- justifyContent: 'center',
187
- borderRadius: '100%',
188
- backgroundColor: imageCaptureHelpModal ? `#E0E0E0` : '',
189
- }}
190
- onClick={() => {
191
- dispatch(setImageCaptureHelpModal(!imageCaptureHelpModal));
192
- }}
193
- >
194
- <IconInfo
195
- fontSize={24}
196
- width={24}
197
- height={24}
198
- color={imageCaptureHelpModal ? '#2B2C46' : '#AAABB5'}
199
- />
200
- </div>
201
- )}
202
- {auth0.enabled && isAuthenticated && (
203
- <div
204
- style={{
205
- display: 'flex',
206
- alignItems: 'center',
207
- justifyContent: 'center',
208
- }}
209
- onClick={() => {
210
- setShowLogoutModal(true);
211
- }}
212
- >
213
- <IconLogout fontSize={24} width={24} height={24} />
214
- </div>
215
- )}
216
- </div>
217
- </div>
218
- <div className="box-screenshot-camera">
219
- <CameraCustom
220
- isToggle={isOpenModalCamera}
221
- onToggleModal={() => {
222
- setOpenModalCamera(!isOpenModalCamera);
223
- }}
224
- />
225
- </div>
226
- </>
227
- );
228
- }
229
-
230
- export default FooterMobile;
@@ -1,237 +0,0 @@
1
- // @ts-nocheck
2
- import React, { memo, useState } from 'react';
3
- import { Typography, Hidden } from '@material-ui/core';
4
- import { RectCoords } from '@nyris/nyris-api';
5
- import { Preview } from '@nyris/nyris-react-components';
6
- import { DEFAULT_REGION } from '../constants';
7
- import { ReactComponent as IconInfo } from 'common/assets/icons/info-tooltip.svg';
8
- import { useTranslation } from 'react-i18next';
9
- import { useAppDispatch, useAppSelector } from 'Store/Store';
10
- import { ReactComponent as ArrowUp } from 'common/assets/icons/arrow_up.svg';
11
- import { ReactComponent as ArrowDown } from 'common/assets/icons/arrow_down.svg';
12
- import { ReactComponent as Trash } from 'common/assets/icons/trash.svg';
13
- import { useQuery } from 'hooks/useQuery';
14
- import {
15
- reset,
16
- setSearchResults,
17
- updateStatusLoading,
18
- } from 'Store/search/Search';
19
- import { useHistory } from 'react-router-dom';
20
- import { find } from 'services/image';
21
- import { isEmpty } from 'lodash';
22
-
23
- function ImagePreviewMobileComponent({
24
- requestImage,
25
- imageSelection,
26
- debouncedOnImageSelectionChange,
27
- filteredRegions,
28
- showAdjustInfo,
29
- showAdjustInfoBasedOnConfidence,
30
- ...rest
31
- }: {
32
- requestImage: any;
33
- imageSelection: any;
34
-
35
- debouncedOnImageSelectionChange: any;
36
- filteredRegions: any;
37
- showAdjustInfoBasedOnConfidence: any;
38
- showAdjustInfo: any;
39
- }) {
40
- const { t } = useTranslation();
41
- const [editActive, setEditActive] = useState(false);
42
- const settings = useAppSelector(state => state.settings);
43
- const { preFilter } = useAppSelector(state => state.search);
44
- const isAlgoliaEnabled = settings.algolia?.enabled;
45
- const query = useQuery();
46
- const dispatch = useAppDispatch();
47
- const history = useHistory();
48
-
49
- const handleArrowClick = () => {
50
- setEditActive(s => !s);
51
- };
52
-
53
- const searchQuery = query.get('query') || '';
54
-
55
- const onImageRemove = () => {
56
- if (!searchQuery) {
57
- dispatch(reset(''));
58
- history.push('/');
59
- }
60
- dispatch(reset(''));
61
-
62
- if (!isAlgoliaEnabled) {
63
- let payload: any;
64
- let filters: any[] = [];
65
- const preFilterValues = [
66
- {
67
- key: settings.visualSearchFilterKey,
68
- values: Object.keys(preFilter),
69
- },
70
- ];
71
- if (searchQuery || requestImage) {
72
- dispatch(updateStatusLoading(true));
73
- find({
74
- settings,
75
- filters: !isEmpty(preFilter) ? preFilterValues : undefined,
76
- text: searchQuery,
77
- })
78
- .then((res: any) => {
79
- res?.results.forEach((item: any) => {
80
- filters.push({
81
- sku: item.sku,
82
- score: item.score,
83
- });
84
- });
85
- payload = {
86
- ...res,
87
- filters,
88
- };
89
-
90
- dispatch(setSearchResults(payload));
91
- dispatch(updateStatusLoading(false));
92
- })
93
- .catch((e: any) => {
94
- console.log('error input search', e);
95
- dispatch(updateStatusLoading(false));
96
- });
97
- } else {
98
- dispatch(setSearchResults([]));
99
- }
100
- }
101
- };
102
-
103
- return (
104
- <div
105
- className="col-left"
106
- style={{
107
- backgroundColor: '#5D5D63',
108
- marginBottom: '15px',
109
- }}
110
- >
111
- <div>
112
- <div className="box-preview">
113
- <div>
114
- <div
115
- className="preview-item"
116
- style={{
117
- backgroundColor: 'transparent',
118
- }}
119
- >
120
- <Preview
121
- key={requestImage?.id}
122
- onSelectionChange={(r: RectCoords) => {
123
- debouncedOnImageSelectionChange(r);
124
- }}
125
- image={requestImage?.canvas}
126
- selection={imageSelection || DEFAULT_REGION}
127
- regions={filteredRegions}
128
- minWidth={
129
- Math.min(80 * (requestImage?.canvas?.width / requestImage?.canvas?.height), 200)
130
- }
131
- minHeight={80}
132
- maxWidth={255}
133
- maxHeight={255}
134
- dotColor={editActive ? '#FBD914' : ''}
135
- minCropWidth={editActive ? 30 : 5}
136
- minCropHeight={editActive ? 30 : 5}
137
- rounded={false}
138
- expandAnimation={editActive}
139
- shrinkAnimation={!editActive}
140
- onExpand={() => {
141
- setEditActive(true);
142
- }}
143
- showGrip={editActive}
144
- draggable={editActive ? true : false}
145
- />
146
- </div>
147
- </div>
148
-
149
- {(showAdjustInfoBasedOnConfidence || showAdjustInfo) && (
150
- <div
151
- style={{
152
- backgroundColor: '#3E36DC',
153
- display: 'flex',
154
- columnGap: '6px',
155
- padding: '5px',
156
- width: 'fit-content',
157
- minWidth: '180px',
158
- marginTop: 'auto',
159
- position: 'absolute',
160
- bottom: -25,
161
- borderRadius: '16px',
162
- zIndex: 1000,
163
- }}
164
- >
165
- <IconInfo color="white" />
166
- <Typography
167
- style={{
168
- fontSize: 10,
169
- color: '#fff',
170
- }}
171
- >
172
- {showAdjustInfo
173
- ? t('Crop the image for better results')
174
- : 'Crop the image for better results'}
175
- </Typography>
176
- </div>
177
- )}
178
- </div>
179
- <>
180
- <Hidden>
181
- <div
182
- style={{
183
- position: 'absolute',
184
- left: '15px',
185
- top: '25px',
186
- padding: '4px',
187
- }}
188
- onClick={onImageRemove}
189
- >
190
- <div
191
- style={{
192
- width: '24px',
193
- height: '24px',
194
- justifyContent: 'center',
195
- alignItems: 'center',
196
- display: 'flex',
197
- borderRadius: '100%',
198
- }}
199
- >
200
- <Trash color="white" fill="white" />
201
- </div>
202
- </div>
203
- </Hidden>
204
-
205
- <Hidden mdUp>
206
- <div
207
- className="slideDown"
208
- style={{
209
- position: 'absolute',
210
- bottom: '25px',
211
- right: '20px',
212
- }}
213
- onClick={handleArrowClick}
214
- >
215
- <div
216
- style={{
217
- width: '24px',
218
- height: '24px',
219
- justifyContent: 'center',
220
- alignItems: 'center',
221
- display: 'flex',
222
- borderRadius: '100%',
223
- backgroundColor: 'white',
224
- }}
225
- >
226
- {editActive && <ArrowUp color="black" />}
227
- {!editActive && <ArrowDown color="black" fill="black" />}
228
- </div>
229
- </div>
230
- </Hidden>
231
- </>
232
- </div>
233
- </div>
234
- );
235
- }
236
- const ImagePreviewMobile = memo(ImagePreviewMobileComponent);
237
- export default ImagePreviewMobile;