@nyris/nyris-webapp 0.2.4 → 0.3.1

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 (199) hide show
  1. package/build/asset-manifest.json +32 -18
  2. package/build/index.html +1 -1
  3. package/build/js/test.js +62 -0
  4. package/build/{precache-manifest.211a3df6baece8bbe3672765faa0d629.js → precache-manifest.3e7aa489925304848e8f04e3015d8567.js} +89 -13
  5. package/build/service-worker.js +1 -1
  6. package/build/static/css/2.8285176a.chunk.css +2 -0
  7. package/build/static/css/2.8285176a.chunk.css.map +1 -0
  8. package/build/static/css/main.b731b101.chunk.css +2 -0
  9. package/build/static/css/main.b731b101.chunk.css.map +1 -0
  10. package/build/static/js/2.8297cb74.chunk.js +3 -0
  11. package/build/static/js/2.8297cb74.chunk.js.LICENSE.txt +133 -0
  12. package/build/static/js/2.8297cb74.chunk.js.map +1 -0
  13. package/build/static/js/main.05909665.chunk.js +2 -0
  14. package/build/static/js/main.05909665.chunk.js.map +1 -0
  15. package/build/static/js/{runtime-main.f5553a9b.js → runtime-main.b418ff16.js} +1 -1
  16. package/build/static/js/{runtime-main.f5553a9b.js.map → runtime-main.b418ff16.js.map} +1 -1
  17. package/build/static/media/Fill.37094b44.svg +3 -0
  18. package/build/static/media/Montserrat-Bold.5a052e98.otf +0 -0
  19. package/build/static/media/Montserrat-Light.21789e89.otf +0 -0
  20. package/build/static/media/Montserrat-Medium.a53e0373.otf +0 -0
  21. package/build/static/media/Montserrat-Regular.71cdc681.otf +0 -0
  22. package/build/static/media/Montserrat-SemiBold.f613d915.otf +0 -0
  23. package/build/static/media/Rectangle.4dd8b747.png +0 -0
  24. package/build/static/media/admin.9529c7f6.svg +3 -0
  25. package/build/static/media/bg-support-page.6ac55268.svg +9 -0
  26. package/build/static/media/book_mark.8e294c0b.svg +3 -0
  27. package/build/static/media/icon_dislike.94607ca6.svg +3 -0
  28. package/build/static/media/icon_like.a4fb1b18.svg +3 -0
  29. package/build/static/media/icon_modal_image.3068d0ea.svg +21 -0
  30. package/build/static/media/icon_search_image.c2c728c0.svg +3 -0
  31. package/build/static/media/nyris_logo.22d8f250.svg +3 -0
  32. package/build/static/media/reload_icon.4b579a74.svg +3 -0
  33. package/build/static/media/save_search.bebaeebf.svg +3 -0
  34. package/build/static/media/support.289c3a3c.svg +3 -0
  35. package/build/static/media/translate_icon.f0492297.svg +3 -0
  36. package/package.json +31 -6
  37. package/public/js/test.js +62 -0
  38. package/src/App.css +27 -11
  39. package/src/App.tsx +19 -217
  40. package/src/Router.tsx +97 -0
  41. package/src/Store/Auth.ts +44 -0
  42. package/src/Store/Nyris.ts +77 -0
  43. package/src/Store/Search.ts +269 -0
  44. package/src/Store/Store.ts +46 -0
  45. package/src/Store/common.d.ts +10 -0
  46. package/src/{epics → Store/epics}/feedback.ts +0 -0
  47. package/src/{epics → Store/epics}/types.ts +1 -1
  48. package/src/common/assets/fonts/Montserrat_OTF/Montserrat-Bold.otf +0 -0
  49. package/src/common/assets/fonts/Montserrat_OTF/Montserrat-Light.otf +0 -0
  50. package/src/common/assets/fonts/Montserrat_OTF/Montserrat-Medium.otf +0 -0
  51. package/src/common/assets/fonts/Montserrat_OTF/Montserrat-Regular.otf +0 -0
  52. package/src/common/assets/fonts/Montserrat_OTF/Montserrat-SemiBold.otf +0 -0
  53. package/src/{fonts → common/assets/fonts}/roboto-bold-webfont.woff +0 -0
  54. package/src/{fonts → common/assets/fonts}/roboto-bold-webfont.woff2 +0 -0
  55. package/src/{fonts → common/assets/fonts}/roboto-italic-webfont.woff +0 -0
  56. package/src/{fonts → common/assets/fonts}/roboto-italic-webfont.woff2 +0 -0
  57. package/src/{fonts → common/assets/fonts}/roboto-regular-webfont.woff +0 -0
  58. package/src/{fonts → common/assets/fonts}/roboto-regular-webfont.woff2 +0 -0
  59. package/src/{fonts → common/assets/fonts}/robotocondensed-bold-webfont.woff +0 -0
  60. package/src/{fonts → common/assets/fonts}/robotocondensed-bold-webfont.woff2 +0 -0
  61. package/src/{fonts → common/assets/fonts}/robotocondensed-bolditalic-webfont.woff +0 -0
  62. package/src/{fonts → common/assets/fonts}/robotocondensed-bolditalic-webfont.woff2 +0 -0
  63. package/src/common/assets/icons/Fill.png +0 -0
  64. package/src/common/assets/icons/Fill.svg +3 -0
  65. package/src/common/assets/icons/Icon_wechat.png +0 -0
  66. package/src/common/assets/icons/Icon_whatsapp.png +0 -0
  67. package/src/common/assets/icons/admin.png +0 -0
  68. package/src/common/assets/icons/admin.svg +3 -0
  69. package/src/common/assets/icons/book_mark.png +0 -0
  70. package/src/common/assets/icons/book_mark.svg +3 -0
  71. package/src/common/assets/icons/icon_barcode.png +0 -0
  72. package/src/common/assets/icons/icon_camera.png +0 -0
  73. package/src/common/assets/icons/icon_dislike.svg +3 -0
  74. package/src/common/assets/icons/icon_disslike.png +0 -0
  75. package/src/common/assets/icons/icon_email.png +0 -0
  76. package/src/common/assets/icons/icon_like.png +0 -0
  77. package/src/common/assets/icons/icon_like.svg +3 -0
  78. package/src/common/assets/icons/icon_modal_image.png +0 -0
  79. package/src/common/assets/icons/icon_modal_image.svg +21 -0
  80. package/src/common/assets/icons/icon_picture.png +0 -0
  81. package/src/common/assets/icons/icon_search_image.png +0 -0
  82. package/src/common/assets/icons/icon_search_image.svg +3 -0
  83. package/src/common/assets/icons/nyris_logo.svg +3 -0
  84. package/src/common/assets/icons/reload_icon.png +0 -0
  85. package/src/common/assets/icons/reload_icon.svg +3 -0
  86. package/src/common/assets/icons/save_search.png +0 -0
  87. package/src/common/assets/icons/save_search.svg +3 -0
  88. package/src/common/assets/icons/setting_search_icon.png +0 -0
  89. package/src/common/assets/icons/support.png +0 -0
  90. package/src/common/assets/icons/support.svg +3 -0
  91. package/src/common/assets/icons/translate_icon.png +0 -0
  92. package/src/common/assets/icons/translate_icon.svg +3 -0
  93. package/src/common/assets/icons/view_off.png +0 -0
  94. package/src/common/assets/images/Rectangle.png +0 -0
  95. package/src/common/assets/images/bg-support-page.svg +9 -0
  96. package/src/{images → common/assets/images}/fav/android-icon-192x192.png +0 -0
  97. package/src/{images → common/assets/images}/fav/apple-icon-114x114.png +0 -0
  98. package/src/{images → common/assets/images}/fav/apple-icon-120x120.png +0 -0
  99. package/src/{images → common/assets/images}/fav/apple-icon-144x144.png +0 -0
  100. package/src/{images → common/assets/images}/fav/apple-icon-152x152.png +0 -0
  101. package/src/{images → common/assets/images}/fav/apple-icon-180x180.png +0 -0
  102. package/src/{images → common/assets/images}/fav/apple-icon-57x57.png +0 -0
  103. package/src/{images → common/assets/images}/fav/apple-icon-60x60.png +0 -0
  104. package/src/{images → common/assets/images}/fav/apple-icon-72x72.png +0 -0
  105. package/src/{images → common/assets/images}/fav/apple-icon-76x76.png +0 -0
  106. package/src/{images → common/assets/images}/fav/browserconfig.xml +0 -0
  107. package/src/{images → common/assets/images}/fav/favicon-16x16.png +0 -0
  108. package/src/{images → common/assets/images}/fav/favicon-32x32.png +0 -0
  109. package/src/{images → common/assets/images}/fav/favicon-96x96.png +0 -0
  110. package/src/{images → common/assets/images}/fav/manifest.json +0 -0
  111. package/src/{images → common/assets/images}/ic_cam.png +0 -0
  112. package/src/{images → common/assets/images}/ic_cam.svg +0 -0
  113. package/src/{images → common/assets/images}/ic_cam_large.png +0 -0
  114. package/src/{images → common/assets/images}/ic_cam_large.svg +0 -0
  115. package/src/{images → common/assets/images}/ic_cam_large_noimage.png +0 -0
  116. package/src/{images → common/assets/images}/ic_close_feedback.png +0 -0
  117. package/src/{images → common/assets/images}/ic_close_feedback.svg +0 -0
  118. package/src/{images → common/assets/images}/ic_shopNow.png +0 -0
  119. package/src/{images → common/assets/images}/ic_shopNow.svg +0 -0
  120. package/src/{images → common/assets/images}/ic_shopNowLight.png +0 -0
  121. package/src/{images → common/assets/images}/ic_shopNowLight.svg +0 -0
  122. package/src/common/assets/images/image_test.png +0 -0
  123. package/src/{images → common/assets/images}/nyris_logo.png +0 -0
  124. package/src/{images → common/assets/images}/rewe.svg +0 -0
  125. package/src/{images → common/assets/images}/sectionTransBack.png +0 -0
  126. package/src/{images → common/assets/images}/sectionTransBack.svg +0 -0
  127. package/src/{images → common/assets/images}/sectionTransTop.png +0 -0
  128. package/src/{images → common/assets/images}/sectionTransTop.svg +0 -0
  129. package/src/components/DetailItem.tsx +175 -0
  130. package/src/components/DragDropFile.tsx +188 -0
  131. package/src/components/ExampleImages.tsx +32 -17
  132. package/src/components/Feedback.tsx +87 -48
  133. package/src/components/FilterComponent.tsx +47 -0
  134. package/src/components/Footer.tsx +29 -0
  135. package/src/components/FooterMD.tsx +54 -0
  136. package/src/components/FooterNewVersion.tsx +12 -0
  137. package/src/components/FooterResult.tsx +47 -0
  138. package/src/components/Header.tsx +35 -0
  139. package/src/components/HeaderMd.tsx +39 -0
  140. package/src/components/HeaderNewVersion.tsx +92 -0
  141. package/src/components/Layout.tsx +46 -0
  142. package/src/components/LoadingScreen/index.tsx +42 -0
  143. package/src/components/Navigation.tsx +34 -0
  144. package/src/components/Panigation/Pagination.tsx +140 -0
  145. package/src/components/Panigation/cx.js +3 -0
  146. package/src/components/Panigation/isModifierClick.js +10 -0
  147. package/src/components/Result.tsx +186 -113
  148. package/src/components/Saved/AllItem.tsx +32 -0
  149. package/src/components/Saved/Category.tsx +16 -0
  150. package/src/components/carousel/DefaultCarousel.tsx +48 -0
  151. package/src/components/common.d.ts +9 -0
  152. package/src/components/common.scss +54 -0
  153. package/src/components/default-select.tsx +45 -0
  154. package/src/components/hitItem/hits.tsx +50 -0
  155. package/src/components/hitItem/infinitiHits.tsx +33 -0
  156. package/src/components/input/inputSearch.tsx +77 -0
  157. package/src/components/modal/DefaultModal.tsx +28 -0
  158. package/src/components/preview/preview.tsx +433 -0
  159. package/src/components/results/ItemResult.tsx +155 -0
  160. package/src/components/search/ListSearch.tsx +209 -0
  161. package/src/defaults.ts +4 -3
  162. package/src/index.css +577 -306
  163. package/src/index.tsx +39 -186
  164. package/src/modules/LandingPage/common.scss +1288 -0
  165. package/src/modules/LandingPage/indexApp.tsx +474 -0
  166. package/src/modules/LandingPage/indexAppMD.tsx +494 -0
  167. package/src/modules/LandingPage/indexNewVersion.tsx +118 -0
  168. package/src/page/Auth/login.tsx +7 -0
  169. package/src/page/Exception/404.tsx +11 -0
  170. package/src/page/History/index.tsx +76 -0
  171. package/src/page/Profile/index.tsx +87 -0
  172. package/src/page/Saved/MockData.ts +223 -0
  173. package/src/page/Saved/index.tsx +166 -0
  174. package/src/page/Support/index.tsx +160 -0
  175. package/src/page/result/MockData.ts +36 -0
  176. package/src/page/result/index.tsx +482 -0
  177. package/src/services/Feedback.ts +65 -0
  178. package/src/services/findByImage.ts +24 -0
  179. package/src/services/findRegionsCustom.ts +212 -0
  180. package/src/services/image.ts +110 -0
  181. package/src/services/nyris.ts +123 -0
  182. package/src/services/session.ts +20 -0
  183. package/src/services/types.ts +96 -0
  184. package/src/types.ts +43 -3
  185. package/tsconfig.json +3 -8
  186. package/build/static/css/2.43a1c8b7.chunk.css +0 -2
  187. package/build/static/css/2.43a1c8b7.chunk.css.map +0 -1
  188. package/build/static/css/main.f6ed5f12.chunk.css +0 -2
  189. package/build/static/css/main.f6ed5f12.chunk.css.map +0 -1
  190. package/build/static/js/2.b56c1bca.chunk.js +0 -3
  191. package/build/static/js/2.b56c1bca.chunk.js.LICENSE.txt +0 -79
  192. package/build/static/js/2.b56c1bca.chunk.js.map +0 -1
  193. package/build/static/js/main.a9ea9ea5.chunk.js +0 -2
  194. package/build/static/js/main.a9ea9ea5.chunk.js.map +0 -1
  195. package/src/AppMD.tsx +0 -320
  196. package/src/actions/nyrisAppActions.ts +0 -76
  197. package/src/actions/searchActions.ts +0 -135
  198. package/src/epics/index.ts +0 -133
  199. package/src/epics/search.ts +0 -114
