@nyris/nyris-webapp 0.3.38 → 0.3.40
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 -13
- package/build/index.html +1 -1
- package/build/{precache-manifest.a2cdab23d5aa96747cff64ba8ff5e72d.js → precache-manifest.ad1e72495167d7e9d93f00c47916ab94.js} +22 -10
- package/build/service-worker.js +1 -1
- package/build/static/css/main.86d40309.chunk.css +2 -0
- package/build/static/css/main.86d40309.chunk.css.map +1 -0
- package/build/static/js/2.1e5f374f.chunk.js +3 -0
- package/build/static/js/2.1e5f374f.chunk.js.map +1 -0
- package/build/static/js/main.1532f80b.chunk.js +3 -0
- package/build/static/js/main.1532f80b.chunk.js.map +1 -0
- package/build/static/media/arrow_down.c1b611db.svg +3 -0
- package/build/static/media/arrow_up.fcd6b144.svg +3 -0
- package/build/static/media/trash.1624780d.svg +3 -0
- package/package.json +3 -3
- package/src/App.tsx +14 -14
- package/src/common/assets/icons/arrow_down.svg +3 -0
- package/src/common/assets/icons/arrow_up.svg +3 -0
- package/src/common/assets/icons/trash.svg +3 -0
- package/src/components/AppMobile.tsx +1 -0
- package/src/components/CadenasLoading.tsx +4 -3
- package/src/components/DragDropFile.tsx +8 -8
- package/src/components/HeaderMobile.tsx +13 -7
- package/src/components/ImageCaptureHelpModal.tsx +9 -4
- package/src/components/ImagePreviewMobile.tsx +230 -43
- package/src/components/Inquiry/InquiryBanner.tsx +1 -1
- package/src/components/Layout.tsx +35 -3
- package/src/components/Loading.tsx +69 -0
- package/src/components/PanelResult/index.tsx +6 -2
- package/src/components/ProductDetailView.tsx +2 -2
- package/src/components/ProductList/index.tsx +4 -2
- package/src/components/appMobile.scss +4 -28
- package/src/components/common.scss +68 -3
- package/src/components/drawer/cameraCustom.tsx +2 -2
- package/src/components/input/inputSearch.tsx +3 -3
- package/src/components/results/ItemResult.tsx +2 -2
- package/src/components/rfq/RfqBanner.tsx +2 -2
- package/src/page/landingPage/AppMD.tsx +11 -10
- package/src/page/landingPage/common.scss +5 -81
- package/src/page/result/index.tsx +1 -1
- package/src/translations.ts +59 -8
- package/build/static/css/main.37f029a6.chunk.css +0 -2
- package/build/static/css/main.37f029a6.chunk.css.map +0 -1
- package/build/static/js/2.38a0d15b.chunk.js +0 -3
- package/build/static/js/2.38a0d15b.chunk.js.map +0 -1
- package/build/static/js/main.c4d401d2.chunk.js +0 -3
- package/build/static/js/main.c4d401d2.chunk.js.map +0 -1
- /package/build/static/js/{2.38a0d15b.chunk.js.LICENSE.txt → 2.1e5f374f.chunk.js.LICENSE.txt} +0 -0
- /package/build/static/js/{main.c4d401d2.chunk.js.LICENSE.txt → main.1532f80b.chunk.js.LICENSE.txt} +0 -0
|
@@ -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="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>
|
|
@@ -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="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>
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
<svg width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M9 0.5C9 0.223858 8.77614 0 8.5 0H5.5C5.22386 0 5 0.223858 5 0.5C5 0.776142 5.22386 1 5.5 1H8.5C8.77614 1 9 0.776142 9 0.5ZM1.5 3C1.22386 3 1 2.77614 1 2.5C1 2.22386 1.22386 2 1.5 2H12.5C12.7761 2 13 2.22386 13 2.5C13 2.77614 12.7761 3 12.5 3C12.2239 3 12 3.22386 12 3.5V13C12 13.5523 11.5523 14 11 14H3C2.44772 14 2 13.5523 2 13V3.5C2 3.22386 1.77614 3 1.5 3ZM4 3C3.44772 3 3 3.44772 3 4V12C3 12.5523 3.44772 13 4 13H10C10.5523 13 11 12.5523 11 12V4C11 3.44772 10.5523 3 10 3H4ZM6 5.5C6 5.22386 5.77614 5 5.5 5C5.22386 5 5 5.22386 5 5.5V10.5C5 10.7761 5.22386 11 5.5 11C5.77614 11 6 10.7761 6 10.5V5.5ZM9 5.5C9 5.22386 8.77614 5 8.5 5C8.22386 5 8 5.22386 8 5.5V10.5C8 10.7761 8.22386 11 8.5 11C8.77614 11 9 10.7761 9 10.5V5.5Z" 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.40",
|
|
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.
|
|
16
|
-
"@nyris/nyris-react-components": "^0.3.
|
|
15
|
+
"@nyris/nyris-api": "^0.3.40",
|
|
16
|
+
"@nyris/nyris-react-components": "^0.3.40",
|
|
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/src/App.tsx
CHANGED
|
@@ -7,24 +7,24 @@ import 'index.css';
|
|
|
7
7
|
import { useMediaQuery } from 'react-responsive';
|
|
8
8
|
import AppMD from 'page/landingPage/AppMD';
|
|
9
9
|
import AppMobile from 'page/landingPage/AppMobile';
|
|
10
|
-
import i18n from 'i18next';
|
|
11
|
-
import { initReactI18next } from 'react-i18next';
|
|
12
|
-
import { useAppSelector } from 'Store/Store';
|
|
13
|
-
import { translations } from 'translations';
|
|
10
|
+
// import i18n from 'i18next';
|
|
11
|
+
// import { initReactI18next } from 'react-i18next';
|
|
12
|
+
// import { useAppSelector } from 'Store/Store';
|
|
13
|
+
// import { translations } from 'translations';
|
|
14
14
|
|
|
15
|
-
i18n.use(initReactI18next).init({
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
});
|
|
15
|
+
// i18n.use(initReactI18next).init({
|
|
16
|
+
// resources: translations,
|
|
17
|
+
// fallbackLng: 'en',
|
|
18
|
+
// interpolation: {
|
|
19
|
+
// escapeValue: false,
|
|
20
|
+
// },
|
|
21
|
+
// returnNull: false,
|
|
22
|
+
// });
|
|
23
23
|
|
|
24
24
|
function App(): JSX.Element {
|
|
25
|
-
const language = useAppSelector(state => state.settings.language);
|
|
25
|
+
// const language = useAppSelector(state => state.settings.language);
|
|
26
26
|
|
|
27
|
-
i18n.changeLanguage(language);
|
|
27
|
+
// i18n.changeLanguage(language);
|
|
28
28
|
|
|
29
29
|
const isMobile = useMediaQuery({ query: '(max-width: 776px)' });
|
|
30
30
|
let SelectedApp: any = isMobile ? AppMobile : AppMD;
|
|
@@ -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="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>
|
|
@@ -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="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>
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
<svg width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M9 0.5C9 0.223858 8.77614 0 8.5 0H5.5C5.22386 0 5 0.223858 5 0.5C5 0.776142 5.22386 1 5.5 1H8.5C8.77614 1 9 0.776142 9 0.5ZM1.5 3C1.22386 3 1 2.77614 1 2.5C1 2.22386 1.22386 2 1.5 2H12.5C12.7761 2 13 2.22386 13 2.5C13 2.77614 12.7761 3 12.5 3C12.2239 3 12 3.22386 12 3.5V13C12 13.5523 11.5523 14 11 14H3C2.44772 14 2 13.5523 2 13V3.5C2 3.22386 1.77614 3 1.5 3ZM4 3C3.44772 3 3 3.44772 3 4V12C3 12.5523 3.44772 13 4 13H10C10.5523 13 11 12.5523 11 12V4C11 3.44772 10.5523 3 10 3H4ZM6 5.5C6 5.22386 5.77614 5 5.5 5C5.22386 5 5 5.22386 5 5.5V10.5C5 10.7761 5.22386 11 5.5 11C5.77614 11 6 10.7761 6 10.5V5.5ZM9 5.5C9 5.22386 8.77614 5 8.5 5C8.22386 5 8 5.22386 8 5.5V10.5C8 10.7761 8.22386 11 8.5 11C8.77614 11 9 10.7761 9 10.5V5.5Z" fill="currentColor"/>
|
|
3
|
+
</svg>
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { useTranslation } from 'react-i18next';
|
|
2
3
|
import { useMediaQuery } from 'react-responsive';
|
|
3
4
|
|
|
4
5
|
const LoadingSpinner = () => (
|
|
@@ -8,7 +9,7 @@ const LoadingSpinner = () => (
|
|
|
8
9
|
viewBox="0 0 150 150"
|
|
9
10
|
fill="none"
|
|
10
11
|
xmlns="http://www.w3.org/2000/svg"
|
|
11
|
-
className="
|
|
12
|
+
className="loading-spinner"
|
|
12
13
|
>
|
|
13
14
|
<path
|
|
14
15
|
fillRule="evenodd"
|
|
@@ -34,7 +35,7 @@ const LoadingSpinner = () => (
|
|
|
34
35
|
|
|
35
36
|
function CadenasLoading() {
|
|
36
37
|
const isMobile = useMediaQuery({ query: '(max-width: 776px)' });
|
|
37
|
-
|
|
38
|
+
const { t } = useTranslation();
|
|
38
39
|
return (
|
|
39
40
|
<div
|
|
40
41
|
style={{
|
|
@@ -56,7 +57,7 @@ function CadenasLoading() {
|
|
|
56
57
|
transform: 'translate(-50%, -50%)',
|
|
57
58
|
}}
|
|
58
59
|
>
|
|
59
|
-
loading
|
|
60
|
+
{t('loading')}
|
|
60
61
|
</p>
|
|
61
62
|
<LoadingSpinner />
|
|
62
63
|
</div>
|
|
@@ -19,6 +19,7 @@ import { ReactComponent as IconDownload } from 'common/assets/icons/IconUploadDo
|
|
|
19
19
|
import { RectCoords } from '@nyris/nyris-api';
|
|
20
20
|
import { useTranslation } from 'react-i18next';
|
|
21
21
|
import { isEmpty } from 'lodash';
|
|
22
|
+
import Loading from './Loading';
|
|
22
23
|
|
|
23
24
|
interface Props {
|
|
24
25
|
acceptTypes: any;
|
|
@@ -87,12 +88,11 @@ function DragDropFile(props: Props) {
|
|
|
87
88
|
});
|
|
88
89
|
|
|
89
90
|
return (
|
|
90
|
-
<Box
|
|
91
|
-
{
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
)}
|
|
91
|
+
<Box
|
|
92
|
+
className={`box-content-main`}
|
|
93
|
+
style={{ marginTop: 32, paddingTop: 0 }}
|
|
94
|
+
>
|
|
95
|
+
{isLoading && <Loading />}
|
|
96
96
|
|
|
97
97
|
<div
|
|
98
98
|
className={`box-border-none`}
|
|
@@ -117,9 +117,9 @@ function DragDropFile(props: Props) {
|
|
|
117
117
|
</Box>
|
|
118
118
|
<label htmlFor="select_file" className="" style={{ fontSize: 14 }}>
|
|
119
119
|
<span className="fw-700 text-f14" style={{ paddingRight: '4px' }}>
|
|
120
|
-
{t('
|
|
120
|
+
{t('Drag and drop')}
|
|
121
121
|
</span>
|
|
122
|
-
{t('
|
|
122
|
+
{t('an image here')}
|
|
123
123
|
</label>
|
|
124
124
|
<input
|
|
125
125
|
{...getInputProps()}
|
|
@@ -25,6 +25,7 @@ import { ReactComponent as FilterIcon } from 'common/assets/icons/filter.svg';
|
|
|
25
25
|
|
|
26
26
|
import { debounce, isEmpty } from 'lodash';
|
|
27
27
|
import { useQuery } from 'hooks/useQuery';
|
|
28
|
+
import { useTranslation } from 'react-i18next';
|
|
28
29
|
|
|
29
30
|
interface Props {
|
|
30
31
|
onToggleFilterMobile?: any;
|
|
@@ -44,7 +45,9 @@ function HeaderMobileComponent(props: Props): JSX.Element {
|
|
|
44
45
|
preFilterDropdown,
|
|
45
46
|
valueTextSearch,
|
|
46
47
|
} = search;
|
|
48
|
+
|
|
47
49
|
const query = useQuery();
|
|
50
|
+
const searchQuery = query.get('query') || '';
|
|
48
51
|
const containerRefInputMobile = useRef<HTMLDivElement>(null);
|
|
49
52
|
const [isShowFilter, setShowFilter] = useState<boolean>(false);
|
|
50
53
|
const history = useHistory();
|
|
@@ -70,7 +73,6 @@ function HeaderMobileComponent(props: Props): JSX.Element {
|
|
|
70
73
|
}, [imageThumbSearchInput, dispatch, refine, history]);
|
|
71
74
|
|
|
72
75
|
useEffect(() => {
|
|
73
|
-
const searchQuery = query.get('query') || '';
|
|
74
76
|
if (!isEmpty(searchQuery)) {
|
|
75
77
|
dispatch(updateValueTextSearchMobile(searchQuery));
|
|
76
78
|
refine(searchQuery);
|
|
@@ -79,7 +81,7 @@ function HeaderMobileComponent(props: Props): JSX.Element {
|
|
|
79
81
|
refine(searchQuery);
|
|
80
82
|
}, 100);
|
|
81
83
|
}
|
|
82
|
-
}, [query, refine, dispatch]);
|
|
84
|
+
}, [query, refine, dispatch, searchQuery]);
|
|
83
85
|
|
|
84
86
|
const searchOrRedirect = useCallback(
|
|
85
87
|
debounce((value: any) => {
|
|
@@ -159,7 +161,7 @@ function HeaderMobileComponent(props: Props): JSX.Element {
|
|
|
159
161
|
)}
|
|
160
162
|
<div
|
|
161
163
|
style={{
|
|
162
|
-
margin: '16px 8px
|
|
164
|
+
margin: '16px 8px',
|
|
163
165
|
display: 'flex',
|
|
164
166
|
columnGap: '8px',
|
|
165
167
|
alignItems: 'center',
|
|
@@ -215,8 +217,8 @@ function HeaderMobileComponent(props: Props): JSX.Element {
|
|
|
215
217
|
<div
|
|
216
218
|
style={{
|
|
217
219
|
position: 'absolute',
|
|
218
|
-
top: '
|
|
219
|
-
left: '
|
|
220
|
+
top: '7px',
|
|
221
|
+
left: '35px',
|
|
220
222
|
display: 'flex',
|
|
221
223
|
justifyContent: 'center',
|
|
222
224
|
alignItems: 'center',
|
|
@@ -238,7 +240,10 @@ function HeaderMobileComponent(props: Props): JSX.Element {
|
|
|
238
240
|
)}
|
|
239
241
|
</Box>
|
|
240
242
|
|
|
241
|
-
<Input
|
|
243
|
+
<Input
|
|
244
|
+
value={textSearchInputMobile || searchQuery}
|
|
245
|
+
onChange={onChangeText}
|
|
246
|
+
/>
|
|
242
247
|
|
|
243
248
|
{history.location?.pathname !== '/' && textSearchInputMobile && (
|
|
244
249
|
<Button
|
|
@@ -363,6 +368,7 @@ const Input = ({ value, onChange }: any) => {
|
|
|
363
368
|
element?.removeEventListener('scroll', inputEventFn, false);
|
|
364
369
|
};
|
|
365
370
|
}, []);
|
|
371
|
+
const { t } = useTranslation();
|
|
366
372
|
|
|
367
373
|
return (
|
|
368
374
|
<input
|
|
@@ -379,7 +385,7 @@ const Input = ({ value, onChange }: any) => {
|
|
|
379
385
|
borderRadius: '32px',
|
|
380
386
|
}}
|
|
381
387
|
className="input-search"
|
|
382
|
-
placeholder=
|
|
388
|
+
placeholder={t('Search')}
|
|
383
389
|
value={value}
|
|
384
390
|
onChange={onChange}
|
|
385
391
|
id={INPUT_ID}
|
|
@@ -11,8 +11,6 @@ function ImageCaptureHelpModal({ handleClose }: Props) {
|
|
|
11
11
|
return (
|
|
12
12
|
<Box
|
|
13
13
|
style={{
|
|
14
|
-
paddingLeft: '24px',
|
|
15
|
-
paddingRight: '24px',
|
|
16
14
|
paddingBottom: '24px',
|
|
17
15
|
}}
|
|
18
16
|
>
|
|
@@ -23,8 +21,11 @@ function ImageCaptureHelpModal({ handleClose }: Props) {
|
|
|
23
21
|
top={0}
|
|
24
22
|
style={{ background: 'white', width: '100%' }}
|
|
25
23
|
>
|
|
26
|
-
<Button
|
|
27
|
-
|
|
24
|
+
<Button
|
|
25
|
+
onClick={handleClose}
|
|
26
|
+
style={{ paddingTop: '8px', paddingRight: '8px' }}
|
|
27
|
+
>
|
|
28
|
+
<CloseIcon fontSize={'small'} />
|
|
28
29
|
</Button>
|
|
29
30
|
</Box>
|
|
30
31
|
<p
|
|
@@ -33,6 +34,8 @@ function ImageCaptureHelpModal({ handleClose }: Props) {
|
|
|
33
34
|
lineHeight: '40px',
|
|
34
35
|
fontWeight: 700,
|
|
35
36
|
color: '#2B2C46',
|
|
37
|
+
paddingLeft: '24px',
|
|
38
|
+
paddingRight: '24px',
|
|
36
39
|
}}
|
|
37
40
|
>
|
|
38
41
|
Six ways to optimize visual search
|
|
@@ -43,6 +46,8 @@ function ImageCaptureHelpModal({ handleClose }: Props) {
|
|
|
43
46
|
flexDirection: 'column',
|
|
44
47
|
rowGap: '16px',
|
|
45
48
|
marginTop: '16px',
|
|
49
|
+
paddingLeft: '24px',
|
|
50
|
+
paddingRight: '24px',
|
|
46
51
|
}}
|
|
47
52
|
>
|
|
48
53
|
{visualSearchHelp.map((data, index) => {
|
|
@@ -1,12 +1,20 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Box, Typography } from '@material-ui/core';
|
|
1
|
+
import React, { memo, useState } from 'react';
|
|
2
|
+
import { Box, Typography, Hidden } from '@material-ui/core';
|
|
3
3
|
import { RectCoords } from '@nyris/nyris-api';
|
|
4
4
|
import { Preview } from '@nyris/nyris-react-components';
|
|
5
5
|
import { DEFAULT_REGION } from '../constants';
|
|
6
6
|
import { ReactComponent as IconInfo } from 'common/assets/icons/info-tooltip.svg';
|
|
7
7
|
import { useTranslation } from 'react-i18next';
|
|
8
|
+
import { useAppDispatch } from 'Store/Store';
|
|
9
|
+
import { ReactComponent as ArrowUp } from 'common/assets/icons/arrow_up.svg';
|
|
10
|
+
import { ReactComponent as ArrowDown } from 'common/assets/icons/arrow_down.svg';
|
|
11
|
+
import { ReactComponent as Trash } from 'common/assets/icons/trash.svg';
|
|
12
|
+
import { useQuery } from 'hooks/useQuery';
|
|
13
|
+
import { reset } from 'Store/search/Search';
|
|
14
|
+
import { useHistory } from 'react-router-dom';
|
|
15
|
+
import { connectSearchBox } from 'react-instantsearch-dom';
|
|
8
16
|
|
|
9
|
-
function
|
|
17
|
+
function ImagePreviewMobileComponent({
|
|
10
18
|
requestImage,
|
|
11
19
|
imageSelection,
|
|
12
20
|
setImageSelection,
|
|
@@ -14,6 +22,7 @@ function ImagePreviewMobile({
|
|
|
14
22
|
filteredRegions,
|
|
15
23
|
showAdjustInfo,
|
|
16
24
|
showAdjustInfoBasedOnConfidence,
|
|
25
|
+
...rest
|
|
17
26
|
}: {
|
|
18
27
|
requestImage: any;
|
|
19
28
|
imageSelection: any;
|
|
@@ -24,64 +33,242 @@ function ImagePreviewMobile({
|
|
|
24
33
|
showAdjustInfo: any;
|
|
25
34
|
}) {
|
|
26
35
|
const { t } = useTranslation();
|
|
36
|
+
const { refine }: any = rest;
|
|
37
|
+
const [editActive, setEditActive] = useState(false);
|
|
38
|
+
const [showShrinkAnimation, setShrinkAnimation] = useState(false);
|
|
39
|
+
const query = useQuery();
|
|
40
|
+
const dispatch = useAppDispatch();
|
|
41
|
+
const history = useHistory();
|
|
42
|
+
|
|
43
|
+
const handleArrowClick = () => {
|
|
44
|
+
setEditActive(s => !s);
|
|
45
|
+
setShrinkAnimation(true);
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
const onImageRemove = () => {
|
|
49
|
+
const searchQuery = query.get('query') || '';
|
|
50
|
+
|
|
51
|
+
if (!searchQuery) {
|
|
52
|
+
dispatch(reset(''));
|
|
53
|
+
history.push('/');
|
|
54
|
+
}
|
|
55
|
+
dispatch(reset(''));
|
|
56
|
+
|
|
57
|
+
// not an ideal solution: fixes text search not working after removing image
|
|
58
|
+
setTimeout(() => {
|
|
59
|
+
refine(searchQuery);
|
|
60
|
+
}, 100);
|
|
61
|
+
};
|
|
27
62
|
|
|
28
63
|
return (
|
|
29
64
|
<Box
|
|
30
65
|
className="col-left"
|
|
31
66
|
style={{
|
|
32
|
-
backgroundColor: '#
|
|
67
|
+
backgroundColor: '#5D5D63',
|
|
33
68
|
marginBottom: '15px',
|
|
34
69
|
}}
|
|
35
70
|
>
|
|
36
|
-
{
|
|
37
|
-
<
|
|
38
|
-
<Box className="preview
|
|
39
|
-
<
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
71
|
+
{editActive && (
|
|
72
|
+
<div>
|
|
73
|
+
<Box className="box-preview">
|
|
74
|
+
<Box
|
|
75
|
+
className="preview-item expand-animation"
|
|
76
|
+
style={{ backgroundColor: 'transparent' }}
|
|
77
|
+
>
|
|
78
|
+
<Preview
|
|
79
|
+
key={requestImage?.id}
|
|
80
|
+
onSelectionChange={(r: RectCoords) => {
|
|
81
|
+
setImageSelection(r);
|
|
82
|
+
debouncedOnImageSelectionChange(r);
|
|
83
|
+
}}
|
|
84
|
+
image={requestImage?.canvas}
|
|
85
|
+
selection={imageSelection || DEFAULT_REGION}
|
|
86
|
+
regions={filteredRegions}
|
|
87
|
+
maxWidth={240}
|
|
88
|
+
maxHeight={240}
|
|
89
|
+
dotColor={'#FBD914'}
|
|
90
|
+
minCropWidth={60}
|
|
91
|
+
minCropHeight={60}
|
|
92
|
+
rounded={false}
|
|
93
|
+
expandAnimation={true}
|
|
94
|
+
/>
|
|
95
|
+
</Box>
|
|
96
|
+
{(showAdjustInfoBasedOnConfidence || showAdjustInfo) && (
|
|
97
|
+
<Box
|
|
98
|
+
className="box-title_col-left"
|
|
99
|
+
alignItems="center"
|
|
100
|
+
style={{
|
|
101
|
+
backgroundColor: '#3E36DC',
|
|
102
|
+
display: 'flex',
|
|
103
|
+
columnGap: '6px',
|
|
104
|
+
padding: '5px',
|
|
105
|
+
width: 'fit-content',
|
|
106
|
+
}}
|
|
107
|
+
>
|
|
108
|
+
<IconInfo color="white" />
|
|
109
|
+
<Typography
|
|
110
|
+
style={{
|
|
111
|
+
fontSize: 10,
|
|
112
|
+
color: '#fff',
|
|
113
|
+
}}
|
|
114
|
+
>
|
|
115
|
+
{showAdjustInfo
|
|
116
|
+
? t('Crop the image for better results')
|
|
117
|
+
: 'Crop the image for better results'}
|
|
118
|
+
</Typography>
|
|
119
|
+
</Box>
|
|
120
|
+
)}
|
|
55
121
|
</Box>
|
|
56
|
-
|
|
122
|
+
<Hidden>
|
|
57
123
|
<Box
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
columnGap: '6px',
|
|
64
|
-
padding: '5px',
|
|
65
|
-
width: 'fit-content',
|
|
124
|
+
sx={{
|
|
125
|
+
position: 'absolute',
|
|
126
|
+
left: '15px',
|
|
127
|
+
top: '25px',
|
|
128
|
+
padding: '4px',
|
|
66
129
|
}}
|
|
130
|
+
onClick={onImageRemove}
|
|
67
131
|
>
|
|
68
|
-
<
|
|
69
|
-
|
|
132
|
+
<Box
|
|
133
|
+
sx={{
|
|
134
|
+
width: '24px',
|
|
135
|
+
height: '24px',
|
|
136
|
+
justifyContent: 'center',
|
|
137
|
+
alignItems: 'center',
|
|
138
|
+
display: 'flex',
|
|
139
|
+
borderRadius: '100%',
|
|
140
|
+
}}
|
|
141
|
+
>
|
|
142
|
+
<Trash color="white" fill="white" />
|
|
143
|
+
</Box>
|
|
144
|
+
</Box>
|
|
145
|
+
</Hidden>
|
|
146
|
+
|
|
147
|
+
<Hidden mdUp>
|
|
148
|
+
<Box
|
|
149
|
+
className="slideDown"
|
|
150
|
+
sx={{
|
|
151
|
+
position: 'absolute',
|
|
152
|
+
bottom: '25px',
|
|
153
|
+
right: '20px',
|
|
154
|
+
}}
|
|
155
|
+
onClick={handleArrowClick}
|
|
156
|
+
>
|
|
157
|
+
<Box
|
|
158
|
+
bgcolor={'white'}
|
|
159
|
+
sx={{
|
|
160
|
+
width: '24px',
|
|
161
|
+
height: '24px',
|
|
162
|
+
justifyContent: 'center',
|
|
163
|
+
alignItems: 'center',
|
|
164
|
+
display: 'flex',
|
|
165
|
+
borderRadius: '100%',
|
|
166
|
+
}}
|
|
167
|
+
>
|
|
168
|
+
<ArrowUp color="black" />
|
|
169
|
+
</Box>
|
|
170
|
+
</Box>
|
|
171
|
+
</Hidden>
|
|
172
|
+
</div>
|
|
173
|
+
)}
|
|
174
|
+
{!editActive && (
|
|
175
|
+
<Box
|
|
176
|
+
className={showShrinkAnimation ? 'shrink-animation' : ''}
|
|
177
|
+
sx={{
|
|
178
|
+
display: 'flex',
|
|
179
|
+
alignItems: 'center',
|
|
180
|
+
justifyContent: 'center',
|
|
181
|
+
height: 80,
|
|
182
|
+
width: '100%',
|
|
183
|
+
}}
|
|
184
|
+
>
|
|
185
|
+
<Hidden>
|
|
186
|
+
<Box
|
|
187
|
+
sx={{
|
|
188
|
+
position: 'absolute',
|
|
189
|
+
left: '15px',
|
|
190
|
+
top: '25px',
|
|
191
|
+
padding: '4px',
|
|
192
|
+
}}
|
|
193
|
+
onClick={onImageRemove}
|
|
194
|
+
>
|
|
195
|
+
<Box
|
|
196
|
+
// className={showShrinkAnimation ? 'slideUp' : ''}
|
|
197
|
+
sx={{
|
|
198
|
+
width: '24px',
|
|
199
|
+
height: '24px',
|
|
200
|
+
justifyContent: 'center',
|
|
201
|
+
alignItems: 'center',
|
|
202
|
+
display: 'flex',
|
|
203
|
+
borderRadius: '100%',
|
|
204
|
+
}}
|
|
205
|
+
>
|
|
206
|
+
<Trash color="white" fill="white" />
|
|
207
|
+
</Box>
|
|
208
|
+
</Box>
|
|
209
|
+
</Hidden>
|
|
210
|
+
<Box
|
|
211
|
+
sx={{
|
|
212
|
+
display: 'flex',
|
|
213
|
+
height: '100%',
|
|
214
|
+
width: '100%',
|
|
215
|
+
justifyContent: 'center',
|
|
216
|
+
alignItems: 'center',
|
|
217
|
+
}}
|
|
218
|
+
onClick={handleArrowClick}
|
|
219
|
+
>
|
|
220
|
+
{requestImage && requestImage?.canvas?.toDataURL && (
|
|
221
|
+
<img
|
|
222
|
+
src={requestImage?.canvas?.toDataURL()}
|
|
70
223
|
style={{
|
|
71
|
-
|
|
72
|
-
|
|
224
|
+
width: '80px',
|
|
225
|
+
height: '80px',
|
|
226
|
+
objectFit: 'contain',
|
|
227
|
+
background: 'white',
|
|
228
|
+
}}
|
|
229
|
+
alt="preview"
|
|
230
|
+
/>
|
|
231
|
+
)}
|
|
232
|
+
|
|
233
|
+
<div
|
|
234
|
+
className={
|
|
235
|
+
showShrinkAnimation
|
|
236
|
+
? 'shrink-animation circle-layer'
|
|
237
|
+
: 'circle-layer'
|
|
238
|
+
}
|
|
239
|
+
></div>
|
|
240
|
+
</Box>
|
|
241
|
+
<Hidden mdUp>
|
|
242
|
+
<Box
|
|
243
|
+
sx={{
|
|
244
|
+
position: 'absolute',
|
|
245
|
+
right: '25px',
|
|
246
|
+
padding: '4px',
|
|
247
|
+
}}
|
|
248
|
+
onClick={handleArrowClick}
|
|
249
|
+
>
|
|
250
|
+
<Box
|
|
251
|
+
bgcolor={'white'}
|
|
252
|
+
className={showShrinkAnimation ? 'slideUp' : ''}
|
|
253
|
+
sx={{
|
|
254
|
+
width: '24px',
|
|
255
|
+
height: '24px',
|
|
256
|
+
justifyContent: 'center',
|
|
257
|
+
alignItems: 'center',
|
|
258
|
+
display: 'flex',
|
|
259
|
+
borderRadius: '100%',
|
|
73
260
|
}}
|
|
74
261
|
>
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
: 'Crop the image for better results'}
|
|
78
|
-
</Typography>
|
|
262
|
+
<ArrowDown color="black" fill="black" />
|
|
263
|
+
</Box>
|
|
79
264
|
</Box>
|
|
80
|
-
|
|
265
|
+
</Hidden>
|
|
81
266
|
</Box>
|
|
82
|
-
}
|
|
267
|
+
)}
|
|
83
268
|
</Box>
|
|
84
269
|
);
|
|
85
270
|
}
|
|
86
|
-
|
|
271
|
+
const ImagePreviewMobile = connectSearchBox<any>(
|
|
272
|
+
memo(ImagePreviewMobileComponent),
|
|
273
|
+
);
|
|
87
274
|
export default ImagePreviewMobile;
|