@nyris/nyris-webapp 0.3.3 → 0.3.6

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 (205) hide show
  1. package/build/asset-manifest.json +18 -32
  2. package/build/index.html +1 -1
  3. package/build/{precache-manifest.01ce682577e62add75aa397b2a944b75.js → precache-manifest.bffed513ca17d8ac16af1cc3aaa7d908.js} +13 -89
  4. package/build/service-worker.js +1 -1
  5. package/build/static/css/2.43a1c8b7.chunk.css +2 -0
  6. package/build/static/css/2.43a1c8b7.chunk.css.map +1 -0
  7. package/build/static/css/main.2a76dc8a.chunk.css +2 -0
  8. package/build/static/css/main.2a76dc8a.chunk.css.map +1 -0
  9. package/build/static/js/2.4e9a4ce1.chunk.js +3 -0
  10. package/build/static/js/2.4e9a4ce1.chunk.js.LICENSE.txt +79 -0
  11. package/build/static/js/2.4e9a4ce1.chunk.js.map +1 -0
  12. package/build/static/js/main.ec93aa4d.chunk.js +2 -0
  13. package/build/static/js/main.ec93aa4d.chunk.js.map +1 -0
  14. package/build/static/js/{runtime-main.b418ff16.js → runtime-main.f5553a9b.js} +1 -1
  15. package/build/static/js/{runtime-main.b418ff16.js.map → runtime-main.f5553a9b.js.map} +1 -1
  16. package/package.json +7 -30
  17. package/src/App.css +64 -20
  18. package/src/App.tsx +253 -19
  19. package/src/AppMD.tsx +320 -0
  20. package/src/Demo2.tsx +220 -0
  21. package/src/actions/nyrisAppActions.ts +76 -0
  22. package/src/actions/searchActions.ts +218 -0
  23. package/src/components/ExampleImages.tsx +17 -32
  24. package/src/components/Feedback.tsx +48 -87
  25. package/src/components/FiltersList.tsx +69 -0
  26. package/src/components/Header.tsx +17 -32
  27. package/src/components/Result.tsx +113 -186
  28. package/src/components/Sidebar.tsx +40 -0
  29. package/src/defaults.ts +3 -4
  30. package/src/{Store/epics → epics}/feedback.ts +0 -0
  31. package/src/epics/index.ts +154 -0
  32. package/src/epics/search.ts +203 -0
  33. package/src/{Store/epics → epics}/types.ts +1 -1
  34. package/src/{common/assets/fonts → fonts}/roboto-bold-webfont.woff +0 -0
  35. package/src/{common/assets/fonts → fonts}/roboto-bold-webfont.woff2 +0 -0
  36. package/src/{common/assets/fonts → fonts}/roboto-italic-webfont.woff +0 -0
  37. package/src/{common/assets/fonts → fonts}/roboto-italic-webfont.woff2 +0 -0
  38. package/src/{common/assets/fonts → fonts}/roboto-regular-webfont.woff +0 -0
  39. package/src/{common/assets/fonts → fonts}/roboto-regular-webfont.woff2 +0 -0
  40. package/src/{common/assets/fonts → fonts}/robotocondensed-bold-webfont.woff +0 -0
  41. package/src/{common/assets/fonts → fonts}/robotocondensed-bold-webfont.woff2 +0 -0
  42. package/src/{common/assets/fonts → fonts}/robotocondensed-bolditalic-webfont.woff +0 -0
  43. package/src/{common/assets/fonts → fonts}/robotocondensed-bolditalic-webfont.woff2 +0 -0
  44. package/src/{common/assets/images → images}/fav/android-icon-192x192.png +0 -0
  45. package/src/{common/assets/images → images}/fav/apple-icon-114x114.png +0 -0
  46. package/src/{common/assets/images → images}/fav/apple-icon-120x120.png +0 -0
  47. package/src/{common/assets/images → images}/fav/apple-icon-144x144.png +0 -0
  48. package/src/{common/assets/images → images}/fav/apple-icon-152x152.png +0 -0
  49. package/src/{common/assets/images → images}/fav/apple-icon-180x180.png +0 -0
  50. package/src/{common/assets/images → images}/fav/apple-icon-57x57.png +0 -0
  51. package/src/{common/assets/images → images}/fav/apple-icon-60x60.png +0 -0
  52. package/src/{common/assets/images → images}/fav/apple-icon-72x72.png +0 -0
  53. package/src/{common/assets/images → images}/fav/apple-icon-76x76.png +0 -0
  54. package/src/{common/assets/images → images}/fav/browserconfig.xml +0 -0
  55. package/src/{common/assets/images → images}/fav/favicon-16x16.png +0 -0
  56. package/src/{common/assets/images → images}/fav/favicon-32x32.png +0 -0
  57. package/src/{common/assets/images → images}/fav/favicon-96x96.png +0 -0
  58. package/src/{common/assets/images → images}/fav/manifest.json +0 -0
  59. package/src/{common/assets/images → images}/ic_cam.png +0 -0
  60. package/src/{common/assets/images → images}/ic_cam.svg +0 -0
  61. package/src/{common/assets/images → images}/ic_cam_large.png +0 -0
  62. package/src/{common/assets/images → images}/ic_cam_large.svg +0 -0
  63. package/src/{common/assets/images → images}/ic_cam_large_noimage.png +0 -0
  64. package/src/{common/assets/images → images}/ic_close_feedback.png +0 -0
  65. package/src/{common/assets/images → images}/ic_close_feedback.svg +0 -0
  66. package/src/{common/assets/images → images}/ic_shopNow.png +0 -0
  67. package/src/{common/assets/images → images}/ic_shopNow.svg +0 -0
  68. package/src/{common/assets/images → images}/ic_shopNowLight.png +0 -0
  69. package/src/{common/assets/images → images}/ic_shopNowLight.svg +0 -0
  70. package/src/{common/assets/images → images}/nyris_logo.png +0 -0
  71. package/src/{common/assets/images → images}/rewe.svg +0 -0
  72. package/src/{common/assets/images → images}/sectionTransBack.png +0 -0
  73. package/src/{common/assets/images → images}/sectionTransBack.svg +0 -0
  74. package/src/{common/assets/images → images}/sectionTransTop.png +0 -0
  75. package/src/{common/assets/images → images}/sectionTransTop.svg +0 -0
  76. package/src/index.css +416 -573
  77. package/src/index.tsx +190 -39
  78. package/src/types.ts +3 -43
  79. package/tsconfig.json +8 -3
  80. package/build/js/settings.example.js +0 -31
  81. package/build/js/test.js +0 -56
  82. package/build/static/css/2.8285176a.chunk.css +0 -2
  83. package/build/static/css/2.8285176a.chunk.css.map +0 -1
  84. package/build/static/css/main.6676fe1f.chunk.css +0 -2
  85. package/build/static/css/main.6676fe1f.chunk.css.map +0 -1
  86. package/build/static/js/2.d1562c08.chunk.js +0 -3
  87. package/build/static/js/2.d1562c08.chunk.js.LICENSE.txt +0 -133
  88. package/build/static/js/2.d1562c08.chunk.js.map +0 -1
  89. package/build/static/js/main.5c08aba4.chunk.js +0 -2
  90. package/build/static/js/main.5c08aba4.chunk.js.map +0 -1
  91. package/build/static/media/Fill.37094b44.svg +0 -3
  92. package/build/static/media/Montserrat-Bold.5a052e98.otf +0 -0
  93. package/build/static/media/Montserrat-Light.21789e89.otf +0 -0
  94. package/build/static/media/Montserrat-Medium.a53e0373.otf +0 -0
  95. package/build/static/media/Montserrat-Regular.71cdc681.otf +0 -0
  96. package/build/static/media/Montserrat-SemiBold.f613d915.otf +0 -0
  97. package/build/static/media/Rectangle.4dd8b747.png +0 -0
  98. package/build/static/media/admin.9529c7f6.svg +0 -3
  99. package/build/static/media/bg-support-page.6ac55268.svg +0 -9
  100. package/build/static/media/book_mark.8e294c0b.svg +0 -3
  101. package/build/static/media/icon_dislike.94607ca6.svg +0 -3
  102. package/build/static/media/icon_like.a4fb1b18.svg +0 -3
  103. package/build/static/media/icon_modal_image.3068d0ea.svg +0 -21
  104. package/build/static/media/icon_search_image.c2c728c0.svg +0 -3
  105. package/build/static/media/nyris_logo.22d8f250.svg +0 -3
  106. package/build/static/media/reload_icon.4b579a74.svg +0 -3
  107. package/build/static/media/save_search.bebaeebf.svg +0 -3
  108. package/build/static/media/support.289c3a3c.svg +0 -3
  109. package/build/static/media/translate_icon.f0492297.svg +0 -3
  110. package/public/js/settings.example.js +0 -31
  111. package/public/js/test.js +0 -56
  112. package/src/Router.tsx +0 -97
  113. package/src/Store/Auth.ts +0 -44
  114. package/src/Store/Nyris.ts +0 -77
  115. package/src/Store/Search.ts +0 -269
  116. package/src/Store/Store.ts +0 -46
  117. package/src/Store/common.d.ts +0 -10
  118. package/src/common/assets/fonts/Montserrat_OTF/Montserrat-Bold.otf +0 -0
  119. package/src/common/assets/fonts/Montserrat_OTF/Montserrat-Light.otf +0 -0
  120. package/src/common/assets/fonts/Montserrat_OTF/Montserrat-Medium.otf +0 -0
  121. package/src/common/assets/fonts/Montserrat_OTF/Montserrat-Regular.otf +0 -0
  122. package/src/common/assets/fonts/Montserrat_OTF/Montserrat-SemiBold.otf +0 -0
  123. package/src/common/assets/icons/Fill.png +0 -0
  124. package/src/common/assets/icons/Fill.svg +0 -3
  125. package/src/common/assets/icons/Icon_wechat.png +0 -0
  126. package/src/common/assets/icons/Icon_whatsapp.png +0 -0
  127. package/src/common/assets/icons/admin.png +0 -0
  128. package/src/common/assets/icons/admin.svg +0 -3
  129. package/src/common/assets/icons/book_mark.png +0 -0
  130. package/src/common/assets/icons/book_mark.svg +0 -3
  131. package/src/common/assets/icons/icon_barcode.png +0 -0
  132. package/src/common/assets/icons/icon_camera.png +0 -0
  133. package/src/common/assets/icons/icon_dislike.svg +0 -3
  134. package/src/common/assets/icons/icon_disslike.png +0 -0
  135. package/src/common/assets/icons/icon_email.png +0 -0
  136. package/src/common/assets/icons/icon_like.png +0 -0
  137. package/src/common/assets/icons/icon_like.svg +0 -3
  138. package/src/common/assets/icons/icon_modal_image.png +0 -0
  139. package/src/common/assets/icons/icon_modal_image.svg +0 -21
  140. package/src/common/assets/icons/icon_picture.png +0 -0
  141. package/src/common/assets/icons/icon_search_image.png +0 -0
  142. package/src/common/assets/icons/icon_search_image.svg +0 -3
  143. package/src/common/assets/icons/nyris_logo.svg +0 -3
  144. package/src/common/assets/icons/reload_icon.png +0 -0
  145. package/src/common/assets/icons/reload_icon.svg +0 -3
  146. package/src/common/assets/icons/save_search.png +0 -0
  147. package/src/common/assets/icons/save_search.svg +0 -3
  148. package/src/common/assets/icons/setting_search_icon.png +0 -0
  149. package/src/common/assets/icons/support.png +0 -0
  150. package/src/common/assets/icons/support.svg +0 -3
  151. package/src/common/assets/icons/translate_icon.png +0 -0
  152. package/src/common/assets/icons/translate_icon.svg +0 -3
  153. package/src/common/assets/icons/view_off.png +0 -0
  154. package/src/common/assets/images/Rectangle.png +0 -0
  155. package/src/common/assets/images/bg-support-page.svg +0 -9
  156. package/src/common/assets/images/image_test.png +0 -0
  157. package/src/components/CustomHits/index.tsx +0 -57
  158. package/src/components/DetailItem.tsx +0 -175
  159. package/src/components/DragDropFile.tsx +0 -188
  160. package/src/components/FilterComponent.tsx +0 -33
  161. package/src/components/Footer.tsx +0 -29
  162. package/src/components/FooterMD.tsx +0 -54
  163. package/src/components/FooterNewVersion.tsx +0 -12
  164. package/src/components/FooterResult.tsx +0 -47
  165. package/src/components/HeaderMd.tsx +0 -39
  166. package/src/components/HeaderNewVersion.tsx +0 -92
  167. package/src/components/Layout.tsx +0 -46
  168. package/src/components/LoadingScreen/index.tsx +0 -29
  169. package/src/components/Navigation.tsx +0 -34
  170. package/src/components/Panigation/Pagination.tsx +0 -140
  171. package/src/components/Panigation/cx.js +0 -3
  172. package/src/components/Panigation/isModifierClick.js +0 -10
  173. package/src/components/Saved/AllItem.tsx +0 -32
  174. package/src/components/Saved/Category.tsx +0 -16
  175. package/src/components/carousel/DefaultCarousel.tsx +0 -48
  176. package/src/components/common.d.ts +0 -9
  177. package/src/components/common.scss +0 -54
  178. package/src/components/default-select.tsx +0 -44
  179. package/src/components/hitItem/hits.tsx +0 -50
  180. package/src/components/hitItem/infinitiHits.tsx +0 -33
  181. package/src/components/input/inputSearch.tsx +0 -77
  182. package/src/components/modal/DefaultModal.tsx +0 -28
  183. package/src/components/preview/preview.tsx +0 -433
  184. package/src/components/results/ItemResult.tsx +0 -155
  185. package/src/components/search/ListSearch.tsx +0 -209
  186. package/src/modules/LandingPage/common.scss +0 -1304
  187. package/src/modules/LandingPage/indexApp.tsx +0 -492
  188. package/src/modules/LandingPage/indexAppMD.tsx +0 -501
  189. package/src/modules/LandingPage/indexNewVersion.tsx +0 -117
  190. package/src/page/Auth/login.tsx +0 -7
  191. package/src/page/Exception/404.tsx +0 -11
  192. package/src/page/History/index.tsx +0 -76
  193. package/src/page/Profile/index.tsx +0 -87
  194. package/src/page/Saved/MockData.ts +0 -223
  195. package/src/page/Saved/index.tsx +0 -166
  196. package/src/page/Support/index.tsx +0 -160
  197. package/src/page/result/MockData.ts +0 -36
  198. package/src/page/result/index.tsx +0 -473
  199. package/src/services/Feedback.ts +0 -65
  200. package/src/services/findByImage.ts +0 -24
  201. package/src/services/findRegionsCustom.ts +0 -212
  202. package/src/services/image.ts +0 -110
  203. package/src/services/nyris.ts +0 -123
  204. package/src/services/session.ts +0 -20
  205. package/src/services/types.ts +0 -96
