@nyris/nyris-webapp 0.2.4 → 0.3.1

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.
Files changed (199) hide show
  1. package/build/asset-manifest.json +32 -18
  2. package/build/index.html +1 -1
  3. package/build/js/test.js +62 -0
  4. package/build/{precache-manifest.211a3df6baece8bbe3672765faa0d629.js → precache-manifest.3e7aa489925304848e8f04e3015d8567.js} +89 -13
  5. package/build/service-worker.js +1 -1
  6. package/build/static/css/2.8285176a.chunk.css +2 -0
  7. package/build/static/css/2.8285176a.chunk.css.map +1 -0
  8. package/build/static/css/main.b731b101.chunk.css +2 -0
  9. package/build/static/css/main.b731b101.chunk.css.map +1 -0
  10. package/build/static/js/2.8297cb74.chunk.js +3 -0
  11. package/build/static/js/2.8297cb74.chunk.js.LICENSE.txt +133 -0
  12. package/build/static/js/2.8297cb74.chunk.js.map +1 -0
  13. package/build/static/js/main.05909665.chunk.js +2 -0
  14. package/build/static/js/main.05909665.chunk.js.map +1 -0
  15. package/build/static/js/{runtime-main.f5553a9b.js → runtime-main.b418ff16.js} +1 -1
  16. package/build/static/js/{runtime-main.f5553a9b.js.map → runtime-main.b418ff16.js.map} +1 -1
  17. package/build/static/media/Fill.37094b44.svg +3 -0
  18. package/build/static/media/Montserrat-Bold.5a052e98.otf +0 -0
  19. package/build/static/media/Montserrat-Light.21789e89.otf +0 -0
  20. package/build/static/media/Montserrat-Medium.a53e0373.otf +0 -0
  21. package/build/static/media/Montserrat-Regular.71cdc681.otf +0 -0
  22. package/build/static/media/Montserrat-SemiBold.f613d915.otf +0 -0
  23. package/build/static/media/Rectangle.4dd8b747.png +0 -0
  24. package/build/static/media/admin.9529c7f6.svg +3 -0
  25. package/build/static/media/bg-support-page.6ac55268.svg +9 -0
  26. package/build/static/media/book_mark.8e294c0b.svg +3 -0
  27. package/build/static/media/icon_dislike.94607ca6.svg +3 -0
  28. package/build/static/media/icon_like.a4fb1b18.svg +3 -0
  29. package/build/static/media/icon_modal_image.3068d0ea.svg +21 -0
  30. package/build/static/media/icon_search_image.c2c728c0.svg +3 -0
  31. package/build/static/media/nyris_logo.22d8f250.svg +3 -0
  32. package/build/static/media/reload_icon.4b579a74.svg +3 -0
  33. package/build/static/media/save_search.bebaeebf.svg +3 -0
  34. package/build/static/media/support.289c3a3c.svg +3 -0
  35. package/build/static/media/translate_icon.f0492297.svg +3 -0
  36. package/package.json +31 -6
  37. package/public/js/test.js +62 -0
  38. package/src/App.css +27 -11
  39. package/src/App.tsx +19 -217
  40. package/src/Router.tsx +97 -0
  41. package/src/Store/Auth.ts +44 -0
  42. package/src/Store/Nyris.ts +77 -0
  43. package/src/Store/Search.ts +269 -0
  44. package/src/Store/Store.ts +46 -0
  45. package/src/Store/common.d.ts +10 -0
  46. package/src/{epics → Store/epics}/feedback.ts +0 -0
  47. package/src/{epics → Store/epics}/types.ts +1 -1
  48. package/src/common/assets/fonts/Montserrat_OTF/Montserrat-Bold.otf +0 -0
  49. package/src/common/assets/fonts/Montserrat_OTF/Montserrat-Light.otf +0 -0
  50. package/src/common/assets/fonts/Montserrat_OTF/Montserrat-Medium.otf +0 -0
  51. package/src/common/assets/fonts/Montserrat_OTF/Montserrat-Regular.otf +0 -0
  52. package/src/common/assets/fonts/Montserrat_OTF/Montserrat-SemiBold.otf +0 -0
  53. package/src/{fonts → common/assets/fonts}/roboto-bold-webfont.woff +0 -0
  54. package/src/{fonts → common/assets/fonts}/roboto-bold-webfont.woff2 +0 -0
  55. package/src/{fonts → common/assets/fonts}/roboto-italic-webfont.woff +0 -0
  56. package/src/{fonts → common/assets/fonts}/roboto-italic-webfont.woff2 +0 -0
  57. package/src/{fonts → common/assets/fonts}/roboto-regular-webfont.woff +0 -0
  58. package/src/{fonts → common/assets/fonts}/roboto-regular-webfont.woff2 +0 -0
  59. package/src/{fonts → common/assets/fonts}/robotocondensed-bold-webfont.woff +0 -0
  60. package/src/{fonts → common/assets/fonts}/robotocondensed-bold-webfont.woff2 +0 -0
  61. package/src/{fonts → common/assets/fonts}/robotocondensed-bolditalic-webfont.woff +0 -0
  62. package/src/{fonts → common/assets/fonts}/robotocondensed-bolditalic-webfont.woff2 +0 -0
  63. package/src/common/assets/icons/Fill.png +0 -0
  64. package/src/common/assets/icons/Fill.svg +3 -0
  65. package/src/common/assets/icons/Icon_wechat.png +0 -0
  66. package/src/common/assets/icons/Icon_whatsapp.png +0 -0
  67. package/src/common/assets/icons/admin.png +0 -0
  68. package/src/common/assets/icons/admin.svg +3 -0
  69. package/src/common/assets/icons/book_mark.png +0 -0
  70. package/src/common/assets/icons/book_mark.svg +3 -0
  71. package/src/common/assets/icons/icon_barcode.png +0 -0
  72. package/src/common/assets/icons/icon_camera.png +0 -0
  73. package/src/common/assets/icons/icon_dislike.svg +3 -0
  74. package/src/common/assets/icons/icon_disslike.png +0 -0
  75. package/src/common/assets/icons/icon_email.png +0 -0
  76. package/src/common/assets/icons/icon_like.png +0 -0
  77. package/src/common/assets/icons/icon_like.svg +3 -0
  78. package/src/common/assets/icons/icon_modal_image.png +0 -0
  79. package/src/common/assets/icons/icon_modal_image.svg +21 -0
  80. package/src/common/assets/icons/icon_picture.png +0 -0
  81. package/src/common/assets/icons/icon_search_image.png +0 -0
  82. package/src/common/assets/icons/icon_search_image.svg +3 -0
  83. package/src/common/assets/icons/nyris_logo.svg +3 -0
  84. package/src/common/assets/icons/reload_icon.png +0 -0
  85. package/src/common/assets/icons/reload_icon.svg +3 -0
  86. package/src/common/assets/icons/save_search.png +0 -0
  87. package/src/common/assets/icons/save_search.svg +3 -0
  88. package/src/common/assets/icons/setting_search_icon.png +0 -0
  89. package/src/common/assets/icons/support.png +0 -0
  90. package/src/common/assets/icons/support.svg +3 -0
  91. package/src/common/assets/icons/translate_icon.png +0 -0
  92. package/src/common/assets/icons/translate_icon.svg +3 -0
  93. package/src/common/assets/icons/view_off.png +0 -0
  94. package/src/common/assets/images/Rectangle.png +0 -0
  95. package/src/common/assets/images/bg-support-page.svg +9 -0
  96. package/src/{images → common/assets/images}/fav/android-icon-192x192.png +0 -0
  97. package/src/{images → common/assets/images}/fav/apple-icon-114x114.png +0 -0
  98. package/src/{images → common/assets/images}/fav/apple-icon-120x120.png +0 -0
  99. package/src/{images → common/assets/images}/fav/apple-icon-144x144.png +0 -0
  100. package/src/{images → common/assets/images}/fav/apple-icon-152x152.png +0 -0
  101. package/src/{images → common/assets/images}/fav/apple-icon-180x180.png +0 -0
  102. package/src/{images → common/assets/images}/fav/apple-icon-57x57.png +0 -0
  103. package/src/{images → common/assets/images}/fav/apple-icon-60x60.png +0 -0
  104. package/src/{images → common/assets/images}/fav/apple-icon-72x72.png +0 -0
  105. package/src/{images → common/assets/images}/fav/apple-icon-76x76.png +0 -0
  106. package/src/{images → common/assets/images}/fav/browserconfig.xml +0 -0
  107. package/src/{images → common/assets/images}/fav/favicon-16x16.png +0 -0
  108. package/src/{images → common/assets/images}/fav/favicon-32x32.png +0 -0
  109. package/src/{images → common/assets/images}/fav/favicon-96x96.png +0 -0
  110. package/src/{images → common/assets/images}/fav/manifest.json +0 -0
  111. package/src/{images → common/assets/images}/ic_cam.png +0 -0
  112. package/src/{images → common/assets/images}/ic_cam.svg +0 -0
  113. package/src/{images → common/assets/images}/ic_cam_large.png +0 -0
  114. package/src/{images → common/assets/images}/ic_cam_large.svg +0 -0
  115. package/src/{images → common/assets/images}/ic_cam_large_noimage.png +0 -0
  116. package/src/{images → common/assets/images}/ic_close_feedback.png +0 -0
  117. package/src/{images → common/assets/images}/ic_close_feedback.svg +0 -0
  118. package/src/{images → common/assets/images}/ic_shopNow.png +0 -0
  119. package/src/{images → common/assets/images}/ic_shopNow.svg +0 -0
  120. package/src/{images → common/assets/images}/ic_shopNowLight.png +0 -0
  121. package/src/{images → common/assets/images}/ic_shopNowLight.svg +0 -0
  122. package/src/common/assets/images/image_test.png +0 -0
  123. package/src/{images → common/assets/images}/nyris_logo.png +0 -0
  124. package/src/{images → common/assets/images}/rewe.svg +0 -0
  125. package/src/{images → common/assets/images}/sectionTransBack.png +0 -0
  126. package/src/{images → common/assets/images}/sectionTransBack.svg +0 -0
  127. package/src/{images → common/assets/images}/sectionTransTop.png +0 -0
  128. package/src/{images → common/assets/images}/sectionTransTop.svg +0 -0
  129. package/src/components/DetailItem.tsx +175 -0
  130. package/src/components/DragDropFile.tsx +188 -0
  131. package/src/components/ExampleImages.tsx +32 -17
  132. package/src/components/Feedback.tsx +87 -48
  133. package/src/components/FilterComponent.tsx +47 -0
  134. package/src/components/Footer.tsx +29 -0
  135. package/src/components/FooterMD.tsx +54 -0
  136. package/src/components/FooterNewVersion.tsx +12 -0
  137. package/src/components/FooterResult.tsx +47 -0
  138. package/src/components/Header.tsx +35 -0
  139. package/src/components/HeaderMd.tsx +39 -0
  140. package/src/components/HeaderNewVersion.tsx +92 -0
  141. package/src/components/Layout.tsx +46 -0
  142. package/src/components/LoadingScreen/index.tsx +42 -0
  143. package/src/components/Navigation.tsx +34 -0
  144. package/src/components/Panigation/Pagination.tsx +140 -0
  145. package/src/components/Panigation/cx.js +3 -0
  146. package/src/components/Panigation/isModifierClick.js +10 -0
  147. package/src/components/Result.tsx +186 -113
  148. package/src/components/Saved/AllItem.tsx +32 -0
  149. package/src/components/Saved/Category.tsx +16 -0
  150. package/src/components/carousel/DefaultCarousel.tsx +48 -0
  151. package/src/components/common.d.ts +9 -0
  152. package/src/components/common.scss +54 -0
  153. package/src/components/default-select.tsx +45 -0
  154. package/src/components/hitItem/hits.tsx +50 -0
  155. package/src/components/hitItem/infinitiHits.tsx +33 -0
  156. package/src/components/input/inputSearch.tsx +77 -0
  157. package/src/components/modal/DefaultModal.tsx +28 -0
  158. package/src/components/preview/preview.tsx +433 -0
  159. package/src/components/results/ItemResult.tsx +155 -0
  160. package/src/components/search/ListSearch.tsx +209 -0
  161. package/src/defaults.ts +4 -3
  162. package/src/index.css +577 -306
  163. package/src/index.tsx +39 -186
  164. package/src/modules/LandingPage/common.scss +1288 -0
  165. package/src/modules/LandingPage/indexApp.tsx +474 -0
  166. package/src/modules/LandingPage/indexAppMD.tsx +494 -0
  167. package/src/modules/LandingPage/indexNewVersion.tsx +118 -0
  168. package/src/page/Auth/login.tsx +7 -0
  169. package/src/page/Exception/404.tsx +11 -0
  170. package/src/page/History/index.tsx +76 -0
  171. package/src/page/Profile/index.tsx +87 -0
  172. package/src/page/Saved/MockData.ts +223 -0
  173. package/src/page/Saved/index.tsx +166 -0
  174. package/src/page/Support/index.tsx +160 -0
  175. package/src/page/result/MockData.ts +36 -0
  176. package/src/page/result/index.tsx +482 -0
  177. package/src/services/Feedback.ts +65 -0
  178. package/src/services/findByImage.ts +24 -0
  179. package/src/services/findRegionsCustom.ts +212 -0
  180. package/src/services/image.ts +110 -0
  181. package/src/services/nyris.ts +123 -0
  182. package/src/services/session.ts +20 -0
  183. package/src/services/types.ts +96 -0
  184. package/src/types.ts +43 -3
  185. package/tsconfig.json +3 -8
  186. package/build/static/css/2.43a1c8b7.chunk.css +0 -2
  187. package/build/static/css/2.43a1c8b7.chunk.css.map +0 -1
  188. package/build/static/css/main.f6ed5f12.chunk.css +0 -2
  189. package/build/static/css/main.f6ed5f12.chunk.css.map +0 -1
  190. package/build/static/js/2.b56c1bca.chunk.js +0 -3
  191. package/build/static/js/2.b56c1bca.chunk.js.LICENSE.txt +0 -79
  192. package/build/static/js/2.b56c1bca.chunk.js.map +0 -1
  193. package/build/static/js/main.a9ea9ea5.chunk.js +0 -2
  194. package/build/static/js/main.a9ea9ea5.chunk.js.map +0 -1
  195. package/src/AppMD.tsx +0 -320
  196. package/src/actions/nyrisAppActions.ts +0 -76
  197. package/src/actions/searchActions.ts +0 -135
  198. package/src/epics/index.ts +0 -133
  199. package/src/epics/search.ts +0 -114
