@nyris/nyris-webapp 0.3.2 → 0.3.5

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 (46) hide show
  1. package/build/asset-manifest.json +8 -8
  2. package/build/index.html +1 -1
  3. package/build/js/test.js +14 -20
  4. package/build/{precache-manifest.8f85a4fff2063a7498a608ec69549bb1.js → precache-manifest.bbb31f2ce7710d7eb3175b1b48241d24.js} +9 -9
  5. package/build/service-worker.js +1 -1
  6. package/build/static/js/2.4a55bc61.chunk.js +3 -0
  7. package/build/static/js/{2.efc0ab83.chunk.js.LICENSE.txt → 2.4a55bc61.chunk.js.LICENSE.txt} +0 -9
  8. package/build/static/js/2.4a55bc61.chunk.js.map +1 -0
  9. package/build/static/js/main.2660f94a.chunk.js +2 -0
  10. package/build/static/js/main.2660f94a.chunk.js.map +1 -0
  11. package/package.json +3 -3
  12. package/public/js/test.js +14 -20
  13. package/src/App.tsx +3 -7
  14. package/src/Store/Nyris.ts +7 -7
  15. package/src/Store/Search.ts +48 -74
  16. package/src/Store/Store.ts +12 -5
  17. package/src/components/CustomHits/index.tsx +57 -0
  18. package/src/components/DragDropFile.tsx +27 -23
  19. package/src/components/ExampleImages.tsx +2 -2
  20. package/src/components/Feedback.tsx +2 -2
  21. package/src/components/Footer.tsx +1 -1
  22. package/src/components/HeaderMd.tsx +4 -5
  23. package/src/index.tsx +2 -1
  24. package/src/modules/LandingPage/{indexApp.tsx → App.tsx} +52 -208
  25. package/src/modules/LandingPage/{indexAppMD.tsx → AppMD.tsx} +52 -147
  26. package/src/modules/LandingPage/index.tsx +169 -0
  27. package/src/modules/LandingPage/indexNewVersion.tsx +14 -21
  28. package/src/modules/LandingPage/propsType.ts +43 -0
  29. package/src/page/result/index.tsx +51 -106
  30. package/src/services/Feedback.ts +46 -47
  31. package/src/services/image.ts +28 -98
  32. package/src/services/session.ts +13 -16
  33. package/src/services/types.ts +2 -48
  34. package/src/types.ts +12 -8
  35. package/build/static/js/2.efc0ab83.chunk.js +0 -3
  36. package/build/static/js/2.efc0ab83.chunk.js.map +0 -1
  37. package/build/static/js/main.3bfed050.chunk.js +0 -2
  38. package/build/static/js/main.3bfed050.chunk.js.map +0 -1
  39. package/src/App.test.tsx +0 -49
  40. package/src/Store/common.d.ts +0 -10
  41. package/src/Store/epics/feedback.ts +0 -59
  42. package/src/Store/epics/types.ts +0 -12
  43. package/src/components/preview/preview.tsx +0 -433
  44. package/src/services/findByImage.ts +0 -24
  45. package/src/services/findRegionsCustom.ts +0 -212
  46. package/src/services/nyris.ts +0 -123
package/src/index.tsx CHANGED
@@ -20,9 +20,10 @@ document.title = window.location.host;
20
20
 
21
21
  let md: MDSettings = {
22
22
  ...defaultMdSettings,
23
- ...settings.materialDesign,
23
+ ...settings.themePage.materialDesign,
24
24
  };
25
25
 
