@nyris/nyris-webapp 0.3.4 → 0.3.9
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.9800bdc87f5a2c5d6d8a5d1a5287598f.js → precache-manifest.a97813497ab8d37548141e5e2618d0dc.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.0481043c.chunk.css +2 -0
- package/build/static/css/main.0481043c.chunk.css.map +1 -0
- package/build/static/js/2.6e13adbe.chunk.js +3 -0
- package/build/static/js/2.6e13adbe.chunk.js.LICENSE.txt +79 -0
- package/build/static/js/2.6e13adbe.chunk.js.map +1 -0
- package/build/static/js/main.f5da7aa4.chunk.js +2 -0
- package/build/static/js/main.f5da7aa4.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.test.tsx +49 -0
- package/src/App.tsx +242 -17
- package/src/AppMD.tsx +320 -0
- package/src/actions/nyrisAppActions.ts +76 -0
- package/src/actions/searchActions.ts +217 -0
- package/src/components/ExampleImages.tsx +17 -32
- package/src/components/Feedback.tsx +48 -87
- package/src/components/FiltersList.tsx +67 -0
- package/src/components/Header.tsx +17 -32
- package/src/components/Result.tsx +113 -186
- package/src/components/Sidebar.tsx +42 -0
- package/src/defaults.ts +3 -4
- package/src/epics/feedback.ts +59 -0
- package/src/epics/index.ts +154 -0
- package/src/epics/search.ts +164 -0
- package/src/epics/types.ts +12 -0
- 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 +415 -572
- package/src/index.tsx +191 -39
- package/src/types.ts +3 -42
- 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.29ddd567.chunk.js +0 -3
- package/build/static/js/2.29ddd567.chunk.js.LICENSE.txt +0 -124
- package/build/static/js/2.29ddd567.chunk.js.map +0 -1
- package/build/static/js/main.c35ded37.chunk.js +0 -2
- package/build/static/js/main.c35ded37.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 -270
- package/src/Store/Store.ts +0 -53
- 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 -38
- 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/results/ItemResult.tsx +0 -155
- package/src/components/search/ListSearch.tsx +0 -209
- package/src/modules/LandingPage/App.tsx +0 -318
- package/src/modules/LandingPage/AppMD.tsx +0 -399
- package/src/modules/LandingPage/common.scss +0 -1304
- package/src/modules/LandingPage/index.tsx +0 -193
- package/src/modules/LandingPage/indexNewVersion.tsx +0 -110
- package/src/modules/LandingPage/propsType.ts +0 -43
- 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 -468
- package/src/services/Feedback.ts +0 -65
- package/src/services/findByImage.ts +0 -24
- package/src/services/findRegionsCustom.ts +0 -15
- package/src/services/image.ts +0 -107
- package/src/services/nyris.ts +0 -123
- package/src/services/session.ts +0 -20
- package/src/services/types.ts +0 -82
|
@@ -1,193 +0,0 @@
|
|
|
1
|
-
import React, { useCallback, useEffect, useState } from "react";
|
|
2
|
-
import {
|
|
3
|
-
RectCoords,
|
|
4
|
-
cadExtensions,
|
|
5
|
-
isCadFile,
|
|
6
|
-
isImageFile,
|
|
7
|
-
ImageSearchOptions,
|
|
8
|
-
} from "@nyris/nyris-api";
|
|
9
|
-
|
|
10
|
-
import { useAppDispatch, useAppSelector } from "Store/Store";
|
|
11
|
-
import {
|
|
12
|
-
loadCadFileLoad,
|
|
13
|
-
setSearchResults,
|
|
14
|
-
loadFileSelectRegion,
|
|
15
|
-
loadingActionRegions,
|
|
16
|
-
loadingActionResults,
|
|
17
|
-
searchFileImageNonRegion,
|
|
18
|
-
} from "Store/Search";
|
|
19
|
-
import {
|
|
20
|
-
feedbackNegative,
|
|
21
|
-
feedbackSubmitPositive,
|
|
22
|
-
hideFeedback,
|
|
23
|
-
showCamera,
|
|
24
|
-
showFeedback,
|
|
25
|
-
showResults,
|
|
26
|
-
showStart,
|
|
27
|
-
} from "Store/Nyris";
|
|
28
|
-
import { serviceImage, serviceImageNonRegion } from "services/image";
|
|
29
|
-
import { findByImage } from "services/findByImage";
|
|
30
|
-
import { debounce, isEmpty } from "lodash";
|
|
31
|
-
import { feedbackClickEpic } from "services/Feedback";
|
|
32
|
-
import AppMD from "./AppMD";
|
|
33
|
-
import App from "./App";
|
|
34
|
-
import {AppHandlers, AppProps} from "./propsType";
|
|
35
|
-
import {defaultMdSettings} from "../../defaults";
|
|
36
|
-
|
|
37
|
-
const LandingPageApp = () => {
|
|
38
|
-
const dispatch = useAppDispatch();
|
|
39
|
-
const searchState = useAppSelector((state) => state);
|
|
40
|
-
const [rectCoords, setRectCoords] = useState<any>();
|
|
41
|
-
const defaultSelection = {x1: 0.1, x2: 0.9, y1: 0.1, y2: 0.9};
|
|
42
|
-
const [selection, setSelection] = useState<RectCoords>(defaultSelection);
|
|
43
|
-
|
|
44
|
-
const { settings, search, nyris } = searchState;
|
|
45
|
-
const {
|
|
46
|
-
fetchingRegions,
|
|
47
|
-
fetchingResults,
|
|
48
|
-
requestImage,
|
|
49
|
-
selectedRegion,
|
|
50
|
-
} = search;
|
|
51
|
-
const { showPart } = nyris;
|
|
52
|
-
|
|
53
|
-
const isDefaultRect = (r: RectCoords) => r.x1 === 0 && r.x2 === 1 && r.y1 === 0 && r.y2 === 1;
|
|
54
|
-
|
|
55
|
-
// update selection, if it is not the default one
|
|
56
|
-
useEffect(() => {
|
|
57
|
-
if (!isDefaultRect(selectedRegion)) {
|
|
58
|
-
setSelection(selectedRegion);
|
|
59
|
-
}
|
|
60
|
-
}, [selectedRegion]);
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
useEffect(() => {
|
|
64
|
-
if (isEmpty(rectCoords)) {
|
|
65
|
-
return;
|
|
66
|
-
}
|
|
67
|
-
onSearchOffersForImage(rectCoords);
|
|
68
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
69
|
-
}, [rectCoords]);
|
|
70
|
-
|
|
71
|
-
const acceptTypes = ["image/*"]
|
|
72
|
-
.concat(settings.cadSearch ? cadExtensions : [])
|
|
73
|
-
.join(",");
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
function scrollTop() {
|
|
77
|
-
// TODO might require polyfill for ios and edge
|
|
78
|
-
window.scrollTo({ top: 0, left: 0, behavior: "smooth" });
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
const onLinkClick = (_position: number, url: string) => {
|
|
82
|
-
feedbackClickEpic(searchState, _position).catch(console.warn);
|
|
83
|
-
if (url) {
|
|
84
|
-
window.open(url);
|
|
85
|
-
}
|
|
86
|
-
};
|
|
87
|
-
// TODO: search image file home page
|
|
88
|
-
const isCheckImageFile = (file: any) => {
|
|
89
|
-
dispatch(loadingActionResults());
|
|
90
|
-
dispatch(showResults());
|
|
91
|
-
dispatch(showFeedback());
|
|
92
|
-
if (isImageFile(file) || typeof file === "string") {
|
|
93
|
-
return serviceImage(file, searchState.settings).then((res) => {
|
|
94
|
-
dispatch(setSearchResults(res));
|
|
95
|
-
});
|
|
96
|
-
}
|
|
97
|
-
if (isCadFile(file)) {
|
|
98
|
-
return dispatch(loadCadFileLoad(file));
|
|
99
|
-
}
|
|
100
|
-
};
|
|
101
|
-
//
|
|
102
|
-
|
|
103
|
-
const searchByUrl = (url: string, position?: number) => {
|
|
104
|
-
dispatch(loadingActionResults());
|
|
105
|
-
dispatch(showResults());
|
|
106
|
-
if (position) {
|
|
107
|
-
feedbackClickEpic(searchState, position);
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
if (settings.regions) {
|
|
111
|
-
serviceImage(url, searchState.settings).then((res) => {
|
|
112
|
-
dispatch(setSearchResults(res));
|
|
113
|
-
dispatch(showFeedback());
|
|
114
|
-
});
|
|
115
|
-
} else {
|
|
116
|
-
serviceImageNonRegion(url, searchState, rectCoords).then((res) => {
|
|
117
|
-
dispatch(searchFileImageNonRegion(res));
|
|
118
|
-
dispatch(showFeedback());
|
|
119
|
-
});
|
|
120
|
-
}
|
|
121
|
-
};
|
|
122
|
-
|
|
123
|
-
const handlerRectCoords = debounce((value) => {
|
|
124
|
-
return setRectCoords(value);
|
|
125
|
-
}, 1200);
|
|
126
|
-
|
|
127
|
-
const debouncedSetRectCoords = useCallback(
|
|
128
|
-
(value) => handlerRectCoords(value),
|
|
129
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
130
|
-
[]
|
|
131
|
-
);
|
|
132
|
-
|
|
133
|
-
const onSearchOffersForImage = (r: RectCoords) => {
|
|
134
|
-
const { canvas }: any = requestImage;
|
|
135
|
-
let options: ImageSearchOptions = {
|
|
136
|
-
cropRect: r,
|
|
137
|
-
};
|
|
138
|
-
dispatch(loadingActionRegions());
|
|
139
|
-
return findByImage(canvas, options, settings).then((res) => {
|
|
140
|
-
dispatch(loadFileSelectRegion(res));
|
|
141
|
-
return dispatch(showFeedback());
|
|
142
|
-
});
|
|
143
|
-
};
|
|
144
|
-
|
|
145
|
-
const handlers : AppHandlers = {
|
|
146
|
-
onExampleImageClick: url => searchByUrl(url),
|
|
147
|
-
onCameraClick: () => dispatch(showCamera),
|
|
148
|
-
onCaptureCanceled: () => dispatch(showStart),
|
|
149
|
-
onCaptureComplete: (i) => isCheckImageFile(i),
|
|
150
|
-
onCloseFeedback: () => dispatch(hideFeedback),
|
|
151
|
-
onFileDropped: (f) => isCheckImageFile(f),
|
|
152
|
-
onImageClick: (position, url) => searchByUrl(url, position),
|
|
153
|
-
onLinkClick: onLinkClick,
|
|
154
|
-
onPositiveFeedback: () => {
|
|
155
|
-
dispatch(feedbackSubmitPositive());
|
|
156
|
-
// TODO submit positive feedback to the api
|
|
157
|
-
},
|
|
158
|
-
onNegativeFeedback: () => {
|
|
159
|
-
dispatch(feedbackNegative());
|
|
160
|
-
// TODO submit negative feedback to the api
|
|
161
|
-
},
|
|
162
|
-
onSelectFile: (f) => isCheckImageFile(f),
|
|
163
|
-
onSelectionChange: r => {
|
|
164
|
-
setSelection(r);
|
|
165
|
-
debouncedSetRectCoords(r);
|
|
166
|
-
},
|
|
167
|
-
onShowStart: () => {
|
|
168
|
-
dispatch(showStart());
|
|
169
|
-
scrollTop();
|
|
170
|
-
}
|
|
171
|
-
};
|
|
172
|
-
|
|
173
|
-
let props : AppProps = {
|
|
174
|
-
search: {
|
|
175
|
-
...search,
|
|
176
|
-
previewSelection: selection
|
|
177
|
-
},
|
|
178
|
-
settings,
|
|
179
|
-
previewImage: search.requestImage,
|
|
180
|
-
acceptTypes,
|
|
181
|
-
showPart,
|
|
182
|
-
handlers,
|
|
183
|
-
loading: fetchingRegions || fetchingResults,
|
|
184
|
-
mdSettings: settings.themePage.materialDesign || defaultMdSettings,
|
|
185
|
-
feedbackState: nyris.feedbackState,
|
|
186
|
-
|
|
187
|
-
};
|
|
188
|
-
|
|
189
|
-
return settings.themePage.materialDesign?.active? <AppMD {...props}/> : <App {...props}/>;
|
|
190
|
-
|
|
191
|
-
};
|
|
192
|
-
|
|
193
|
-
export default LandingPageApp;
|
|
@@ -1,110 +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 {createSessionByApi} from "../../services/session";
|
|
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 { apiKeyAlgolia, appIdAlgolia, indexNameAlgolia } = settings;
|
|
29
|
-
const searchClient = algoliasearch(appIdAlgolia, apiKeyAlgolia);
|
|
30
|
-
searchClient.initIndex(indexNameAlgolia);
|
|
31
|
-
|
|
32
|
-
useEffect(() => {
|
|
33
|
-
const createSession = async () => {
|
|
34
|
-
let payload = await createSessionByApi(searchState.settings);
|
|
35
|
-
dispatch(setUpdateSession(payload));
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
createSession().catch(console.log);
|
|
39
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
40
|
-
}, []);
|
|
41
|
-
|
|
42
|
-
const acceptTypes = ["image/*"]
|
|
43
|
-
.concat(settings.cadSearch ? cadExtensions : [])
|
|
44
|
-
.join(",");
|
|
45
|
-
|
|
46
|
-
const InfiniteHits = ({ hits }: any) => {
|
|
47
|
-
return <div></div>;
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
const onChangeLoading = (value: boolean) => {
|
|
51
|
-
setLoading(value);
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
const CustomInfiniteHits = connectInfiniteHits(InfiniteHits);
|
|
55
|
-
|
|
56
|
-
const nonEmptyFilter: any[] = !search?.requestImage
|
|
57
|
-
? []
|
|
58
|
-
: ["sku:DOES_NOT_EXIST<score=1>"];
|
|
59
|
-
// Build filter using reverse position for stable item order
|
|
60
|
-
const filterSkus: any = search?.results
|
|
61
|
-
? search?.results.slice().reverse().map(
|
|
62
|
-
(f: any, i: number) => `sku:'${f.sku}'<score=${i}>`
|
|
63
|
-
)
|
|
64
|
-
: "";
|
|
65
|
-
const filtersString = [...nonEmptyFilter, ...filterSkus].join(" OR ");
|
|
66
|
-
|
|
67
|
-
return (
|
|
68
|
-
<Box className={`box-content-main ${isLoading ? "loading" : ""}`}>
|
|
69
|
-
<InstantSearch
|
|
70
|
-
indexName={indexNameAlgolia}
|
|
71
|
-
searchClient={searchClient}
|
|
72
|
-
searchState={searchStateInput}
|
|
73
|
-
onSearchStateChange={(state: any) => {
|
|
74
|
-
setSearchStateInput(state);
|
|
75
|
-
dispatch(changeValueTextSearch(state));
|
|
76
|
-
history.push("/result");
|
|
77
|
-
}}
|
|
78
|
-
>
|
|
79
|
-
<Box className="box-content_top">
|
|
80
|
-
<div className="box-logo">
|
|
81
|
-
<img src={TranslateIcon} width={32} height={27} alt="logo_icon" />
|
|
82
|
-
</div>
|
|
83
|
-
<div className="box-input">
|
|
84
|
-
<div className="wrap-input-search">
|
|
85
|
-
<Configure filters={filtersString}></Configure>
|
|
86
|
-
<div style={{ display: "none" }}>
|
|
87
|
-
<CustomInfiniteHits />
|
|
88
|
-
</div>
|
|
89
|
-
<CustomSearchBox />
|
|
90
|
-
</div>
|
|
91
|
-
</div>
|
|
92
|
-
<div className="box-bottom">
|
|
93
|
-
<Typography className="text-bottom">
|
|
94
|
-
Search by any name, category, SKU or keyword.
|
|
95
|
-
</Typography>
|
|
96
|
-
</div>
|
|
97
|
-
</Box>
|
|
98
|
-
<Box className="box-content_bottom">
|
|
99
|
-
<DragDropFile
|
|
100
|
-
acceptTypes={acceptTypes}
|
|
101
|
-
isLoading={isLoading}
|
|
102
|
-
onChangeLoading={onChangeLoading}
|
|
103
|
-
/>
|
|
104
|
-
</Box>
|
|
105
|
-
</InstantSearch>
|
|
106
|
-
</Box>
|
|
107
|
-
);
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
export default AppNewVersion;
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import {CategoryPrediction, Code, RectCoords, Region} from "@nyris/nyris-api";
|
|
2
|
-
import {AppSettings, CanvasWithId, MDSettings} from "../../types";
|
|
3
|
-
import {NyrisAppPart, NyrisFeedbackState} from "../../Store/Nyris";
|
|
4
|
-
|
|
5
|
-
export interface AppHandlers {
|
|
6
|
-
onExampleImageClick: (url: string) => void;
|
|
7
|
-
onImageClick: (position: number, url: string) => void;
|
|
8
|
-
onLinkClick: (position: number, url: string) => void;
|
|
9
|
-
onFileDropped: (file: File) => void;
|
|
10
|
-
onCaptureComplete: (image: HTMLCanvasElement) => void;
|
|
11
|
-
onCaptureCanceled: () => void;
|
|
12
|
-
onSelectFile: (f: File) => void;
|
|
13
|
-
onCameraClick: () => void;
|
|
14
|
-
onShowStart: () => void;
|
|
15
|
-
onSelectionChange: (r: RectCoords) => void;
|
|
16
|
-
onPositiveFeedback: () => void;
|
|
17
|
-
onNegativeFeedback: () => void;
|
|
18
|
-
onCloseFeedback: () => void;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
export interface AppProps {
|
|
23
|
-
search: {
|
|
24
|
-
results: any[];
|
|
25
|
-
requestId?: string;
|
|
26
|
-
duration?: number;
|
|
27
|
-
categoryPredictions: CategoryPrediction[];
|
|
28
|
-
codes: Code[];
|
|
29
|
-
filterOptions: string[];
|
|
30
|
-
errorMessage?: string;
|
|
31
|
-
regions: Region[];
|
|
32
|
-
previewSelection: RectCoords;
|
|
33
|
-
toastErrorMessage?: string;
|
|
34
|
-
};
|
|
35
|
-
acceptTypes: string,
|
|
36
|
-
previewImage?: CanvasWithId;
|
|
37
|
-
settings: AppSettings;
|
|
38
|
-
loading: boolean;
|
|
39
|
-
showPart: NyrisAppPart;
|
|
40
|
-
feedbackState: NyrisFeedbackState;
|
|
41
|
-
handlers: AppHandlers;
|
|
42
|
-
mdSettings: MDSettings;
|
|
43
|
-
}
|
package/src/page/Auth/login.tsx
DELETED
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
import { Box, Button, Typography } from "@material-ui/core";
|
|
2
|
-
import React from "react";
|
|
3
|
-
import ListSearch from "components/search/ListSearch";
|
|
4
|
-
|
|
5
|
-
interface Option {
|
|
6
|
-
readonly label: string;
|
|
7
|
-
readonly value: string;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
function SearchHistory(): JSX.Element {
|
|
11
|
-
return (
|
|
12
|
-
<Box className="wrap-main-search-history">
|
|
13
|
-
<Box className="box-main-top">
|
|
14
|
-
<Box className="box-input">
|
|
15
|
-
{/* <InputSearch
|
|
16
|
-
inputValueInputSearch={inputValueInputSearch}
|
|
17
|
-
handleChange={handleChangeInputSearch}
|
|
18
|
-
handleKeyDown={handleKeyDown}
|
|
19
|
-
handleInputChange={handleInputChange}
|
|
20
|
-
valueInputSearch={valueInputSearch}
|
|
21
|
-
styleControl={{
|
|
22
|
-
width: 640,
|
|
23
|
-
background: "#FFFFFF",
|
|
24
|
-
boxShadow: "0px 0px 6.66667px rgba(0, 0, 0, 0.2)",
|
|
25
|
-
borderRadius: 21,
|
|
26
|
-
minHeight: 42,
|
|
27
|
-
display: "flex",
|
|
28
|
-
alignItems: "center",
|
|
29
|
-
paddingLeft: "16px",
|
|
30
|
-
}}
|
|
31
|
-
placeholder={"Search"}
|
|
32
|
-
customComponent={{
|
|
33
|
-
DropdownIndicator: () => {
|
|
34
|
-
return (
|
|
35
|
-
<Box mr={1}>
|
|
36
|
-
<button
|
|
37
|
-
className="btn-input-search"
|
|
38
|
-
onClick={() => {
|
|
39
|
-
console.log("321");
|
|
40
|
-
}}
|
|
41
|
-
>
|
|
42
|
-
<img src={IconSetting} alt="icon_search" />
|
|
43
|
-
</button>
|
|
44
|
-
</Box>
|
|
45
|
-
);
|
|
46
|
-
},
|
|
47
|
-
}}
|
|
48
|
-
/> */}
|
|
49
|
-
</Box>
|
|
50
|
-
</Box>
|
|
51
|
-
|
|
52
|
-
<Box className="box-main-bottom">
|
|
53
|
-
<Box className="col-left">
|
|
54
|
-
<ul className="box-time">
|
|
55
|
-
<li>
|
|
56
|
-
<Button>
|
|
57
|
-
<Typography className="text-f9 active">2021</Typography>
|
|
58
|
-
</Button>
|
|
59
|
-
</li>
|
|
60
|
-
<li>
|
|
61
|
-
<Button>
|
|
62
|
-
<Typography className="text-f9">2020</Typography>
|
|
63
|
-
</Button>
|
|
64
|
-
</li>
|
|
65
|
-
</ul>
|
|
66
|
-
</Box>
|
|
67
|
-
<Box className="col-right">
|
|
68
|
-
<ListSearch />
|
|
69
|
-
<ListSearch />
|
|
70
|
-
</Box>
|
|
71
|
-
</Box>
|
|
72
|
-
</Box>
|
|
73
|
-
);
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
export default SearchHistory;
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { Box, Button, FormControlLabel, Grid, Typography } from "@material-ui/core";
|
|
3
|
-
import BgColor from "common/assets/images/Rectangle.png";
|
|
4
|
-
|
|
5
|
-
interface Props {}
|
|
6
|
-
|
|
7
|
-
function Profile(props: Props) {
|
|
8
|
-
return (
|
|
9
|
-
<Box className="wrap-main-profile">
|
|
10
|
-
<Grid container>
|
|
11
|
-
<Grid item xs={6} className="box-col-left">
|
|
12
|
-
<Box className="box-top">
|
|
13
|
-
<Typography className="text-f40 fw-600 text-dark">
|
|
14
|
-
Jose Luis Reyes
|
|
15
|
-
</Typography>
|
|
16
|
-
<Typography className="text-f13 text-dark2 fw-600">
|
|
17
|
-
Nyris GmbH
|
|
18
|
-
</Typography>
|
|
19
|
-
</Box>
|
|
20
|
-
<Box className="box-bottom">
|
|
21
|
-
<Box className="box-content">
|
|
22
|
-
<Typography className="text-f12 text-dark fw-700">Profile</Typography>
|
|
23
|
-
<Box mt={1}>
|
|
24
|
-
<FormControlLabel
|
|
25
|
-
labelPlacement="top"
|
|
26
|
-
control={<input />}
|
|
27
|
-
label="Name"
|
|
28
|
-
className="w-100"
|
|
29
|
-
style={{ alignItems: "flex-start", margin: 0 }}
|
|
30
|
-
/>
|
|
31
|
-
</Box>
|
|
32
|
-
<Box mt={1}>
|
|
33
|
-
<FormControlLabel
|
|
34
|
-
labelPlacement="top"
|
|
35
|
-
control={<input />}
|
|
36
|
-
label="E-mail"
|
|
37
|
-
style={{ alignItems: "flex-start", margin: 0 }}
|
|
38
|
-
className="w-100"
|
|
39
|
-
/>
|
|
40
|
-
</Box>
|
|
41
|
-
<Box mt={1}>
|
|
42
|
-
<FormControlLabel
|
|
43
|
-
labelPlacement="top"
|
|
44
|
-
control={<input />}
|
|
45
|
-
label="Password"
|
|
46
|
-
style={{ alignItems: "flex-start", margin: 0 }}
|
|
47
|
-
className="w-100"
|
|
48
|
-
/>
|
|
49
|
-
</Box>
|
|
50
|
-
<Box className="w-100" mt={2}>
|
|
51
|
-
<Typography className="text-f12 text-dark fw-700">Account</Typography>
|
|
52
|
-
</Box>
|
|
53
|
-
<Box mt={1}>
|
|
54
|
-
<FormControlLabel
|
|
55
|
-
labelPlacement="top"
|
|
56
|
-
control={<input />}
|
|
57
|
-
label="Company"
|
|
58
|
-
style={{ alignItems: "flex-start", margin: 0 }}
|
|
59
|
-
className="w-100"
|
|
60
|
-
/>
|
|
61
|
-
</Box>
|
|
62
|
-
<Box mt={1}>
|
|
63
|
-
<FormControlLabel
|
|
64
|
-
labelPlacement="top"
|
|
65
|
-
control={<input />}
|
|
66
|
-
label="Role"
|
|
67
|
-
style={{ alignItems: "flex-start", margin: 0 }}
|
|
68
|
-
className="w-100"
|
|
69
|
-
/>
|
|
70
|
-
</Box>
|
|
71
|
-
<Box mt={2}>
|
|
72
|
-
<Button className="btn-log-out">Log out</Button>
|
|
73
|
-
</Box>
|
|
74
|
-
</Box>
|
|
75
|
-
</Box>
|
|
76
|
-
</Grid>
|
|
77
|
-
<Grid item xs={6} className="box-col-right">
|
|
78
|
-
<Box className="box-bg-image">
|
|
79
|
-
<img src={BgColor} alt="" />
|
|
80
|
-
</Box>
|
|
81
|
-
</Grid>
|
|
82
|
-
</Grid>
|
|
83
|
-
</Box>
|
|
84
|
-
);
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
export default Profile;
|