@nyris/nyris-webapp 0.3.2 → 0.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/asset-manifest.json +8 -8
- package/build/index.html +1 -1
- package/build/js/test.js +14 -20
- package/build/{precache-manifest.8f85a4fff2063a7498a608ec69549bb1.js → precache-manifest.01ce682577e62add75aa397b2a944b75.js} +8 -8
- package/build/service-worker.js +1 -1
- package/build/static/js/{2.efc0ab83.chunk.js → 2.d1562c08.chunk.js} +3 -3
- package/build/static/js/{2.efc0ab83.chunk.js.LICENSE.txt → 2.d1562c08.chunk.js.LICENSE.txt} +0 -0
- package/build/static/js/{2.efc0ab83.chunk.js.map → 2.d1562c08.chunk.js.map} +1 -1
- package/build/static/js/main.5c08aba4.chunk.js +2 -0
- package/build/static/js/main.5c08aba4.chunk.js.map +1 -0
- package/package.json +3 -3
- package/public/js/test.js +14 -20
- package/src/App.tsx +2 -2
- package/src/components/CustomHits/index.tsx +57 -0
- package/src/components/ExampleImages.tsx +2 -2
- package/src/modules/LandingPage/indexApp.tsx +27 -9
- package/src/modules/LandingPage/indexAppMD.tsx +20 -13
- package/build/static/js/main.3bfed050.chunk.js +0 -2
- package/build/static/js/main.3bfed050.chunk.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nyris/nyris-webapp",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.3",
|
|
4
4
|
"homepage": "./",
|
|
5
5
|
"dependencies": {
|
|
6
6
|
"@babel/runtime": "^7.17.2",
|
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
"@material-ui/data-grid": "^4.0.0-alpha.37",
|
|
9
9
|
"@material-ui/icons": "^4.4.1",
|
|
10
10
|
"@material-ui/lab": "^4.0.0-alpha.60",
|
|
11
|
-
"@nyris/nyris-api": "^0.3.
|
|
12
|
-
"@nyris/nyris-react-components": "^0.3.
|
|
11
|
+
"@nyris/nyris-api": "^0.3.3",
|
|
12
|
+
"@nyris/nyris-react-components": "^0.3.3",
|
|
13
13
|
"@reduxjs/toolkit": "^1.6.1",
|
|
14
14
|
"@types/blueimp-load-image": "^2.23.4",
|
|
15
15
|
"@types/classnames": "^2.2.9",
|
package/public/js/test.js
CHANGED
|
@@ -12,15 +12,14 @@ var settings = {
|
|
|
12
12
|
resultTemplate: "default",
|
|
13
13
|
responseFormat: "application/offers.complete+json",
|
|
14
14
|
exampleImages: [
|
|
15
|
-
"https://
|
|
16
|
-
"https://
|
|
17
|
-
"https://
|
|
18
|
-
"https://
|
|
19
|
-
"https://img.nyris.io/demo/everybag/mb-dle-4.jpg",
|
|
15
|
+
"https://storage.googleapis.com/nyris/share/examples_search/example_1.jpg",
|
|
16
|
+
"https://storage.googleapis.com/nyris/share/examples_search/example_2.jpg",
|
|
17
|
+
"https://storage.googleapis.com/nyris/share/examples_search/example_3.jpg",
|
|
18
|
+
"https://storage.googleapis.com/nyris/share/examples_search/example_4.jpg",
|
|
20
19
|
],
|
|
21
20
|
deactivated: false,
|
|
22
21
|
cadSearch: false,
|
|
23
|
-
|
|
22
|
+
themePage: {
|
|
24
23
|
default: {
|
|
25
24
|
active: false,
|
|
26
25
|
},
|
|
@@ -40,23 +39,18 @@ var settings = {
|
|
|
40
39
|
resultLinkIcon: "eye",
|
|
41
40
|
},
|
|
42
41
|
},
|
|
43
|
-
|
|
42
|
+
newVersion: {
|
|
44
43
|
active: true,
|
|
45
44
|
},
|
|
46
45
|
},
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
imageMatchingUrlBySku: "https://api.nyris.io/recommend/v1",
|
|
56
|
-
imageMatchingSubmitManualUrl: "https://api.nyris.io/find/v1/manual",
|
|
57
|
-
regionProposalUrl: "https://api.nyris.io/find/v1/regions",
|
|
58
|
-
feedbackUrl: "https://api.nyris.io/feedback/v1",
|
|
59
|
-
}
|
|
46
|
+
imageMatchingUrl: "https://api.nyris.io/find/v1",
|
|
47
|
+
imageMatchingUrlBySku: "https://api.nyris.io/recommend/v1",
|
|
48
|
+
imageMatchingSubmitManualUrl: "https://api.nyris.io/find/v1/manual",
|
|
49
|
+
regionProposalUrl: "https://api.nyris.io/find/v1/regions",
|
|
50
|
+
feedbackUrl: "https://api.nyris.io/feedback/v1",
|
|
51
|
+
appIdAlgolia: "HBDJYUK5G4",
|
|
52
|
+
indexNameAlgolia: "Normparts",
|
|
53
|
+
apiKeyAlgolia: "f6a833ff662086f362b93064b9de6f02",
|
|
60
54
|
};
|
|
61
55
|
settings["customSearchRequest"] = null;
|
|
62
56
|
settings["responseHook"] = null;
|
package/src/App.tsx
CHANGED
|
@@ -11,10 +11,10 @@ import {AppState} from "./types";
|
|
|
11
11
|
|
|
12
12
|
function App(): JSX.Element {
|
|
13
13
|
const { settings } = useAppSelector<AppState>((state: any) => state);
|
|
14
|
-
const { themePage } = settings;
|
|
14
|
+
const { themePage }: any = settings;
|
|
15
15
|
let SelectedApp =
|
|
16
16
|
themePage.default?.active ? LandingPageApp : (
|
|
17
|
-
themePage.
|
|
17
|
+
themePage.mdWhiteLabel?.active ? LandingPageAppMD : AppNewVersion);
|
|
18
18
|
|
|
19
19
|
return <SelectedApp />;
|
|
20
20
|
}
|
|
@@ -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;
|
|
@@ -15,10 +15,10 @@ const ExampleImages: React.FC<ExampleImagesProps> = ({
|
|
|
15
15
|
}
|
|
16
16
|
return (
|
|
17
17
|
<section className="useExampleImg">
|
|
18
|
-
<Typography className="title-box">
|
|
18
|
+
<Typography className="title-box text-center">
|
|
19
19
|
You can also try one of these pictures:
|
|
20
20
|
</Typography>
|
|
21
|
-
<div className="exampleImages">
|
|
21
|
+
<div className="exampleImages d-flex justify-center">
|
|
22
22
|
<div className="exImagesWrap">
|
|
23
23
|
{images.map((i) => {
|
|
24
24
|
return (
|
|
@@ -22,7 +22,6 @@ import { AppSettings, MDSettings, CanvasWithId } from "types";
|
|
|
22
22
|
import {
|
|
23
23
|
makeFileHandler,
|
|
24
24
|
Capture,
|
|
25
|
-
Preview,
|
|
26
25
|
} from "@nyris/nyris-react-components";
|
|
27
26
|
import { Snackbar } from "@material-ui/core";
|
|
28
27
|
import MuiAlert, { AlertProps } from "@material-ui/lab/Alert";
|
|
@@ -35,7 +34,6 @@ import {
|
|
|
35
34
|
loadingActionRegions,
|
|
36
35
|
loadingActionResults,
|
|
37
36
|
searchFileImageNonRegion,
|
|
38
|
-
selectionChanged,
|
|
39
37
|
} from "Store/Search";
|
|
40
38
|
import {
|
|
41
39
|
NyrisAppPart,
|
|
@@ -49,6 +47,7 @@ import { serviceImage, serviceImageNonRegion } from "services/image";
|
|
|
49
47
|
import { findByImage } from "services/findByImage";
|
|
50
48
|
import { debounce, isEmpty } from "lodash";
|
|
51
49
|
import { feedbackClickEpic } from "services/Feedback";
|
|
50
|
+
import Preview from "components/preview/preview";
|
|
52
51
|
export interface AppHandlers {
|
|
53
52
|
onExampleImageClick: (url: string) => void;
|
|
54
53
|
onImageClick: (position: number, url: string) => void;
|
|
@@ -123,9 +122,9 @@ const LandingPageApp = () => {
|
|
|
123
122
|
// return dispatch(loadFile(fs[0]));
|
|
124
123
|
},
|
|
125
124
|
});
|
|
126
|
-
const minPreviewHeight = 400;
|
|
127
|
-
const halfOfTheScreenHeight = Math.floor(window.innerHeight * 0.45);
|
|
128
|
-
const maxPreviewHeight = Math.max(minPreviewHeight, halfOfTheScreenHeight);
|
|
125
|
+
// const minPreviewHeight = 400;
|
|
126
|
+
// const halfOfTheScreenHeight = Math.floor(window.innerHeight * 0.45);
|
|
127
|
+
// const maxPreviewHeight = Math.max(minPreviewHeight, halfOfTheScreenHeight);
|
|
129
128
|
|
|
130
129
|
useEffect(() => {
|
|
131
130
|
if (isEmpty(rectCoords)) {
|
|
@@ -161,7 +160,7 @@ const LandingPageApp = () => {
|
|
|
161
160
|
window.open(url);
|
|
162
161
|
}
|
|
163
162
|
};
|
|
164
|
-
|
|
163
|
+
// TODO: search image file home page
|
|
165
164
|
const isCheckImageFile = (file: any) => {
|
|
166
165
|
dispatch(showResults(""));
|
|
167
166
|
dispatch(loadingActionResults(""));
|
|
@@ -175,6 +174,7 @@ const LandingPageApp = () => {
|
|
|
175
174
|
return dispatch(loadCadFileLoad(file));
|
|
176
175
|
}
|
|
177
176
|
};
|
|
177
|
+
//
|
|
178
178
|
|
|
179
179
|
const getUrlToCanvasFile = (url: string, position?: number) => {
|
|
180
180
|
dispatch(showResults(""));
|
|
@@ -217,7 +217,6 @@ const LandingPageApp = () => {
|
|
|
217
217
|
});
|
|
218
218
|
};
|
|
219
219
|
|
|
220
|
-
|
|
221
220
|
return (
|
|
222
221
|
<div>
|
|
223
222
|
{showPart === "camera" && (
|
|
@@ -360,9 +359,10 @@ const LandingPageApp = () => {
|
|
|
360
359
|
</div>
|
|
361
360
|
)}
|
|
362
361
|
</Animate>
|
|
362
|
+
{/* // TODO:Box Preview image. */}
|
|
363
363
|
{settings.preview && requestImage && (
|
|
364
364
|
<div className="preview">
|
|
365
|
-
<Preview
|
|
365
|
+
{/* <Preview
|
|
366
366
|
key={requestImage?.id}
|
|
367
367
|
maxWidth={document.body.clientWidth}
|
|
368
368
|
maxHeight={maxPreviewHeight}
|
|
@@ -374,6 +374,25 @@ const LandingPageApp = () => {
|
|
|
374
374
|
regions={regions}
|
|
375
375
|
selection={selectedRegion}
|
|
376
376
|
image={requestImage.canvas}
|
|
377
|
+
/> */}
|
|
378
|
+
<Preview
|
|
379
|
+
key={requestImage?.id}
|
|
380
|
+
onSelectionChange={(r: RectCoords) => {
|
|
381
|
+
debounceRectCoords(r);
|
|
382
|
+
return;
|
|
383
|
+
}}
|
|
384
|
+
image={requestImage?.canvas}
|
|
385
|
+
initialRegion={
|
|
386
|
+
!selectedRegion
|
|
387
|
+
? regions[0]
|
|
388
|
+
? regions[0]
|
|
389
|
+
: { x1: 0, x2: 1, y1: 0, y2: 1 }
|
|
390
|
+
: selectedRegion
|
|
391
|
+
}
|
|
392
|
+
regions={regions}
|
|
393
|
+
maxWidth={400}
|
|
394
|
+
maxHeight={500}
|
|
395
|
+
dotColor="#FBD914"
|
|
377
396
|
/>
|
|
378
397
|
</div>
|
|
379
398
|
)}
|
|
@@ -384,7 +403,6 @@ const LandingPageApp = () => {
|
|
|
384
403
|
<Codes codes={codes} />
|
|
385
404
|
</div>
|
|
386
405
|
<CategoryFilter cats={filterOptions} />
|
|
387
|
-
|
|
388
406
|
<div className="wrapper">
|
|
389
407
|
<NodeGroup
|
|
390
408
|
data={results}
|
|
@@ -19,7 +19,7 @@ import Icon from "@material-ui/core/Icon";
|
|
|
19
19
|
import React, { useCallback, useEffect, useState } from "react";
|
|
20
20
|
import { NodeGroup } from "react-move";
|
|
21
21
|
import classNames from "classnames";
|
|
22
|
-
import { Capture
|
|
22
|
+
import { Capture } from "@nyris/nyris-react-components";
|
|
23
23
|
import { useAppDispatch, useAppSelector } from "Store/Store";
|
|
24
24
|
import {
|
|
25
25
|
RectCoords,
|
|
@@ -36,7 +36,7 @@ import {
|
|
|
36
36
|
loadingActionRegions,
|
|
37
37
|
loadingActionResults,
|
|
38
38
|
searchFileImageNonRegion,
|
|
39
|
-
selectionChanged,
|
|
39
|
+
// selectionChanged,
|
|
40
40
|
} from "Store/Search";
|
|
41
41
|
import { showCamera, showFeedback, showResults, showStart } from "Store/Nyris";
|
|
42
42
|
import _, { debounce, isEmpty } from "lodash";
|
|
@@ -44,6 +44,7 @@ import { serviceImage, serviceImageNonRegion } from "services/image";
|
|
|
44
44
|
import { findByImage } from "services/findByImage";
|
|
45
45
|
import { feedbackRegionEpic } from "services/Feedback";
|
|
46
46
|
import { MDSettings } from "../../types";
|
|
47
|
+
import Preview from "components/preview/preview";
|
|
47
48
|
|
|
48
49
|
const useStyles = makeStyles((theme) => ({
|
|
49
50
|
icon: {
|
|
@@ -155,9 +156,9 @@ const LandingPageAppMD: React.FC<any> = () => {
|
|
|
155
156
|
onDrop: (fs: File[]) => dispatch(loadFile(fs[0])),
|
|
156
157
|
});
|
|
157
158
|
|
|
158
|
-
const minPreviewHeight = 400;
|
|
159
|
-
const halfOfTheScreenHeight = Math.floor(window.innerHeight * 0.45);
|
|
160
|
-
const maxPreviewHeight = Math.max(minPreviewHeight, halfOfTheScreenHeight);
|
|
159
|
+
// const minPreviewHeight = 400;
|
|
160
|
+
// const halfOfTheScreenHeight = Math.floor(window.innerHeight * 0.45);
|
|
161
|
+
// const maxPreviewHeight = Math.max(minPreviewHeight, halfOfTheScreenHeight);
|
|
161
162
|
const acceptTypes = ["image/*"]
|
|
162
163
|
.concat(settings.cadSearch ? cadExtensions : [])
|
|
163
164
|
.join(",");
|
|
@@ -358,17 +359,23 @@ const LandingPageAppMD: React.FC<any> = () => {
|
|
|
358
359
|
{requestImage && (
|
|
359
360
|
<Card style={{ marginBottom: "4em" }} raised={true}>
|
|
360
361
|
<Preview
|
|
361
|
-
key={requestImage
|
|
362
|
-
maxWidth={document.body.clientWidth}
|
|
363
|
-
maxHeight={maxPreviewHeight}
|
|
364
|
-
dotColor={mdSettings.primaryColor}
|
|
362
|
+
key={requestImage?.id}
|
|
365
363
|
onSelectionChange={(r: RectCoords) => {
|
|
366
|
-
|
|
367
|
-
return
|
|
364
|
+
debounceRectCoords(r);
|
|
365
|
+
return;
|
|
368
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
|
+
}
|
|
369
375
|
regions={regions}
|
|
370
|
-
|
|
371
|
-
|
|
376
|
+
maxWidth={400}
|
|
377
|
+
maxHeight={500}
|
|
378
|
+
dotColor="#FBD914"
|
|
372
379
|
/>
|
|
373
380
|
</Card>
|
|
374
381
|
)}
|