@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.
Files changed (200) hide show
  1. package/build/asset-manifest.json +32 -18
  2. package/build/index.html +1 -1
  3. package/build/js/test.js +56 -0
  4. package/build/{precache-manifest.aa7c9d32340f77d86c9a3347b54ba2a5.js → precache-manifest.01ce682577e62add75aa397b2a944b75.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.6676fe1f.chunk.css +2 -0
  9. package/build/static/css/main.6676fe1f.chunk.css.map +1 -0
  10. package/build/static/js/2.d1562c08.chunk.js +3 -0
  11. package/build/static/js/2.d1562c08.chunk.js.LICENSE.txt +133 -0
  12. package/build/static/js/2.d1562c08.chunk.js.map +1 -0
  13. package/build/static/js/main.5c08aba4.chunk.js +2 -0
  14. package/build/static/js/main.5c08aba4.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 +30 -6
  37. package/public/js/test.js +56 -0
  38. package/src/App.css +27 -11
  39. package/src/App.tsx +19 -235
  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/CustomHits/index.tsx +57 -0
  130. package/src/components/DetailItem.tsx +175 -0
  131. package/src/components/DragDropFile.tsx +188 -0
  132. package/src/components/ExampleImages.tsx +32 -17
  133. package/src/components/Feedback.tsx +87 -48
  134. package/src/components/FilterComponent.tsx +33 -0
  135. package/src/components/Footer.tsx +29 -0
  136. package/src/components/FooterMD.tsx +54 -0
  137. package/src/components/FooterNewVersion.tsx +12 -0
  138. package/src/components/FooterResult.tsx +47 -0
  139. package/src/components/Header.tsx +35 -0
  140. package/src/components/HeaderMd.tsx +39 -0
  141. package/src/components/HeaderNewVersion.tsx +92 -0
  142. package/src/components/Layout.tsx +46 -0
  143. package/src/components/LoadingScreen/index.tsx +29 -0
  144. package/src/components/Navigation.tsx +34 -0
  145. package/src/components/Panigation/Pagination.tsx +140 -0
  146. package/src/components/Panigation/cx.js +3 -0
  147. package/src/components/Panigation/isModifierClick.js +10 -0
  148. package/src/components/Result.tsx +186 -113
  149. package/src/components/Saved/AllItem.tsx +32 -0
  150. package/src/components/Saved/Category.tsx +16 -0
  151. package/src/components/carousel/DefaultCarousel.tsx +48 -0
  152. package/src/components/common.d.ts +9 -0
  153. package/src/components/common.scss +54 -0
  154. package/src/components/default-select.tsx +44 -0
  155. package/src/components/hitItem/hits.tsx +50 -0
  156. package/src/components/hitItem/infinitiHits.tsx +33 -0
  157. package/src/components/input/inputSearch.tsx +77 -0
  158. package/src/components/modal/DefaultModal.tsx +28 -0
  159. package/src/components/preview/preview.tsx +433 -0
  160. package/src/components/results/ItemResult.tsx +155 -0
  161. package/src/components/search/ListSearch.tsx +209 -0
  162. package/src/defaults.ts +4 -3
  163. package/src/index.css +577 -306
  164. package/src/index.tsx +39 -187
  165. package/src/modules/LandingPage/common.scss +1304 -0
  166. package/src/modules/LandingPage/indexApp.tsx +492 -0
  167. package/src/modules/LandingPage/indexAppMD.tsx +501 -0
  168. package/src/modules/LandingPage/indexNewVersion.tsx +117 -0
  169. package/src/page/Auth/login.tsx +7 -0
  170. package/src/page/Exception/404.tsx +11 -0
  171. package/src/page/History/index.tsx +76 -0
  172. package/src/page/Profile/index.tsx +87 -0
  173. package/src/page/Saved/MockData.ts +223 -0
  174. package/src/page/Saved/index.tsx +166 -0
  175. package/src/page/Support/index.tsx +160 -0
  176. package/src/page/result/MockData.ts +36 -0
  177. package/src/page/result/index.tsx +473 -0
  178. package/src/services/Feedback.ts +65 -0
  179. package/src/services/findByImage.ts +24 -0
  180. package/src/services/findRegionsCustom.ts +212 -0
  181. package/src/services/image.ts +110 -0
  182. package/src/services/nyris.ts +123 -0
  183. package/src/services/session.ts +20 -0
  184. package/src/services/types.ts +96 -0
  185. package/src/types.ts +43 -3
  186. package/tsconfig.json +3 -8
  187. package/build/static/css/2.43a1c8b7.chunk.css +0 -2
  188. package/build/static/css/2.43a1c8b7.chunk.css.map +0 -1
  189. package/build/static/css/main.f6ed5f12.chunk.css +0 -2
  190. package/build/static/css/main.f6ed5f12.chunk.css.map +0 -1
  191. package/build/static/js/2.a591d52a.chunk.js +0 -3
  192. package/build/static/js/2.a591d52a.chunk.js.LICENSE.txt +0 -79
  193. package/build/static/js/2.a591d52a.chunk.js.map +0 -1
  194. package/build/static/js/main.5a3dcfb4.chunk.js +0 -2
  195. package/build/static/js/main.5a3dcfb4.chunk.js.map +0 -1
  196. package/src/AppMD.tsx +0 -320
  197. package/src/actions/nyrisAppActions.ts +0 -76
  198. package/src/actions/searchActions.ts +0 -143
  199. package/src/epics/index.ts +0 -149
  200. package/src/epics/search.ts +0 -114
File without changes
File without changes
File without changes
@@ -0,0 +1,57 @@
1
+ import React from "react";
2
+ import PropTypes from "prop-types";
3
+ import { connectHits } from "react-instantsearch-dom";
4
+ import ItemResult from "components/results/ItemResult";
5
+
6
+ function Hits({
7
+ hits,
8
+ setDataResultToAlgolia,
9
+ handlerToggleModal,
10
+ setOpenModalShare,
11
+ setSearchStateInput,
12
+ getUrlToCanvasFile,
13
+ setLoading,
14
+ sendFeedBackAction,
15
+ }: any): JSX.Element {
16
+ const handleSearch = () => {
17
+ setDataResultToAlgolia(hits);
18
+ };
19
+ console.log("hitshits", hits);
20
+
21
+ return (
22
+ <>
23
+ {handleSearch}
24
+ {hits.map((hit: any, index: any) => {
25
+ return (
26
+ <ItemResult
27
+ key={index}
28
+ dataItem={hit}
29
+ handlerToggleModal={() => {
30
+ handlerToggleModal(hit);
31
+ }}
32
+ handlerToggleModalShare={() => setOpenModalShare(true)}
33
+ indexItem={hit.__position}
34
+ isHover={false}
35
+ onSearchImage={(url: any) => {
36
+ setSearchStateInput({});
37
+ getUrlToCanvasFile(url);
38
+ setLoading(true);
39
+ }}
40
+ handlerFeedback={(value: string) => {
41
+ sendFeedBackAction(value);
42
+ }}
43
+ />
44
+ );
45
+ })}
46
+ </>
47
+ );
48
+ }
49
+
50
+ Hits.propTypes = {
51
+ hits: PropTypes.arrayOf(PropTypes.object),
52
+ objectIDs: PropTypes.arrayOf(PropTypes.string),
53
+ setObjectIDs: PropTypes.func,
54
+ };
55
+
56
+ const CustomHits = connectHits(Hits);
57
+ export default CustomHits;
@@ -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 text-center">
19
+ You can also try one of these pictures:
20
+ </Typography>
21
+ <div className="exampleImages d-flex justify-center">
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;