26
+
26
27
  let theme = createTheme({
27
28
  typography: {
28
29
  fontFamily: md.customFontFamily,
@@ -1,231 +1,86 @@
1
1
  import "App.css";
2
- import React, { useCallback, useEffect, useState } from "react";
2
+ import React, { useEffect, useState } from "react";
3
3
  import Result from "components/Result";
4
4
  import ExampleImages from "components/ExampleImages";
5
5
  import CategoryFilter from "components/CategoryFilter";
6
6
  import PredictedCategories from "components/PredictedCategories";
7
7
  import Codes from "components/Codes";
8
- import {
9
- Code,
10
- CategoryPrediction,
11
- RectCoords,
12
- Region,
13
- cadExtensions,
14
- isCadFile,
15
- isImageFile,
16
- ImageSearchOptions,
17
- } from "@nyris/nyris-api";
18
8
  import { useDropzone } from "react-dropzone";
19
9
  import classNames from "classnames";
20
10
  import { Animate, NodeGroup } from "react-move";
21
- import { AppSettings, MDSettings, CanvasWithId } from "types";
22
11
  import {
23
12
  makeFileHandler,
24
- Capture,
25
- Preview,
13
+ Capture, Preview,
26
14
  } from "@nyris/nyris-react-components";
27
15
  import { Snackbar } from "@material-ui/core";
28
16
  import MuiAlert, { AlertProps } from "@material-ui/lab/Alert";
29
17
 
30
- import { useAppDispatch, useAppSelector } from "Store/Store";
31
- import {
32
- loadCadFileLoad,
33
- loadFile,
34
- loadFileSelectRegion,
35
- loadingActionRegions,
36
- loadingActionResults,
37
- searchFileImageNonRegion,
38
- selectionChanged,
39
- } from "Store/Search";
40
- import {
41
- NyrisAppPart,
42
- NyrisFeedbackState,
43
- showCamera,
44
- showFeedback,
45
- showResults,
46
- showStart,
47
- } from "Store/Nyris";
48
- import { serviceImage, serviceImageNonRegion } from "services/image";
49
- import { findByImage } from "services/findByImage";
50
- import { debounce, isEmpty } from "lodash";
51
- import { feedbackClickEpic } from "services/Feedback";
52
- export interface AppHandlers {
53
- onExampleImageClick: (url: string) => void;
54
- onImageClick: (position: number, url: string) => void;
55
- onLinkClick: (position: number, url: string) => void;
56
- onFileDropped: (file: File) => void;
57
- onCaptureComplete: (image: HTMLCanvasElement) => void;
58
- onCaptureCanceled: () => void;
59
- onSelectFile: (f: File) => void;
60
- onCameraClick: () => void;
61
- onShowStart: () => void;
62
- onSelectionChange: (r: RectCoords) => void;
63
- onPositiveFeedback: () => void;
64
- onNegativeFeedback: () => void;
65
- onCloseFeedback: () => void;
66
- }
67
-
68
- export interface AppProps {
69
- search: {
70
- results: any[];
71
- requestId?: string;
72
- duration?: number;
73
- categoryPredictions: CategoryPrediction[];
74
- codes: Code[];
75
- filterOptions: string[];
76
- errorMessage?: string;
77
- regions: Region[];
78
- previewSelection: RectCoords;
79
- toastErrorMessage?: string;
80
- };
81
- previewImage?: CanvasWithId;
82
- settings: AppSettings;
83
- loading: boolean;
84
- showPart: NyrisAppPart;
85
- feedbackState: NyrisFeedbackState;
86
- handlers: AppHandlers;
87
- mdSettings: MDSettings;
88
- }
18
+ import {AppProps} from "./propsType";
89
19
 
90
20
  function Alert(props: AlertProps) {
91
21
  return <MuiAlert elevation={6} variant="filled" {...props} />;
92
22
  }
93
23
 
94
- const LandingPageApp = () => {
95
- const dispatch = useAppDispatch();
96
- const searchState = useAppSelector((state) => state);
97
- const [toastOpen, setToastOpen] = useState(false);
98
- const [rectCoords, setRectCoords] = useState<any>(undefined);
99
- const { settings, search, nyris } = searchState;
24
+ const LandingPageApp = (props: AppProps) => {
25
+ const {
26
+ handlers,
27
+ showPart,
28
+ acceptTypes,
29
+ settings,
30
+ search,
31
+ loading,
32
+ previewImage
33
+ } = props;
34
+
100
35
  const {
101
- errorMessage,
102
36
  results,
103
37
  requestId,
104
- fetchingRegions,
105
- fetchingResults,
106
- requestImage,
107
- regions,
108
- selectedRegion,
38
+ duration,
109
39
  categoryPredictions,
110
40
  codes,
111
41
  filterOptions,
112
- duration,
42
+ errorMessage,
43
+ regions,
44
+ previewSelection
113
45
  } = search;
114
- const { showPart } = nyris;
46
+
47
+ const {
48
+ onExampleImageClick,
49
+ onImageClick,
50
+ onLinkClick,
51
+ onFileDropped,
52
+ onCaptureComplete,
53
+ onCaptureCanceled,
54
+ onSelectFile,
55
+ onCameraClick,
56
+ onShowStart,
57
+ onSelectionChange,
58
+ } = handlers;
115
59
 
116
60
  const { getRootProps, getInputProps, isDragActive } = useDropzone({
117
61
  onDrop: (fs: File[]) => {
118
- // console.log("fsssssssss", fs);
119
- serviceImage(fs[0], searchState).then((res) => {
120
- dispatch(loadFile(res));
121
- return dispatch(showFeedback(""));
122
- });
123
- // return dispatch(loadFile(fs[0]));
62
+ onFileDropped(fs[0]);
124
63
  },
125
64
  });
126
- const minPreviewHeight = 400;
127
- const halfOfTheScreenHeight = Math.floor(window.innerHeight * 0.45);
128
- const maxPreviewHeight = Math.max(minPreviewHeight, halfOfTheScreenHeight);
129
-
130
- useEffect(() => {
131
- if (isEmpty(rectCoords)) {
132
- return;
133
- }
134
- onSearchOffersForImage(rectCoords);
135
- // eslint-disable-next-line react-hooks/exhaustive-deps
136
- }, [rectCoords]);
137
65
 
138
- const acceptTypes = ["image/*"]
139
- .concat(settings.cadSearch ? cadExtensions : [])
140
- .join(",");
141
66
 
67
+ const [toastOpen, setToastOpen] = useState(false);
142
68
  useEffect(() => {
143
69
  if (errorMessage !== "") {
144
70
  setToastOpen(true);
145
71
  }
146
72
  }, [errorMessage]);
147
73
 
148
- function scrollTop() {
149
- // TODO might require polyfill for ios and edge
150
- window.scrollTo({ top: 0, left: 0, behavior: "smooth" });
151
- }
152
-
153
- const onShowStart = () => {
154
- dispatch(showStart(""));
155
- scrollTop();
156
- };
157
-
158
- const onLinkClick = (_position: number, url: string) => {
159
- feedbackClickEpic(searchState, _position);
160
- if (url) {
161
- window.open(url);
162
- }
163
- };
164
-
165
- const isCheckImageFile = (file: any) => {
166
- dispatch(showResults(""));
167
- dispatch(loadingActionResults(""));
168
- dispatch(showFeedback(""));
169
- if (isImageFile(file) || typeof file === "string") {
170
- return serviceImage(file, searchState).then((res) => {
171
- return dispatch(loadFile(res));
172
- });
173
- }
174
- if (isCadFile(file)) {
175
- return dispatch(loadCadFileLoad(file));
176
- }
177
- };
178
-
179
- const getUrlToCanvasFile = (url: string, position?: number) => {
180
- dispatch(showResults(""));
181
- dispatch(loadingActionResults(""));
182
- if (position) {
183
- feedbackClickEpic(searchState, position);
184
- }
185
-
186
- if (settings.regions) {
187
- serviceImage(url, searchState).then((res) => {
188
- dispatch(loadFile(res));
189
- return dispatch(showFeedback(""));
190
- });
191
- } else {
192
- serviceImageNonRegion(url, searchState, rectCoords).then((res) => {
193
- dispatch(searchFileImageNonRegion(res));
194
- });
195
- }
196
- };
197
-
198
- const handlerRectCoords = debounce((value) => {
199
- return setRectCoords(value);
200
- }, 1200);
201
-
202
- const debounceRectCoords = useCallback(
203
- (value) => handlerRectCoords(value),
204
- // eslint-disable-next-line react-hooks/exhaustive-deps
205
- []
206
- );
207
-
208
- const onSearchOffersForImage = (r: RectCoords) => {
209
- const { canvas }: any = requestImage;
210
- let options: ImageSearchOptions = {
211
- cropRect: r,
212
- };
213
- dispatch(loadingActionRegions(""));
214
- return findByImage(canvas, options, settings).then((res) => {
215
- dispatch(loadFileSelectRegion(res));
216
- return dispatch(showFeedback(""));
217
- });
218
- };
219
-
74
+ const minPreviewHeight = 400;
75
+ const halfOfTheScreenHeight = Math.floor(window.innerHeight * 0.45);
76
+ const maxPreviewHeight = Math.max(minPreviewHeight, halfOfTheScreenHeight);
220
77
 
221
78
  return (
222
- <div>
223
- {showPart === "camera" && (
79
+ <div>
80
+ {showPart === "camera" && (
224
81
  <Capture
225
- onCaptureComplete={(image: HTMLCanvasElement) => {
226
- return isCheckImageFile(image);
227
- }}
228
- onCaptureCanceled={() => dispatch(showStart)}
82
+ onCaptureComplete={ onCaptureComplete }
83
+ onCaptureCanceled={ onCaptureCanceled }
229
84
  useAppText="Use default camera app"
230
85
  />
231
86
  )}
@@ -254,7 +109,7 @@ const LandingPageApp = () => {
254
109
  className="inputfile"
255
110
  accept="image/*"
256
111
  capture="environment"
257
- onClick={() => dispatch(showCamera)}
112
+ onClick={() => onCameraClick()}
258
113
  />
259
114
  <input
260
115
  type="file"
@@ -271,9 +126,7 @@ const LandingPageApp = () => {
271
126
  id="select_file"
272
127
  className="inputfile"
273
128
  accept={acceptTypes}
274
- onChange={makeFileHandler((e) => {
275
- return isCheckImageFile(e);
276
- })}
129
+ onChange={makeFileHandler(onSelectFile)}
277
130
  />
278
131
  <div className="onDesktop">
279
132
  Drop an image
@@ -304,9 +157,7 @@ const LandingPageApp = () => {
304
157
  </section>
305
158
  <ExampleImages
306
159
  images={settings.exampleImages}
307
- onExampleImageClicked={(url: string) => {
308
- return getUrlToCanvasFile(url);
309
- }}
160
+ onExampleImageClicked={onExampleImageClick}
310
161
  />
311
162
  </div>
312
163
  </div>
@@ -349,7 +200,7 @@ const LandingPageApp = () => {
349
200
  </div>
350
201
  )}
351
202
  <Animate
352
- show={fetchingRegions || fetchingResults}
203
+ show={loading}
353
204
  start={{ opacity: 0.0 }}
354
205
  enter={{ opacity: [1.0], timing: { duration: 300 } }}
355
206
  leave={{ opacity: [0.0], timing: { duration: 300 } }}
@@ -360,20 +211,17 @@ const LandingPageApp = () => {
360
211
  </div>
361
212
  )}
362
213
  </Animate>
363
- {settings.preview && requestImage && (
214
+ {settings.preview && previewImage && (
364
215
  <div className="preview">
365
216
  <Preview
366
- key={requestImage?.id}
217
+ key={previewImage?.id}
218
+ onSelectionChange={ onSelectionChange }
219
+ image={previewImage?.canvas}
220
+ selection={previewSelection}
221
+ regions={regions}
367
222
  maxWidth={document.body.clientWidth}
368
223
  maxHeight={maxPreviewHeight}
369
224
  dotColor="#4C8F9F"
370
- onSelectionChange={(r: RectCoords) => {
371
- dispatch(selectionChanged(r));
372
- return debounceRectCoords(r);
373
- }}
374
- regions={regions}
375
- selection={selectedRegion}
376
- image={requestImage.canvas}
377
225
  />
378
226
  </div>
379
227
  )}
@@ -384,7 +232,6 @@ const LandingPageApp = () => {
384
232
  <Codes codes={codes} />
385
233
  </div>
386
234
  <CategoryFilter cats={filterOptions} />
387
-
388
235
  <div className="wrapper">
389
236
  <NodeGroup
390
237
  data={results}
@@ -403,9 +250,7 @@ const LandingPageApp = () => {
403
250
  key={key}
404
251
  noImageUrl={settings.noImageUrl}
405
252
  template={settings.resultTemplate}
406
- onImageClick={(_pos, url) => {
407
- return getUrlToCanvasFile(url, _pos);
408
- }}
253
+ onImageClick={onImageClick}
409
254
  onLinkClick={onLinkClick}
410
255
  result={data}
411
256
  style={{
@@ -420,8 +265,7 @@ const LandingPageApp = () => {
420
265
 
421
266
  {(results.length === 0 &&
422
267
  showPart === "results" &&
423
- fetchingRegions) ||
424
- (fetchingResults && (
268
+ !loading && (
425
269
  <div className="noResults">
426
270
  We did not find anything{" "}
427
271
  <span role="img" aria-label="sad face">
@@ -16,34 +16,12 @@ import {
16
16
  } from "@material-ui/core";
17
17
  import { PhotoCamera, ArrowBack, Image } from "@material-ui/icons";
18
18
  import Icon from "@material-ui/core/Icon";
19
- import React, { useCallback, useEffect, useState } from "react";
20
19
  import { NodeGroup } from "react-move";
21
20
  import classNames from "classnames";
22
- import { Capture, Preview } 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";
21
+ import {Capture, Preview} from "@nyris/nyris-react-components";
22
+ import _ from "lodash";
23
+ import {AppProps} from "./propsType";
24
+ import React from "react";
47
25
 
48
26
  const useStyles = makeStyles((theme) => ({
49
27
  icon: {
@@ -122,106 +100,43 @@ const makeFileHandler = (action: any) => (e: any) => {
122
100
  }
123
101
  };
124
102
 
125
- const LandingPageAppMD: React.FC<any> = () => {
126
- const dispatch = useAppDispatch();
103
+ const LandingPageAppMD = (props: AppProps) => {
127
104
  const classes = useStyles();
128
- const [rectCoords, setRectCoords] = useState<any>();
129
- const searchState = useAppSelector((state) => state);
130
- const { settings, search, nyris } = searchState;
131
- const { showPart } = nyris;
132
105
  const {
133
- requestImage,
134
- regions,
135
- selectedRegion,
136
- fetchingRegions,
137
- fetchingResults,
106
+ handlers,
107
+ showPart,
108
+ acceptTypes,
109
+ settings,
110
+ search,
111
+ loading,
112
+ previewImage
113
+ } = props;
114
+
115
+ const mdSettings = settings.themePage.materialDesign;
116
+
117
+ const {
138
118
  results,
139
- requestId,
119
+ regions,
120
+ previewSelection,
140
121
  } = search;
141
- const { themePage }: any = settings;
142
- useEffect(() => {
143
- if (isEmpty(rectCoords)) {
144
- return;
145
- }
146
- onSearchOffersForImage(rectCoords);
147
- // eslint-disable-next-line react-hooks/exhaustive-deps
148
- }, [rectCoords]);
149
-
150
- const loading = fetchingRegions || fetchingResults;
151
122
 
152
- const mdSettings: any = themePage.materialDesign as MDSettings;
123
+ const {
124
+ onLinkClick,
125
+ onFileDropped,
126
+ onCaptureComplete,
127
+ onCaptureCanceled,
128
+ onSelectFile,
129
+ onCameraClick,
130
+ onShowStart,
131
+ onSelectionChange,
132
+ } = handlers;
153
133
 
154
134
  const { getRootProps, getInputProps, isDragActive } = useDropzone({
155
- onDrop: (fs: File[]) => dispatch(loadFile(fs[0])),
135
+ onDrop: (fs: File[]) => {
136
+ onFileDropped(fs[0]);
137
+ },
156
138
  });
157
139
 
158
- const minPreviewHeight = 400;
159
- const halfOfTheScreenHeight = Math.floor(window.innerHeight * 0.45);
160
- const maxPreviewHeight = Math.max(minPreviewHeight, halfOfTheScreenHeight);
161
- const acceptTypes = ["image/*"]
162
- .concat(settings.cadSearch ? cadExtensions : [])
163
- .join(",");
164
-
165
- const isCheckImageFile = async (file: any) => {
166
- dispatch(showResults(""));
167
- dispatch(loadingActionResults(""));
168
- dispatch(showFeedback(""));
169
- if (isImageFile(file) || typeof file === "string") {
170
- if (settings.regions) {
171
- serviceImage(file, searchState).then((res) => {
172
- dispatch(loadFile(res));
173
- return dispatch(showFeedback(""));
174
- });
175
- } else {
176
- serviceImageNonRegion(file, searchState, rectCoords).then((res) => {
177
- dispatch(searchFileImageNonRegion(res));
178
- });
179
- }
180
- // return serviceImage(file, settings).then((res) => {
181
- // return dispatch(loadFile(res));
182
- // });
183
- }
184
- if (isCadFile(file)) {
185
- return dispatch(loadCadFileLoad(file));
186
- }
187
- };
188
-
189
- const feedbackClickEpic = async (position: any, _url: string) => {
190
- try {
191
- const api = new NyrisAPI(settings);
192
- const sessionId = search.sessionId || search.requestId;
193
- if (sessionId && requestId) {
194
- await api.sendFeedback(sessionId, requestId, {
195
- event: "click",
196
- data: { positions: [position] },
197
- });
198
- }
199
- } catch (error) {
200
- console.log("err feedbackClickEpic", error);
201
- }
202
- };
203
-
204
- const handlerRectCoords = debounce((value) => {
205
- setRectCoords(value);
206
- }, 1200);
207
-
208
- const debounceRectCoords = useCallback(
209
- (value) => handlerRectCoords(value),
210
- // eslint-disable-next-line react-hooks/exhaustive-deps
211
- []
212
- );
213
- const onSearchOffersForImage = (r: RectCoords) => {
214
- const { canvas }: any = requestImage;
215
- let options: ImageSearchOptions = {
216
- cropRect: r,
217
- };
218
- feedbackRegionEpic(searchState, r);
219
- dispatch(loadingActionRegions(""));
220
- return findByImage(canvas, options, settings).then((res) => {
221
- dispatch(loadFileSelectRegion(res));
222
- return dispatch(showFeedback(""));
223
- });
224
- };
225
140
 
226
141
  return (
227
142
  <React.Fragment>
@@ -234,10 +149,8 @@ const LandingPageAppMD: React.FC<any> = () => {
234
149
  <CssBaseline />
235
150
  {showPart === "camera" && (
236
151
  <Capture
237
- onCaptureComplete={(image: HTMLCanvasElement) =>
238
- isCheckImageFile(image)
239
- }
240
- onCaptureCanceled={() => dispatch(showStart)}
152
+ onCaptureComplete={onCaptureComplete}
153
+ onCaptureCanceled={onCaptureCanceled}
241
154
  useAppText="Use default camera app"
242
155
  />
243
156
  )}
@@ -258,9 +171,7 @@ const LandingPageAppMD: React.FC<any> = () => {
258
171
  <Button
259
172
  variant={"contained"}
260
173
  color={"primary"}
261
- onClick={() => {
262
- return dispatch(showCamera);
263
- }}
174
+ onClick={onCameraClick}
264
175
  >
265
176
  Take a picture
266
177
  </Button>
@@ -273,7 +184,7 @@ const LandingPageAppMD: React.FC<any> = () => {
273
184
  accept={acceptTypes}
274
185
  id="raised-button-file"
275
186
  type="file"
276
- onChange={makeFileHandler((e: any) => isCheckImageFile(e))}
187
+ onChange={makeFileHandler(onSelectFile)}
277
188
  style={{
278
189
  width: ".1px",
279
190
  height: ".1px",
@@ -323,9 +234,7 @@ const LandingPageAppMD: React.FC<any> = () => {
323
234
  id="raised-button-file"
324
235
  type="file"
325
236
  {...getInputProps()}
326
- onChange={makeFileHandler((e: any) => {
327
- return isCheckImageFile(e);
328
- })}
237
+ onChange={makeFileHandler(onSelectFile)}
329
238
  style={{
330
239
  width: ".1px",
331
240
  height: ".1px",
@@ -355,20 +264,17 @@ const LandingPageAppMD: React.FC<any> = () => {
355
264
  )}
356
265
  maxWidth="md"
357
266
  >
358
- {requestImage && (
267
+ {previewImage && (
359
268
  <Card style={{ marginBottom: "4em" }} raised={true}>
360
269
  <Preview
361
- key={requestImage.id}
362
- maxWidth={document.body.clientWidth}
363
- maxHeight={maxPreviewHeight}
364
- dotColor={mdSettings.primaryColor}
365
- onSelectionChange={(r: RectCoords) => {
366
- dispatch(selectionChanged(r));
367
- return debounceRectCoords(r);
368
- }}
270
+ key={previewImage?.id}
271
+ onSelectionChange={onSelectionChange}
272
+ image={previewImage?.canvas}
273
+ selection={previewSelection}
369
274
  regions={regions}
370
- selection={selectedRegion}
371
- image={requestImage.canvas}
275
+ maxWidth={400}
276
+ maxHeight={500}
277
+ dotColor="#FBD914"
372
278
  />
373
279
  </Card>
374
280
  )}
@@ -417,13 +323,13 @@ const LandingPageAppMD: React.FC<any> = () => {
417
323
  component="h5"
418
324
  className={classes.withElipsis}
419
325
  >
420
- {result[mdSettings.resultFirstRowProperty]}
326
+ {result[mdSettings?.resultFirstRowProperty!!]}
421
327
  </Typography>
422
328
  <Typography
423
329
  variant="body2"
424
330
  className={classes.withElipsis}
425
331
  >
426
- {result[mdSettings.resultSecondRowProperty]}
332
+ {result[mdSettings?.resultSecondRowProperty!!]}
427
333
  </Typography>
428
334
  </CardContent>
429
335
  {result.l && (
@@ -435,26 +341,25 @@ const LandingPageAppMD: React.FC<any> = () => {
435
341
  color="primary"
436
342
  onClick={
437
343
  () => {
438
- return feedbackClickEpic(
344
+ onLinkClick(
439
345
  result.position,
440
346
  result.l
441
347
  );
442
348
  }
443
- // handlers.onLinkClick(result.position, result.l)
444
349
  }
445
350
  onAuxClick={() => {
446
- return feedbackClickEpic(
351
+ onLinkClick(
447
352
  result.position,
448
353
  result.l
449
354
  );
450
355
  }}
451
356
  >
452
- {mdSettings.resultLinkIcon && (
357
+ {mdSettings?.resultLinkIcon && (
453
358
  <React.Fragment>
454
359
  <Icon>{mdSettings.resultLinkIcon}</Icon>{" "}
455
360
  </React.Fragment>
456
361
  )}
457
- {mdSettings.resultLinkText}
362
+ {mdSettings?.resultLinkText}
458
363
  </Button>
459
364
  </CardActions>
460
365
  )}
@@ -479,7 +384,7 @@ const LandingPageAppMD: React.FC<any> = () => {
479
384
  aria-label="back"
480
385
  className={classes.fab}
481
386
  color="primary"
482
- onClick={() => dispatch(showStart(""))}
387
+ onClick={onShowStart}
483
388
  >
484
389
  <ArrowBack />
485
390
  </Fab>