File without changes
File without changes
File without changes
@@ -0,0 +1,175 @@
1
+ import { Box, Button, Grid, Typography } from "@material-ui/core";
2
+ import React from "react";
3
+ import CloseOutlinedIcon from "@material-ui/icons/CloseOutlined";
4
+ import DefaultCarousel from "./carousel/DefaultCarousel";
5
+ import { Link } from "react-router-dom";
6
+ import IconSupport from "common/assets/icons/support.svg";
7
+ import IconLike from "common/assets/icons/icon_like.svg";
8
+ import IconDisLike from "common/assets/icons/icon_dislike.svg";
9
+ import IconShare from "common/assets/icons/Fill.svg";
10
+ import IconBookmark from "common/assets/icons/book_mark.svg";
11
+ // import IconPicture from "common/assets/icons/icon_picture.png";
12
+ import IconPicture from "common/assets/icons/icon_modal_image.svg";
13
+ import { useState } from "react";
14
+ import { isEmpty } from "lodash";
15
+ import { useEffect } from "react";
16
+
17
+ interface Props {
18
+ numberResult?: number;
19
+ results?: any;
20
+ handlerCloseModal: () => void;
21
+ onNextItem?: () => void;
22
+ onPrevItem?: () => void;
23
+ dataItem?: any;
24
+ onHandlerModalShare?: () => void;
25
+ onSearchImage?: any;
26
+ }
27
+
28
+ function DetailItem(props: Props) {
29
+ const {
30
+ handlerCloseModal,
31
+ dataItem,
32
+ onHandlerModalShare,
33
+ onSearchImage,
34
+ } = props;
35
+
36
+ const { img, title, sku, main_image_link } = dataItem;
37
+ const [dataImageCarousel, setDataImageCarouSel] = useState<any[]>([]);
38
+
39
+ useEffect(() => {
40
+ checkDataItemResult(dataItem);
41
+ }, [dataItem]);
42
+
43
+ const checkDataItemResult = (dataItem: any) => {
44
+ if (!dataItem) {
45
+ return setDataImageCarouSel([]);
46
+ }
47
+ let valueKey: any[] = [];
48
+ const newObject = dataItem;
49
+ for (let key in newObject) {
50
+ if (key?.includes("recognition_image_link")) {
51
+ if (!isEmpty(newObject[key])) {
52
+ valueKey.push({
53
+ url: newObject[key],
54
+ });
55
+ }
56
+ } else {
57
+ if (key === "main_image_link") {
58
+ valueKey.push({
59
+ url: newObject[key],
60
+ });
61
+ }
62
+ }
63
+ }
64
+ setDataImageCarouSel(valueKey);
65
+ };
66
+
67
+ return (
68
+ <Box className="box-modal-default">
69
+ <Box className="ml-auto" style={{ width: "fit-content", marginRight: 5 }}>
70
+ <Button style={{ padding: 0 }} onClick={handlerCloseModal}>
71
+ <CloseOutlinedIcon style={{ fontSize: 12, color: "#55566B" }} />
72
+ </Button>
73
+ </Box>
74
+
75
+ <Box className="box-carosel">
76
+ <DefaultCarousel imgItem={dataImageCarousel} />
77
+ <Button
78
+ className="icon-style"
79
+ onClick={() => {
80
+ if (!main_image_link) {
81
+ console.log("321");
82
+
83
+ return;
84
+ }
85
+ onSearchImage(main_image_link);
86
+ handlerCloseModal();
87
+ }}
88
+ >
89
+ <img src={IconPicture} alt="icon_picture" />
90
+ </Button>
91
+ </Box>
92
+
93
+ <Box
94
+ className="box-content"
95
+ display={"flex"}
96
+ style={{ flexDirection: "column" }}
97
+ >
98
+ <Box className="box-top">
99
+ <Grid container justifyContent="space-between">
100
+ <Grid item xs={10}>
101
+ <Typography className="text-f9 fw-500 max-line-1">
102
+ SKU: {sku}
103
+ </Typography>
104
+ <Typography className="text-f16 fw-600 text-dark">
105
+ {title}
106
+ </Typography>
107
+ <Link className="text-f9 text-blue" to={"/"} href="#">
108
+ View full description
109
+ </Link>
110
+ </Grid>
111
+ <Grid item>
112
+ <Button className="btn-item">
113
+ <img
114
+ src={IconBookmark}
115
+ alt="image_item"
116
+ className="icon_action"
117
+ />
118
+ </Button>
119
+ </Grid>
120
+ </Grid>
121
+ </Box>
122
+
123
+ <Box className="box-bottom">
124
+ <Grid container justifyContent="space-between" alignItems="center">
125
+ <Grid item>
126
+ <Box display={"flex"} alignItems={"center"}>
127
+ <Button className="btn-item">
128
+ <img
129
+ src={IconLike}
130
+ alt="image_item"
131
+ className="icon_action"
132
+ />
133
+ </Button>
134
+ <Button className="btn-item">
135
+ <img
136
+ src={IconDisLike}
137
+ alt="image_item"
138
+ className="icon_action"
139
+ />
140
+ </Button>
141
+ </Box>
142
+ </Grid>
143
+ <Grid item>
144
+ <Box display={"flex"} alignItems={"center"}>
145
+ <Button className="btn-item" onClick={onHandlerModalShare}>
146
+ <img
147
+ src={IconShare}
148
+ alt="image_item"
149
+ className="icon_action"
150
+ />
151
+ </Button>
152
+ <Button className="btn-item">
153
+ <Box
154
+ className="box-gray text-center box-support"
155
+ display={"flex"}
156
+ justifyContent={"center"}
157
+ alignItems={"center"}
158
+ >
159
+ <img
160
+ src={IconSupport}
161
+ alt="image_item"
162
+ className="icon_support"
163
+ />
164
+ </Box>
165
+ </Button>
166
+ </Box>
167
+ </Grid>
168
+ </Grid>
169
+ </Box>
170
+ </Box>
171
+ </Box>
172
+ );
173
+ }
174
+
175
+ export default DetailItem;
@@ -0,0 +1,188 @@
1
+ import { Box, Typography } from "@material-ui/core";
2
+ import React from "react";
3
+ import { useDropzone } from "react-dropzone";
4
+ import IconSearch from "common/assets/icons/icon_search_image.svg";
5
+ import { makeFileHandler } from "@nyris/nyris-react-components";
6
+ import { useAppDispatch, useAppSelector } from "Store/Store";
7
+ import { serviceImage, serviceImageNonRegion } from "services/image";
8
+ import {
9
+ loadFile,
10
+ loadingActionResults,
11
+ searchFileImageNonRegion,
12
+ } from "Store/Search";
13
+ import { showFeedback, showResults } from "Store/Nyris";
14
+ import { useHistory } from "react-router-dom";
15
+ import ExampleImages from "./ExampleImages";
16
+ import { feedbackClickEpic } from "services/Feedback";
17
+ import { useState } from "react";
18
+
19
+ interface Props {
20
+ acceptTypes: any;
21
+ onChangeLoading: any;
22
+ isLoading: boolean;
23
+ }
24
+
25
+ function DragDropFile(props: Props) {
26
+ const history = useHistory();
27
+ const dispatch = useAppDispatch();
28
+ const { acceptTypes, onChangeLoading, isLoading } = props;
29
+ const searchState = useAppSelector((state) => state);
30
+ const { settings } = searchState;
31
+ const [rectCoords] = useState<any>(undefined);
32
+ const [isLoadingLoadFile, setLoadingLoadFile] = useState<any>(false);
33
+
34
+ const { getRootProps, getInputProps, isDragActive } = useDropzone({
35
+ onDrop: (fs: File[]) => {
36
+ onChangeLoading(true);
37
+ console.log("321");
38
+ let payload: any;
39
+ let filters: any[] = [];
40
+ setLoadingLoadFile(true);
41
+ console.log("fs", fs);
42
+
43
+ return serviceImage(fs[0], searchState).then((res: any) => {
44
+ console.log("res?.results", res);
45
+
46
+ res?.results.map((item: any) => {
47
+ filters.push({
48
+ sku: item.sku,
49
+ score: item.score,
50
+ });
51
+ });
52
+ payload = {
53
+ ...res,
54
+ // results: newResult,
55
+ filters,
56
+ };
57
+ console.log("payload", payload);
58
+
59
+ dispatch(loadFile(payload));
60
+ setLoadingLoadFile(false);
61
+ onChangeLoading(false);
62
+ history.push("/result");
63
+ return dispatch(showFeedback(""));
64
+ });
65
+ },
66
+ });
67
+
68
+ const getUrlToCanvasFile = (url: string, position?: number) => {
69
+ onChangeLoading(true);
70
+ dispatch(showResults(""));
71
+ dispatch(loadingActionResults(""));
72
+ if (position) {
73
+ feedbackClickEpic(searchState, position);
74
+ }
75
+
76
+ if (settings.regions) {
77
+ serviceImage(url, searchState).then((res) => {
78
+ dispatch(loadFile(res));
79
+ onChangeLoading(false);
80
+ history.push("/result");
81
+ return dispatch(showFeedback(""));
82
+ });
83
+ } else {
84
+ serviceImageNonRegion(url, searchState, rectCoords).then((res) => {
85
+ onChangeLoading(false);
86
+ history.push("/result");
87
+ dispatch(searchFileImageNonRegion(res));
88
+ });
89
+ }
90
+ };
91
+
92
+ return (
93
+ <Box
94
+ className={
95
+ !isDragActive && !isLoadingLoadFile
96
+ ? `box-content-main`
97
+ : `box-content-main-drop`
98
+ }
99
+ >
100
+ {isLoading && (
101
+ <Box className="loadingSpinCT">
102
+ <Box className="box-content-spin"></Box>
103
+ </Box>
104
+ )}
105
+
106
+ <div
107
+ className={`box-border`}
108
+ style={{ position: "relative" }}
109
+ {...getRootProps({
110
+ onClick: (e) => {
111
+ e.stopPropagation();
112
+ },
113
+ })}
114
+ >
115
+ {isDragActive ? (
116
+ <Box>
117
+ <Typography className="text-drop-file">
118
+ DRAG <span className="tractor">&</span> DROP
119
+ </Typography>
120
+ <input
121
+ {...getInputProps({
122
+ onClick: (e) => {
123
+ e.stopPropagation();
124
+ },
125
+ })}
126
+ type="file"
127
+ name="file"
128
+ id="select_file"
129
+ // className="inputFile"
130
+ placeholder="Choose photo"
131
+ accept={acceptTypes}
132
+ onChange={makeFileHandler((e) => {})}
133
+ />
134
+ </Box>
135
+ ) : (
136
+ <>
137
+ <Box
138
+ className="box-content-drop"
139
+ {...getRootProps({
140
+ onClick: (e) => {
141
+ e.stopPropagation();
142
+ },
143
+ })}
144
+ >
145
+ <Box className="box-image">
146
+ <img
147
+ width={27}
148
+ height={27}
149
+ src={IconSearch}
150
+ alt="icon_search"
151
+ />
152
+ </Box>
153
+ <label htmlFor="select_file" className="text-f20 text-bold">
154
+ <span className="box-blue">Choose photo</span> or drag & drop it
155
+ here
156
+ </label>
157
+ <input
158
+ {...getInputProps()}
159
+ type="file"
160
+ name="file"
161
+ id="select_file"
162
+ className="inputFile"
163
+ placeholder="Choose photo"
164
+ style={{ display: "block" }}
165
+ // accept={acceptTypes}
166
+ // onChange={makeFileHandler((e) => {
167
+ // return isCheckImageFile(e);
168
+ // })}
169
+ />
170
+ </Box>
171
+ <Box style={{ marginTop: 19, zIndex: 109 }} className="box-thumb">
172
+ <Box display={"flex"} alignItems={"flex-end"}>
173
+ <ExampleImages
174
+ images={settings.exampleImages}
175
+ onExampleImageClicked={(url: string) => {
176
+ return getUrlToCanvasFile(url);
177
+ }}
178
+ />
179
+ </Box>
180
+ </Box>
181
+ </>
182
+ )}
183
+ </div>
184
+ </Box>
185
+ );
186
+ }
187
+
188
+ export default DragDropFile;
@@ -1,24 +1,39 @@
1
- import React from 'react';
1
+ import { Typography } from "@material-ui/core";
2
+ import React from "react";
2
3
 
