@nyris/nyris-webapp 0.3.5 → 0.3.12
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.bbb31f2ce7710d7eb3175b1b48241d24.js → precache-manifest.1b00dd5c15aa0815244681503d6fa9da.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.0c9239ba.chunk.css +2 -0
- package/build/static/css/main.0c9239ba.chunk.css.map +1 -0
- package/build/static/js/2.520bb6d6.chunk.js +3 -0
- package/build/static/js/2.520bb6d6.chunk.js.LICENSE.txt +79 -0
- package/build/static/js/2.520bb6d6.chunk.js.map +1 -0
- package/build/static/js/main.ef6a9744.chunk.js +2 -0
- package/build/static/js/main.ef6a9744.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 +386 -15
- package/src/AppMD.tsx +320 -0
- package/src/actions/nyrisAppActions.ts +80 -0
- package/src/actions/searchActions.ts +323 -0
- package/src/components/CategoryFilter.tsx +16 -13
- package/src/components/Codes.tsx +20 -16
- package/src/components/ExampleImages.tsx +10 -15
- package/src/components/Feedback.tsx +12 -21
- package/src/components/FiltersList.tsx +122 -0
- package/src/components/Header.tsx +26 -29
- package/src/components/PredictedCategories.tsx +15 -12
- package/src/components/SelectedFiltersSummary.tsx +85 -0
- package/src/components/Sidebar.tsx +52 -0
- package/src/defaults.ts +3 -4
- package/src/epics/feedback.ts +59 -0
- package/src/epics/index.ts +223 -0
- package/src/epics/search.ts +239 -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 +502 -570
- package/src/index.tsx +170 -16
- package/src/types.ts +7 -51
- package/src/utils.ts +5 -0
- 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.4a55bc61.chunk.js +0 -3
- package/build/static/js/2.4a55bc61.chunk.js.LICENSE.txt +0 -124
- package/build/static/js/2.4a55bc61.chunk.js.map +0 -1
- package/build/static/js/main.2660f94a.chunk.js +0 -2
- package/build/static/js/main.2660f94a.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 -243
- package/src/Store/Store.ts +0 -53
- 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 -192
- 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 -169
- 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 -418
- package/src/services/Feedback.ts +0 -64
- package/src/services/image.ts +0 -40
- package/src/services/session.ts +0 -17
- package/src/services/types.ts +0 -50
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
import { EpicConf } from "./types";
|
|
2
|
+
import { combineEpics, ofType } from "redux-observable";
|
|
3
|
+
import { switchMap, withLatestFrom } from "rxjs/operators";
|
|
4
|
+
import { AppAction } from "../types";
|
|
5
|
+
import {
|
|
6
|
+
ImageSearchOptions,
|
|
7
|
+
urlOrBlobToCanvas,
|
|
8
|
+
isCadFile,
|
|
9
|
+
isImageFile,
|
|
10
|
+
Filter,
|
|
11
|
+
} from "@nyris/nyris-api";
|
|
12
|
+
import { imageLoaded, cadFileLoaded } from "../actions/searchActions";
|
|
13
|
+
|
|
14
|
+
const imageSearch: EpicConf = (action$, state$, { api }) =>
|
|
15
|
+
action$.pipe(
|
|
16
|
+
ofType("SEARCH_REQUEST_START"),
|
|
17
|
+
withLatestFrom(state$),
|
|
18
|
+
switchMap(async ([action, state]): Promise<AppAction> => {
|
|
19
|
+
if (action.type !== "SEARCH_REQUEST_START") {
|
|
20
|
+
throw new Error(`Wrong action type ${action.type}`);
|
|
21
|
+
}
|
|
22
|
+
if ("image" in action) {
|
|
23
|
+
let { image, normalizedRect } = action;
|
|
24
|
+
|
|
25
|
+
// refactor this
|
|
26
|
+
let selectedFilters = new Array<Filter>();
|
|
27
|
+
if (state.search.selectedFilters.size > 0) {
|
|
28
|
+
state.search.selectedFilters.forEach((values, key) => {
|
|
29
|
+
if (values && values.length > 0) {
|
|
30
|
+
let filterObj: Filter = {
|
|
31
|
+
key: key,
|
|
32
|
+
values: values,
|
|
33
|
+
};
|
|
34
|
+
selectedFilters.push(filterObj);
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
let options: ImageSearchOptions = {
|
|
40
|
+
cropRect: normalizedRect,
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
try {
|
|
44
|
+
if (selectedFilters && selectedFilters.length > 0) {
|
|
45
|
+
console.log("With Filters");
|
|
46
|
+
const { results, duration, requestId, categoryPredictions, codes } =
|
|
47
|
+
await api.findByImageWithFilters(image, options, selectedFilters);
|
|
48
|
+
return {
|
|
49
|
+
type: "SEARCH_REQUEST_SUCCEED",
|
|
50
|
+
results,
|
|
51
|
+
requestId,
|
|
52
|
+
duration,
|
|
53
|
+
categoryPredictions,
|
|
54
|
+
codes,
|
|
55
|
+
};
|
|
56
|
+
} else {
|
|
57
|
+
console.log("Without Filters");
|
|
58
|
+
const { results, duration, requestId, categoryPredictions, codes } =
|
|
59
|
+
await api.findByImage(image, options);
|
|
60
|
+
return {
|
|
61
|
+
type: "SEARCH_REQUEST_SUCCEED",
|
|
62
|
+
results,
|
|
63
|
+
requestId,
|
|
64
|
+
duration,
|
|
65
|
+
categoryPredictions,
|
|
66
|
+
codes,
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
} catch (e) {
|
|
70
|
+
console.warn("search failed", e);
|
|
71
|
+
return {
|
|
72
|
+
type: "SEARCH_REQUEST_FAIL",
|
|
73
|
+
reason: e.message,
|
|
74
|
+
exception: e,
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
if ("file" in action) {
|
|
80
|
+
console.log("file");
|
|
81
|
+
let { file } = action;
|
|
82
|
+
|
|
83
|
+
let options: ImageSearchOptions = {};
|
|
84
|
+
|
|
85
|
+
try {
|
|
86
|
+
const { results, duration, requestId, categoryPredictions, codes } =
|
|
87
|
+
await api.findByCad(file, options);
|
|
88
|
+
return {
|
|
89
|
+
type: "SEARCH_REQUEST_SUCCEED",
|
|
90
|
+
results,
|
|
91
|
+
requestId,
|
|
92
|
+
duration,
|
|
93
|
+
categoryPredictions,
|
|
94
|
+
codes,
|
|
95
|
+
};
|
|
96
|
+
} catch (e) {
|
|
97
|
+
console.warn("search failed", e);
|
|
98
|
+
return {
|
|
99
|
+
type: "SEARCH_REQUEST_FAIL",
|
|
100
|
+
reason: e.message,
|
|
101
|
+
exception: e,
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
throw new Error(`Wrong action content ${action}`);
|
|
106
|
+
})
|
|
107
|
+
);
|
|
108
|
+
|
|
109
|
+
const regionSearch: EpicConf = (action$, state$, { api }) =>
|
|
110
|
+
action$.pipe(
|
|
111
|
+
ofType("REGION_REQUEST_START"),
|
|
112
|
+
withLatestFrom(state$),
|
|
113
|
+
switchMap(async ([action, { settings }]): Promise<AppAction> => {
|
|
114
|
+
if (action.type !== "REGION_REQUEST_START") {
|
|
115
|
+
throw new Error(`Wrong action type ${action.type}`);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
let { image } = action;
|
|
119
|
+
|
|
120
|
+
try {
|
|
121
|
+
let regions = await api.findRegions(image);
|
|
122
|
+
return { type: "REGION_REQUEST_SUCCEED", regions };
|
|
123
|
+
} catch (e) {
|
|
124
|
+
console.error(e);
|
|
125
|
+
return { type: "REGION_REQUEST_FAIL", reason: e.message, exception: e };
|
|
126
|
+
}
|
|
127
|
+
})
|
|
128
|
+
);
|
|
129
|
+
|
|
130
|
+
const loadFile: EpicConf = (action$) =>
|
|
131
|
+
action$.pipe(
|
|
132
|
+
ofType("LOAD_FILE"),
|
|
133
|
+
switchMap(async (action): Promise<AppAction> => {
|
|
134
|
+
if (action.type !== "LOAD_FILE") {
|
|
135
|
+
throw new Error(`Wrong action type ${action.type}`);
|
|
136
|
+
}
|
|
137
|
+
const randomId = Math.random().toString();
|
|
138
|
+
if ("file" in action) {
|
|
139
|
+
const file = action.file;
|
|
140
|
+
if (isImageFile(file)) {
|
|
141
|
+
return imageLoaded(await urlOrBlobToCanvas(file), randomId);
|
|
142
|
+
}
|
|
143
|
+
if (isCadFile(file)) {
|
|
144
|
+
return cadFileLoaded(file, randomId);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
throw new Error(
|
|
148
|
+
`LOAD_FILE action wrong properties ${Object.keys(action).join(",")}`
|
|
149
|
+
);
|
|
150
|
+
})
|
|
151
|
+
);
|
|
152
|
+
|
|
153
|
+
const loadImage: EpicConf = (action$) =>
|
|
154
|
+
action$.pipe(
|
|
155
|
+
ofType("LOAD_IMAGE"),
|
|
156
|
+
switchMap(async (action): Promise<AppAction> => {
|
|
157
|
+
if (action.type !== "LOAD_IMAGE") {
|
|
158
|
+
throw new Error(`Wrong action type ${action.type}`);
|
|
159
|
+
}
|
|
160
|
+
const randomId = Math.random().toString();
|
|
161
|
+
if ("url" in action) {
|
|
162
|
+
return imageLoaded(await urlOrBlobToCanvas(action.url), randomId);
|
|
163
|
+
}
|
|
164
|
+
if ("file" in action) {
|
|
165
|
+
return imageLoaded(await urlOrBlobToCanvas(action.file), randomId);
|
|
166
|
+
}
|
|
167
|
+
if ("image" in action) {
|
|
168
|
+
return imageLoaded(action.image, randomId);
|
|
169
|
+
}
|
|
170
|
+
throw new Error(
|
|
171
|
+
`LOAD_IMAGE action wrong properties ${Object.keys(action).join(",")}`
|
|
172
|
+
);
|
|
173
|
+
})
|
|
174
|
+
);
|
|
175
|
+
|
|
176
|
+
const loadFilters: EpicConf = (action$, state$, { api }) =>
|
|
177
|
+
action$.pipe(
|
|
178
|
+
ofType("LOAD_FILTERS"),
|
|
179
|
+
withLatestFrom(state$),
|
|
180
|
+
switchMap(async ([action, state]): Promise<AppAction> => {
|
|
181
|
+
if (action.type !== "LOAD_FILTERS") {
|
|
182
|
+
throw new Error(`Wrong action type ${action.type}`);
|
|
183
|
+
}
|
|
184
|
+
try {
|
|
185
|
+
// use find filters
|
|
186
|
+
|
|
187
|
+
let filters = await api.getFilters();
|
|
188
|
+
|
|
189
|
+
filters = filters.slice(0, 3);
|
|
190
|
+
console.log(filters);
|
|
191
|
+
return { type: "LOAD_FILTERS_SUCCESS", filters };
|
|
192
|
+
} catch (e) {
|
|
193
|
+
console.error(e);
|
|
194
|
+
return { type: "LOAD_FILTERS_FAIL", reason: e.message, exception: e };
|
|
195
|
+
}
|
|
196
|
+
})
|
|
197
|
+
);
|
|
198
|
+
|
|
199
|
+
const searchFilters: EpicConf = (action$, state$, { api }) =>
|
|
200
|
+
action$.pipe(
|
|
201
|
+
ofType("SEARCH_FILTERS"),
|
|
202
|
+
withLatestFrom(state$),
|
|
203
|
+
switchMap(async ([action, state]): Promise<AppAction> => {
|
|
204
|
+
if (action.type !== "SEARCH_FILTERS") {
|
|
205
|
+
throw new Error(`Wrong action type ${action.type}`);
|
|
206
|
+
}
|
|
207
|
+
try {
|
|
208
|
+
// use find filters
|
|
209
|
+
let { key, value } = action;
|
|
210
|
+
let values: string[] = [];
|
|
211
|
+
if (value) {
|
|
212
|
+
let response = await api.searchFilters(key, value);
|
|
213
|
+
if (response && response.length > 0) {
|
|
214
|
+
values = values.concat(await api.searchFilters(key, value));
|
|
215
|
+
}
|
|
216
|
+
} else {
|
|
217
|
+
// if no value load default values in search
|
|
218
|
+
let defaultfilters = await api.getFilters();
|
|
219
|
+
let filter = defaultfilters.find((x) => x.key === key);
|
|
220
|
+
if (filter && filter.values && filter.values.length > 0) {
|
|
221
|
+
values = filter.values;
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
return { type: "UPDATE_FILTERS", key, values };
|
|
225
|
+
} catch (e) {
|
|
226
|
+
console.error(e);
|
|
227
|
+
return { type: "LOAD_FILTERS_FAIL", reason: e.message, exception: e };
|
|
228
|
+
}
|
|
229
|
+
})
|
|
230
|
+
);
|
|
231
|
+
|
|
232
|
+
export default combineEpics(
|
|
233
|
+
imageSearch,
|
|
234
|
+
regionSearch,
|
|
235
|
+
loadFile,
|
|
236
|
+
loadImage,
|
|
237
|
+
loadFilters,
|
|
238
|
+
searchFilters
|
|
239
|
+
);
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import NyrisAPI from "@nyris/nyris-api";
|
|
2
|
+
import {Epic} from "redux-observable";
|
|
3
|
+
import {AppAction, AppState} from "../types";
|
|
4
|
+
import {History} from "history";
|
|
5
|
+
|
|
6
|
+
export interface EpicsDependencies {
|
|
7
|
+
api: NyrisAPI,
|
|
8
|
+
history: History
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export type EpicConf = Epic<AppAction, AppAction, AppState, EpicsDependencies>;
|
|
12
|
+
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|