@nyris/nyris-webapp 0.2.6 → 0.3.3
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 +32 -18
- package/build/index.html +1 -1
- package/build/js/test.js +56 -0
- package/build/{precache-manifest.aa7c9d32340f77d86c9a3347b54ba2a5.js → precache-manifest.01ce682577e62add75aa397b2a944b75.js} +89 -13
- package/build/service-worker.js +1 -1
- package/build/static/css/2.8285176a.chunk.css +2 -0
- package/build/static/css/2.8285176a.chunk.css.map +1 -0
- package/build/static/css/main.6676fe1f.chunk.css +2 -0
- package/build/static/css/main.6676fe1f.chunk.css.map +1 -0
- package/build/static/js/2.d1562c08.chunk.js +3 -0
- package/build/static/js/2.d1562c08.chunk.js.LICENSE.txt +133 -0
- package/build/static/js/2.d1562c08.chunk.js.map +1 -0
- package/build/static/js/main.5c08aba4.chunk.js +2 -0
- package/build/static/js/main.5c08aba4.chunk.js.map +1 -0
- package/build/static/js/{runtime-main.f5553a9b.js → runtime-main.b418ff16.js} +1 -1
- package/build/static/js/{runtime-main.f5553a9b.js.map → runtime-main.b418ff16.js.map} +1 -1
- package/build/static/media/Fill.37094b44.svg +3 -0
- package/build/static/media/Montserrat-Bold.5a052e98.otf +0 -0
- package/build/static/media/Montserrat-Light.21789e89.otf +0 -0
- package/build/static/media/Montserrat-Medium.a53e0373.otf +0 -0
- package/build/static/media/Montserrat-Regular.71cdc681.otf +0 -0
- package/build/static/media/Montserrat-SemiBold.f613d915.otf +0 -0
- package/build/static/media/Rectangle.4dd8b747.png +0 -0
- package/build/static/media/admin.9529c7f6.svg +3 -0
- package/build/static/media/bg-support-page.6ac55268.svg +9 -0
- package/build/static/media/book_mark.8e294c0b.svg +3 -0
- package/build/static/media/icon_dislike.94607ca6.svg +3 -0
- package/build/static/media/icon_like.a4fb1b18.svg +3 -0
- package/build/static/media/icon_modal_image.3068d0ea.svg +21 -0
- package/build/static/media/icon_search_image.c2c728c0.svg +3 -0
- package/build/static/media/nyris_logo.22d8f250.svg +3 -0
- package/build/static/media/reload_icon.4b579a74.svg +3 -0
- package/build/static/media/save_search.bebaeebf.svg +3 -0
- package/build/static/media/support.289c3a3c.svg +3 -0
- package/build/static/media/translate_icon.f0492297.svg +3 -0
- package/package.json +30 -6
- package/public/js/test.js +56 -0
- package/src/App.css +27 -11
- package/src/App.tsx +19 -235
- package/src/Router.tsx +97 -0
- package/src/Store/Auth.ts +44 -0
- package/src/Store/Nyris.ts +77 -0
- package/src/Store/Search.ts +269 -0
- package/src/Store/Store.ts +46 -0
- package/src/Store/common.d.ts +10 -0
- package/src/{epics → Store/epics}/feedback.ts +0 -0
- package/src/{epics → Store/epics}/types.ts +1 -1
- package/src/common/assets/fonts/Montserrat_OTF/Montserrat-Bold.otf +0 -0
- package/src/common/assets/fonts/Montserrat_OTF/Montserrat-Light.otf +0 -0
- package/src/common/assets/fonts/Montserrat_OTF/Montserrat-Medium.otf +0 -0
- package/src/common/assets/fonts/Montserrat_OTF/Montserrat-Regular.otf +0 -0
- package/src/common/assets/fonts/Montserrat_OTF/Montserrat-SemiBold.otf +0 -0
- package/src/{fonts → common/assets/fonts}/roboto-bold-webfont.woff +0 -0
- package/src/{fonts → common/assets/fonts}/roboto-bold-webfont.woff2 +0 -0
- package/src/{fonts → common/assets/fonts}/roboto-italic-webfont.woff +0 -0
- package/src/{fonts → common/assets/fonts}/roboto-italic-webfont.woff2 +0 -0
- package/src/{fonts → common/assets/fonts}/roboto-regular-webfont.woff +0 -0
- package/src/{fonts → common/assets/fonts}/roboto-regular-webfont.woff2 +0 -0
- package/src/{fonts → common/assets/fonts}/robotocondensed-bold-webfont.woff +0 -0
- package/src/{fonts → common/assets/fonts}/robotocondensed-bold-webfont.woff2 +0 -0
- package/src/{fonts → common/assets/fonts}/robotocondensed-bolditalic-webfont.woff +0 -0
- package/src/{fonts → common/assets/fonts}/robotocondensed-bolditalic-webfont.woff2 +0 -0
- package/src/common/assets/icons/Fill.png +0 -0
- package/src/common/assets/icons/Fill.svg +3 -0
- package/src/common/assets/icons/Icon_wechat.png +0 -0
- package/src/common/assets/icons/Icon_whatsapp.png +0 -0
- package/src/common/assets/icons/admin.png +0 -0
- package/src/common/assets/icons/admin.svg +3 -0
- package/src/common/assets/icons/book_mark.png +0 -0
- package/src/common/assets/icons/book_mark.svg +3 -0
- package/src/common/assets/icons/icon_barcode.png +0 -0
- package/src/common/assets/icons/icon_camera.png +0 -0
- package/src/common/assets/icons/icon_dislike.svg +3 -0
- package/src/common/assets/icons/icon_disslike.png +0 -0
- package/src/common/assets/icons/icon_email.png +0 -0
- package/src/common/assets/icons/icon_like.png +0 -0
- package/src/common/assets/icons/icon_like.svg +3 -0
- package/src/common/assets/icons/icon_modal_image.png +0 -0
- package/src/common/assets/icons/icon_modal_image.svg +21 -0
- package/src/common/assets/icons/icon_picture.png +0 -0
- package/src/common/assets/icons/icon_search_image.png +0 -0
- package/src/common/assets/icons/icon_search_image.svg +3 -0
- package/src/common/assets/icons/nyris_logo.svg +3 -0
- package/src/common/assets/icons/reload_icon.png +0 -0
- package/src/common/assets/icons/reload_icon.svg +3 -0
- package/src/common/assets/icons/save_search.png +0 -0
- package/src/common/assets/icons/save_search.svg +3 -0
- package/src/common/assets/icons/setting_search_icon.png +0 -0
- package/src/common/assets/icons/support.png +0 -0
- package/src/common/assets/icons/support.svg +3 -0
- package/src/common/assets/icons/translate_icon.png +0 -0
- package/src/common/assets/icons/translate_icon.svg +3 -0
- package/src/common/assets/icons/view_off.png +0 -0
- package/src/common/assets/images/Rectangle.png +0 -0
- package/src/common/assets/images/bg-support-page.svg +9 -0
- package/src/{images → common/assets/images}/fav/android-icon-192x192.png +0 -0
- package/src/{images → common/assets/images}/fav/apple-icon-114x114.png +0 -0
- package/src/{images → common/assets/images}/fav/apple-icon-120x120.png +0 -0
- package/src/{images → common/assets/images}/fav/apple-icon-144x144.png +0 -0
- package/src/{images → common/assets/images}/fav/apple-icon-152x152.png +0 -0
- package/src/{images → common/assets/images}/fav/apple-icon-180x180.png +0 -0
- package/src/{images → common/assets/images}/fav/apple-icon-57x57.png +0 -0
- package/src/{images → common/assets/images}/fav/apple-icon-60x60.png +0 -0
- package/src/{images → common/assets/images}/fav/apple-icon-72x72.png +0 -0
- package/src/{images → common/assets/images}/fav/apple-icon-76x76.png +0 -0
- package/src/{images → common/assets/images}/fav/browserconfig.xml +0 -0
- package/src/{images → common/assets/images}/fav/favicon-16x16.png +0 -0
- package/src/{images → common/assets/images}/fav/favicon-32x32.png +0 -0
- package/src/{images → common/assets/images}/fav/favicon-96x96.png +0 -0
- package/src/{images → common/assets/images}/fav/manifest.json +0 -0
- package/src/{images → common/assets/images}/ic_cam.png +0 -0
- package/src/{images → common/assets/images}/ic_cam.svg +0 -0
- package/src/{images → common/assets/images}/ic_cam_large.png +0 -0
- package/src/{images → common/assets/images}/ic_cam_large.svg +0 -0
- package/src/{images → common/assets/images}/ic_cam_large_noimage.png +0 -0
- package/src/{images → common/assets/images}/ic_close_feedback.png +0 -0
- package/src/{images → common/assets/images}/ic_close_feedback.svg +0 -0
- package/src/{images → common/assets/images}/ic_shopNow.png +0 -0
- package/src/{images → common/assets/images}/ic_shopNow.svg +0 -0
- package/src/{images → common/assets/images}/ic_shopNowLight.png +0 -0
- package/src/{images → common/assets/images}/ic_shopNowLight.svg +0 -0
- package/src/common/assets/images/image_test.png +0 -0
- package/src/{images → common/assets/images}/nyris_logo.png +0 -0
- package/src/{images → common/assets/images}/rewe.svg +0 -0
- package/src/{images → common/assets/images}/sectionTransBack.png +0 -0
- package/src/{images → common/assets/images}/sectionTransBack.svg +0 -0
- package/src/{images → common/assets/images}/sectionTransTop.png +0 -0
- package/src/{images → common/assets/images}/sectionTransTop.svg +0 -0
- package/src/components/CustomHits/index.tsx +57 -0
- package/src/components/DetailItem.tsx +175 -0
- package/src/components/DragDropFile.tsx +188 -0
- package/src/components/ExampleImages.tsx +32 -17
- package/src/components/Feedback.tsx +87 -48
- package/src/components/FilterComponent.tsx +33 -0
- package/src/components/Footer.tsx +29 -0
- package/src/components/FooterMD.tsx +54 -0
- package/src/components/FooterNewVersion.tsx +12 -0
- package/src/components/FooterResult.tsx +47 -0
- package/src/components/Header.tsx +35 -0
- package/src/components/HeaderMd.tsx +39 -0
- package/src/components/HeaderNewVersion.tsx +92 -0
- package/src/components/Layout.tsx +46 -0
- package/src/components/LoadingScreen/index.tsx +29 -0
- package/src/components/Navigation.tsx +34 -0
- package/src/components/Panigation/Pagination.tsx +140 -0
- package/src/components/Panigation/cx.js +3 -0
- package/src/components/Panigation/isModifierClick.js +10 -0
- package/src/components/Result.tsx +186 -113
- package/src/components/Saved/AllItem.tsx +32 -0
- package/src/components/Saved/Category.tsx +16 -0
- package/src/components/carousel/DefaultCarousel.tsx +48 -0
- package/src/components/common.d.ts +9 -0
- package/src/components/common.scss +54 -0
- package/src/components/default-select.tsx +44 -0
- package/src/components/hitItem/hits.tsx +50 -0
- package/src/components/hitItem/infinitiHits.tsx +33 -0
- package/src/components/input/inputSearch.tsx +77 -0
- package/src/components/modal/DefaultModal.tsx +28 -0
- package/src/components/preview/preview.tsx +433 -0
- package/src/components/results/ItemResult.tsx +155 -0
- package/src/components/search/ListSearch.tsx +209 -0
- package/src/defaults.ts +4 -3
- package/src/index.css +577 -306
- package/src/index.tsx +39 -187
- package/src/modules/LandingPage/common.scss +1304 -0
- package/src/modules/LandingPage/indexApp.tsx +492 -0
- package/src/modules/LandingPage/indexAppMD.tsx +501 -0
- package/src/modules/LandingPage/indexNewVersion.tsx +117 -0
- package/src/page/Auth/login.tsx +7 -0
- package/src/page/Exception/404.tsx +11 -0
- package/src/page/History/index.tsx +76 -0
- package/src/page/Profile/index.tsx +87 -0
- package/src/page/Saved/MockData.ts +223 -0
- package/src/page/Saved/index.tsx +166 -0
- package/src/page/Support/index.tsx +160 -0
- package/src/page/result/MockData.ts +36 -0
- package/src/page/result/index.tsx +473 -0
- package/src/services/Feedback.ts +65 -0
- package/src/services/findByImage.ts +24 -0
- package/src/services/findRegionsCustom.ts +212 -0
- package/src/services/image.ts +110 -0
- package/src/services/nyris.ts +123 -0
- package/src/services/session.ts +20 -0
- package/src/services/types.ts +96 -0
- package/src/types.ts +43 -3
- package/tsconfig.json +3 -8
- package/build/static/css/2.43a1c8b7.chunk.css +0 -2
- package/build/static/css/2.43a1c8b7.chunk.css.map +0 -1
- package/build/static/css/main.f6ed5f12.chunk.css +0 -2
- package/build/static/css/main.f6ed5f12.chunk.css.map +0 -1
- package/build/static/js/2.a591d52a.chunk.js +0 -3
- package/build/static/js/2.a591d52a.chunk.js.LICENSE.txt +0 -79
- package/build/static/js/2.a591d52a.chunk.js.map +0 -1
- package/build/static/js/main.5a3dcfb4.chunk.js +0 -2
- package/build/static/js/main.5a3dcfb4.chunk.js.map +0 -1
- package/src/AppMD.tsx +0 -320
- package/src/actions/nyrisAppActions.ts +0 -76
- package/src/actions/searchActions.ts +0 -143
- package/src/epics/index.ts +0 -149
- package/src/epics/search.ts +0 -114
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Box,
|
|
3
|
+
Button,
|
|
4
|
+
CircularProgress,
|
|
5
|
+
IconButton,
|
|
6
|
+
TextareaAutosize,
|
|
7
|
+
Typography,
|
|
8
|
+
} from "@material-ui/core";
|
|
9
|
+
import React, { useState } from "react";
|
|
10
|
+
import PhotoCameraOutlinedIcon from "@material-ui/icons/PhotoCameraOutlined";
|
|
11
|
+
import CloseOutlinedIcon from "@material-ui/icons/CloseOutlined";
|
|
12
|
+
interface Props {}
|
|
13
|
+
|
|
14
|
+
function SupportPage(props: Props) {
|
|
15
|
+
const [imageUpload, setImageUpload] = useState<any[]>([]);
|
|
16
|
+
const [isLoading, setLoading] = useState<boolean>(false);
|
|
17
|
+
const onUploadImage = (e: any) => {
|
|
18
|
+
let newValue: any[] = [];
|
|
19
|
+
Object.values(e.target.files).forEach((val: any, index: any) => {
|
|
20
|
+
newValue.push({
|
|
21
|
+
value: index,
|
|
22
|
+
urlImage: URL.createObjectURL(val),
|
|
23
|
+
});
|
|
24
|
+
});
|
|
25
|
+
setImageUpload(newValue);
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
const onRemoveImage = (value: any) => {
|
|
29
|
+
setLoading(true);
|
|
30
|
+
const newArr = imageUpload;
|
|
31
|
+
setImageUpload(newArr);
|
|
32
|
+
setTimeout(() => {
|
|
33
|
+
setLoading(false);
|
|
34
|
+
}, 1000);
|
|
35
|
+
};
|
|
36
|
+
console.log("imageUpload", imageUpload);
|
|
37
|
+
|
|
38
|
+
return (
|
|
39
|
+
<Box className="wrap-main-support-page" display={"flex"}>
|
|
40
|
+
<Box className="col-left">
|
|
41
|
+
<Box
|
|
42
|
+
className="col-left__top"
|
|
43
|
+
display={"flex"}
|
|
44
|
+
alignItems={"center"}
|
|
45
|
+
justifyContent={"center"}
|
|
46
|
+
>
|
|
47
|
+
<Box
|
|
48
|
+
style={{ width: 640 }}
|
|
49
|
+
marginLeft={"auto"}
|
|
50
|
+
display={"flex"}
|
|
51
|
+
justifyContent={"center"}
|
|
52
|
+
>
|
|
53
|
+
<Typography
|
|
54
|
+
className="text-f40 text-white fw-700"
|
|
55
|
+
style={{ width: 442 }}
|
|
56
|
+
>
|
|
57
|
+
Didn’t find what you were looking for?
|
|
58
|
+
</Typography>
|
|
59
|
+
</Box>
|
|
60
|
+
</Box>
|
|
61
|
+
<Box className="col-left__bottom">
|
|
62
|
+
<Box style={{ width: 640 }} marginLeft={"auto"}>
|
|
63
|
+
<Box className="box-form">
|
|
64
|
+
<form>
|
|
65
|
+
<Box mb={1}>
|
|
66
|
+
<Typography className="text-white text-f12">
|
|
67
|
+
Share your search with our product expert:
|
|
68
|
+
</Typography>
|
|
69
|
+
</Box>
|
|
70
|
+
<Box className="box-btn-upload" mb={1}>
|
|
71
|
+
<input
|
|
72
|
+
accept="image/*"
|
|
73
|
+
id="contained-button-file"
|
|
74
|
+
multiple
|
|
75
|
+
type="file"
|
|
76
|
+
style={{ display: "none" }}
|
|
77
|
+
onChange={onUploadImage}
|
|
78
|
+
/>
|
|
79
|
+
<label htmlFor="contained-button-file">
|
|
80
|
+
<IconButton
|
|
81
|
+
color="primary"
|
|
82
|
+
aria-label="upload picture"
|
|
83
|
+
component="span"
|
|
84
|
+
className="btn-upload"
|
|
85
|
+
>
|
|
86
|
+
Open file
|
|
87
|
+
<PhotoCameraOutlinedIcon style={{ fontSize: 12 }} />
|
|
88
|
+
</IconButton>
|
|
89
|
+
</label>
|
|
90
|
+
</Box>
|
|
91
|
+
{!isLoading ? (
|
|
92
|
+
<Box
|
|
93
|
+
className="box-preview-image"
|
|
94
|
+
display={"flex"}
|
|
95
|
+
flexWrap={"wrap"}
|
|
96
|
+
>
|
|
97
|
+
{imageUpload &&
|
|
98
|
+
imageUpload.map((item: any, index: any) => {
|
|
99
|
+
return (
|
|
100
|
+
<Box className="box-image w-100" key={index}>
|
|
101
|
+
<Button
|
|
102
|
+
className="btn-close w-100"
|
|
103
|
+
onClick={() => {
|
|
104
|
+
const newValue = index;
|
|
105
|
+
onRemoveImage(newValue);
|
|
106
|
+
}}
|
|
107
|
+
>
|
|
108
|
+
<CloseOutlinedIcon style={{ fontSize: 12 }} />
|
|
109
|
+
</Button>
|
|
110
|
+
<img
|
|
111
|
+
style={{ height: "100%" }}
|
|
112
|
+
src={item.urlImage}
|
|
113
|
+
key={index}
|
|
114
|
+
alt={`${index}`}
|
|
115
|
+
/>
|
|
116
|
+
</Box>
|
|
117
|
+
);
|
|
118
|
+
})}
|
|
119
|
+
</Box>
|
|
120
|
+
) : (
|
|
121
|
+
<CircularProgress />
|
|
122
|
+
)}
|
|
123
|
+
|
|
124
|
+
<Box mb={2}>
|
|
125
|
+
<Typography className="text-white text-f12">
|
|
126
|
+
Or leave a message:
|
|
127
|
+
</Typography>
|
|
128
|
+
</Box>
|
|
129
|
+
<Box mb={2}>
|
|
130
|
+
<Box mb={1}>
|
|
131
|
+
<Typography className="text-white text-f8">
|
|
132
|
+
Message
|
|
133
|
+
</Typography>
|
|
134
|
+
</Box>
|
|
135
|
+
<TextareaAutosize
|
|
136
|
+
placeholder="Message"
|
|
137
|
+
minRows={1}
|
|
138
|
+
// style={{height: 'fit-content'}}
|
|
139
|
+
className="text-f9 textarea-ct w-100"
|
|
140
|
+
/>
|
|
141
|
+
</Box>
|
|
142
|
+
<Box display={"flex"}>
|
|
143
|
+
<Button className="text-white text-f9 fw-700 bg-dark w-50 border-rd-0">
|
|
144
|
+
Cancel
|
|
145
|
+
</Button>
|
|
146
|
+
<Button className="text-white text-f9 fw-700 bg-pink2 w-50 border-rd-0">
|
|
147
|
+
Send
|
|
148
|
+
</Button>
|
|
149
|
+
</Box>
|
|
150
|
+
</form>
|
|
151
|
+
</Box>
|
|
152
|
+
</Box>
|
|
153
|
+
</Box>
|
|
154
|
+
</Box>
|
|
155
|
+
<Box className="col-right"></Box>
|
|
156
|
+
</Box>
|
|
157
|
+
);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
export default SupportPage;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
export const dataFieldOne = [
|
|
2
|
+
{
|
|
3
|
+
value: "dataFieldOne",
|
|
4
|
+
title: "Filter one with a longer title",
|
|
5
|
+
},
|
|
6
|
+
];
|
|
7
|
+
export const dataFieldTow = [
|
|
8
|
+
{
|
|
9
|
+
value: "dataFieldTow",
|
|
10
|
+
title: "Filter two",
|
|
11
|
+
},
|
|
12
|
+
];
|
|
13
|
+
export const dataFieldThree = [
|
|
14
|
+
{
|
|
15
|
+
value: "dataFieldThree",
|
|
16
|
+
title: "Filter three with a smaller title",
|
|
17
|
+
},
|
|
18
|
+
];
|
|
19
|
+
export const dataFieldFour = [
|
|
20
|
+
{
|
|
21
|
+
value: "dataFieldFour",
|
|
22
|
+
title: "Filter four",
|
|
23
|
+
},
|
|
24
|
+
];
|
|
25
|
+
export const dataFieldFive = [
|
|
26
|
+
{
|
|
27
|
+
value: "dataFieldFive",
|
|
28
|
+
title: "Filter five",
|
|
29
|
+
},
|
|
30
|
+
];
|
|
31
|
+
export const dataFieldSix = [
|
|
32
|
+
{
|
|
33
|
+
value: "dataFieldSix",
|
|
34
|
+
title: "Filter six",
|
|
35
|
+
},
|
|
36
|
+
];
|
|
@@ -0,0 +1,473 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Box,
|
|
3
|
+
Button,
|
|
4
|
+
IconButton,
|
|
5
|
+
InputBase,
|
|
6
|
+
Paper,
|
|
7
|
+
Typography,
|
|
8
|
+
} from "@material-ui/core";
|
|
9
|
+
import React, { useEffect, useState } from "react";
|
|
10
|
+
import IconWhatsApp from "common/assets/icons/Icon_whatsapp.png";
|
|
11
|
+
import IconEmail from "common/assets/icons/icon_email.png";
|
|
12
|
+
import IconWeChat from "common/assets/icons/Icon_wechat.png";
|
|
13
|
+
// import FilterComponent from "components/FilterComponent";
|
|
14
|
+
// import {
|
|
15
|
+
// dataFieldFive,
|
|
16
|
+
// dataFieldFour,
|
|
17
|
+
// dataFieldOne,
|
|
18
|
+
// dataFieldSix,
|
|
19
|
+
// dataFieldThree,
|
|
20
|
+
// dataFieldTow,
|
|
21
|
+
// } from "./MockData";
|
|
22
|
+
import ItemResult from "components/results/ItemResult";
|
|
23
|
+
import { useAppDispatch, useAppSelector } from "Store/Store";
|
|
24
|
+
import { debounce } from "lodash";
|
|
25
|
+
import KeyboardArrowRightOutlinedIcon from "@material-ui/icons/KeyboardArrowRightOutlined";
|
|
26
|
+
import KeyboardArrowLeftOutlinedIcon from "@material-ui/icons/KeyboardArrowLeftOutlined";
|
|
27
|
+
import FooterResult from "components/FooterResult";
|
|
28
|
+
import DefaultModal from "components/modal/DefaultModal";
|
|
29
|
+
import CloseOutlinedIcon from "@material-ui/icons/CloseOutlined";
|
|
30
|
+
import DetailItem from "components/DetailItem";
|
|
31
|
+
import FileCopyOutlinedIcon from "@material-ui/icons/FileCopyOutlined";
|
|
32
|
+
import { RectCoords } from "@nyris/nyris-api";
|
|
33
|
+
import {
|
|
34
|
+
loadFile,
|
|
35
|
+
loadingActionResults,
|
|
36
|
+
searchFileImageNonRegion,
|
|
37
|
+
selectionChanged,
|
|
38
|
+
updateResultChangePosition,
|
|
39
|
+
} from "Store/Search";
|
|
40
|
+
import { showFeedback, showResults } from "Store/Nyris";
|
|
41
|
+
import algoliasearch from "algoliasearch/lite";
|
|
42
|
+
import {
|
|
43
|
+
InstantSearch,
|
|
44
|
+
Hits,
|
|
45
|
+
Pagination,
|
|
46
|
+
Configure,
|
|
47
|
+
} from "react-instantsearch-dom";
|
|
48
|
+
import CustomSearchBox from "components/input/inputSearch";
|
|
49
|
+
import { feedbackClickEpic } from "services/Feedback";
|
|
50
|
+
import {
|
|
51
|
+
searchImageByPosition,
|
|
52
|
+
serviceImage,
|
|
53
|
+
serviceImageNonRegion,
|
|
54
|
+
} from "services/image";
|
|
55
|
+
import Preview from "components/preview/preview";
|
|
56
|
+
import NyrisAPI from "@nyris/nyris-api";
|
|
57
|
+
import LoadingScreenCustom from "components/LoadingScreen";
|
|
58
|
+
|
|
59
|
+
interface Props {}
|
|
60
|
+
|
|
61
|
+
function ResultComponent(props: Props) {
|
|
62
|
+
const dispatch = useAppDispatch();
|
|
63
|
+
const StateGlobal = useAppSelector((state) => state);
|
|
64
|
+
const [showColLeft, setToggleShowColLeft] = useState<boolean>(false);
|
|
65
|
+
const [showImageCanvas, setShowImageCanvas] = useState<boolean>(true);
|
|
66
|
+
const [isOpenModalImage, setOpenModalImage] = useState<boolean>(false);
|
|
67
|
+
const [numberResult, setNumberResult] = useState<number>(0);
|
|
68
|
+
const [isOpenModalShare, setOpenModalShare] = useState<boolean>(false);
|
|
69
|
+
const { search, settings }: any = StateGlobal;
|
|
70
|
+
const { results, requestImage, regions, selectedRegion }: any = search;
|
|
71
|
+
const { valueTextSearch } = search;
|
|
72
|
+
const [dataResult, setDataResult] = useState<any[]>([]);
|
|
73
|
+
const [dataImageModal, setDataImageModal] = useState<any>();
|
|
74
|
+
const [searchStateInput, setSearchStateInput] = useState<any>({});
|
|
75
|
+
const apiNyris = new NyrisAPI(settings);
|
|
76
|
+
const [isLoading, setLoading] = useState<any>(false);
|
|
77
|
+
const { apiKeyAlgolia, appIdAlgolia, indexNameAlgolia } = settings;
|
|
78
|
+
const searchClient = algoliasearch(appIdAlgolia, apiKeyAlgolia);
|
|
79
|
+
const index = searchClient.initIndex(indexNameAlgolia);
|
|
80
|
+
|
|
81
|
+
useEffect(() => {
|
|
82
|
+
if (!valueTextSearch) {
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
setSearchStateInput(valueTextSearch);
|
|
86
|
+
}, [valueTextSearch]);
|
|
87
|
+
|
|
88
|
+
useEffect(() => {
|
|
89
|
+
if (results?.length === 0) {
|
|
90
|
+
setDataResult([]);
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
setDataResult(results);
|
|
94
|
+
}, [results]);
|
|
95
|
+
|
|
96
|
+
useEffect(() => {
|
|
97
|
+
if (!showColLeft) {
|
|
98
|
+
return setShowImageCanvas(true);
|
|
99
|
+
}
|
|
100
|
+
return setShowImageCanvas(false);
|
|
101
|
+
}, [showColLeft]);
|
|
102
|
+
|
|
103
|
+
// TODO: hanlder modal:
|
|
104
|
+
const handlerToggleModal = (item: any) => {
|
|
105
|
+
setDataImageModal(item);
|
|
106
|
+
return setOpenModalImage(true);
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
const onNextItem = () => {
|
|
110
|
+
if (numberResult === results.length) {
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
setNumberResult(numberResult + 1);
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
const onPrevItem = () => {
|
|
117
|
+
if (numberResult === 0) {
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
setNumberResult(numberResult - 1);
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
// TODO: rectCoords
|
|
124
|
+
|
|
125
|
+
const debounceRectCoords = (value: any) => handlerRectCoords(value);
|
|
126
|
+
|
|
127
|
+
const handlerRectCoords = debounce((value: any) => {
|
|
128
|
+
dispatch(selectionChanged(value));
|
|
129
|
+
setLoading(true);
|
|
130
|
+
return onSearchOffersForImage(value);
|
|
131
|
+
}, 500);
|
|
132
|
+
|
|
133
|
+
// TODO: Search offers for image:
|
|
134
|
+
const onSearchOffersForImage = (r: RectCoords) => {
|
|
135
|
+
if (!requestImage) {
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
138
|
+
const { canvas }: any = requestImage;
|
|
139
|
+
if (settings.regions) {
|
|
140
|
+
searchImageByPosition(canvas, StateGlobal, r).then((res: any) => {
|
|
141
|
+
const payload = {
|
|
142
|
+
...res,
|
|
143
|
+
requestImage: requestImage,
|
|
144
|
+
};
|
|
145
|
+
dispatch(updateResultChangePosition(payload));
|
|
146
|
+
setLoading(false);
|
|
147
|
+
return dispatch(showFeedback(""));
|
|
148
|
+
});
|
|
149
|
+
} else {
|
|
150
|
+
serviceImageNonRegion(canvas, StateGlobal, null).then((res: any) => {
|
|
151
|
+
const payload = {
|
|
152
|
+
...res,
|
|
153
|
+
requestImage: requestImage,
|
|
154
|
+
};
|
|
155
|
+
dispatch(updateResultChangePosition(payload));
|
|
156
|
+
return dispatch(showFeedback(""));
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
};
|
|
160
|
+
|
|
161
|
+
// TODO: Search text
|
|
162
|
+
const searchTextByApiAndFilter = async (searchState: any) => {
|
|
163
|
+
try {
|
|
164
|
+
if (searchState?.query !== "") {
|
|
165
|
+
const data = await index.search(searchState.query, {});
|
|
166
|
+
const productIds = data.hits.map((hit: any) => hit.sku);
|
|
167
|
+
const eventData = {
|
|
168
|
+
query: data.query,
|
|
169
|
+
page: data.page,
|
|
170
|
+
product_ids: productIds,
|
|
171
|
+
};
|
|
172
|
+
const textSearchEvent: any = { event: "text-search", data: eventData };
|
|
173
|
+
await apiNyris.sendFeedback(
|
|
174
|
+
search?.sessionId,
|
|
175
|
+
search?.requestId,
|
|
176
|
+
textSearchEvent
|
|
177
|
+
);
|
|
178
|
+
}
|
|
179
|
+
} catch (error: any) {
|
|
180
|
+
console.log("searchTextByApi", error);
|
|
181
|
+
return;
|
|
182
|
+
}
|
|
183
|
+
};
|
|
184
|
+
|
|
185
|
+
// TODO: Handler like dislike
|
|
186
|
+
const sendFeedBackAction = async (type: string) => {
|
|
187
|
+
try {
|
|
188
|
+
const action = type === "like" ? true : false;
|
|
189
|
+
const payload: any = {
|
|
190
|
+
event: "feedback",
|
|
191
|
+
data: {
|
|
192
|
+
success: action,
|
|
193
|
+
},
|
|
194
|
+
};
|
|
195
|
+
await apiNyris.sendFeedback(
|
|
196
|
+
search?.sessionId,
|
|
197
|
+
search?.requestId,
|
|
198
|
+
payload
|
|
199
|
+
);
|
|
200
|
+
} catch (error) {}
|
|
201
|
+
};
|
|
202
|
+
|
|
203
|
+
// Search image with url or file
|
|
204
|
+
const getUrlToCanvasFile = (url: string, position?: number) => {
|
|
205
|
+
dispatch(showResults(""));
|
|
206
|
+
dispatch(loadingActionResults(""));
|
|
207
|
+
if (position) {
|
|
208
|
+
feedbackClickEpic(StateGlobal, position);
|
|
209
|
+
return;
|
|
210
|
+
}
|
|
211
|
+
if (settings.regions) {
|
|
212
|
+
serviceImage(url, StateGlobal).then((res: any) => {
|
|
213
|
+
dispatch(loadFile(res));
|
|
214
|
+
setLoading(false);
|
|
215
|
+
return dispatch(showFeedback(""));
|
|
216
|
+
});
|
|
217
|
+
|
|
218
|
+
return;
|
|
219
|
+
} else {
|
|
220
|
+
serviceImageNonRegion(url, StateGlobal, undefined).then((res) => {
|
|
221
|
+
dispatch(searchFileImageNonRegion(res));
|
|
222
|
+
});
|
|
223
|
+
return;
|
|
224
|
+
}
|
|
225
|
+
};
|
|
226
|
+
|
|
227
|
+
// Todo: item result.
|
|
228
|
+
const Hit = (hit: any) => {
|
|
229
|
+
return (
|
|
230
|
+
<ItemResult
|
|
231
|
+
dataItem={hit?.hit}
|
|
232
|
+
handlerToggleModal={() => {
|
|
233
|
+
handlerToggleModal(hit?.hit);
|
|
234
|
+
}}
|
|
235
|
+
handlerToggleModalShare={() => setOpenModalShare(true)}
|
|
236
|
+
indexItem={hit.__position}
|
|
237
|
+
isHover={false}
|
|
238
|
+
onSearchImage={(url: any) => {
|
|
239
|
+
setSearchStateInput({});
|
|
240
|
+
getUrlToCanvasFile(url);
|
|
241
|
+
setLoading(true);
|
|
242
|
+
}}
|
|
243
|
+
handlerFeedback={(value: string) => {
|
|
244
|
+
sendFeedBackAction(value);
|
|
245
|
+
}}
|
|
246
|
+
/>
|
|
247
|
+
);
|
|
248
|
+
};
|
|
249
|
+
|
|
250
|
+
const nonEmptyFilter: any[] = !search?.requestImage
|
|
251
|
+
? []
|
|
252
|
+
: ["sku:DOES_NOT_EXIST<score=1>"];
|
|
253
|
+
const filterSkus: any = search?.results
|
|
254
|
+
? search?.results.map(
|
|
255
|
+
(f: any) => `sku:'${f.sku}'<score=${Math.round(100 * f.score)}>`
|
|
256
|
+
)
|
|
257
|
+
: "";
|
|
258
|
+
const filtersString = [...nonEmptyFilter, ...filterSkus].join(" OR ");
|
|
259
|
+
return (
|
|
260
|
+
<Box className={`wrap-main-result loading`}>
|
|
261
|
+
<>
|
|
262
|
+
{isLoading && (
|
|
263
|
+
<Box className="box-wrap-loading">
|
|
264
|
+
<Box className="loadingSpinCT">
|
|
265
|
+
<Box className="box-content-spin"></Box>
|
|
266
|
+
</Box>
|
|
267
|
+
</Box>
|
|
268
|
+
)}
|
|
269
|
+
<InstantSearch
|
|
270
|
+
indexName={indexNameAlgolia}
|
|
271
|
+
searchClient={searchClient}
|
|
272
|
+
searchState={searchStateInput}
|
|
273
|
+
onSearchStateChange={(state: any) => {
|
|
274
|
+
setSearchStateInput(state);
|
|
275
|
+
searchTextByApiAndFilter(state);
|
|
276
|
+
}}
|
|
277
|
+
>
|
|
278
|
+
<Configure filters={filtersString}></Configure>
|
|
279
|
+
<Box className="box-wrap-result-component">
|
|
280
|
+
<div className="box-search">
|
|
281
|
+
<Box>
|
|
282
|
+
<CustomSearchBox />
|
|
283
|
+
</Box>
|
|
284
|
+
{/* <Box className="box-filter">
|
|
285
|
+
<FilterComponent />
|
|
286
|
+
</Box> */}
|
|
287
|
+
</div>
|
|
288
|
+
<Box className="box-result">
|
|
289
|
+
<>
|
|
290
|
+
{settings.preview && requestImage && (
|
|
291
|
+
<Box className={`col-left ${showColLeft && "toggle"}`}>
|
|
292
|
+
<Box className="box-preview">
|
|
293
|
+
<Button
|
|
294
|
+
className="button-toggle"
|
|
295
|
+
onClick={() => {
|
|
296
|
+
setTimeout(() => {
|
|
297
|
+
setToggleShowColLeft(!showColLeft);
|
|
298
|
+
}, 500);
|
|
299
|
+
}}
|
|
300
|
+
>
|
|
301
|
+
{showColLeft ? (
|
|
302
|
+
<KeyboardArrowRightOutlinedIcon />
|
|
303
|
+
) : (
|
|
304
|
+
<KeyboardArrowLeftOutlinedIcon />
|
|
305
|
+
)}
|
|
306
|
+
</Button>
|
|
307
|
+
{requestImage && showImageCanvas && (
|
|
308
|
+
<Box className="preview-item">
|
|
309
|
+
<Preview
|
|
310
|
+
key={requestImage?.id}
|
|
311
|
+
onSelectionChange={(r: RectCoords) => {
|
|
312
|
+
debounceRectCoords(r);
|
|
313
|
+
return;
|
|
314
|
+
}}
|
|
315
|
+
image={requestImage?.canvas}
|
|
316
|
+
initialRegion={
|
|
317
|
+
!selectedRegion
|
|
318
|
+
? regions[0]
|
|
319
|
+
? regions[0]
|
|
320
|
+
: { x1: 0, x2: 1, y1: 0, y2: 1 }
|
|
321
|
+
: selectedRegion
|
|
322
|
+
}
|
|
323
|
+
regions={regions}
|
|
324
|
+
maxWidth={400}
|
|
325
|
+
maxHeight={500}
|
|
326
|
+
dotColor="#FBD914"
|
|
327
|
+
/>
|
|
328
|
+
</Box>
|
|
329
|
+
)}
|
|
330
|
+
</Box>
|
|
331
|
+
<Box className="box-title_col-left">
|
|
332
|
+
<Typography style={{ fontSize: 11, color: "#fff" }}>
|
|
333
|
+
Adjust the selection frame for better results.
|
|
334
|
+
</Typography>
|
|
335
|
+
</Box>
|
|
336
|
+
</Box>
|
|
337
|
+
)}
|
|
338
|
+
|
|
339
|
+
<Box
|
|
340
|
+
className={`col-right ${
|
|
341
|
+
settings.preview && "ml-auto mr-auto"
|
|
342
|
+
}`}
|
|
343
|
+
>
|
|
344
|
+
<Box
|
|
345
|
+
className={`box-item-result ${
|
|
346
|
+
requestImage && showImageCanvas
|
|
347
|
+
? "mr-auto"
|
|
348
|
+
: "ml-auto mr-auto"
|
|
349
|
+
}`}
|
|
350
|
+
>
|
|
351
|
+
<LoadingScreenCustom>
|
|
352
|
+
<Hits hitComponent={Hit} />
|
|
353
|
+
</LoadingScreenCustom>
|
|
354
|
+
</Box>
|
|
355
|
+
</Box>
|
|
356
|
+
</>
|
|
357
|
+
</Box>
|
|
358
|
+
<Box>
|
|
359
|
+
<Box className="box-panigation">
|
|
360
|
+
<Pagination />
|
|
361
|
+
</Box>
|
|
362
|
+
<Box className="box-notify">
|
|
363
|
+
<FooterResult search={search} />
|
|
364
|
+
</Box>
|
|
365
|
+
</Box>
|
|
366
|
+
|
|
367
|
+
{/* TODO: Component modal image */}
|
|
368
|
+
<DefaultModal
|
|
369
|
+
openModal={isOpenModalImage}
|
|
370
|
+
handleClose={(e: any) => {
|
|
371
|
+
setOpenModalImage(false);
|
|
372
|
+
}}
|
|
373
|
+
>
|
|
374
|
+
<DetailItem
|
|
375
|
+
handlerCloseModal={() => {
|
|
376
|
+
setOpenModalImage(false);
|
|
377
|
+
}}
|
|
378
|
+
onPrevItem={onPrevItem}
|
|
379
|
+
onNextItem={onNextItem}
|
|
380
|
+
dataItem={dataImageModal}
|
|
381
|
+
results={dataResult}
|
|
382
|
+
onHandlerModalShare={() => setOpenModalShare(true)}
|
|
383
|
+
onSearchImage={(url: string) => {
|
|
384
|
+
setLoading(true);
|
|
385
|
+
getUrlToCanvasFile(url);
|
|
386
|
+
}}
|
|
387
|
+
/>
|
|
388
|
+
</DefaultModal>
|
|
389
|
+
|
|
390
|
+
{/* TODO: Component modal share */}
|
|
391
|
+
<DefaultModal
|
|
392
|
+
openModal={isOpenModalShare}
|
|
393
|
+
handleClose={() => setOpenModalShare(false)}
|
|
394
|
+
>
|
|
395
|
+
<Box className="box-modal-default box-modal-share">
|
|
396
|
+
<Box
|
|
397
|
+
className="ml-auto"
|
|
398
|
+
style={{ width: "fit-content", marginRight: 5 }}
|
|
399
|
+
>
|
|
400
|
+
<Button
|
|
401
|
+
style={{ padding: 0 }}
|
|
402
|
+
onClick={() => setOpenModalShare(false)}
|
|
403
|
+
>
|
|
404
|
+
<CloseOutlinedIcon
|
|
405
|
+
style={{ fontSize: 12, color: "#55566B" }}
|
|
406
|
+
/>
|
|
407
|
+
</Button>
|
|
408
|
+
</Box>
|
|
409
|
+
<Box className="box-content-box-share">
|
|
410
|
+
<Typography className="text-f12 text-gray text-bold">
|
|
411
|
+
Share
|
|
412
|
+
</Typography>
|
|
413
|
+
<Paper component="form" className="box-input">
|
|
414
|
+
<InputBase
|
|
415
|
+
className="text-f9 text-gray"
|
|
416
|
+
style={{ width: "100%" }}
|
|
417
|
+
value={"https://www.go..."}
|
|
418
|
+
/>
|
|
419
|
+
<IconButton
|
|
420
|
+
color="secondary"
|
|
421
|
+
aria-label="directions"
|
|
422
|
+
style={{ padding: 0 }}
|
|
423
|
+
>
|
|
424
|
+
<FileCopyOutlinedIcon style={{ fontSize: 8 }} />
|
|
425
|
+
</IconButton>
|
|
426
|
+
</Paper>
|
|
427
|
+
|
|
428
|
+
<Box mt={1} className="box-media-share">
|
|
429
|
+
<Button style={{ padding: 0 }}>
|
|
430
|
+
<Box display={"flex"} alignItems={"center"}>
|
|
431
|
+
<img src={IconEmail} alt="icon_email" />
|
|
432
|
+
<Typography
|
|
433
|
+
className="text-f8 fw-500"
|
|
434
|
+
style={{ color: "#2B2C46", marginLeft: 5 }}
|
|
435
|
+
>
|
|
436
|
+
Share with e-Mail
|
|
437
|
+
</Typography>
|
|
438
|
+
</Box>
|
|
439
|
+
</Button>
|
|
440
|
+
<Button style={{ padding: 0 }}>
|
|
441
|
+
<Box display={"flex"} alignItems={"center"}>
|
|
442
|
+
<img src={IconWhatsApp} alt="icon_email" />
|
|
443
|
+
<Typography
|
|
444
|
+
className="text-f8 fw-500"
|
|
445
|
+
style={{ color: "#2B2C46", marginLeft: 5 }}
|
|
446
|
+
>
|
|
447
|
+
Share with WhatsApp
|
|
448
|
+
</Typography>
|
|
449
|
+
</Box>
|
|
450
|
+
</Button>
|
|
451
|
+
<Button style={{ padding: 0 }}>
|
|
452
|
+
<Box display={"flex"} alignItems={"center"}>
|
|
453
|
+
<img src={IconWeChat} alt="icon_email" />
|
|
454
|
+
<Typography
|
|
455
|
+
className="text-f8 fw-500"
|
|
456
|
+
style={{ color: "#2B2C46", marginLeft: 5 }}
|
|
457
|
+
>
|
|
458
|
+
Share with WeChat
|
|
459
|
+
</Typography>
|
|
460
|
+
</Box>
|
|
461
|
+
</Button>
|
|
462
|
+
</Box>
|
|
463
|
+
</Box>
|
|
464
|
+
</Box>
|
|
465
|
+
</DefaultModal>
|
|
466
|
+
</Box>
|
|
467
|
+
</InstantSearch>
|
|
468
|
+
</>
|
|
469
|
+
</Box>
|
|
470
|
+
);
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
export default ResultComponent;
|