@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,318 +0,0 @@
|
|
|
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 CategoryFilter from "components/CategoryFilter";
|
|
6
|
-
import PredictedCategories from "components/PredictedCategories";
|
|
7
|
-
import Codes from "components/Codes";
|
|
8
|
-
import { useDropzone } from "react-dropzone";
|
|
9
|
-
import classNames from "classnames";
|
|
10
|
-
import { Animate, NodeGroup } from "react-move";
|
|
11
|
-
import {
|
|
12
|
-
makeFileHandler,
|
|
13
|
-
Capture, Preview,
|
|
14
|
-
} from "@nyris/nyris-react-components";
|
|
15
|
-
import { Snackbar } from "@material-ui/core";
|
|
16
|
-
import MuiAlert, { AlertProps } from "@material-ui/lab/Alert";
|
|
17
|
-
|
|
18
|
-
import {AppProps} from "./propsType";
|
|
19
|
-
|
|
20
|
-
function Alert(props: AlertProps) {
|
|
21
|
-
return <MuiAlert elevation={6} variant="filled" {...props} />;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
const LandingPageApp = (props: AppProps) => {
|
|
25
|
-
const {
|
|
26
|
-
handlers,
|
|
27
|
-
showPart,
|
|
28
|
-
acceptTypes,
|
|
29
|
-
settings,
|
|
30
|
-
search,
|
|
31
|
-
loading,
|
|
32
|
-
previewImage
|
|
33
|
-
} = props;
|
|
34
|
-
|
|
35
|
-
const {
|
|
36
|
-
results,
|
|
37
|
-
requestId,
|
|
38
|
-
duration,
|
|
39
|
-
categoryPredictions,
|
|
40
|
-
codes,
|
|
41
|
-
filterOptions,
|
|
42
|
-
errorMessage,
|
|
43
|
-
regions,
|
|
44
|
-
previewSelection
|
|
45
|
-
} = search;
|
|
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;
|
|
59
|
-
|
|
60
|
-
const { getRootProps, getInputProps, isDragActive } = useDropzone({
|
|
61
|
-
onDrop: (fs: File[]) => {
|
|
62
|
-
onFileDropped(fs[0]);
|
|
63
|
-
},
|
|
64
|
-
});
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
const [toastOpen, setToastOpen] = useState(false);
|
|
68
|
-
useEffect(() => {
|
|
69
|
-
if (errorMessage !== "") {
|
|
70
|
-
setToastOpen(true);
|
|
71
|
-
}
|
|
72
|
-
}, [errorMessage]);
|
|
73
|
-
|
|
74
|
-
const minPreviewHeight = 400;
|
|
75
|
-
const halfOfTheScreenHeight = Math.floor(window.innerHeight * 0.45);
|
|
76
|
-
const maxPreviewHeight = Math.max(minPreviewHeight, halfOfTheScreenHeight);
|
|
77
|
-
|
|
78
|
-
return (
|
|
79
|
-
<div>
|
|
80
|
-
{showPart === "camera" && (
|
|
81
|
-
<Capture
|
|
82
|
-
onCaptureComplete={ onCaptureComplete }
|
|
83
|
-
onCaptureCanceled={ onCaptureCanceled }
|
|
84
|
-
useAppText="Use default camera app"
|
|
85
|
-
/>
|
|
86
|
-
)}
|
|
87
|
-
<div
|
|
88
|
-
className={classNames("headSection", {
|
|
89
|
-
hidden: showPart === "results",
|
|
90
|
-
})}
|
|
91
|
-
id="headSection"
|
|
92
|
-
>
|
|
93
|
-
<div
|
|
94
|
-
{...getRootProps({
|
|
95
|
-
onClick: (e) => {
|
|
96
|
-
e.stopPropagation();
|
|
97
|
-
},
|
|
98
|
-
})}
|
|
99
|
-
className={classNames("wrapper", "dragAndDropActionArea", {
|
|
100
|
-
fileIsHover: isDragActive,
|
|
101
|
-
})}
|
|
102
|
-
>
|
|
103
|
-
<div className="contentWrap">
|
|
104
|
-
<section className="uploadImage">
|
|
105
|
-
<input
|
|
106
|
-
type="button"
|
|
107
|
-
name="file"
|
|
108
|
-
id="capture"
|
|
109
|
-
className="inputfile"
|
|
110
|
-
accept="image/*"
|
|
111
|
-
capture="environment"
|
|
112
|
-
onClick={() => onCameraClick()}
|
|
113
|
-
/>
|
|
114
|
-
<input
|
|
115
|
-
type="file"
|
|
116
|
-
name="file"
|
|
117
|
-
id="capture_file"
|
|
118
|
-
className="inputfile"
|
|
119
|
-
accept={acceptTypes}
|
|
120
|
-
capture="environment"
|
|
121
|
-
/>
|
|
122
|
-
<input
|
|
123
|
-
{...getInputProps()}
|
|
124
|
-
type="file"
|
|
125
|
-
name="file"
|
|
126
|
-
id="select_file"
|
|
127
|
-
className="inputfile"
|
|
128
|
-
accept={acceptTypes}
|
|
129
|
-
onChange={makeFileHandler(onSelectFile)}
|
|
130
|
-
/>
|
|
131
|
-
<div className="onDesktop">
|
|
132
|
-
Drop an image
|
|
133
|
-
<div className="smallText">or</div>
|
|
134
|
-
</div>
|
|
135
|
-
<div className="onMobile camIcon">
|
|
136
|
-
<img src="./images/ic_cam_large.svg" alt="Camera" />
|
|
137
|
-
</div>
|
|
138
|
-
<label
|
|
139
|
-
htmlFor="capture"
|
|
140
|
-
className="btn primary onMobile"
|
|
141
|
-
style={{ marginBottom: "2em", width: "22em" }}
|
|
142
|
-
>
|
|
143
|
-
<span className="onMobile">Take a picture</span>
|
|
144
|
-
</label>
|
|
145
|
-
<br />
|
|
146
|
-
<label
|
|
147
|
-
htmlFor="select_file"
|
|
148
|
-
className="btn primary"
|
|
149
|
-
style={{ width: "22em" }}
|
|
150
|
-
>
|
|
151
|
-
<span>Select a file</span>
|
|
152
|
-
</label>
|
|
153
|
-
<label
|
|
154
|
-
htmlFor="capture"
|
|
155
|
-
className="mobileUploadHandler onMobile"
|
|
156
|
-
/>
|
|
157
|
-
</section>
|
|
158
|
-
<ExampleImages
|
|
159
|
-
images={settings.exampleImages}
|
|
160
|
-
onExampleImageClicked={onExampleImageClick}
|
|
161
|
-
/>
|
|
162
|
-
</div>
|
|
163
|
-
</div>
|
|
164
|
-
<div
|
|
165
|
-
className={classNames("tryDifferent", {
|
|
166
|
-
hidden: showPart !== "results",
|
|
167
|
-
})}
|
|
168
|
-
onClick={() => onShowStart()}
|
|
169
|
-
>
|
|
170
|
-
<div className="icIcon"></div>
|
|
171
|
-
<div className="textDesc"> Try a different image</div>
|
|
172
|
-
<br style={{ clear: "both" }} />
|
|
173
|
-
</div>
|
|
174
|
-
<div className="headerSeparatorTop" />
|
|
175
|
-
<div className="headerSeparatorBack" />
|
|
176
|
-
</div>
|
|
177
|
-
|
|
178
|
-
<section
|
|
179
|
-
className={classNames(
|
|
180
|
-
"results",
|
|
181
|
-
{ resultsActive: showPart === "results" },
|
|
182
|
-
results.length === 1 ? "singleProduct" : "multipleProducts"
|
|
183
|
-
)}
|
|
184
|
-
>
|
|
185
|
-
{errorMessage && (
|
|
186
|
-
<div className="errorMsg">
|
|
187
|
-
{errorMessage}
|
|
188
|
-
<div
|
|
189
|
-
style={{
|
|
190
|
-
textAlign: "center",
|
|
191
|
-
fontSize: "0.7em",
|
|
192
|
-
paddingTop: "0.8em",
|
|
193
|
-
}}
|
|
194
|
-
>
|
|
195
|
-
<span>
|
|
196
|
-
Make sure to include the request ID when reporting a problem:{" "}
|
|
197
|
-
{requestId}
|
|
198
|
-
</span>
|
|
199
|
-
</div>
|
|
200
|
-
</div>
|
|
201
|
-
)}
|
|
202
|
-
<Animate
|
|
203
|
-
show={loading}
|
|
204
|
-
start={{ opacity: 0.0 }}
|
|
205
|
-
enter={{ opacity: [1.0], timing: { duration: 300 } }}
|
|
206
|
-
leave={{ opacity: [0.0], timing: { duration: 300 } }}
|
|
207
|
-
>
|
|
208
|
-
{(s) => (
|
|
209
|
-
<div className="loadingOverlay" style={{ ...s }}>
|
|
210
|
-
<div className="loading" />
|
|
211
|
-
</div>
|
|
212
|
-
)}
|
|
213
|
-
</Animate>
|
|
214
|
-
{settings.preview && previewImage && (
|
|
215
|
-
<div className="preview">
|
|
216
|
-
<Preview
|
|
217
|
-
key={previewImage?.id}
|
|
218
|
-
onSelectionChange={ onSelectionChange }
|
|
219
|
-
image={previewImage?.canvas}
|
|
220
|
-
selection={previewSelection}
|
|
221
|
-
regions={regions}
|
|
222
|
-
maxWidth={document.body.clientWidth}
|
|
223
|
-
maxHeight={maxPreviewHeight}
|
|
224
|
-
dotColor="#4C8F9F"
|
|
225
|
-
/>
|
|
226
|
-
</div>
|
|
227
|
-
)}
|
|
228
|
-
<div className="predicted-categories">
|
|
229
|
-
<PredictedCategories cs={categoryPredictions} />
|
|
230
|
-
</div>
|
|
231
|
-
<div className="predicted-categories">
|
|
232
|
-
<Codes codes={codes} />
|
|
233
|
-
</div>
|
|
234
|
-
<CategoryFilter cats={filterOptions} />
|
|
235
|
-
<div className="wrapper">
|
|
236
|
-
<NodeGroup
|
|
237
|
-
data={results}
|
|
238
|
-
keyAccessor={(r) => r.sku}
|
|
239
|
-
start={(r, i) => ({ opacity: 0, translateX: -100 })}
|
|
240
|
-
enter={(r, i) => ({
|
|
241
|
-
opacity: [1],
|
|
242
|
-
translateX: [0],
|
|
243
|
-
timing: { delay: i * 100, duration: 300 },
|
|
244
|
-
})}
|
|
245
|
-
>
|
|
246
|
-
{(rs) => (
|
|
247
|
-
<>
|
|
248
|
-
{rs.map(({ key, data, state }) => (
|
|
249
|
-
<Result
|
|
250
|
-
key={key}
|
|
251
|
-
noImageUrl={settings.noImageUrl}
|
|
252
|
-
template={settings.resultTemplate}
|
|
253
|
-
onImageClick={onImageClick}
|
|
254
|
-
onLinkClick={onLinkClick}
|
|
255
|
-
result={data}
|
|
256
|
-
style={{
|
|
257
|
-
opacity: state.opacity,
|
|
258
|
-
transform: `translateX(${state.translateX}%)`,
|
|
259
|
-
}}
|
|
260
|
-
/>
|
|
261
|
-
))}
|
|
262
|
-
</>
|
|
263
|
-
)}
|
|
264
|
-
</NodeGroup>
|
|
265
|
-
|
|
266
|
-
{(results.length === 0 &&
|
|
267
|
-
showPart === "results" &&
|
|
268
|
-
!loading && (
|
|
269
|
-
<div className="noResults">
|
|
270
|
-
We did not find anything{" "}
|
|
271
|
-
<span role="img" aria-label="sad face">
|
|
272
|
-
😕
|
|
273
|
-
</span>
|
|
274
|
-
</div>
|
|
275
|
-
))}
|
|
276
|
-
|
|
277
|
-
<br style={{ clear: "both" }} />
|
|
278
|
-
|
|
279
|
-
{duration && showPart === "results" && (
|
|
280
|
-
<div
|
|
281
|
-
style={{
|
|
282
|
-
textAlign: "center",
|
|
283
|
-
fontSize: "0.7em",
|
|
284
|
-
paddingTop: "0.8em",
|
|
285
|
-
}}
|
|
286
|
-
>
|
|
287
|
-
Search took {duration.toFixed(2)} seconds
|
|
288
|
-
</div>
|
|
289
|
-
)}
|
|
290
|
-
|
|
291
|
-
{requestId && showPart === "results" && (
|
|
292
|
-
<div
|
|
293
|
-
style={{
|
|
294
|
-
textAlign: "center",
|
|
295
|
-
fontSize: "0.7em",
|
|
296
|
-
paddingTop: "0.8em",
|
|
297
|
-
}}
|
|
298
|
-
>
|
|
299
|
-
Request identifier {requestId}
|
|
300
|
-
</div>
|
|
301
|
-
)}
|
|
302
|
-
</div>
|
|
303
|
-
</section>
|
|
304
|
-
|
|
305
|
-
<Snackbar
|
|
306
|
-
open={toastOpen}
|
|
307
|
-
autoHideDuration={3000}
|
|
308
|
-
onClose={() => setToastOpen(false)}
|
|
309
|
-
>
|
|
310
|
-
<Alert onClose={() => setToastOpen(false)} severity="error">
|
|
311
|
-
{errorMessage}
|
|
312
|
-
</Alert>
|
|
313
|
-
</Snackbar>
|
|
314
|
-
</div>
|
|
315
|
-
);
|
|
316
|
-
};
|
|
317
|
-
|
|
318
|
-
export default LandingPageApp;
|
|
@@ -1,399 +0,0 @@
|
|
|
1
|
-
import { useDropzone } from "react-dropzone";
|
|
2
|
-
import {
|
|
3
|
-
makeStyles,
|
|
4
|
-
Button,
|
|
5
|
-
Card,
|
|
6
|
-
CardActions,
|
|
7
|
-
CardContent,
|
|
8
|
-
CardMedia,
|
|
9
|
-
CircularProgress,
|
|
10
|
-
Container,
|
|
11
|
-
CssBaseline,
|
|
12
|
-
Fab,
|
|
13
|
-
Grid,
|
|
14
|
-
Hidden,
|
|
15
|
-
Typography,
|
|
16
|
-
} from "@material-ui/core";
|
|
17
|
-
import { PhotoCamera, ArrowBack, Image } from "@material-ui/icons";
|
|
18
|
-
import Icon from "@material-ui/core/Icon";
|
|
19
|
-
import { NodeGroup } from "react-move";
|
|
20
|
-
import classNames from "classnames";
|
|
21
|
-
import {Capture, Preview} from "@nyris/nyris-react-components";
|
|
22
|
-
import _ from "lodash";
|
|
23
|
-
import {AppProps} from "./propsType";
|
|
24
|
-
import React from "react";
|
|
25
|
-
|
|
26
|
-
const useStyles = makeStyles((theme) => ({
|
|
27
|
-
icon: {
|
|
28
|
-
marginRight: theme.spacing(2),
|
|
29
|
-
},
|
|
30
|
-
heroContent: {
|
|
31
|
-
backgroundColor: theme.palette.background.paper,
|
|
32
|
-
padding: theme.spacing(8, 0, 6),
|
|
33
|
-
transition: "all 300ms",
|
|
34
|
-
overflow: "hidden",
|
|
35
|
-
height: 500,
|
|
36
|
-
},
|
|
37
|
-
heroContentClosed: {
|
|
38
|
-
height: 0,
|
|
39
|
-
padding: 0,
|
|
40
|
-
},
|
|
41
|
-
heroButtons: {
|
|
42
|
-
marginTop: theme.spacing(4),
|
|
43
|
-
},
|
|
44
|
-
cardGrid: {
|
|
45
|
-
paddingTop: theme.spacing(8),
|
|
46
|
-
paddingBottom: theme.spacing(8),
|
|
47
|
-
minHeight: 600,
|
|
48
|
-
overflow: "hidden",
|
|
49
|
-
transition: "all 300ms",
|
|
50
|
-
},
|
|
51
|
-
cardGridCollapsed: {
|
|
52
|
-
height: 0,
|
|
53
|
-
opacity: 0,
|
|
54
|
-
minHeight: 0,
|
|
55
|
-
paddingTop: 0,
|
|
56
|
-
paddingBottom: 0,
|
|
57
|
-
},
|
|
58
|
-
card: {
|
|
59
|
-
height: "100%",
|
|
60
|
-
display: "flex",
|
|
61
|
-
flexDirection: "column",
|
|
62
|
-
},
|
|
63
|
-
cardMedia: {
|
|
64
|
-
paddingTop: "56.25%", // 16:9
|
|
65
|
-
backgroundSize: "contain",
|
|
66
|
-
},
|
|
67
|
-
cardContent: {
|
|
68
|
-
flexGrow: 1,
|
|
69
|
-
paddingBottom: 0,
|
|
70
|
-
},
|
|
71
|
-
footer: {
|
|
72
|
-
backgroundColor: theme.palette.background.paper,
|
|
73
|
-
padding: theme.spacing(6),
|
|
74
|
-
},
|
|
75
|
-
withElipsis: {
|
|
76
|
-
textOverflow: "ellipsis",
|
|
77
|
-
overflow: "hidden",
|
|
78
|
-
whiteSpace: "nowrap",
|
|
79
|
-
},
|
|
80
|
-
loading: {
|
|
81
|
-
margin: theme.spacing(2),
|
|
82
|
-
},
|
|
83
|
-
fabContainer: {
|
|
84
|
-
position: "fixed",
|
|
85
|
-
bottom: theme.spacing(2),
|
|
86
|
-
},
|
|
87
|
-
fab: {
|
|
88
|
-
marginLeft: theme.spacing(2),
|
|
89
|
-
},
|
|
90
|
-
}));
|
|
91
|
-
|
|
92
|
-
const makeFileHandler = (action: any) => (e: any) => {
|
|
93
|
-
let file = (e.dataTransfer && e.dataTransfer.files[0]) || e.target.files[0];
|
|
94
|
-
if (e.target && e.target.value) {
|
|
95
|
-
e.target.value = "";
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
if (file) {
|
|
99
|
-
action(file);
|
|
100
|
-
}
|
|
101
|
-
};
|
|
102
|
-
|
|
103
|
-
const LandingPageAppMD = (props: AppProps) => {
|
|
104
|
-
const classes = useStyles();
|
|
105
|
-
const {
|
|
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 {
|
|
118
|
-
results,
|
|
119
|
-
regions,
|
|
120
|
-
previewSelection,
|
|
121
|
-
} = search;
|
|
122
|
-
|
|
123
|
-
const {
|
|
124
|
-
onLinkClick,
|
|
125
|
-
onFileDropped,
|
|
126
|
-
onCaptureComplete,
|
|
127
|
-
onCaptureCanceled,
|
|
128
|
-
onSelectFile,
|
|
129
|
-
onCameraClick,
|
|
130
|
-
onShowStart,
|
|
131
|
-
onSelectionChange,
|
|
132
|
-
} = handlers;
|
|
133
|
-
|
|
134
|
-
const { getRootProps, getInputProps, isDragActive } = useDropzone({
|
|
135
|
-
onDrop: (fs: File[]) => {
|
|
136
|
-
onFileDropped(fs[0]);
|
|
137
|
-
},
|
|
138
|
-
});
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
return (
|
|
142
|
-
<React.Fragment>
|
|
143
|
-
{!_.isEmpty(mdSettings?.resultLinkIcon) && (
|
|
144
|
-
<link
|
|
145
|
-
rel="stylesheet"
|
|
146
|
-
href="https://fonts.googleapis.com/icon?family=Material+Icons"
|
|
147
|
-
/>
|
|
148
|
-
)}
|
|
149
|
-
<CssBaseline />
|
|
150
|
-
{showPart === "camera" && (
|
|
151
|
-
<Capture
|
|
152
|
-
onCaptureComplete={onCaptureComplete}
|
|
153
|
-
onCaptureCanceled={onCaptureCanceled}
|
|
154
|
-
useAppText="Use default camera app"
|
|
155
|
-
/>
|
|
156
|
-
)}
|
|
157
|
-
<main>
|
|
158
|
-
<div
|
|
159
|
-
className={classNames(
|
|
160
|
-
classes.heroContent,
|
|
161
|
-
showPart === "results" ? classes.heroContentClosed : null
|
|
162
|
-
)}
|
|
163
|
-
>
|
|
164
|
-
<Container maxWidth="md">
|
|
165
|
-
<div>
|
|
166
|
-
<Hidden mdUp>
|
|
167
|
-
<div style={{ textAlign: "center" }}>
|
|
168
|
-
<PhotoCamera style={{ fontSize: "20em", color: "#cccccc" }} />
|
|
169
|
-
</div>
|
|
170
|
-
<div style={{ textAlign: "center" }}>
|
|
171
|
-
<Button
|
|
172
|
-
variant={"contained"}
|
|
173
|
-
color={"primary"}
|
|
174
|
-
onClick={onCameraClick}
|
|
175
|
-
>
|
|
176
|
-
Take a picture
|
|
177
|
-
</Button>
|
|
178
|
-
</div>
|
|
179
|
-
<div style={{ textAlign: "center" }}>
|
|
180
|
-
<Typography>or</Typography>
|
|
181
|
-
</div>
|
|
182
|
-
<div style={{ textAlign: "center" }}>
|
|
183
|
-
<input
|
|
184
|
-
accept={acceptTypes}
|
|
185
|
-
id="raised-button-file"
|
|
186
|
-
type="file"
|
|
187
|
-
onChange={makeFileHandler(onSelectFile)}
|
|
188
|
-
style={{
|
|
189
|
-
width: ".1px",
|
|
190
|
-
height: ".1px",
|
|
191
|
-
overflow: "hidden",
|
|
192
|
-
opacity: 0,
|
|
193
|
-
}}
|
|
194
|
-
/>
|
|
195
|
-
<label htmlFor="raised-button-file">
|
|
196
|
-
<Button
|
|
197
|
-
variant={"contained"}
|
|
198
|
-
color={"primary"}
|
|
199
|
-
component="span"
|
|
200
|
-
>
|
|
201
|
-
Select a file
|
|
202
|
-
</Button>
|
|
203
|
-
</label>
|
|
204
|
-
</div>
|
|
205
|
-
</Hidden>
|
|
206
|
-
<Hidden smDown>
|
|
207
|
-
<div
|
|
208
|
-
style={{
|
|
209
|
-
borderStyle: "dashed",
|
|
210
|
-
borderWidth: 5,
|
|
211
|
-
borderColor: isDragActive ? "#ccc" : "#eee",
|
|
212
|
-
borderRadius: 10,
|
|
213
|
-
padding: 10,
|
|
214
|
-
paddingBottom: 30,
|
|
215
|
-
}}
|
|
216
|
-
{...getRootProps({
|
|
217
|
-
onClick: (e) => {
|
|
218
|
-
e.stopPropagation();
|
|
219
|
-
},
|
|
220
|
-
})}
|
|
221
|
-
>
|
|
222
|
-
<div style={{ textAlign: "center" }}>
|
|
223
|
-
<Image style={{ fontSize: "20em", color: "#cccccc" }} />
|
|
224
|
-
</div>
|
|
225
|
-
<div style={{ textAlign: "center" }}>
|
|
226
|
-
<Typography variant="body2">DROP AN IMAGE</Typography>
|
|
227
|
-
</div>
|
|
228
|
-
<div style={{ textAlign: "center" }}>
|
|
229
|
-
<Typography variant="subtitle2">or</Typography>
|
|
230
|
-
</div>
|
|
231
|
-
<div style={{ textAlign: "center" }}>
|
|
232
|
-
<input
|
|
233
|
-
accept={acceptTypes}
|
|
234
|
-
id="raised-button-file"
|
|
235
|
-
type="file"
|
|
236
|
-
{...getInputProps()}
|
|
237
|
-
onChange={makeFileHandler(onSelectFile)}
|
|
238
|
-
style={{
|
|
239
|
-
width: ".1px",
|
|
240
|
-
height: ".1px",
|
|
241
|
-
overflow: "hidden",
|
|
242
|
-
opacity: 0,
|
|
243
|
-
}}
|
|
244
|
-
/>
|
|
245
|
-
<label htmlFor="raised-button-file">
|
|
246
|
-
<Button
|
|
247
|
-
variant={"contained"}
|
|
248
|
-
color={"primary"}
|
|
249
|
-
component="span"
|
|
250
|
-
>
|
|
251
|
-
Select an image
|
|
252
|
-
</Button>
|
|
253
|
-
</label>
|
|
254
|
-
</div>
|
|
255
|
-
</div>
|
|
256
|
-
</Hidden>
|
|
257
|
-
</div>
|
|
258
|
-
</Container>
|
|
259
|
-
</div>
|
|
260
|
-
<Container
|
|
261
|
-
className={classNames(
|
|
262
|
-
classes.cardGrid,
|
|
263
|
-
showPart !== "results" && classes.cardGridCollapsed
|
|
264
|
-
)}
|
|
265
|
-
maxWidth="md"
|
|
266
|
-
>
|
|
267
|
-
{previewImage && (
|
|
268
|
-
<Card style={{ marginBottom: "4em" }} raised={true}>
|
|
269
|
-
<Preview
|
|
270
|
-
key={previewImage?.id}
|
|
271
|
-
onSelectionChange={onSelectionChange}
|
|
272
|
-
image={previewImage?.canvas}
|
|
273
|
-
selection={previewSelection}
|
|
274
|
-
regions={regions}
|
|
275
|
-
maxWidth={400}
|
|
276
|
-
maxHeight={500}
|
|
277
|
-
dotColor="#FBD914"
|
|
278
|
-
/>
|
|
279
|
-
</Card>
|
|
280
|
-
)}
|
|
281
|
-
|
|
282
|
-
{loading && (
|
|
283
|
-
<div style={{ textAlign: "center" }}>
|
|
284
|
-
<CircularProgress className={classes.loading} />
|
|
285
|
-
</div>
|
|
286
|
-
)}
|
|
287
|
-
|
|
288
|
-
<Grid container spacing={4}>
|
|
289
|
-
<NodeGroup
|
|
290
|
-
data={results}
|
|
291
|
-
keyAccessor={(r) => r.position + r.sku}
|
|
292
|
-
start={(r, i) => ({ opacity: 0, translateX: -100 })}
|
|
293
|
-
enter={(r, i) => ({
|
|
294
|
-
opacity: [1],
|
|
295
|
-
translateX: [0],
|
|
296
|
-
timing: { delay: i * 100, duration: 300 },
|
|
297
|
-
})}
|
|
298
|
-
>
|
|
299
|
-
{(rs) => (
|
|
300
|
-
<>
|
|
301
|
-
{rs.map(({ key, data: result, state }) => (
|
|
302
|
-
<Grid item key={key} xs={12} sm={4} md={3}>
|
|
303
|
-
<Card
|
|
304
|
-
className={classes.card}
|
|
305
|
-
style={{
|
|
306
|
-
opacity: state.opacity,
|
|
307
|
-
position: "relative",
|
|
308
|
-
transform: `translateX(${state.translateX}%)`,
|
|
309
|
-
}}
|
|
310
|
-
>
|
|
311
|
-
<CardMedia
|
|
312
|
-
className={classes.cardMedia}
|
|
313
|
-
image={
|
|
314
|
-
(result.img && result.img.url) ||
|
|
315
|
-
settings.noImageUrl
|
|
316
|
-
}
|
|
317
|
-
title={result.title}
|
|
318
|
-
/>
|
|
319
|
-
<CardContent className={classes.cardContent}>
|
|
320
|
-
<Typography
|
|
321
|
-
gutterBottom
|
|
322
|
-
variant="subtitle2"
|
|
323
|
-
component="h5"
|
|
324
|
-
className={classes.withElipsis}
|
|
325
|
-
>
|
|
326
|
-
{result[mdSettings?.resultFirstRowProperty!!]}
|
|
327
|
-
</Typography>
|
|
328
|
-
<Typography
|
|
329
|
-
variant="body2"
|
|
330
|
-
className={classes.withElipsis}
|
|
331
|
-
>
|
|
332
|
-
{result[mdSettings?.resultSecondRowProperty!!]}
|
|
333
|
-
</Typography>
|
|
334
|
-
</CardContent>
|
|
335
|
-
{result.l && (
|
|
336
|
-
<CardActions>
|
|
337
|
-
<Button
|
|
338
|
-
variant="outlined"
|
|
339
|
-
style={{ marginLeft: "auto" }}
|
|
340
|
-
size="small"
|
|
341
|
-
color="primary"
|
|
342
|
-
onClick={
|
|
343
|
-
() => {
|
|
344
|
-
onLinkClick(
|
|
345
|
-
result.position,
|
|
346
|
-
result.l
|
|
347
|
-
);
|
|
348
|
-
}
|
|
349
|
-
}
|
|
350
|
-
onAuxClick={() => {
|
|
351
|
-
onLinkClick(
|
|
352
|
-
result.position,
|
|
353
|
-
result.l
|
|
354
|
-
);
|
|
355
|
-
}}
|
|
356
|
-
>
|
|
357
|
-
{mdSettings?.resultLinkIcon && (
|
|
358
|
-
<React.Fragment>
|
|
359
|
-
<Icon>{mdSettings.resultLinkIcon}</Icon>{" "}
|
|
360
|
-
</React.Fragment>
|
|
361
|
-
)}
|
|
362
|
-
{mdSettings?.resultLinkText}
|
|
363
|
-
</Button>
|
|
364
|
-
</CardActions>
|
|
365
|
-
)}
|
|
366
|
-
</Card>
|
|
367
|
-
</Grid>
|
|
368
|
-
))}
|
|
369
|
-
</>
|
|
370
|
-
)}
|
|
371
|
-
</NodeGroup>
|
|
372
|
-
</Grid>
|
|
373
|
-
|
|
374
|
-
{results.length === 0 && showPart === "results" && !loading && (
|
|
375
|
-
<Typography variant="h3" align="center">
|
|
376
|
-
We did not find anything
|
|
377
|
-
</Typography>
|
|
378
|
-
)}
|
|
379
|
-
</Container>
|
|
380
|
-
{showPart !== "start" && (
|
|
381
|
-
<Container maxWidth="lg">
|
|
382
|
-
<div className={classes.fabContainer}>
|
|
383
|
-
<Fab
|
|
384
|
-
aria-label="back"
|
|
385
|
-
className={classes.fab}
|
|
386
|
-
color="primary"
|
|
387
|
-
onClick={onShowStart}
|
|
388
|
-
>
|
|
389
|
-
<ArrowBack />
|
|
390
|
-
</Fab>
|
|
391
|
-
</div>
|
|
392
|
-
</Container>
|
|
393
|
-
)}
|
|
394
|
-
</main>
|
|
395
|
-
</React.Fragment>
|
|
396
|
-
);
|
|
397
|
-
};
|
|
398
|
-
|
|
399
|
-
export default LandingPageAppMD;
|