@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
|
@@ -1,210 +1,137 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import {
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {OfferNyrisResult as ResultData} from "@nyris/nyris-api";
|
|
3
3
|
|
|
4
4
|
// TODO this needs refactoring: Make it one block with parameters for first line, second line, image url ..
|
|
5
5
|
|
|
6
6
|
interface Options {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
result: any,
|
|
8
|
+
noImageUrl: string,
|
|
9
|
+
onImageClick: (e: React.MouseEvent) => void,
|
|
10
|
+
onLinkClick: (e: React.MouseEvent) => void
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
const renderPrice = (result: ResultData) =>
|
|
14
|
-
|
|
14
|
+
result.p ? '' + (result.p.vi / 100).toFixed(2) + ' ' + result.p.c : '';
|
|
15
15
|
|
|
16
|
-
const renderDefault = ({
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
<div className="prdctDetailsWrap">
|
|
41
|
-
<div>
|
|
42
|
-
<div className="prdctTitle">{result.title}</div>
|
|
43
|
-
<div className="prdctMeta">
|
|
44
|
-
<span className="prdctPrice">{renderPrice(result)}</span>
|
|
45
|
-
</div>
|
|
46
|
-
<a
|
|
47
|
-
onClick={onLinkClick}
|
|
48
|
-
onAuxClick={onLinkClick}
|
|
49
|
-
className="prdctShopLink"
|
|
50
|
-
href={result.l}
|
|
51
|
-
target="_blank"
|
|
52
|
-
rel="noopener noreferrer"
|
|
53
|
-
>
|
|
54
|
-
Buy Now
|
|
55
|
-
</a>
|
|
56
|
-
</div>
|
|
57
|
-
</div>
|
|
58
|
-
</>
|
|
59
|
-
);
|
|
16
|
+
const renderDefault = ({result, noImageUrl, onImageClick, onLinkClick}: Options) => {
|
|
17
|
+
return (
|
|
18
|
+
<>
|
|
19
|
+
<a href={result.l} className="imageLink" title="Click the image so see similar products"
|
|
20
|
+
onClick={onImageClick}
|
|
21
|
+
onAuxClick={onLinkClick}>
|
|
22
|
+
<div className="prdctImg">
|
|
23
|
+
<div className="imgWrap">
|
|
24
|
+
<img src={(result.img && result.img.url + '?r=512x512') || noImageUrl} alt={result.title}/>
|
|
25
|
+
</div>
|
|
26
|
+
</div>
|
|
27
|
+
</a>
|
|
28
|
+
<div className="prdctDetailsWrap">
|
|
29
|
+
<div>
|
|
30
|
+
<div className="prdctTitle">{result.title}</div>
|
|
31
|
+
<div className="prdctMeta">
|
|
32
|
+
<span className="prdctPrice">{renderPrice(result)}</span>
|
|
33
|
+
</div>
|
|
34
|
+
<a onClick={onLinkClick} onAuxClick={onLinkClick} className="prdctShopLink" href={result.l}
|
|
35
|
+
target="_blank" rel="noopener noreferrer">Buy Now</a>
|
|
36
|
+
</div>
|
|
37
|
+
</div>
|
|
38
|
+
</>
|
|
39
|
+
);
|
|
60
40
|
};
|
|
61
41
|
|
|
62
|
-
const renderSnr = ({
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
href={result.l}
|
|
71
|
-
className="imageLink"
|
|
72
|
-
onClick={onImageClick}
|
|
73
|
-
onAuxClick={onLinkClick}
|
|
74
|
-
>
|
|
75
|
-
<div className="prdctImg">
|
|
76
|
-
<div className="imgWrap">
|
|
77
|
-
<img
|
|
78
|
-
src={(result.img && result.img.url + "?r=512x512") || noImageUrl}
|
|
79
|
-
alt={result.title}
|
|
80
|
-
/>
|
|
81
|
-
</div>
|
|
82
|
-
</div>
|
|
83
|
-
</a>
|
|
84
|
-
<div className="prdctDetailsWrap">
|
|
85
|
-
<div>
|
|
86
|
-
<div className="prdctTitle">{result.sku}</div>
|
|
87
|
-
<div
|
|
88
|
-
className="prdctMeta"
|
|
89
|
-
style={{ height: "5em", whiteSpace: "normal" }}
|
|
90
|
-
>
|
|
91
|
-
{result.title}
|
|
92
|
-
</div>
|
|
93
|
-
<a
|
|
94
|
-
style={{ backgroundImage: "none", paddingLeft: "10px" }}
|
|
95
|
-
className="prdctShopLink"
|
|
96
|
-
href={result.l}
|
|
97
|
-
target="_blank"
|
|
98
|
-
rel="noopener noreferrer"
|
|
99
|
-
onClick={onLinkClick}
|
|
100
|
-
onAuxClick={onLinkClick}
|
|
101
|
-
>
|
|
102
|
-
Info
|
|
42
|
+
const renderSnr = ({result, noImageUrl, onImageClick, onLinkClick}: Options) => (
|
|
43
|
+
<>
|
|
44
|
+
<a href={result.l} className="imageLink" onClick={onImageClick} onAuxClick={onLinkClick}>
|
|
45
|
+
<div className="prdctImg">
|
|
46
|
+
<div className="imgWrap">
|
|
47
|
+
<img src={(result.img && result.img.url + '?r=512x512') || noImageUrl} alt={result.title}/>
|
|
48
|
+
</div>
|
|
49
|
+
</div>
|
|
103
50
|
</a>
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
51
|
+
<div className="prdctDetailsWrap">
|
|
52
|
+
<div>
|
|
53
|
+
<div className="prdctTitle">{result.sku}</div>
|
|
54
|
+
<div className="prdctMeta" style={{height: '5em', whiteSpace: 'normal'}}>
|
|
55
|
+
{result.title}
|
|
56
|
+
</div>
|
|
57
|
+
<a style={{backgroundImage: 'none', paddingLeft: '10px'}} className="prdctShopLink" href={result.l}
|
|
58
|
+
target="_blank" rel="noopener noreferrer"
|
|
59
|
+
onClick={onLinkClick} onAuxClick={onLinkClick}>Info</a>
|
|
60
|
+
</div>
|
|
61
|
+
</div>
|
|
62
|
+
</>
|
|
107
63
|
);
|
|
108
64
|
|
|
109
|
-
const renderSnrMultilink = (
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
<div
|
|
133
|
-
className="prdctMeta"
|
|
134
|
-
style={{ height: "5em", whiteSpace: "normal" }}
|
|
135
|
-
>
|
|
136
|
-
{result.title}
|
|
65
|
+
const renderSnrMultilink = ({result, noImageUrl, onImageClick}: Options, onLinkClick: (url: string) => void) => (
|
|
66
|
+
<>
|
|
67
|
+
<a href={result.l} className="imageLink"
|
|
68
|
+
onClick={onImageClick} onAuxClick={onImageClick}>
|
|
69
|
+
<div className="prdctImg">
|
|
70
|
+
<div className="imgWrap">
|
|
71
|
+
<img src={(result.img && result.img.url + '?r=512x512') || noImageUrl} alt={result.title}/>
|
|
72
|
+
</div>
|
|
73
|
+
</div>
|
|
74
|
+
</a>
|
|
75
|
+
<div className="prdctDetailsWrap">
|
|
76
|
+
<div>
|
|
77
|
+
<div className="prdctTitle">{result.sku}</div>
|
|
78
|
+
<div className="prdctMeta" style={{height: '5em', whiteSpace: 'normal'}}>
|
|
79
|
+
{result.title}
|
|
80
|
+
</div>
|
|
81
|
+
{result.l.map((l: { text: string, href: string }) =>
|
|
82
|
+
<a style={{backgroundImage: 'none', paddingLeft: '10px'}} className="prdctShopLink" href={l.href}
|
|
83
|
+
onClick={() => onLinkClick(l.href)} onAuxClick={() => onLinkClick(l.href)} target="_blank"
|
|
84
|
+
key={l.href}
|
|
85
|
+
rel="noopener noreferrer">{l.text}</a>
|
|
86
|
+
)}
|
|
87
|
+
</div>
|
|
137
88
|
</div>
|
|
138
|
-
|
|
139
|
-
<a
|
|
140
|
-
style={{ backgroundImage: "none", paddingLeft: "10px" }}
|
|
141
|
-
className="prdctShopLink"
|
|
142
|
-
href={l.href}
|
|
143
|
-
onClick={() => onLinkClick(l.href)}
|
|
144
|
-
onAuxClick={() => onLinkClick(l.href)}
|
|
145
|
-
target="_blank"
|
|
146
|
-
key={l.href}
|
|
147
|
-
rel="noopener noreferrer"
|
|
148
|
-
>
|
|
149
|
-
{l.text}
|
|
150
|
-
</a>
|
|
151
|
-
))}
|
|
152
|
-
</div>
|
|
153
|
-
</div>
|
|
154
|
-
</>
|
|
89
|
+
</>
|
|
155
90
|
);
|
|
156
91
|
|
|
157
92
|
export interface ResultProps {
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
93
|
+
result: any,
|
|
94
|
+
style: any,
|
|
95
|
+
template?: string,
|
|
96
|
+
onImageClick: (pos: number, url: string) => void,
|
|
97
|
+
onLinkClick: (pos: number, url: string) => void,
|
|
98
|
+
noImageUrl?: string
|
|
164
99
|
}
|
|
165
100
|
|
|
166
|
-
const Result: React.FC<ResultProps> = ({
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
}
|
|
179
|
-
onLinkClick: (e: React.MouseEvent) => {
|
|
180
|
-
e.preventDefault();
|
|
181
|
-
onLinkClick(result.position, result.l);
|
|
182
|
-
},
|
|
183
|
-
noImageUrl: noImageUrl || "images/ic_cam_large_noimage.png",
|
|
184
|
-
result,
|
|
185
|
-
};
|
|
101
|
+
const Result: React.FC<ResultProps> = ({result, style, template, onImageClick, onLinkClick, noImageUrl}) => {
|
|
102
|
+
let options: Options = {
|
|
103
|
+
onImageClick: (e: React.MouseEvent) => {
|
|
104
|
+
e.preventDefault();
|
|
105
|
+
onImageClick(result.position, result.img.url);
|
|
106
|
+
},
|
|
107
|
+
onLinkClick: (e: React.MouseEvent) => {
|
|
108
|
+
e.preventDefault();
|
|
109
|
+
onLinkClick(result.position, result.l);
|
|
110
|
+
},
|
|
111
|
+
noImageUrl: noImageUrl || 'images/ic_cam_large_noimage.png',
|
|
112
|
+
result
|
|
113
|
+
};
|
|
186
114
|
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
break;
|
|
201
|
-
}
|
|
115
|
+
let resultInner = null;
|
|
116
|
+
switch (template) {
|
|
117
|
+
case "snr":
|
|
118
|
+
resultInner = renderSnr(options);
|
|
119
|
+
break;
|
|
120
|
+
case "snr-multilink":
|
|
121
|
+
resultInner = renderSnrMultilink(options, (url) => onLinkClick(result.position, url));
|
|
122
|
+
break;
|
|
123
|
+
case 'default':
|
|
124
|
+
default:
|
|
125
|
+
resultInner = renderDefault(options);
|
|
126
|
+
break;
|
|
127
|
+
}
|
|
202
128
|
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
129
|
+
return (
|
|
130
|
+
<div className="prdctItem" style={{...style}}>
|
|
131
|
+
{resultInner}
|
|
132
|
+
</div>
|
|
133
|
+
);
|
|
208
134
|
};
|
|
209
135
|
|
|
136
|
+
|
|
210
137
|
export default Result;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import {RiMenuLine} from 'react-icons/ri';
|
|
3
|
+
import { Filter } from '../../../nyris-api/index';
|
|
4
|
+
import FiltersList from './FiltersList';
|
|
5
|
+
|
|
6
|
+
interface SidebarProps {
|
|
7
|
+
filters: Filter[]
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
const Sidebar: React.FC<SidebarProps> = ({filters}) =>{
|
|
11
|
+
const [isExpanded, setIsExpanded] = useState(false);
|
|
12
|
+
const handleToggler =()=>{
|
|
13
|
+
if(isExpanded){
|
|
14
|
+
setIsExpanded(false);
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
setIsExpanded(true);
|
|
18
|
+
}
|
|
19
|
+
return (
|
|
20
|
+
|
|
21
|
+
<div className={isExpanded ? "sidebar" : "Sidebar collapsed"}>
|
|
22
|
+
<div className="sidebarContent" >
|
|
23
|
+
<div className="sidebarHeader">
|
|
24
|
+
<RiMenuLine className="sidebar-icon" onClick={handleToggler}/>
|
|
25
|
+
<h1 className={isExpanded ? "sidebar-logo" : "sidebar-logo collapsedHide"}> Select Filters </h1>
|
|
26
|
+
</div>
|
|
27
|
+
<div className={isExpanded ? "Sidebar-items" : "Sidebar-items collapsedHide"}>
|
|
28
|
+
{filters && filters.map((x) => {
|
|
29
|
+
return <FiltersList filter={x}/>
|
|
30
|
+
})
|
|
31
|
+
}
|
|
32
|
+
</div>
|
|
33
|
+
</div>
|
|
34
|
+
</div>
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
)
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export default Sidebar
|
package/src/defaults.ts
CHANGED
|
@@ -17,10 +17,7 @@ export const defaultSettings : AppSettings = {
|
|
|
17
17
|
'^https?://(www.)?vimeo.com/',
|
|
18
18
|
'^https?://(www.)?dailymotion.com/',
|
|
19
19
|
'^https?://(www.)?dai.ly/'
|
|
20
|
-
]
|
|
21
|
-
themePage: {
|
|
22
|
-
default: { active: true }
|
|
23
|
-
}
|
|
20
|
+
]
|
|
24
21
|
};
|
|
25
22
|
|
|
26
23
|
export const defaultMdSettings = {
|
|
@@ -30,8 +27,10 @@ export const defaultMdSettings = {
|
|
|
30
27
|
appBarTitle: '',
|
|
31
28
|
primaryColor: '#e2001a',
|
|
32
29
|
secondaryColor: '#777777',
|
|
30
|
+
|
|
33
31
|
resultFirstRowProperty: 'title',
|
|
34
32
|
resultSecondRowProperty: 'sku',
|
|
35
33
|
resultLinkText: 'Info',
|
|
34
|
+
|
|
36
35
|
customFontFamily: 'Helvetica',
|
|
37
36
|
};
|
|
File without changes
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import {combineEpics, ofType} from "redux-observable";
|
|
2
|
+
import {debounceTime, delay, ignoreElements, map, switchMap, tap, withLatestFrom} from "rxjs/operators";
|
|
3
|
+
import {showFeedback, showResults} from "../actions/nyrisAppActions";
|
|
4
|
+
import {EpicConf} from "./types";
|
|
5
|
+
import feedbackEpics from "./feedback";
|
|
6
|
+
import searchEpics from "./search";
|
|
7
|
+
import {searchOffersForImage, searchOffersForCad, searchRegions} from "../actions/searchActions";
|
|
8
|
+
import {AppAction} from "../types";
|
|
9
|
+
import {selectFirstCenteredRegion} from "@nyris/nyris-api";
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
const historyEpic: EpicConf = (action$, state$, {history}) => action$.pipe(
|
|
14
|
+
ofType('SHOW_RESULTS', 'SHOW_START'),
|
|
15
|
+
withLatestFrom(state$),
|
|
16
|
+
tap(([action, state]) => {
|
|
17
|
+
let { type } = action;
|
|
18
|
+
console.log("action");
|
|
19
|
+
console.log(state.search.selectedFilters);
|
|
20
|
+
// action to clear all filters
|
|
21
|
+
if (type === 'SHOW_RESULTS' && history.location.pathname !== '/results') {
|
|
22
|
+
history.push('/results');
|
|
23
|
+
}
|
|
24
|
+
if (type === 'SHOW_START' && history.location.pathname !== '/') {
|
|
25
|
+
|
|
26
|
+
history.goBack();
|
|
27
|
+
}
|
|
28
|
+
}),
|
|
29
|
+
ignoreElements()
|
|
30
|
+
);
|
|
31
|
+
|
|
32
|
+
const onSearchSuccessShowResults: EpicConf = (action$) => action$.pipe(
|
|
33
|
+
ofType('SEARCH_REQUEST_SUCCEED'),
|
|
34
|
+
map(showResults)
|
|
35
|
+
);
|
|
36
|
+
|
|
37
|
+
const onSearchSuccessRedirectToSite: EpicConf = (action$, state$) => action$.pipe(
|
|
38
|
+
ofType('SEARCH_REQUEST_SUCCEED'),
|
|
39
|
+
withLatestFrom(state$),
|
|
40
|
+
tap(([action, {settings}]) => {
|
|
41
|
+
if (action.type !== 'SEARCH_REQUEST_SUCCEED' || !action.results || action.results.length !== 1) {
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
const firstLink = action.results[0].l;
|
|
46
|
+
const instantRedirectPatterns = settings.instantRedirectPatterns;
|
|
47
|
+
if (!instantRedirectPatterns.find(r => new RegExp(r).test(firstLink))) {
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
window.location.href = firstLink;
|
|
51
|
+
}),
|
|
52
|
+
ignoreElements()
|
|
53
|
+
);
|
|
54
|
+
|
|
55
|
+
const onSearchSuccessShowFeedbackDelayed: EpicConf = (action$) => action$.pipe(
|
|
56
|
+
ofType('SEARCH_REQUEST_SUCCEED'),
|
|
57
|
+
delay(3000),
|
|
58
|
+
map(showFeedback)
|
|
59
|
+
);
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
const startSearchOnImageLoaded: EpicConf = (action$, state$) => action$.pipe(
|
|
63
|
+
ofType('IMAGE_LOADED'),
|
|
64
|
+
withLatestFrom(state$),
|
|
65
|
+
switchMap(async ([action, {settings}]) : Promise<AppAction> => {
|
|
66
|
+
if (action.type !== 'IMAGE_LOADED') {
|
|
67
|
+
throw new Error(`Wrong action type ${action.type}`);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
let { image } = action;
|
|
71
|
+
|
|
72
|
+
if (settings.regions) {
|
|
73
|
+
return searchRegions(image.canvas);
|
|
74
|
+
}
|
|
75
|
+
return searchOffersForImage(image.canvas);
|
|
76
|
+
})
|
|
77
|
+
);
|
|
78
|
+
|
|
79
|
+
const startSearchOnCadLoaded: EpicConf = (action$, state$) => action$.pipe(
|
|
80
|
+
ofType('CAD_LOADED'),
|
|
81
|
+
withLatestFrom(state$),
|
|
82
|
+
switchMap(async ([action, {settings}]) : Promise<AppAction> => {
|
|
83
|
+
if (action.type !== 'CAD_LOADED') {
|
|
84
|
+
throw new Error(`Wrong action type ${action.type}`);
|
|
85
|
+
}
|
|
86
|
+
let { file } = action;
|
|
87
|
+
return searchOffersForCad(file);
|
|
88
|
+
})
|
|
89
|
+
);
|
|
90
|
+
|
|
91
|
+
const startSearchOnRegionsSuccessful: EpicConf = (action$, state$) => action$.pipe(
|
|
92
|
+
ofType('REGION_REQUEST_SUCCEED'),
|
|
93
|
+
withLatestFrom(state$),
|
|
94
|
+
switchMap(async ([action, { search: { requestImage}}]) : Promise<AppAction> => {
|
|
95
|
+
if (action.type !== 'REGION_REQUEST_SUCCEED') {
|
|
96
|
+
throw new Error(`Wrong action type ${action.type}`);
|
|
97
|
+
}
|
|
98
|
+
if (!requestImage) {
|
|
99
|
+
throw new Error(`No requestImage`);
|
|
100
|
+
}
|
|
101
|
+
let { regions } = action;
|
|
102
|
+
|
|
103
|
+
let selection = selectFirstCenteredRegion(regions, 0.3, {x1: 0, x2: 1, y1: 0, y2: 1});
|
|
104
|
+
return searchOffersForImage(requestImage.canvas, selection);
|
|
105
|
+
})
|
|
106
|
+
);
|
|
107
|
+
|
|
108
|
+
const startSearchOnRegionsFailed: EpicConf = (action$, state$) => action$.pipe(
|
|
109
|
+
ofType('REGION_REQUEST_FAIL'),
|
|
110
|
+
withLatestFrom(state$),
|
|
111
|
+
switchMap(async ([action, { search: { requestImage}}]) : Promise<AppAction> => {
|
|
112
|
+
if (action.type !== 'REGION_REQUEST_FAIL') {
|
|
113
|
+
throw new Error(`Wrong action type ${action.type}`);
|
|
114
|
+
}
|
|
115
|
+
if (!requestImage) {
|
|
116
|
+
throw new Error(`No requestImage`);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
return searchOffersForImage(requestImage.canvas);
|
|
120
|
+
})
|
|
121
|
+
);
|
|
122
|
+
|
|
123
|
+
const startSearchOnRegionChange: EpicConf = (action$, state$) => action$.pipe(
|
|
124
|
+
ofType('REGION_CHANGED'),
|
|
125
|
+
debounceTime(1200),
|
|
126
|
+
withLatestFrom(state$),
|
|
127
|
+
switchMap(async ([action, { search: { requestImage}}]) : Promise<AppAction> => {
|
|
128
|
+
if (action.type !== 'REGION_CHANGED') {
|
|
129
|
+
throw new Error(`Wrong action type ${action.type}`);
|
|
130
|
+
}
|
|
131
|
+
if (!requestImage) {
|
|
132
|
+
throw new Error(`No requestImage`);
|
|
133
|
+
}
|
|
134
|
+
let { normalizedRect } = action;
|
|
135
|
+
return searchOffersForImage(requestImage.canvas, normalizedRect);
|
|
136
|
+
})
|
|
137
|
+
);
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
const rootEpic = combineEpics(
|
|
141
|
+
searchEpics,
|
|
142
|
+
feedbackEpics,
|
|
143
|
+
historyEpic,
|
|
144
|
+
startSearchOnImageLoaded,
|
|
145
|
+
startSearchOnCadLoaded,
|
|
146
|
+
startSearchOnRegionsSuccessful,
|
|
147
|
+
startSearchOnRegionsFailed,
|
|
148
|
+
startSearchOnRegionChange,
|
|
149
|
+
onSearchSuccessShowResults,
|
|
150
|
+
onSearchSuccessShowFeedbackDelayed,
|
|
151
|
+
onSearchSuccessRedirectToSite
|
|
152
|
+
);
|
|
153
|
+
|
|
154
|
+
export default rootEpic;
|