@@ -1,137 +1,210 @@
1
- import React from 'react';
2
- import {OfferNyrisResult as ResultData} from "@nyris/nyris-api";
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
- result: any,
8
- noImageUrl: string,
9
- onImageClick: (e: React.MouseEvent) => void,
10
- onLinkClick: (e: React.MouseEvent) => void
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
- result.p ? '' + (result.p.vi / 100).toFixed(2) + ' ' + result.p.c : '';
14
+ result.p ? "" + (result.p.vi / 100).toFixed(2) + " " + result.p.c : "";
15
15
 
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
- );
40
- };
41
-
42
- const renderSnr = ({result, noImageUrl, onImageClick, onLinkClick}: Options) => (
16
+ const renderDefault = ({
17
+ result,
18
+ noImageUrl,
19
+ onImageClick,
20
+ onLinkClick,
21
+ }: Options) => {
22
+ return (
43
23
  <>
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>
50
- </a>
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>
24
+ <a
25
+ href={result.l}
26
+ className="imageLink"
27
+ title="Click the image so see similar products"
28
+ onClick={onImageClick}
29
+ onAuxClick={onLinkClick}
30
+ >
31
+ <div className="prdctImg">
32
+ <div className="imgWrap">
33
+ <img
34
+ src={(result.img && result.img.url + "?r=512x512") || noImageUrl}
35
+ alt={result.title}
36
+ />
37
+ </div>
38
+ </div>
39
+ </a>
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>
61
56
  </div>
57
+ </div>
62
58
  </>
63
- );
59
+ );
60
+ };
64
61
 
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>
62
+ const renderSnr = ({
63
+ result,
64
+ noImageUrl,
65
+ onImageClick,
66
+ onLinkClick,
67
+ }: Options) => (
68
+ <>
69
+ <a
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
74
103
  </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>
104
+ </div>
105
+ </div>
106
+ </>
107
+ );
108
+
109
+ const renderSnrMultilink = (
110
+ { result, noImageUrl, onImageClick }: Options,
111
+ onLinkClick: (url: string) => void
112
+ ) => (
113
+ <>
114
+ <a
115
+ href={result.l}
116
+ className="imageLink"
117
+ onClick={onImageClick}
118
+ onAuxClick={onImageClick}
119
+ >
120
+ <div className="prdctImg">
121
+ <div className="imgWrap">
122
+ <img
123
+ src={(result.img && result.img.url + "?r=512x512") || noImageUrl}
124
+ alt={result.title}
125
+ />
88
126
  </div>
89
- </>
127
+ </div>
128
+ </a>
129
+ <div className="prdctDetailsWrap">
130
+ <div>
131
+ <div className="prdctTitle">{result.sku}</div>
132
+ <div
133
+ className="prdctMeta"
134
+ style={{ height: "5em", whiteSpace: "normal" }}
135
+ >
136
+ {result.title}
137
+ </div>
138
+ {result.l.map((l: { text: string; href: string }) => (
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
+ </>
90
155
  );
91
156
 
92
157
  export interface ResultProps {
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
158
+ result: any;
159
+ style: any;
160
+ template?: string;
161
+ onImageClick: (pos: number, url: string) => void;
162
+ onLinkClick: (pos: number, url: string) => void;
163
+ noImageUrl?: string;
99
164
  }
100
165
 
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
- };
166
+ const Result: React.FC<ResultProps> = ({
167
+ result,
168
+ style,
169
+ template,
170
+ onImageClick,
171
+ onLinkClick,
172
+ noImageUrl,
173
+ }) => {
174
+ let options: Options = {
175
+ onImageClick: (e: React.MouseEvent) => {
176
+ e.preventDefault();
177
+ onImageClick(result.position, result.img.url);
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
+ };
114
186
 
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
- }
187
+ let resultInner = null;
188
+ switch (template) {
189
+ case "snr":
190
+ resultInner = renderSnr(options);
191
+ break;
192
+ case "snr-multilink":
193
+ resultInner = renderSnrMultilink(options, (url) =>
194
+ onLinkClick(result.position, url)
195
+ );
196
+ break;
197
+ case "default":
198
+ default:
199
+ resultInner = renderDefault(options);
200
+ break;
201
+ }
128
202
 
129
- return (
130
- <div className="prdctItem" style={{...style}}>
131
- {resultInner}
132
- </div>
133
- );
203
+ return (
204
+ <div className="prdctItem" style={{ ...style }}>
205
+ {resultInner}
206
+ </div>
207
+ );
134
208
  };
135
209
 
136
-
137
210
  export default Result;
@@ -0,0 +1,32 @@
1
+ import { Grid } from "@material-ui/core";
2
+ import ItemResult from "components/results/ItemResult";
3
+ import React from "react";
4
+
5
+ interface Props {
6
+ dataItem: any[];
7
+ isHover?: boolean
8
+ }
9
+
10
+ function AllItem(props: Props) {
11
+ const { dataItem } = props;
12
+
13
+ return (
14
+ <Grid container spacing={2}>
15
+ {dataItem &&
16
+ dataItem.map((item: any, index: any) => {
17
+ return (
18
+ <Grid item sm={3} key={index}>
19
+ <ItemResult
20
+ dataItem={item}
21
+ isHover={true}
22
+ // handlerToggleModal={handlerToggleModal}
23
+ // handlerToggleModalShare={() => setOpenModalShare(true)}
24
+ />
25
+ </Grid>
26
+ );
27
+ })}
28
+ </Grid>
29
+ );
30
+ }
31
+
32
+ export default AllItem;
@@ -0,0 +1,16 @@
1
+ import { Grid } from "@material-ui/core";
2
+ import React from "react";
3
+
4
+ interface Props {
5
+ nameCategory?: string;
6
+ }
7
+
8
+ function CategoryItemSaved(props: Props) {
9
+ return (
10
+ <Grid container>
11
+ <Grid item xs={4}></Grid>
12
+ </Grid>
13
+ );
14
+ }
15
+
16
+ export default CategoryItemSaved;
@@ -0,0 +1,48 @@
1
+ import { Box, Button } from "@material-ui/core";
2
+ import React from "react";
3
+ import { Carousel } from "react-responsive-carousel";
4
+ import ChevronRightOutlinedIcon from "@material-ui/icons/ChevronRightOutlined";
5
+ import ChevronLeftOutlinedIcon from "@material-ui/icons/ChevronLeftOutlined";
6
+ interface Props {
7
+ imgItem: any[];
8
+ }
9
+
10
+ function DefaultCarousel(props: Props) {
11
+ const { imgItem } = props;
12
+ console.log("imgItem", imgItem);
13
+
14
+ return (
15
+ <Carousel
16
+ showThumbs={false}
17
+ infiniteLoop={false}
18
+ showStatus={false}
19
+ className={imgItem.length > 1 ? "" : "hide-btn-arrow"}
20
+ renderArrowNext={(onClickHandler, hasPrev, label) => (
21
+ <Button onClick={onClickHandler} className="btn-carousel-right">
22
+ <ChevronRightOutlinedIcon
23
+ className="icon-ct"
24
+ style={{ color: "#55566B" }}
25
+ />
26
+ </Button>
27
+ )}
28
+ renderArrowPrev={(onClickHandler, hasPrev, label) => (
29
+ <Button onClick={onClickHandler} className="btn-carousel-left">
30
+ <ChevronLeftOutlinedIcon
31
+ className="icon-ct"
32
+ style={{ color: "#55566B" }}
33
+ />
34
+ </Button>
35
+ )}
36
+ >
37
+ {imgItem?.map((item: any, index: any) => {
38
+ return (
39
+ <Box key={index} style={{height: '100%'}}>
40
+ <img style={{height: '100%'}} src={imgItem ? item?.url : ""} alt="image_product" />
41
+ </Box>
42
+ );
43
+ })}
44
+ </Carousel>
45
+ );
46
+ }
47
+
48
+ export default DefaultCarousel;
@@ -0,0 +1,9 @@
1
+ type ReactNode =
2
+ | ReactChild
3
+ | ReactFragment
4
+ | ReactPortal
5
+ | boolean
6
+ | null
7
+ | undefined;
8
+
9
+ export { ReactNode };
@@ -0,0 +1,54 @@
1
+ .layout-main-newVersion {
2
+ height: 100vh;
3
+ display: flex;
4
+ flex-direction: column;
5
+ justify-content: space-between;
6
+ overflow: hidden;
7
+ .box-header-newVersion-main {
8
+ height: 32px;
9
+ background: #2b2c46;
10
+ .box-content {
11
+ max-width: 1280px;
12
+ margin: auto;
13
+ height: 100%;
14
+ justify-content: space-between;
15
+ align-items: center;
16
+ .nav-menu {
17
+ width: auto;
18
+ color: #fff;
19
+ font-family: "Montserrat";
20
+ font-weight: bold;
21
+ height: 100%;
22
+ a {
23
+ display: flex;
24
+ align-items: center;
25
+ height: 100%;
26
+ padding: 0 10px;
27
+ &.active {
28
+ background: #322bb0;
29
+ }
30
+ }
31
+
32
+ span {
33
+ color: #fff;
34
+ font-size: 11px;
35
+ display: flex;
36
+ justify-content: center;
37
+ align-items: center;
38
+ img {
39
+ margin-left: 12px;
40
+ }
41
+ }
42
+ .item-nav {
43
+ &:last-child {
44
+ margin-right: 0px;
45
+ }
46
+ }
47
+ }
48
+ }
49
+ }
50
+ .box-body-newVersion-wrap-main {
51
+ height: calc(100% - 32px);
52
+ // overflow: auto;
53
+ }
54
+ }
@@ -0,0 +1,45 @@
1
+ import { Box, MenuItem, Select } from "@material-ui/core";
2
+ import React, { useEffect, useState } from "react";
3
+ import KeyboardArrowDownOutlinedIcon from "@material-ui/icons/KeyboardArrowDownOutlined";
4
+ import { connectMenu } from "react-instantsearch-dom";
5
+
6
+ interface Props {
7
+ dataField: any[];
8
+ }
9
+
10
+ function DefaultSelectCustom({ items, currentRefinement, refine }: any) {
11
+ const [valueFilter, setValueFilter] = useState<string>();
12
+
13
+ useEffect(() => {
14
+ if (!valueFilter) {
15
+ return;
16
+ }
17
+ refine(valueFilter);
18
+ }, [valueFilter]);
19
+
20
+ return (
21
+ <Box className="w-100">
22
+ <select
23
+ className="w-100 btn-ct"
24
+ value={currentRefinement || ""}
25
+ onChange={(event: any) => {
26
+ setValueFilter(event?.currentTarget.value);
27
+ // refine(event.currentTarget.value);
28
+ }}
29
+ >
30
+ <option value="">See all options</option>
31
+ {items.map((item: any) => (
32
+ <option
33
+ key={item.label}
34
+ value={item.isRefined ? currentRefinement : item.value}
35
+ >
36
+ {item.label}
37
+ </option>
38
+ ))}
39
+ </select>
40
+ </Box>
41
+ );
42
+ }
43
+ const DefaultSelect = connectMenu(DefaultSelectCustom);
44
+
45
+ export default DefaultSelect;
@@ -0,0 +1,50 @@
1
+ import React from "react";
2
+ import { Hit as AlgoliaHit } from "@algolia/client-search";
3
+ import { useHits, UseHitsProps } from "react-instantsearch-hooks";
4
+ import { useAppDispatch } from "Store/Store";
5
+ import { useEffect } from "react";
6
+ import { resultSearchText } from "Store/Search";
7
+ import { useState } from "react";
8
+ import { CircularProgress } from "@material-ui/core";
9
+
10
+ export type HitsProps<THit> = React.ComponentProps<"div"> &
11
+ UseHitsProps & {
12
+ hitComponent: (props: { hit: THit }) => JSX.Element;
13
+ };
14
+
15
+ export function Hits<THit extends AlgoliaHit<Record<string, unknown>>>({
16
+ hitComponent: Hit,
17
+ ...props
18
+ }: HitsProps<THit>) {
19
+
20
+ const { hits } = useHits(props);
21
+ const dispatch = useAppDispatch();
22
+ const [isLoading, setLoading] = useState<boolean>(false);
23
+
24
+ useEffect(() => {
25
+ setLoading(true);
26
+ setTimeout(() => {
27
+ setLoading(false);
28
+ }, 1000);
29
+ }, []);
30
+
31
+ useEffect(() => {
32
+ if (hits?.length > 0) {
33
+ dispatch(resultSearchText(hits));
34
+ }
35
+ }, []);
36
+
37
+ return (
38
+ <>
39
+ {isLoading ? (
40
+ <CircularProgress />
41
+ ) : (
42
+ <>
43
+ {hits.map((hit: any, index: any) => (
44
+ <Hit key={index} hit={hit as unknown as THit} />
45
+ ))}
46
+ </>
47
+ )}
48
+ </>
49
+ );
50
+ }
@@ -0,0 +1,33 @@
1
+ import { Grid } from "@material-ui/core";
2
+ import ItemResult from "components/results/ItemResult";
3
+ import React from "react";
4
+ import {
5
+ useInfiniteHits,
6
+ UseInfiniteHitsProps,
7
+ } from "react-instantsearch-hooks";
8
+
9
+ function InfiniteHits(props: any) {
10
+ const { hits, isLastPage, showMore } = useInfiniteHits(props);
11
+ console.log("props", useInfiniteHits(props));
12
+
13
+ return (
14
+ <>
15
+ {hits.map((hit: any, index: any) => {
16
+ return (
17
+ <Grid item xs={3}>
18
+ <ItemResult
19
+ dataItem={hit?.hit}
20
+ // handlerToggleModal={() => {
21
+ // handlerToggleModal(hit?.hit);
22
+ // }}
23
+ // handlerToggleModalShare={() => setOpenModalShare(true)}
24
+ // indexItem={hit.__position}
25
+ />
26
+ </Grid>
27
+ );
28
+ })}
29
+ </>
30
+ );
31
+ }
32
+
33
+ export default InfiniteHits;