@@ -1,501 +0,0 @@
1
- import { useDropzone } from "react-dropzone";
2
- import {
3
- makeStyles,
4
- Button,
5
- Card,
6
- CardActions,
7
- CardContent,
8
- CardMedia,
9
- CircularProgress,
10
- Container,
11
- CssBaseline,
12
- Fab,
13
- Grid,
14
- Hidden,
15
- Typography,
16
- } from "@material-ui/core";
17
- import { PhotoCamera, ArrowBack, Image } from "@material-ui/icons";
18
- import Icon from "@material-ui/core/Icon";
19
- import React, { useCallback, useEffect, useState } from "react";
20
- import { NodeGroup } from "react-move";
21
- import classNames from "classnames";
22
- import { Capture } from "@nyris/nyris-react-components";
23
- import { useAppDispatch, useAppSelector } from "Store/Store";
24
- import {
25
- RectCoords,
26
- cadExtensions,
27
- isCadFile,
28
- isImageFile,
29
- ImageSearchOptions,
30
- } from "@nyris/nyris-api";
31
- import NyrisAPI from "@nyris/nyris-api";
32
- import {
33
- loadCadFileLoad,
34
- loadFile,
35
- loadFileSelectRegion,
36
- loadingActionRegions,
37
- loadingActionResults,
38
- searchFileImageNonRegion,
39
- // selectionChanged,
40
- } from "Store/Search";
41
- import { showCamera, showFeedback, showResults, showStart } from "Store/Nyris";
42
- import _, { debounce, isEmpty } from "lodash";
43
- import { serviceImage, serviceImageNonRegion } from "services/image";
44
- import { findByImage } from "services/findByImage";
45
- import { feedbackRegionEpic } from "services/Feedback";
46
- import { MDSettings } from "../../types";
47
- import Preview from "components/preview/preview";
48
-
49
- const useStyles = makeStyles((theme) => ({
50
- icon: {
51
- marginRight: theme.spacing(2),
52
- },
53
- heroContent: {
54
- backgroundColor: theme.palette.background.paper,
55
- padding: theme.spacing(8, 0, 6),
56
- transition: "all 300ms",
57
- overflow: "hidden",
58
- height: 500,
59
- },
60
- heroContentClosed: {
61
- height: 0,
62
- padding: 0,
63
- },
64
- heroButtons: {
65
- marginTop: theme.spacing(4),
66
- },
67
- cardGrid: {
68
- paddingTop: theme.spacing(8),
69
- paddingBottom: theme.spacing(8),
70
- minHeight: 600,
71
- overflow: "hidden",
72
- transition: "all 300ms",
73
- },
74
- cardGridCollapsed: {
75
- height: 0,
76
- opacity: 0,
77
- minHeight: 0,
78
- paddingTop: 0,
79
- paddingBottom: 0,
80
- },
81
- card: {
82
- height: "100%",
83
- display: "flex",
84
- flexDirection: "column",
85
- },
86
- cardMedia: {
87
- paddingTop: "56.25%", // 16:9
88
- backgroundSize: "contain",
89
- },
90
- cardContent: {
91
- flexGrow: 1,
92
- paddingBottom: 0,
93
- },
94
- footer: {
95
- backgroundColor: theme.palette.background.paper,
96
- padding: theme.spacing(6),
97
- },
98
- withElipsis: {
99
- textOverflow: "ellipsis",
100
- overflow: "hidden",
101
- whiteSpace: "nowrap",
102
- },
103
- loading: {
104
- margin: theme.spacing(2),
105
- },
106
- fabContainer: {
107
- position: "fixed",
108
- bottom: theme.spacing(2),
109
- },
110
- fab: {
111
- marginLeft: theme.spacing(2),
112
- },
113
- }));
114
-
115
- const makeFileHandler = (action: any) => (e: any) => {
116
- let file = (e.dataTransfer && e.dataTransfer.files[0]) || e.target.files[0];
117
- if (e.target && e.target.value) {
118
- e.target.value = "";
119
- }
120
-
121
- if (file) {
122
- action(file);
123
- }
124
- };
125
-
126
- const LandingPageAppMD: React.FC<any> = () => {
127
- const dispatch = useAppDispatch();
128
- const classes = useStyles();
129
- const [rectCoords, setRectCoords] = useState<any>();
130
- const searchState = useAppSelector((state) => state);
131
- const { settings, search, nyris } = searchState;
132
- const { showPart } = nyris;
133
- const {
134
- requestImage,
135
- regions,
136
- selectedRegion,
137
- fetchingRegions,
138
- fetchingResults,
139
- results,
140
- requestId,
141
- } = search;
142
- const { themePage }: any = settings;
143
- useEffect(() => {
144
- if (isEmpty(rectCoords)) {
145
- return;
146
- }
147
- onSearchOffersForImage(rectCoords);
148
- // eslint-disable-next-line react-hooks/exhaustive-deps
149
- }, [rectCoords]);
150
-
151
- const loading = fetchingRegions || fetchingResults;
152
-
153
- const mdSettings: any = themePage.materialDesign as MDSettings;
154
-
155
- const { getRootProps, getInputProps, isDragActive } = useDropzone({
156
- onDrop: (fs: File[]) => dispatch(loadFile(fs[0])),
157
- });
158
-
159
- // const minPreviewHeight = 400;
160
- // const halfOfTheScreenHeight = Math.floor(window.innerHeight * 0.45);
161
- // const maxPreviewHeight = Math.max(minPreviewHeight, halfOfTheScreenHeight);
162
- const acceptTypes = ["image/*"]
163
- .concat(settings.cadSearch ? cadExtensions : [])
164
- .join(",");
165
-
166
- const isCheckImageFile = async (file: any) => {
167
- dispatch(showResults(""));
168
- dispatch(loadingActionResults(""));
169
- dispatch(showFeedback(""));
170
- if (isImageFile(file) || typeof file === "string") {
171
- if (settings.regions) {
172
- serviceImage(file, searchState).then((res) => {
173
- dispatch(loadFile(res));
174
- return dispatch(showFeedback(""));
175
- });
176
- } else {
177
- serviceImageNonRegion(file, searchState, rectCoords).then((res) => {
178
- dispatch(searchFileImageNonRegion(res));
179
- });
180
- }
181
- // return serviceImage(file, settings).then((res) => {
182
- // return dispatch(loadFile(res));
183
- // });
184
- }
185
- if (isCadFile(file)) {
186
- return dispatch(loadCadFileLoad(file));
187
- }
188
- };
189
-
190
- const feedbackClickEpic = async (position: any, _url: string) => {
191
- try {
192
- const api = new NyrisAPI(settings);
193
- const sessionId = search.sessionId || search.requestId;
194
- if (sessionId && requestId) {
195
- await api.sendFeedback(sessionId, requestId, {
196
- event: "click",
197
- data: { positions: [position] },
198
- });
199
- }
200
- } catch (error) {
201
- console.log("err feedbackClickEpic", error);
202
- }
203
- };
204
-
205
- const handlerRectCoords = debounce((value) => {
206
- setRectCoords(value);
207
- }, 1200);
208
-
209
- const debounceRectCoords = useCallback(
210
- (value) => handlerRectCoords(value),
211
- // eslint-disable-next-line react-hooks/exhaustive-deps
212
- []
213
- );
214
- const onSearchOffersForImage = (r: RectCoords) => {
215
- const { canvas }: any = requestImage;
216
- let options: ImageSearchOptions = {
217
- cropRect: r,
218
- };
219
- feedbackRegionEpic(searchState, r);
220
- dispatch(loadingActionRegions(""));
221
- return findByImage(canvas, options, settings).then((res) => {
222
- dispatch(loadFileSelectRegion(res));
223
- return dispatch(showFeedback(""));
224
- });
225
- };
226
-
227
- return (
228
- <React.Fragment>
229
- {!_.isEmpty(mdSettings?.resultLinkIcon) && (
230
- <link
231
- rel="stylesheet"
232
- href="https://fonts.googleapis.com/icon?family=Material+Icons"
233
- />
234
- )}
235
- <CssBaseline />
236
- {showPart === "camera" && (
237
- <Capture
238
- onCaptureComplete={(image: HTMLCanvasElement) =>
239
- isCheckImageFile(image)
240
- }
241
- onCaptureCanceled={() => dispatch(showStart)}
242
- useAppText="Use default camera app"
243
- />
244
- )}
245
- <main>
246
- <div
247
- className={classNames(
248
- classes.heroContent,
249
- showPart === "results" ? classes.heroContentClosed : null
250
- )}
251
- >
252
- <Container maxWidth="md">
253
- <div>
254
- <Hidden mdUp>
255
- <div style={{ textAlign: "center" }}>
256
- <PhotoCamera style={{ fontSize: "20em", color: "#cccccc" }} />
257
- </div>
258
- <div style={{ textAlign: "center" }}>
259
- <Button
260
- variant={"contained"}
261
- color={"primary"}
262
- onClick={() => {
263
- return dispatch(showCamera);
264
- }}
265
- >
266
- Take a picture
267
- </Button>
268
- </div>
269
- <div style={{ textAlign: "center" }}>
270
- <Typography>or</Typography>
271
- </div>
272
- <div style={{ textAlign: "center" }}>
273
- <input
274
- accept={acceptTypes}
275
- id="raised-button-file"
276
- type="file"
277
- onChange={makeFileHandler((e: any) => isCheckImageFile(e))}
278
- style={{
279
- width: ".1px",
280
- height: ".1px",
281
- overflow: "hidden",
282
- opacity: 0,
283
- }}
284
- />
285
- <label htmlFor="raised-button-file">
286
- <Button
287
- variant={"contained"}
288
- color={"primary"}
289
- component="span"
290
- >
291
- Select a file
292
- </Button>
293
- </label>
294
- </div>
295
- </Hidden>
296
- <Hidden smDown>
297
- <div
298
- style={{
299
- borderStyle: "dashed",
300
- borderWidth: 5,
301
- borderColor: isDragActive ? "#ccc" : "#eee",
302
- borderRadius: 10,
303
- padding: 10,
304
- paddingBottom: 30,
305
- }}
306
- {...getRootProps({
307
- onClick: (e) => {
308
- e.stopPropagation();
309
- },
310
- })}
311
- >
312
- <div style={{ textAlign: "center" }}>
313
- <Image style={{ fontSize: "20em", color: "#cccccc" }} />
314
- </div>
315
- <div style={{ textAlign: "center" }}>
316
- <Typography variant="body2">DROP AN IMAGE</Typography>
317
- </div>
318
- <div style={{ textAlign: "center" }}>
319
- <Typography variant="subtitle2">or</Typography>
320
- </div>
321
- <div style={{ textAlign: "center" }}>
322
- <input
323
- accept={acceptTypes}
324
- id="raised-button-file"
325
- type="file"
326
- {...getInputProps()}
327
- onChange={makeFileHandler((e: any) => {
328
- return isCheckImageFile(e);
329
- })}
330
- style={{
331
- width: ".1px",
332
- height: ".1px",
333
- overflow: "hidden",
334
- opacity: 0,
335
- }}
336
- />
337
- <label htmlFor="raised-button-file">
338
- <Button
339
- variant={"contained"}
340
- color={"primary"}
341
- component="span"
342
- >
343
- Select an image
344
- </Button>
345
- </label>
346
- </div>
347
- </div>
348
- </Hidden>
349
- </div>
350
- </Container>
351
- </div>
352
- <Container
353
- className={classNames(
354
- classes.cardGrid,
355
- showPart !== "results" && classes.cardGridCollapsed
356
- )}
357
- maxWidth="md"
358
- >
359
- {requestImage && (
360
- <Card style={{ marginBottom: "4em" }} raised={true}>
361
- <Preview
362
- key={requestImage?.id}
363
- onSelectionChange={(r: RectCoords) => {
364
- debounceRectCoords(r);
365
- return;
366
- }}
367
- image={requestImage?.canvas}
368
- initialRegion={
369
- !selectedRegion
370
- ? regions[0]
371
- ? regions[0]
372
- : { x1: 0, x2: 1, y1: 0, y2: 1 }
373
- : selectedRegion
374
- }
375
- regions={regions}
376
- maxWidth={400}
377
- maxHeight={500}
378
- dotColor="#FBD914"
379
- />
380
- </Card>
381
- )}
382
-
383
- {loading && (
384
- <div style={{ textAlign: "center" }}>
385
- <CircularProgress className={classes.loading} />
386
- </div>
387
- )}
388
-
389
- <Grid container spacing={4}>
390
- <NodeGroup
391
- data={results}
392
- keyAccessor={(r) => r.position + r.sku}
393
- start={(r, i) => ({ opacity: 0, translateX: -100 })}
394
- enter={(r, i) => ({
395
- opacity: [1],
396
- translateX: [0],
397
- timing: { delay: i * 100, duration: 300 },
398
- })}
399
- >
400
- {(rs) => (
401
- <>
402
- {rs.map(({ key, data: result, state }) => (
403
- <Grid item key={key} xs={12} sm={4} md={3}>
404
- <Card
405
- className={classes.card}
406
- style={{
407
- opacity: state.opacity,
408
- position: "relative",
409
- transform: `translateX(${state.translateX}%)`,
410
- }}
411
- >
412
- <CardMedia
413
- className={classes.cardMedia}
414
- image={
415
- (result.img && result.img.url) ||
416
- settings.noImageUrl
417
- }
418
- title={result.title}
419
- />
420
- <CardContent className={classes.cardContent}>
421
- <Typography
422
- gutterBottom
423
- variant="subtitle2"
424
- component="h5"
425
- className={classes.withElipsis}
426
- >
427
- {result[mdSettings.resultFirstRowProperty]}
428
- </Typography>
429
- <Typography
430
- variant="body2"
431
- className={classes.withElipsis}
432
- >
433
- {result[mdSettings.resultSecondRowProperty]}
434
- </Typography>
435
- </CardContent>
436
- {result.l && (
437
- <CardActions>
438
- <Button
439
- variant="outlined"
440
- style={{ marginLeft: "auto" }}
441
- size="small"
442
- color="primary"
443
- onClick={
444
- () => {
445
- return feedbackClickEpic(
446
- result.position,
447
- result.l
448
- );
449
- }
450
- // handlers.onLinkClick(result.position, result.l)
451
- }
452
- onAuxClick={() => {
453
- return feedbackClickEpic(
454
- result.position,
455
- result.l
456
- );
457
- }}
458
- >
459
- {mdSettings.resultLinkIcon && (
460
- <React.Fragment>
461
- <Icon>{mdSettings.resultLinkIcon}</Icon>{" "}
462
- </React.Fragment>
463
- )}
464
- {mdSettings.resultLinkText}
465
- </Button>
466
- </CardActions>
467
- )}
468
- </Card>
469
- </Grid>
470
- ))}
471
- </>
472
- )}
473
- </NodeGroup>
474
- </Grid>
475
-
476
- {results.length === 0 && showPart === "results" && !loading && (
477
- <Typography variant="h3" align="center">
478
- We did not find anything
479
- </Typography>
480
- )}
481
- </Container>
482
- {showPart !== "start" && (
483
- <Container maxWidth="lg">
484
- <div className={classes.fabContainer}>
485
- <Fab
486
- aria-label="back"
487
- className={classes.fab}
488
- color="primary"
489
- onClick={() => dispatch(showStart(""))}
490
- >
491
- <ArrowBack />
492
- </Fab>
493
- </div>
494
- </Container>
495
- )}
496
- </main>
497
- </React.Fragment>
498
- );
499
- };
500
-
501
- export default LandingPageAppMD;
@@ -1,117 +0,0 @@
1
- import { Box, Typography } from "@material-ui/core";
2
- import React, { useState, useEffect } from "react";
3
- import "./common.scss";
4
- import TranslateIcon from "common/assets/icons/translate_icon.svg";
5
- import DragDropFile from "components/DragDropFile";
6
- import { cadExtensions } from "@nyris/nyris-api";
7
- import { useAppDispatch, useAppSelector } from "Store/Store";
8
- import { changeValueTextSearch, setUpdateSession } from "Store/Search";
9
- import { useHistory } from "react-router-dom";
10
- import {
11
- Configure,
12
- InstantSearch,
13
- connectInfiniteHits,
14
- } from "react-instantsearch-dom";
15
- import algoliasearch from "algoliasearch/lite";
16
- import CustomSearchBox from "components/input/inputSearch";
17
- import NyrisAPICT from "services/findRegionsCustom";
18
-
19
- interface Props {}
20
-
21
- function AppNewVersion(props: Props) {
22
- const dispatch = useAppDispatch();
23
- const history = useHistory();
24
- const searchState = useAppSelector((state) => state);
25
- const { settings, search }: any = searchState;
26
- const [searchStateInput, setSearchStateInput] = useState<any>({});
27
- const [isLoading, setLoading] = useState<boolean>(false);
28
- const nyrisApi = new NyrisAPICT(settings);
29
- const { apiKeyAlgolia, appIdAlgolia, indexNameAlgolia } = settings;
30
- const searchClient = algoliasearch(appIdAlgolia, apiKeyAlgolia);
31
- searchClient.initIndex(indexNameAlgolia);
32
-
33
- useEffect(() => {
34
- const createSession = async () => {
35
- try {
36
- await nyrisApi.createSession().then((res: any) => {
37
- const payload: any = {
38
- sessionId: res.data.session,
39
- requestId: res.data.id,
40
- };
41
- dispatch(setUpdateSession(payload));
42
- });
43
- } catch (error) {}
44
- };
45
-
46
- createSession();
47
- // eslint-disable-next-line react-hooks/exhaustive-deps
48
- }, []);
49
-
50
- const acceptTypes = ["image/*"]
51
- .concat(settings.cadSearch ? cadExtensions : [])
52
- .join(",");
53
-
54
- const InfiniteHits = ({ hits }: any) => {
55
- return <div></div>;
56
- };
57
-
58
- const onChangeLoading = (value: boolean) => {
59
- setLoading(value);
60
- };
61
-
62
- const CustomInfiniteHits = connectInfiniteHits(InfiniteHits);
63
-
64
- const nonEmptyFilter: any[] = !search?.requestImage
65
- ? []
66
- : ["sku:DOES_NOT_EXIST<score=1>"];
67
- const filterSkus: any = search?.results
68
- ? search?.results.map(
69
- (f: any) => `sku:'${f.sku}'<score=${Math.round(100 * f.score)}>`
70
- )
71
- : "";
72
- const filtersString = [...nonEmptyFilter, ...filterSkus].join(" OR ");
73
-
74
- return (
75
- <Box className={`box-content-main ${isLoading ? "loading" : ""}`}>
76
- <InstantSearch
77
- indexName={indexNameAlgolia}
78
- searchClient={searchClient}
79
- searchState={searchStateInput}
80
- onSearchStateChange={(state: any) => {
81
- setSearchStateInput(state);
82
- dispatch(changeValueTextSearch(state));
83
- history.push("/result");
84
- }}
85
- >
86
- <Box className="box-content_top">
87
- <div className="box-logo">
88
- <img src={TranslateIcon} width={32} height={27} alt="logo_icon" />
89
- </div>
90
- <div className="box-input">
91
- <div className="wrap-input-search">
92
- <Configure filters={filtersString}></Configure>
93
- <div style={{ display: "none" }}>
94
- <CustomInfiniteHits />
95
- </div>
96
- <CustomSearchBox />
97
- </div>
98
- </div>
99
- <div className="box-bottom">
100
- <Typography className="text-bottom">
101
- Search by any name, category, SKU or keyword.
102
- </Typography>
103
- </div>
104
- </Box>
105
- <Box className="box-content_bottom">
106
- <DragDropFile
107
- acceptTypes={acceptTypes}
108
- isLoading={isLoading}
109
- onChangeLoading={onChangeLoading}
110
- />
111
- </Box>
112
- </InstantSearch>
113
- </Box>
114
- );
115
- }
116
-
117
- export default AppNewVersion;
@@ -1,7 +0,0 @@
1
- import React from "react";
2
-
3
- function Login(): JSX.Element {
4
- return <div>page login</div>;
5
- }
6
-
7
- export default Login;
@@ -1,11 +0,0 @@
1
- import React from "react";
2
-
3
- interface Props {}
4
-
5
- function NotFound(props: Props): JSX.Element {
6
- const {} = props;
7
-
8
- return <div>NotFound</div>;
9
- }
10
-
11
- export default NotFound;