@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.
- package/build/asset-manifest.json +18 -32
- package/build/index.html +1 -1
- package/build/{precache-manifest.01ce682577e62add75aa397b2a944b75.js → precache-manifest.bffed513ca17d8ac16af1cc3aaa7d908.js} +13 -89
- package/build/service-worker.js +1 -1
- package/build/static/css/2.43a1c8b7.chunk.css +2 -0
- package/build/static/css/2.43a1c8b7.chunk.css.map +1 -0
- package/build/static/css/main.2a76dc8a.chunk.css +2 -0
- package/build/static/css/main.2a76dc8a.chunk.css.map +1 -0
- package/build/static/js/2.4e9a4ce1.chunk.js +3 -0
- package/build/static/js/2.4e9a4ce1.chunk.js.LICENSE.txt +79 -0
- package/build/static/js/2.4e9a4ce1.chunk.js.map +1 -0
- package/build/static/js/main.ec93aa4d.chunk.js +2 -0
- package/build/static/js/main.ec93aa4d.chunk.js.map +1 -0
- package/build/static/js/{runtime-main.b418ff16.js → runtime-main.f5553a9b.js} +1 -1
- package/build/static/js/{runtime-main.b418ff16.js.map → runtime-main.f5553a9b.js.map} +1 -1
- package/package.json +7 -30
- package/src/App.css +64 -20
- package/src/App.tsx +253 -19
- package/src/AppMD.tsx +320 -0
- package/src/Demo2.tsx +220 -0
- package/src/actions/nyrisAppActions.ts +76 -0
- package/src/actions/searchActions.ts +218 -0
- package/src/components/ExampleImages.tsx +17 -32
- package/src/components/Feedback.tsx +48 -87
- package/src/components/FiltersList.tsx +69 -0
- package/src/components/Header.tsx +17 -32
- package/src/components/Result.tsx +113 -186
- package/src/components/Sidebar.tsx +40 -0
- package/src/defaults.ts +3 -4
- package/src/{Store/epics → epics}/feedback.ts +0 -0
- package/src/epics/index.ts +154 -0
- package/src/epics/search.ts +203 -0
- package/src/{Store/epics → epics}/types.ts +1 -1
- package/src/{common/assets/fonts → fonts}/roboto-bold-webfont.woff +0 -0
- package/src/{common/assets/fonts → fonts}/roboto-bold-webfont.woff2 +0 -0
- package/src/{common/assets/fonts → fonts}/roboto-italic-webfont.woff +0 -0
- package/src/{common/assets/fonts → fonts}/roboto-italic-webfont.woff2 +0 -0
- package/src/{common/assets/fonts → fonts}/roboto-regular-webfont.woff +0 -0
- package/src/{common/assets/fonts → fonts}/roboto-regular-webfont.woff2 +0 -0
- package/src/{common/assets/fonts → fonts}/robotocondensed-bold-webfont.woff +0 -0
- package/src/{common/assets/fonts → fonts}/robotocondensed-bold-webfont.woff2 +0 -0
- package/src/{common/assets/fonts → fonts}/robotocondensed-bolditalic-webfont.woff +0 -0
- package/src/{common/assets/fonts → fonts}/robotocondensed-bolditalic-webfont.woff2 +0 -0
- package/src/{common/assets/images → images}/fav/android-icon-192x192.png +0 -0
- package/src/{common/assets/images → images}/fav/apple-icon-114x114.png +0 -0
- package/src/{common/assets/images → images}/fav/apple-icon-120x120.png +0 -0
- package/src/{common/assets/images → images}/fav/apple-icon-144x144.png +0 -0
- package/src/{common/assets/images → images}/fav/apple-icon-152x152.png +0 -0
- package/src/{common/assets/images → images}/fav/apple-icon-180x180.png +0 -0
- package/src/{common/assets/images → images}/fav/apple-icon-57x57.png +0 -0
- package/src/{common/assets/images → images}/fav/apple-icon-60x60.png +0 -0
- package/src/{common/assets/images → images}/fav/apple-icon-72x72.png +0 -0
- package/src/{common/assets/images → images}/fav/apple-icon-76x76.png +0 -0
- package/src/{common/assets/images → images}/fav/browserconfig.xml +0 -0
- package/src/{common/assets/images → images}/fav/favicon-16x16.png +0 -0
- package/src/{common/assets/images → images}/fav/favicon-32x32.png +0 -0
- package/src/{common/assets/images → images}/fav/favicon-96x96.png +0 -0
- package/src/{common/assets/images → images}/fav/manifest.json +0 -0
- package/src/{common/assets/images → images}/ic_cam.png +0 -0
- package/src/{common/assets/images → images}/ic_cam.svg +0 -0
- package/src/{common/assets/images → images}/ic_cam_large.png +0 -0
- package/src/{common/assets/images → images}/ic_cam_large.svg +0 -0
- package/src/{common/assets/images → images}/ic_cam_large_noimage.png +0 -0
- package/src/{common/assets/images → images}/ic_close_feedback.png +0 -0
- package/src/{common/assets/images → images}/ic_close_feedback.svg +0 -0
- package/src/{common/assets/images → images}/ic_shopNow.png +0 -0
- package/src/{common/assets/images → images}/ic_shopNow.svg +0 -0
- package/src/{common/assets/images → images}/ic_shopNowLight.png +0 -0
- package/src/{common/assets/images → images}/ic_shopNowLight.svg +0 -0
- package/src/{common/assets/images → images}/nyris_logo.png +0 -0
- package/src/{common/assets/images → images}/rewe.svg +0 -0
- package/src/{common/assets/images → images}/sectionTransBack.png +0 -0
- package/src/{common/assets/images → images}/sectionTransBack.svg +0 -0
- package/src/{common/assets/images → images}/sectionTransTop.png +0 -0
- package/src/{common/assets/images → images}/sectionTransTop.svg +0 -0
- package/src/index.css +416 -573
- package/src/index.tsx +190 -39
- package/src/types.ts +3 -43
- package/tsconfig.json +8 -3
- package/build/js/settings.example.js +0 -31
- package/build/js/test.js +0 -56
- package/build/static/css/2.8285176a.chunk.css +0 -2
- package/build/static/css/2.8285176a.chunk.css.map +0 -1
- package/build/static/css/main.6676fe1f.chunk.css +0 -2
- package/build/static/css/main.6676fe1f.chunk.css.map +0 -1
- package/build/static/js/2.d1562c08.chunk.js +0 -3
- package/build/static/js/2.d1562c08.chunk.js.LICENSE.txt +0 -133
- package/build/static/js/2.d1562c08.chunk.js.map +0 -1
- package/build/static/js/main.5c08aba4.chunk.js +0 -2
- package/build/static/js/main.5c08aba4.chunk.js.map +0 -1
- package/build/static/media/Fill.37094b44.svg +0 -3
- package/build/static/media/Montserrat-Bold.5a052e98.otf +0 -0
- package/build/static/media/Montserrat-Light.21789e89.otf +0 -0
- package/build/static/media/Montserrat-Medium.a53e0373.otf +0 -0
- package/build/static/media/Montserrat-Regular.71cdc681.otf +0 -0
- package/build/static/media/Montserrat-SemiBold.f613d915.otf +0 -0
- package/build/static/media/Rectangle.4dd8b747.png +0 -0
- package/build/static/media/admin.9529c7f6.svg +0 -3
- package/build/static/media/bg-support-page.6ac55268.svg +0 -9
- package/build/static/media/book_mark.8e294c0b.svg +0 -3
- package/build/static/media/icon_dislike.94607ca6.svg +0 -3
- package/build/static/media/icon_like.a4fb1b18.svg +0 -3
- package/build/static/media/icon_modal_image.3068d0ea.svg +0 -21
- package/build/static/media/icon_search_image.c2c728c0.svg +0 -3
- package/build/static/media/nyris_logo.22d8f250.svg +0 -3
- package/build/static/media/reload_icon.4b579a74.svg +0 -3
- package/build/static/media/save_search.bebaeebf.svg +0 -3
- package/build/static/media/support.289c3a3c.svg +0 -3
- package/build/static/media/translate_icon.f0492297.svg +0 -3
- package/public/js/settings.example.js +0 -31
- package/public/js/test.js +0 -56
- package/src/Router.tsx +0 -97
- package/src/Store/Auth.ts +0 -44
- package/src/Store/Nyris.ts +0 -77
- package/src/Store/Search.ts +0 -269
- package/src/Store/Store.ts +0 -46
- package/src/Store/common.d.ts +0 -10
- package/src/common/assets/fonts/Montserrat_OTF/Montserrat-Bold.otf +0 -0
- package/src/common/assets/fonts/Montserrat_OTF/Montserrat-Light.otf +0 -0
- package/src/common/assets/fonts/Montserrat_OTF/Montserrat-Medium.otf +0 -0
- package/src/common/assets/fonts/Montserrat_OTF/Montserrat-Regular.otf +0 -0
- package/src/common/assets/fonts/Montserrat_OTF/Montserrat-SemiBold.otf +0 -0
- package/src/common/assets/icons/Fill.png +0 -0
- package/src/common/assets/icons/Fill.svg +0 -3
- package/src/common/assets/icons/Icon_wechat.png +0 -0
- package/src/common/assets/icons/Icon_whatsapp.png +0 -0
- package/src/common/assets/icons/admin.png +0 -0
- package/src/common/assets/icons/admin.svg +0 -3
- package/src/common/assets/icons/book_mark.png +0 -0
- package/src/common/assets/icons/book_mark.svg +0 -3
- package/src/common/assets/icons/icon_barcode.png +0 -0
- package/src/common/assets/icons/icon_camera.png +0 -0
- package/src/common/assets/icons/icon_dislike.svg +0 -3
- package/src/common/assets/icons/icon_disslike.png +0 -0
- package/src/common/assets/icons/icon_email.png +0 -0
- package/src/common/assets/icons/icon_like.png +0 -0
- package/src/common/assets/icons/icon_like.svg +0 -3
- package/src/common/assets/icons/icon_modal_image.png +0 -0
- package/src/common/assets/icons/icon_modal_image.svg +0 -21
- package/src/common/assets/icons/icon_picture.png +0 -0
- package/src/common/assets/icons/icon_search_image.png +0 -0
- package/src/common/assets/icons/icon_search_image.svg +0 -3
- package/src/common/assets/icons/nyris_logo.svg +0 -3
- package/src/common/assets/icons/reload_icon.png +0 -0
- package/src/common/assets/icons/reload_icon.svg +0 -3
- package/src/common/assets/icons/save_search.png +0 -0
- package/src/common/assets/icons/save_search.svg +0 -3
- package/src/common/assets/icons/setting_search_icon.png +0 -0
- package/src/common/assets/icons/support.png +0 -0
- package/src/common/assets/icons/support.svg +0 -3
- package/src/common/assets/icons/translate_icon.png +0 -0
- package/src/common/assets/icons/translate_icon.svg +0 -3
- package/src/common/assets/icons/view_off.png +0 -0
- package/src/common/assets/images/Rectangle.png +0 -0
- package/src/common/assets/images/bg-support-page.svg +0 -9
- package/src/common/assets/images/image_test.png +0 -0
- package/src/components/CustomHits/index.tsx +0 -57
- package/src/components/DetailItem.tsx +0 -175
- package/src/components/DragDropFile.tsx +0 -188
- package/src/components/FilterComponent.tsx +0 -33
- package/src/components/Footer.tsx +0 -29
- package/src/components/FooterMD.tsx +0 -54
- package/src/components/FooterNewVersion.tsx +0 -12
- package/src/components/FooterResult.tsx +0 -47
- package/src/components/HeaderMd.tsx +0 -39
- package/src/components/HeaderNewVersion.tsx +0 -92
- package/src/components/Layout.tsx +0 -46
- package/src/components/LoadingScreen/index.tsx +0 -29
- package/src/components/Navigation.tsx +0 -34
- package/src/components/Panigation/Pagination.tsx +0 -140
- package/src/components/Panigation/cx.js +0 -3
- package/src/components/Panigation/isModifierClick.js +0 -10
- package/src/components/Saved/AllItem.tsx +0 -32
- package/src/components/Saved/Category.tsx +0 -16
- package/src/components/carousel/DefaultCarousel.tsx +0 -48
- package/src/components/common.d.ts +0 -9
- package/src/components/common.scss +0 -54
- package/src/components/default-select.tsx +0 -44
- package/src/components/hitItem/hits.tsx +0 -50
- package/src/components/hitItem/infinitiHits.tsx +0 -33
- package/src/components/input/inputSearch.tsx +0 -77
- package/src/components/modal/DefaultModal.tsx +0 -28
- package/src/components/preview/preview.tsx +0 -433
- package/src/components/results/ItemResult.tsx +0 -155
- package/src/components/search/ListSearch.tsx +0 -209
- package/src/modules/LandingPage/common.scss +0 -1304
- package/src/modules/LandingPage/indexApp.tsx +0 -492
- package/src/modules/LandingPage/indexAppMD.tsx +0 -501
- package/src/modules/LandingPage/indexNewVersion.tsx +0 -117
- package/src/page/Auth/login.tsx +0 -7
- package/src/page/Exception/404.tsx +0 -11
- package/src/page/History/index.tsx +0 -76
- package/src/page/Profile/index.tsx +0 -87
- package/src/page/Saved/MockData.ts +0 -223
- package/src/page/Saved/index.tsx +0 -166
- package/src/page/Support/index.tsx +0 -160
- package/src/page/result/MockData.ts +0 -36
- package/src/page/result/index.tsx +0 -473
- package/src/services/Feedback.ts +0 -65
- package/src/services/findByImage.ts +0 -24
- package/src/services/findRegionsCustom.ts +0 -212
- package/src/services/image.ts +0 -110
- package/src/services/nyris.ts +0 -123
- package/src/services/session.ts +0 -20
- package/src/services/types.ts +0 -96
package/package.json
CHANGED
|
@@ -1,16 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nyris/nyris-webapp",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.6",
|
|
4
4
|
"homepage": "./",
|
|
5
5
|
"dependencies": {
|
|
6
|
-
"@babel/runtime": "^7.17.2",
|
|
7
6
|
"@material-ui/core": "^4.3.3",
|
|
8
|
-
"@material-ui/data-grid": "^4.0.0-alpha.37",
|
|
9
7
|
"@material-ui/icons": "^4.4.1",
|
|
10
8
|
"@material-ui/lab": "^4.0.0-alpha.60",
|
|
11
|
-
"@nyris/nyris-api": "^0.3.
|
|
12
|
-
"@nyris/nyris-react-components": "^0.
|
|
13
|
-
"@reduxjs/toolkit": "^1.6.1",
|
|
9
|
+
"@nyris/nyris-api": "^0.3.6",
|
|
10
|
+
"@nyris/nyris-react-components": "^0.2.6",
|
|
14
11
|
"@types/blueimp-load-image": "^2.23.4",
|
|
15
12
|
"@types/classnames": "^2.2.9",
|
|
16
13
|
"@types/history": "^4.7.3",
|
|
@@ -19,37 +16,21 @@
|
|
|
19
16
|
"@types/react": "16.9.2",
|
|
20
17
|
"@types/react-dom": "16.9.0",
|
|
21
18
|
"@types/react-redux": "^7.1.2",
|
|
22
|
-
"
|
|
23
|
-
"algoliasearch": "^4.12.2",
|
|
24
|
-
"axios": "^0.26.1",
|
|
25
|
-
"blueimp-load-image": "^2.24.0",
|
|
19
|
+
"blueimp-load-image": "^5.16.0",
|
|
26
20
|
"classnames": "^2.2.6",
|
|
27
21
|
"history": "^4.10.1",
|
|
28
|
-
"
|
|
29
|
-
"konva": "5.0.3",
|
|
30
|
-
"lodash": "^4.17.21",
|
|
31
|
-
"qs": "^6.10.3",
|
|
32
|
-
"react": "^17.0.0",
|
|
22
|
+
"react": "^16.13.1",
|
|
33
23
|
"react-dom": "^16.13.1",
|
|
34
24
|
"react-dropzone": "^10.1.8",
|
|
35
|
-
"react-hook-form": "^7.27.1",
|
|
36
|
-
"react-instantsearch-dom": "^6.22.0",
|
|
37
|
-
"react-instantsearch-hooks": "^6.22.0",
|
|
38
|
-
"react-konva": "16.13.0-6",
|
|
39
25
|
"react-move": "^6.0.0",
|
|
40
26
|
"react-redux": "^7.1.1",
|
|
41
|
-
"react-responsive-carousel": "^3.2.22",
|
|
42
|
-
"react-router-dom": "^5.3.0",
|
|
43
27
|
"react-scripts": "^3.4.1",
|
|
44
|
-
"react-select": "^5.2.2",
|
|
45
|
-
"react-table": "^7.7.0",
|
|
46
28
|
"redux": "^4.0.4",
|
|
47
29
|
"redux-observable": "^1.1.0",
|
|
48
|
-
"redux-thunk": "^2.4.1",
|
|
49
30
|
"rxjs": "^6.5.3",
|
|
50
31
|
"source-map-explorer": "^2.0.1",
|
|
51
32
|
"typeface-roboto": "0.0.75",
|
|
52
|
-
"typescript": "
|
|
33
|
+
"typescript": "3.6.2"
|
|
53
34
|
},
|
|
54
35
|
"scripts": {
|
|
55
36
|
"analyze": "source-map-explorer 'build/static/js/*.js'",
|
|
@@ -77,12 +58,8 @@
|
|
|
77
58
|
]
|
|
78
59
|
},
|
|
79
60
|
"devDependencies": {
|
|
80
|
-
"@types/js-cookie": "^3.0.1",
|
|
81
|
-
"@types/lodash": "^4.14.178",
|
|
82
|
-
"@types/react-instantsearch-dom": "^6.12.2",
|
|
83
61
|
"mockserver": "^3.1.1",
|
|
84
62
|
"react-styleguidist": "^11.0.5",
|
|
85
|
-
"redux-devtools-extension": "^2.13.8"
|
|
86
|
-
"sass": "^1.39.0"
|
|
63
|
+
"redux-devtools-extension": "^2.13.8"
|
|
87
64
|
}
|
|
88
65
|
}
|
package/src/App.css
CHANGED
|
@@ -33,33 +33,77 @@
|
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
.predicted-categories {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
36
|
+
display: flex;
|
|
37
|
+
flex-wrap: wrap;
|
|
38
|
+
flex-direction: row;
|
|
39
|
+
justify-content: center;
|
|
40
40
|
}
|
|
41
41
|
.predicted-categories small {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
42
|
+
white-space: nowrap;
|
|
43
|
+
padding-left: 0.4em;
|
|
44
|
+
padding-right: 0.4em;
|
|
45
|
+
font-size: 0.8em;
|
|
46
|
+
border-radius: 5px;
|
|
47
|
+
margin: 0.2em;
|
|
48
|
+
background-color: #fff;
|
|
49
49
|
}
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
50
|
+
.sidebar {
|
|
51
|
+
width: 240px;
|
|
52
|
+
color: white;
|
|
53
|
+
border: 1px solid rgba(246, 242, 242, 0.1);
|
|
54
|
+
margin: 0;
|
|
55
|
+
padding: 0;
|
|
56
|
+
width: 200px;
|
|
57
|
+
position: fixed;
|
|
58
|
+
height: 100%;
|
|
59
|
+
overflow: auto;
|
|
54
60
|
}
|
|
55
|
-
|
|
61
|
+
|
|
62
|
+
.app {
|
|
63
|
+
font-family: sans-serif;
|
|
64
|
+
font-size: 18px;
|
|
65
|
+
display: flex;
|
|
66
|
+
align-items: left;
|
|
56
67
|
justify-content: center;
|
|
68
|
+
flex-direction: column;
|
|
69
|
+
gap: 20px;
|
|
70
|
+
height: 100vh;
|
|
71
|
+
font-family: Cambria, Cochin, Georgia, Times, "Times New Roman", serif;
|
|
57
72
|
}
|
|
58
|
-
.
|
|
59
|
-
|
|
73
|
+
.filterlabel ,.topFilterlabel{
|
|
74
|
+
margin-top: 30px;
|
|
75
|
+
font-size: 25px;
|
|
76
|
+
margin-bottom: 10px;
|
|
77
|
+
color: white;
|
|
60
78
|
}
|
|
61
|
-
.
|
|
62
|
-
|
|
79
|
+
.topFilterlabel {
|
|
80
|
+
border-bottom: 4px solid white;
|
|
81
|
+
}
|
|
82
|
+
.list-container {
|
|
83
|
+
display: flex;
|
|
84
|
+
flex-direction: column;
|
|
85
|
+
gap: 5px;
|
|
86
|
+
color: white;
|
|
87
|
+
font-size: 20px;
|
|
88
|
+
}
|
|
89
|
+
.checked-item,
|
|
90
|
+
.not-checked-item {
|
|
91
|
+
margin-left: 10px;
|
|
92
|
+
}
|
|
93
|
+
.checked-item {
|
|
94
|
+
text-decoration: line-through;
|
|
63
95
|
}
|
|
96
|
+
.rowC {
|
|
97
|
+
display:flex; flex-direction:row;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
.colC {
|
|
101
|
+
display: flex; flex-direction: row;
|
|
102
|
+
}
|
|
103
|
+
.MuiDrawer-paper {
|
|
104
|
+
width: drawerWidth;
|
|
105
|
+
box-sizing: 'border-box';
|
|
106
|
+
}
|
|
107
|
+
|
|
64
108
|
|
|
65
109
|
|
package/src/App.tsx
CHANGED
|
@@ -1,22 +1,256 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
1
|
+
import './App.css';
|
|
2
|
+
import React, {useEffect, useState} from 'react';
|
|
3
|
+
import Result from './components/Result';
|
|
4
|
+
import ExampleImages from './components/ExampleImages';
|
|
5
|
+
import Feedback from './components/Feedback';
|
|
6
|
+
import CategoryFilter from "./components/CategoryFilter";
|
|
7
|
+
import PredictedCategories from "./components/PredictedCategories";
|
|
8
|
+
import Codes from "./components/Codes";
|
|
9
|
+
import {Code, CategoryPrediction, RectCoords, Region, cadExtensions, Filter} from "@nyris/nyris-api";
|
|
10
|
+
import { useDropzone} from "react-dropzone";
|
|
11
|
+
import classNames from 'classnames';
|
|
12
|
+
import {Animate, NodeGroup} from "react-move";
|
|
13
|
+
import {AppSettings, MDSettings, CanvasWithId} from "./types";
|
|
14
|
+
import {NyrisAppPart, NyrisFeedbackState} from "./actions/nyrisAppActions";
|
|
15
|
+
import {makeFileHandler, Capture, Preview} from "@nyris/nyris-react-components";
|
|
16
|
+
import {Drawer, Snackbar, Toolbar} from "@material-ui/core";
|
|
17
|
+
import MuiAlert, { AlertProps } from '@material-ui/lab/Alert';
|
|
18
|
+
import { dispatch } from 'rxjs/internal/observable/pairs';
|
|
19
|
+
import { useDispatch } from 'react-redux';
|
|
20
|
+
import { loadFilters } from './actions/searchActions';
|
|
21
|
+
import Sidebar from './components/Sidebar';
|
|
22
|
+
|
|
23
|
+
export interface AppHandlers {
|
|
24
|
+
onExampleImageClick: (url: string) => void,
|
|
25
|
+
onImageClick: (position: number, url: string) => void,
|
|
26
|
+
onLinkClick: (position: number, url: string) => void,
|
|
27
|
+
onFileDropped: (file: File) => void,
|
|
28
|
+
onCaptureComplete: (image: HTMLCanvasElement) => void,
|
|
29
|
+
onCaptureCanceled: () => void,
|
|
30
|
+
onSelectFile: (f: File) => void,
|
|
31
|
+
onCameraClick: () => void,
|
|
32
|
+
onShowStart: () => void,
|
|
33
|
+
onSelectionChange: (r: RectCoords) => void,
|
|
34
|
+
onPositiveFeedback: () => void,
|
|
35
|
+
onNegativeFeedback: () => void,
|
|
36
|
+
onCloseFeedback: () => void
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export interface AppProps {
|
|
40
|
+
search: {
|
|
41
|
+
results: any[],
|
|
42
|
+
requestId?: string,
|
|
43
|
+
duration?: number,
|
|
44
|
+
categoryPredictions: CategoryPrediction[],
|
|
45
|
+
codes: Code[],
|
|
46
|
+
filterOptions: string[],
|
|
47
|
+
errorMessage?: string,
|
|
48
|
+
regions: Region[],
|
|
49
|
+
previewSelection: RectCoords,
|
|
50
|
+
toastErrorMessage?: string,
|
|
51
|
+
filters: Filter[]
|
|
52
|
+
},
|
|
53
|
+
previewImage?: CanvasWithId,
|
|
54
|
+
settings: AppSettings,
|
|
55
|
+
loading: boolean,
|
|
56
|
+
showPart: NyrisAppPart,
|
|
57
|
+
feedbackState: NyrisFeedbackState,
|
|
58
|
+
handlers: AppHandlers,
|
|
59
|
+
mdSettings: MDSettings
|
|
20
60
|
}
|
|
21
61
|
|
|
62
|
+
function Alert(props: AlertProps) {
|
|
63
|
+
return <MuiAlert elevation={6} variant="filled" {...props} />;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
const App: React.FC<AppProps> = ({
|
|
67
|
+
search: {results, regions, previewSelection, requestId, duration, errorMessage, filterOptions, categoryPredictions, codes, toastErrorMessage, filters},
|
|
68
|
+
showPart, settings, handlers, loading, previewImage, feedbackState
|
|
69
|
+
}) => {
|
|
70
|
+
const {getRootProps, getInputProps, isDragActive} = useDropzone({onDrop: (fs: File[]) => handlers.onFileDropped(fs[0])});
|
|
71
|
+
const minPreviewHeight = 400;
|
|
72
|
+
const halfOfTheScreenHeight = Math.floor(window.innerHeight * 0.45);
|
|
73
|
+
const maxPreviewHeight = Math.max(minPreviewHeight, halfOfTheScreenHeight);
|
|
74
|
+
const acceptTypes =
|
|
75
|
+
[ 'image/*' ].concat(
|
|
76
|
+
settings.cadSearch ? cadExtensions : []
|
|
77
|
+
).join(',');
|
|
78
|
+
const [toastOpen, setToastOpen] = useState(false);
|
|
79
|
+
const dispatch = useDispatch();
|
|
80
|
+
|
|
81
|
+
useEffect(() => {
|
|
82
|
+
if (toastErrorMessage !== '') {
|
|
83
|
+
setToastOpen(true);
|
|
84
|
+
}
|
|
85
|
+
}, [toastErrorMessage])
|
|
86
|
+
|
|
87
|
+
useEffect(() =>{
|
|
88
|
+
dispatch(loadFilters());
|
|
89
|
+
}, [])
|
|
90
|
+
|
|
91
|
+
return (
|
|
92
|
+
<div>
|
|
93
|
+
{showPart === 'camera' &&
|
|
94
|
+
<Capture onCaptureComplete={handlers.onCaptureComplete} onCaptureCanceled={handlers.onCaptureCanceled}
|
|
95
|
+
useAppText='Use default camera app'/>}
|
|
96
|
+
<div className={classNames('headSection', {hidden: showPart === 'results'})} id="headSection">
|
|
97
|
+
<div className="navWrap">
|
|
98
|
+
<div>
|
|
99
|
+
<section id="branding" style={{paddingLeft: '50px',marginLeft: '70px'}}/>
|
|
100
|
+
<div id="menu" className="menuWrap" role="navigation">
|
|
101
|
+
<ul>
|
|
102
|
+
<li><a href="https://nyris.io/imprint/#privacy" target="_blank"
|
|
103
|
+
rel="noopener noreferrer">Privacy Policy</a></li>
|
|
104
|
+
<li><a href="https://nyris.io/" target="_blank" rel="noopener noreferrer">Visit our
|
|
105
|
+
Website</a></li>
|
|
106
|
+
</ul>
|
|
107
|
+
</div>
|
|
108
|
+
</div>
|
|
109
|
+
</div>
|
|
110
|
+
<div {...getRootProps({
|
|
111
|
+
onClick: e => {
|
|
112
|
+
e.stopPropagation();
|
|
113
|
+
}
|
|
114
|
+
})} className={classNames('wrapper', 'dragAndDropActionArea', {'fileIsHover': isDragActive})}>
|
|
115
|
+
<section style={{width:'350px', height: '100%' , marginTop: '100px', borderRight:'4px solid rgba(255, 255, 255, .12)'}}>
|
|
116
|
+
<Toolbar>
|
|
117
|
+
|
|
118
|
+
<div> Select Filters </div>
|
|
119
|
+
</Toolbar>
|
|
120
|
+
{ filters && filters.length > 0 ? <Sidebar filters={filters}/> : <div></div> }
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
</section>
|
|
124
|
+
<div className="contentWrap" style={{marginLeft: '50px', marginTop:'50px'}}>
|
|
125
|
+
<section className="uploadImage">
|
|
126
|
+
<input type="button" name="file" id="capture" className="inputfile" accept="image/*"
|
|
127
|
+
capture="environment" onClick={handlers.onCameraClick}/>
|
|
128
|
+
<input type="file" name="file" id="capture_file" className="inputfile" accept={acceptTypes}
|
|
129
|
+
capture="environment"/>
|
|
130
|
+
<input {...getInputProps()} type="file" name="file" id="select_file" className="inputfile"
|
|
131
|
+
accept={acceptTypes}
|
|
132
|
+
onChange={makeFileHandler(handlers.onSelectFile)}
|
|
133
|
+
/>
|
|
134
|
+
<div className="onDesktop">
|
|
135
|
+
Drop an image
|
|
136
|
+
<div className="smallText">or</div>
|
|
137
|
+
</div>
|
|
138
|
+
<div className="onMobile camIcon">
|
|
139
|
+
<img src="./images/ic_cam_large.svg" alt="Camera"/>
|
|
140
|
+
</div>
|
|
141
|
+
<label htmlFor="capture" className="btn primary onMobile"
|
|
142
|
+
style={{marginBottom: '2em', width: '22em'}}>
|
|
143
|
+
<span className="onMobile">Take a picture</span>
|
|
144
|
+
</label>
|
|
145
|
+
<br/>
|
|
146
|
+
<label htmlFor="select_file" className="btn primary" style={{width: '22em'}}>
|
|
147
|
+
<span>Select a file</span>
|
|
148
|
+
</label>
|
|
149
|
+
<label htmlFor="capture" className="mobileUploadHandler onMobile"/>
|
|
150
|
+
</section>
|
|
151
|
+
<ExampleImages images={settings.exampleImages} onExampleImageClicked={handlers.onExampleImageClick}/>
|
|
152
|
+
</div>
|
|
153
|
+
</div>
|
|
154
|
+
<div className={classNames('tryDifferent', {hidden: showPart !== 'results'})}
|
|
155
|
+
onClick={handlers.onShowStart}>
|
|
156
|
+
<div className="icIcon">
|
|
157
|
+
</div>
|
|
158
|
+
<div className="textDesc"> Try a different image</div>
|
|
159
|
+
<br style={{clear: 'both'}}/>
|
|
160
|
+
</div>
|
|
161
|
+
<div className="headerSeparatorTop"/>
|
|
162
|
+
<div className="headerSeparatorBack"/>
|
|
163
|
+
</div>
|
|
164
|
+
|
|
165
|
+
<section
|
|
166
|
+
className={classNames('results', {resultsActive: showPart === 'results'}, (results.length === 1 ? 'singleProduct' : 'multipleProducts'))}>
|
|
167
|
+
{errorMessage &&
|
|
168
|
+
<div className="errorMsg">
|
|
169
|
+
{errorMessage}
|
|
170
|
+
<div style={{textAlign: 'center', fontSize: '0.7em', paddingTop: '0.8em'}}><span>Make sure to include the request ID when reporting a problem: {requestId}</span>
|
|
171
|
+
</div>
|
|
172
|
+
</div>
|
|
173
|
+
}
|
|
174
|
+
<Animate show={loading} start={{opacity: 0.0}} enter={{opacity: [1.0], timing: {duration: 300}}}
|
|
175
|
+
leave={{opacity: [0.0], timing: {duration: 300}}}>
|
|
176
|
+
{s =>
|
|
177
|
+
<div className="loadingOverlay" style={{...s}}>
|
|
178
|
+
<div className="loading"/>
|
|
179
|
+
</div>
|
|
180
|
+
}
|
|
181
|
+
</Animate>
|
|
182
|
+
{settings.preview && previewImage &&
|
|
183
|
+
<div className="preview">
|
|
184
|
+
<Preview key={previewImage.id}
|
|
185
|
+
maxWidth={document.body.clientWidth} maxHeight={maxPreviewHeight}
|
|
186
|
+
dotColor="#4C8F9F"
|
|
187
|
+
onSelectionChange={handlers.onSelectionChange} regions={regions}
|
|
188
|
+
selection={previewSelection} image={previewImage.canvas}/>
|
|
189
|
+
</div>
|
|
190
|
+
}
|
|
191
|
+
<div className="predicted-categories">
|
|
192
|
+
<PredictedCategories cs={categoryPredictions}/>
|
|
193
|
+
</div>
|
|
194
|
+
<div className="predicted-categories">
|
|
195
|
+
<Codes codes={codes}/>
|
|
196
|
+
</div>
|
|
197
|
+
<CategoryFilter cats={filterOptions}/>
|
|
198
|
+
|
|
199
|
+
<div className="wrapper">
|
|
200
|
+
<NodeGroup data={results}
|
|
201
|
+
keyAccessor={r => r.sku}
|
|
202
|
+
start={(r, i) => ({opacity: 0, translateX: -100})}
|
|
203
|
+
enter={(r, i) => ({
|
|
204
|
+
opacity: [1],
|
|
205
|
+
translateX: [0],
|
|
206
|
+
timing: {delay: i * 100, duration: 300}
|
|
207
|
+
})}
|
|
208
|
+
>
|
|
209
|
+
{rs => <>{rs.map(({key, data, state}) => <Result
|
|
210
|
+
key={key}
|
|
211
|
+
noImageUrl={settings.noImageUrl}
|
|
212
|
+
template={settings.resultTemplate}
|
|
213
|
+
onImageClick={handlers.onImageClick}
|
|
214
|
+
onLinkClick={handlers.onLinkClick}
|
|
215
|
+
result={data}
|
|
216
|
+
style={{opacity: state.opacity, transform: `translateX(${state.translateX}%)`}}/>)}</>}
|
|
217
|
+
</NodeGroup>
|
|
218
|
+
|
|
219
|
+
{results.length === 0 && showPart === 'results' && !loading && (
|
|
220
|
+
|
|
221
|
+
<div className="noResults">We did not find anything <span role="img"
|
|
222
|
+
aria-label="sad face">😕</span></div>
|
|
223
|
+
)}
|
|
224
|
+
|
|
225
|
+
<br style={{clear: 'both'}}/>
|
|
226
|
+
|
|
227
|
+
{duration && showPart === 'results' && (<div style={{textAlign: 'center', fontSize: '0.7em', paddingTop: '0.8em'}}>Search
|
|
228
|
+
took {duration.toFixed(2)} seconds</div>)}
|
|
229
|
+
|
|
230
|
+
{requestId && showPart === 'results' && <div style={{textAlign: 'center', fontSize: '0.7em', paddingTop: '0.8em'}}>Request
|
|
231
|
+
identifier {requestId}</div>}
|
|
232
|
+
</div>
|
|
233
|
+
</section>
|
|
234
|
+
|
|
235
|
+
<Snackbar open={toastOpen} autoHideDuration={3000} onClose={() => setToastOpen(false)}>
|
|
236
|
+
<Alert onClose={() => setToastOpen(false)} severity="error">
|
|
237
|
+
{toastErrorMessage}
|
|
238
|
+
</Alert>
|
|
239
|
+
</Snackbar>
|
|
240
|
+
|
|
241
|
+
<section className="footnote">
|
|
242
|
+
<div className="wrapper">
|
|
243
|
+
© 2017 - 2019 <a href="https://nyris.io">nyris GmbH</a> - All rights reserved - <a
|
|
244
|
+
href="https://nyris.io/imprint/">Imprint</a>
|
|
245
|
+
</div>
|
|
246
|
+
</section>
|
|
247
|
+
<Feedback feedbackState={feedbackState} onPositiveFeedback={handlers.onPositiveFeedback}
|
|
248
|
+
onNegativeFeedback={handlers.onNegativeFeedback} onClose={handlers.onCloseFeedback}/>
|
|
249
|
+
</div>
|
|
250
|
+
);
|
|
251
|
+
|
|
252
|
+
};
|
|
253
|
+
|
|
254
|
+
|
|
255
|
+
|
|
22
256
|
export default App;
|