@nyris/nyris-webapp 0.3.6 → 0.3.13
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 +11 -11
- package/build/index.html +1 -1
- package/build/{precache-manifest.bffed513ca17d8ac16af1cc3aaa7d908.js → precache-manifest.793f0a4375602ec8cd0fba83bf0e3e67.js} +9 -9
- package/build/service-worker.js +1 -1
- 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.4e9a4ce1.chunk.js.LICENSE.txt → 2.520bb6d6.chunk.js.LICENSE.txt} +0 -0
- package/build/static/js/2.520bb6d6.chunk.js.map +1 -0
- package/build/static/js/main.8405239a.chunk.js +2 -0
- package/build/static/js/main.8405239a.chunk.js.map +1 -0
- package/package.json +2 -2
- package/src/App.tsx +346 -213
- package/src/actions/nyrisAppActions.ts +69 -65
- package/src/actions/searchActions.ts +301 -196
- package/src/components/CategoryFilter.tsx +16 -13
- package/src/components/Codes.tsx +20 -16
- package/src/components/ExampleImages.tsx +27 -17
- package/src/components/Feedback.tsx +78 -48
- package/src/components/FiltersList.tsx +106 -59
- package/src/components/Header.tsx +29 -17
- package/src/components/PredictedCategories.tsx +15 -12
- package/src/components/Result.tsx +186 -113
- package/src/components/SelectedFiltersSummary.tsx +84 -0
- package/src/components/Sidebar.tsx +41 -32
- package/src/epics/index.ts +173 -104
- package/src/epics/search.ts +209 -177
- package/src/index.css +98 -9
- package/src/index.tsx +148 -144
- package/src/utils.ts +5 -0
- package/build/static/css/main.2a76dc8a.chunk.css +0 -2
- package/build/static/css/main.2a76dc8a.chunk.css.map +0 -1
- package/build/static/js/2.4e9a4ce1.chunk.js +0 -3
- package/build/static/js/2.4e9a4ce1.chunk.js.map +0 -1
- package/build/static/js/main.ec93aa4d.chunk.js +0 -2
- package/build/static/js/main.ec93aa4d.chunk.js.map +0 -1
- package/src/Demo2.tsx +0 -220
|
@@ -1,76 +1,80 @@
|
|
|
1
|
-
import {AppAction} from "../types";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export type NyrisAppPart = 'start' | 'camera' | 'results';
|
|
5
|
-
export type NyrisFeedbackState = 'hidden' | 'question' | 'positive' | 'negative';
|
|
1
|
+
import { AppAction } from "../types";
|
|
6
2
|
|
|
3
|
+
export type NyrisAppPart = "start" | "camera" | "results";
|
|
4
|
+
export type NyrisFeedbackState =
|
|
5
|
+
| "hidden"
|
|
6
|
+
| "question"
|
|
7
|
+
| "positive"
|
|
8
|
+
| "negative";
|
|
7
9
|
|
|
8
10
|
export interface NyrisAppState {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
+
showPart: NyrisAppPart;
|
|
12
|
+
feedbackState: NyrisFeedbackState;
|
|
11
13
|
}
|
|
12
14
|
|
|
13
15
|
export type NyrisAction =
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
16
|
+
| { type: "SHOW_START" }
|
|
17
|
+
| { type: "SHOW_CAMERA" }
|
|
18
|
+
| { type: "SHOW_RESULTS" }
|
|
19
|
+
| { type: "SHOW_FEEDBACK" }
|
|
20
|
+
| { type: "HIDE_FEEDBACK" }
|
|
21
|
+
| { type: "RESULT_LINK_CLICKED"; position: number; url: string }
|
|
22
|
+
| { type: "RESULT_IMAGE_CLICKED"; position: number; url: string };
|
|
22
23
|
|
|
23
|
-
export const showCamera = ()
|
|
24
|
-
export const showStart = ()
|
|
25
|
-
export const showResults = ()
|
|
26
|
-
export const showFeedback = ()
|
|
27
|
-
export const hideFeedback = ()
|
|
24
|
+
export const showCamera = (): NyrisAction => ({ type: "SHOW_CAMERA" });
|
|
25
|
+
export const showStart = (): NyrisAction => ({ type: "SHOW_START" });
|
|
26
|
+
export const showResults = (): NyrisAction => ({ type: "SHOW_RESULTS" });
|
|
27
|
+
export const showFeedback = (): NyrisAction => ({ type: "SHOW_FEEDBACK" });
|
|
28
|
+
export const hideFeedback = (): NyrisAction => ({ type: "HIDE_FEEDBACK" });
|
|
28
29
|
|
|
29
|
-
const initialNyrisState
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
const initialNyrisState: NyrisAppState = {
|
|
31
|
+
showPart: "start",
|
|
32
|
+
feedbackState: "hidden",
|
|
32
33
|
};
|
|
33
34
|
|
|
34
|
-
export function reducer(
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
35
|
+
export function reducer(
|
|
36
|
+
state: NyrisAppState = initialNyrisState,
|
|
37
|
+
action: AppAction
|
|
38
|
+
): NyrisAppState {
|
|
39
|
+
switch (action.type) {
|
|
40
|
+
case "SHOW_START":
|
|
41
|
+
return {
|
|
42
|
+
...state,
|
|
43
|
+
showPart: "start",
|
|
44
|
+
};
|
|
45
|
+
case "SHOW_CAMERA":
|
|
46
|
+
return {
|
|
47
|
+
...state,
|
|
48
|
+
showPart: "camera",
|
|
49
|
+
};
|
|
50
|
+
case "SEARCH_REQUEST_START":
|
|
51
|
+
case "REGION_REQUEST_START":
|
|
52
|
+
case "SHOW_RESULTS":
|
|
53
|
+
return {
|
|
54
|
+
...state,
|
|
55
|
+
showPart: "results",
|
|
56
|
+
};
|
|
57
|
+
case "SHOW_FEEDBACK":
|
|
58
|
+
return {
|
|
59
|
+
...state,
|
|
60
|
+
feedbackState: "question",
|
|
61
|
+
};
|
|
62
|
+
case "HIDE_FEEDBACK":
|
|
63
|
+
return {
|
|
64
|
+
...state,
|
|
65
|
+
feedbackState: "hidden",
|
|
66
|
+
};
|
|
67
|
+
case "FEEDBACK_SUBMIT_POSITIVE":
|
|
68
|
+
return {
|
|
69
|
+
...state,
|
|
70
|
+
feedbackState: "positive",
|
|
71
|
+
};
|
|
72
|
+
case "FEEDBACK_SUBMIT_NEGATIVE":
|
|
73
|
+
return {
|
|
74
|
+
...state,
|
|
75
|
+
feedbackState: "negative",
|
|
76
|
+
};
|
|
77
|
+
default:
|
|
78
|
+
return state;
|
|
79
|
+
}
|
|
76
80
|
}
|