3
4
  interface ExampleImagesProps {
4
- images: string[],
5
- onExampleImageClicked: (url: string) => void
5
+ images: string[];
6
+ onExampleImageClicked: (url: string) => void;
6
7
  }
7
8
 
8
- const ExampleImages : React.FC<ExampleImagesProps> = ({images, onExampleImageClicked}) => {
9
- if (images.length === 0) {
10
- return null;
11
- }
12
- return (
13
- <section className="useExampleImg">
14
- You can also try one of these pictures:
15
- <div className="exampleImages">
16
- <div className="exImagesWrap">
17
- {images.map((i) => (<img key={i} src={i} alt="" onClick={() => onExampleImageClicked(i)}/>))}
18
- </div>
19
- </div>
20
- </section>
21
- );
9
+ const ExampleImages: React.FC<ExampleImagesProps> = ({
10
+ images,
11
+ onExampleImageClicked,
12
+ }) => {
13
+ if (images.length === 0) {
14
+ return null;
15
+ }
16
+ return (
17
+ <section className="useExampleImg">
18
+ <Typography className="title-box">
19
+ You can also try one of these pictures:
20
+ </Typography>
21
+ <div className="exampleImages">
22
+ <div className="exImagesWrap">
23
+ {images.map((i) => {
24
+ return (
25
+ <img
26
+ key={i}
27
+ src={i}
28
+ alt=""
29
+ onClick={() => onExampleImageClicked(i)}
30
+ />
31
+ );
32
+ })}
33
+ </div>
34
+ </div>
35
+ </section>
36
+ );
22
37
  };
23
38
 
24
39
  export default ExampleImages;
@@ -1,55 +1,94 @@
1
- import React from 'react';
2
- import {NyrisFeedbackState} from "../actions/nyrisAppActions";
3
- import {Animate} from "react-move";
4
-
1
+ import { useAppDispatch, useAppSelector } from "Store/Store";
2
+ import {
3
+ feedbackNegative,
4
+ feedbackSubmitPositive,
5
+ NyrisFeedbackState,
6
+ } from "Store/Nyris";
7
+ import React from "react";
8
+ import { Animate } from "react-move";
9
+ import { feedbackSuccessEpic } from "services/Feedback";
5
10
  interface FeedbackProps {
6
- feedbackState: NyrisFeedbackState,
7
- onPositiveFeedback?: () => void,
8
- onNegativeFeedback?: () => void,
9
- onClose?: () => void
11
+ feedbackState: NyrisFeedbackState;
12
+ onClose?: () => void;
10
13
  }
11
14
 
12
- const Feedback: React.FC<FeedbackProps> = ({feedbackState, onPositiveFeedback, onNegativeFeedback, onClose}) => {
13
- let inner : any = null;
14
- switch (feedbackState) {
15
- case 'question':
16
- inner =
17
- <div className="feedbackForm">
18
- <p>Did you find what you were looking for?</p>
19
- <div className="btn primary positiveFeedback" onClick={onPositiveFeedback}>Yes</div>
20
- <div className="btn secondary negativeFeedback" onClick={onNegativeFeedback}>No</div>
21
- </div>;
22
- break;
23
- case 'positive':
24
- inner = <div className="feedbackMessage positive">Great, thank you for your feedback!</div>
25
- break;
26
- case 'negative':
27
- inner =
28
- <div className="feedbackMessage negative">We saved your request so we can track down the
29
- issue and improve the search experience. Your Feedback helps us to make our service
30
- better for everyone,
31
- thank you!<br/>
32
- <div className="btn dismiss" onClick={onClose}>Dismiss</div>
33
- </div>;
34
- break;
35
- default:
36
- inner = null;
37
- break;
15
+ const Feedback: React.FC<FeedbackProps> = ({ feedbackState, onClose }) => {
16
+ let inner: any = null;
17
+ const state = useAppSelector((state) => state);
18
+ const dispatch = useAppDispatch();
19
+ const onPositiveFeedback = (data: boolean) => {
20
+ feedbackSuccessEpic(state, data);
21
+ if (data) {
22
+ dispatch(feedbackSubmitPositive(""));
23
+ } else {
24
+ dispatch(feedbackNegative(""));
38
25
  }
39
- return (
40
- <Animate show={feedbackState !== 'hidden'} start={{y: 100, opacity: 0}} enter={{y: [0], opacity: [1]}} leave={{y: [100], opacity: [0] }}>
41
- {({y, opacity}) =>
42
- <section className="feedback" style={{transform: `translateY(${y}%)`, opacity }}>
43
- <div className="wrapper">
44
- {inner}
45
- </div>
46
- <div className="closeFeedbackContainer">
47
- <div className="closeFeedback" onClick={onClose}/>
48
- </div>
49
- </section>
50
- }
51
- </Animate>
52
- );
26
+ };
27
+
28
+ switch (feedbackState) {
29
+ case "question":
30
+ inner = (
31
+ <div className="feedbackForm">
32
+ <p>Did you find what you were looking for?</p>
33
+ <div
34
+ className="btn primary positiveFeedback"
35
+ onClick={() => onPositiveFeedback(true)}
36
+ >
37
+ Yes
38
+ </div>
39
+ <div
40
+ className="btn secondary negativeFeedback"
41
+ onClick={() => onPositiveFeedback(false)}
42
+ >
43
+ No
44
+ </div>
45
+ </div>
46
+ );
47
+ break;
48
+ case "positive":
49
+ inner = (
50
+ <div className="feedbackMessage positive">
51
+ Great, thank you for your feedback!
52
+ </div>
53
+ );
54
+ break;
55
+ case "negative":
56
+ inner = (
57
+ <div className="feedbackMessage negative">
58
+ We saved your request so we can track down the issue and improve the
59
+ search experience. Your Feedback helps us to make our service better
60
+ for everyone, thank you!
61
+ <br />
62
+ <div className="btn dismiss" onClick={onClose}>
63
+ Dismiss
64
+ </div>
65
+ </div>
66
+ );
67
+ break;
68
+ default:
69
+ inner = null;
70
+ break;
71
+ }
72
+ return (
73
+ <Animate
74
+ show={feedbackState !== "hidden"}
75
+ start={{ y: 100, opacity: 0 }}
76
+ enter={{ y: [0], opacity: [1] }}
77
+ leave={{ y: [100], opacity: [0] }}
78
+ >
79
+ {({ y, opacity }) => (
80
+ <section
81
+ className="feedback"
82
+ style={{ transform: `translateY(${y}%)`, opacity }}
83
+ >
84
+ <div className="wrapper">{inner}</div>
85
+ <div className="closeFeedbackContainer">
86
+ <div className="closeFeedback" onClick={onClose} />
87
+ </div>
88
+ </section>
89
+ )}
90
+ </Animate>
91
+ );
53
92
  };
54
93
 
55
94
  export default Feedback;