@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,218 +1,323 @@
|
|
|
1
|
-
import {CanvasWithId} from "../types";
|
|
2
|
-
import {
|
|
1
|
+
import { CanvasWithId } from "../types";
|
|
2
|
+
import {
|
|
3
|
+
Code,
|
|
4
|
+
RectCoords,
|
|
5
|
+
Region,
|
|
6
|
+
selectFirstCenteredRegion,
|
|
7
|
+
Filter,
|
|
8
|
+
} from "@nyris/nyris-api";
|
|
3
9
|
|
|
4
10
|
export type ImageSourceType =
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
11
|
+
| { url: string }
|
|
12
|
+
| { file: File }
|
|
13
|
+
| { image: HTMLCanvasElement };
|
|
8
14
|
|
|
9
15
|
export type SearchAction =
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
16
|
+
| { type: "FEEDBACK_SUBMIT_POSITIVE" }
|
|
17
|
+
| { type: "FEEDBACK_SUBMIT_NEGATIVE" }
|
|
18
|
+
| { type: "IMAGE_LOADED"; image: CanvasWithId }
|
|
19
|
+
| { type: "REGION_REQUEST_START"; image: HTMLCanvasElement }
|
|
20
|
+
| { type: "REGION_REQUEST_SUCCEED"; regions: Region[] }
|
|
21
|
+
| { type: "REGION_REQUEST_FAIL"; reason: string; exception: any }
|
|
22
|
+
| {
|
|
23
|
+
type: "SEARCH_REQUEST_START";
|
|
24
|
+
image: HTMLCanvasElement;
|
|
25
|
+
normalizedRect?: RectCoords;
|
|
26
|
+
selectedFilters?: Filter[];
|
|
27
|
+
}
|
|
28
|
+
| { type: "SEARCH_REQUEST_START"; file: File }
|
|
29
|
+
| {
|
|
30
|
+
type: "SEARCH_REQUEST_SUCCEED";
|
|
31
|
+
results: any[];
|
|
32
|
+
requestId: string;
|
|
33
|
+
duration: number;
|
|
34
|
+
categoryPredictions: CategoryPrediction[];
|
|
35
|
+
codes: Code[];
|
|
36
|
+
}
|
|
37
|
+
| { type: "SEARCH_REQUEST_FAIL"; reason: string; exception?: any }
|
|
38
|
+
| { type: "REGION_CHANGED"; normalizedRect: RectCoords }
|
|
39
|
+
| ({ type: "LOAD_IMAGE" } & ImageSourceType)
|
|
40
|
+
| { type: "LOAD_FILE"; file: File }
|
|
41
|
+
| { type: "CAD_LOADED"; file: File }
|
|
42
|
+
| { type: "LOAD_FILTERS" }
|
|
43
|
+
| { type: "LOAD_FILTERS_SUCCESS"; filters: Filter[] }
|
|
44
|
+
| { type: "LOAD_FILTERS_FAIL"; reason: string; exception: any }
|
|
45
|
+
| { type: "ADD_TO_SELECTEDFILTERS"; key: string; value: string }
|
|
46
|
+
| { type: "REMOVE_FROM_SELECTEDFILTERS"; key: string; value: string }
|
|
47
|
+
| { type: "CLEAR_SELECTED_FILTERS" }
|
|
48
|
+
| { type: "SEARCH_FILTERS"; key: string; value: string }
|
|
49
|
+
| { type: "FILTER_CHANGED" }
|
|
50
|
+
| { type: "FILTER_CHANGED_FAIL" }
|
|
51
|
+
| { type: "CLEAR_REQUEST_IMAGE" }
|
|
52
|
+
| { type: "UPDATE_FILTERS"; key: string; values: string[] };
|
|
33
53
|
|
|
34
54
|
interface CategoryPrediction {
|
|
35
|
-
|
|
36
|
-
|
|
55
|
+
name: string;
|
|
56
|
+
score: number;
|
|
37
57
|
}
|
|
38
58
|
|
|
39
59
|
export interface SearchState {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
60
|
+
results: any[];
|
|
61
|
+
duration?: number;
|
|
62
|
+
requestId?: string;
|
|
63
|
+
sessionId?: string;
|
|
64
|
+
regions: Region[];
|
|
65
|
+
selectedRegion: RectCoords;
|
|
66
|
+
fetchingRegions: boolean;
|
|
67
|
+
fetchingResults: boolean;
|
|
68
|
+
filterOptions: string[];
|
|
69
|
+
requestImage?: CanvasWithId;
|
|
70
|
+
requestCadFile?: File;
|
|
71
|
+
categoryPredictions: CategoryPrediction[];
|
|
72
|
+
codes: Code[];
|
|
73
|
+
errorMessage: string;
|
|
74
|
+
filters: Filter[];
|
|
75
|
+
selectedFilters: Map<string, string[]>;
|
|
56
76
|
}
|
|
57
77
|
|
|
58
|
-
const initialState
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
78
|
+
const initialState: SearchState = {
|
|
79
|
+
results: [],
|
|
80
|
+
regions: [],
|
|
81
|
+
selectedRegion: { x1: 0.1, x2: 0.9, y1: 0.1, y2: 0.9 },
|
|
82
|
+
requestImage: undefined,
|
|
83
|
+
fetchingResults: false,
|
|
84
|
+
fetchingRegions: false,
|
|
85
|
+
filterOptions: [],
|
|
86
|
+
categoryPredictions: [],
|
|
87
|
+
codes: [],
|
|
88
|
+
errorMessage: "",
|
|
89
|
+
filters: [],
|
|
90
|
+
selectedFilters: new Map<string, string[]>(),
|
|
71
91
|
};
|
|
72
92
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
export const
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
export const
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
93
|
+
export const loadFile = (file: File): SearchAction => ({
|
|
94
|
+
type: "LOAD_FILE",
|
|
95
|
+
file,
|
|
96
|
+
});
|
|
97
|
+
export const loadUrl = (url: string): SearchAction => ({
|
|
98
|
+
type: "LOAD_IMAGE",
|
|
99
|
+
url,
|
|
100
|
+
});
|
|
101
|
+
export const loadCanvas = (image: HTMLCanvasElement): SearchAction => ({
|
|
102
|
+
type: "LOAD_IMAGE",
|
|
103
|
+
image,
|
|
104
|
+
});
|
|
105
|
+
export const imageLoaded = (
|
|
106
|
+
image: HTMLCanvasElement,
|
|
107
|
+
id: string
|
|
108
|
+
): SearchAction => ({ type: "IMAGE_LOADED", image: { canvas: image, id: id } });
|
|
109
|
+
export const cadFileLoaded = (file: File, id: string): SearchAction => ({
|
|
110
|
+
type: "CAD_LOADED",
|
|
111
|
+
file,
|
|
112
|
+
});
|
|
113
|
+
export const selectionChanged = (normalizedRect: RectCoords): SearchAction => ({
|
|
114
|
+
type: "REGION_CHANGED",
|
|
115
|
+
normalizedRect,
|
|
116
|
+
});
|
|
117
|
+
export const searchRegions = (image: HTMLCanvasElement): SearchAction => ({
|
|
118
|
+
type: "REGION_REQUEST_START",
|
|
119
|
+
image,
|
|
120
|
+
});
|
|
121
|
+
export const searchOffersForImage = (
|
|
122
|
+
image: HTMLCanvasElement,
|
|
123
|
+
normalizedRect?: RectCoords
|
|
124
|
+
): SearchAction => ({
|
|
125
|
+
type: "SEARCH_REQUEST_START",
|
|
126
|
+
image,
|
|
127
|
+
normalizedRect,
|
|
86
128
|
});
|
|
87
|
-
export const searchOffersForCad = (file: File)
|
|
88
|
-
|
|
89
|
-
|
|
129
|
+
export const searchOffersForCad = (file: File): SearchAction => ({
|
|
130
|
+
type: "SEARCH_REQUEST_START",
|
|
131
|
+
file,
|
|
132
|
+
});
|
|
133
|
+
export const submitPositiveFeedback = (): SearchAction => ({
|
|
134
|
+
type: "FEEDBACK_SUBMIT_POSITIVE",
|
|
135
|
+
});
|
|
136
|
+
export const submitNegativeFeedback = (): SearchAction => ({
|
|
137
|
+
type: "FEEDBACK_SUBMIT_NEGATIVE",
|
|
138
|
+
});
|
|
139
|
+
export const loadFilters = (): SearchAction => ({ type: "LOAD_FILTERS" });
|
|
140
|
+
export const addToSelectedFilters = (
|
|
141
|
+
key: string,
|
|
142
|
+
value: string
|
|
143
|
+
): SearchAction => ({ type: "ADD_TO_SELECTEDFILTERS", key, value });
|
|
144
|
+
export const removeFromSelectedFilters = (
|
|
145
|
+
key: string,
|
|
146
|
+
value: string
|
|
147
|
+
): SearchAction => ({ type: "REMOVE_FROM_SELECTEDFILTERS", key, value });
|
|
148
|
+
export const clearAllSelectedFilters = () => ({
|
|
149
|
+
type: "CLEAR_SELECTED_FILTERS",
|
|
150
|
+
});
|
|
151
|
+
export const searchFilters = (key: string, value: string): SearchAction => ({
|
|
152
|
+
type: "SEARCH_FILTERS",
|
|
153
|
+
key,
|
|
154
|
+
value,
|
|
155
|
+
});
|
|
156
|
+
export const filterChanged = (): SearchAction => ({ type: "FILTER_CHANGED" });
|
|
157
|
+
export const clearRequestImage = (): SearchAction => ({
|
|
158
|
+
type: "CLEAR_REQUEST_IMAGE",
|
|
90
159
|
});
|
|
91
|
-
export const submitPositiveFeedback = () : SearchAction => ({ type: 'FEEDBACK_SUBMIT_POSITIVE'});
|
|
92
|
-
export const submitNegativeFeedback = () : SearchAction => ({ type: 'FEEDBACK_SUBMIT_NEGATIVE'});
|
|
93
|
-
export const loadFilters = (): SearchAction => ({type: 'LOAD_FILTERS'});
|
|
94
|
-
export const addToSelectedFilters =(key: string , value: string): SearchAction => ({type : 'ADD_TO_SELECTEDFILTERS' , key , value});
|
|
95
|
-
export const removeFromSelectedFilters = (key: string, value: string) : SearchAction => ({type: 'REMOVE_FROM_SELECTEDFILTERS', key, value});
|
|
96
|
-
export const reducer = (state : SearchState = initialState, action: SearchAction) => {
|
|
97
|
-
switch (action.type) {
|
|
98
|
-
case "IMAGE_LOADED":
|
|
99
|
-
let { image } = action;
|
|
100
|
-
console.log('image', image)
|
|
101
|
-
return {
|
|
102
|
-
...initialState,
|
|
103
|
-
requestImage: image,
|
|
104
|
-
selectedFilters: state.selectedFilters
|
|
105
160
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
161
|
+
export const reducer = (
|
|
162
|
+
state: SearchState = initialState,
|
|
163
|
+
action: SearchAction
|
|
164
|
+
) => {
|
|
165
|
+
switch (action.type) {
|
|
166
|
+
case "IMAGE_LOADED":
|
|
167
|
+
let { image } = action;
|
|
168
|
+
console.log("image", image);
|
|
169
|
+
return {
|
|
170
|
+
...initialState,
|
|
171
|
+
requestImage: image,
|
|
172
|
+
selectedFilters: state.selectedFilters,
|
|
173
|
+
};
|
|
174
|
+
case "CAD_LOADED":
|
|
175
|
+
let { file } = action;
|
|
176
|
+
return {
|
|
177
|
+
...initialState,
|
|
178
|
+
requestCadFile: file,
|
|
179
|
+
};
|
|
180
|
+
case "REGION_REQUEST_START":
|
|
181
|
+
return {
|
|
182
|
+
...state,
|
|
183
|
+
fetchingRegions: true,
|
|
184
|
+
};
|
|
185
|
+
case "REGION_REQUEST_SUCCEED":
|
|
186
|
+
return {
|
|
187
|
+
...state,
|
|
188
|
+
fetchingRegions: false,
|
|
189
|
+
regions: action.regions,
|
|
190
|
+
selectedRegion: selectFirstCenteredRegion(
|
|
191
|
+
action.regions,
|
|
192
|
+
0.3,
|
|
193
|
+
state.selectedRegion
|
|
194
|
+
),
|
|
195
|
+
};
|
|
196
|
+
case "REGION_REQUEST_FAIL":
|
|
197
|
+
return {
|
|
198
|
+
...state,
|
|
199
|
+
fetchingRegions: false,
|
|
200
|
+
errorMessage: action.exception.response.data.detail,
|
|
201
|
+
};
|
|
202
|
+
case "SEARCH_REQUEST_START":
|
|
203
|
+
return {
|
|
204
|
+
...state,
|
|
205
|
+
fetchingResults: true,
|
|
206
|
+
};
|
|
207
|
+
case "SEARCH_REQUEST_SUCCEED":
|
|
208
|
+
let { results, requestId, duration, categoryPredictions, codes } = action;
|
|
209
|
+
return {
|
|
210
|
+
...state,
|
|
211
|
+
results,
|
|
212
|
+
requestId,
|
|
213
|
+
fetchingResults: false,
|
|
214
|
+
sessionId: state.sessionId || requestId,
|
|
215
|
+
categoryPredictions,
|
|
216
|
+
codes,
|
|
217
|
+
duration,
|
|
218
|
+
};
|
|
219
|
+
case "SEARCH_REQUEST_FAIL":
|
|
220
|
+
return {
|
|
221
|
+
...state,
|
|
222
|
+
fetchingResults: false,
|
|
223
|
+
errorMessage: action.reason,
|
|
224
|
+
};
|
|
225
|
+
case "REGION_CHANGED":
|
|
226
|
+
return {
|
|
227
|
+
...state,
|
|
228
|
+
selectedRegion: action.normalizedRect,
|
|
229
|
+
};
|
|
230
|
+
case "LOAD_FILTERS_SUCCESS":
|
|
231
|
+
return {
|
|
232
|
+
...state,
|
|
233
|
+
filters: action.filters,
|
|
234
|
+
};
|
|
235
|
+
case "LOAD_FILTERS_FAIL":
|
|
236
|
+
return {
|
|
237
|
+
...state,
|
|
238
|
+
errorMessage: action.exception.response.data.detail,
|
|
239
|
+
};
|
|
240
|
+
case "ADD_TO_SELECTEDFILTERS":
|
|
241
|
+
return {
|
|
242
|
+
...state,
|
|
243
|
+
selectedFilters: ADDtoSelectedfilters(
|
|
244
|
+
state.selectedFilters,
|
|
245
|
+
action.key,
|
|
246
|
+
action.value
|
|
247
|
+
),
|
|
248
|
+
};
|
|
249
|
+
case "REMOVE_FROM_SELECTEDFILTERS":
|
|
250
|
+
return {
|
|
251
|
+
...state,
|
|
252
|
+
selectedFilters: RemoveFromSelectedFilters(
|
|
253
|
+
state.selectedFilters,
|
|
254
|
+
action.key,
|
|
255
|
+
action.value
|
|
256
|
+
),
|
|
257
|
+
};
|
|
258
|
+
case "CLEAR_SELECTED_FILTERS":
|
|
259
|
+
return {
|
|
260
|
+
...state,
|
|
261
|
+
selectedFilters: new Map<string, string[]>(),
|
|
262
|
+
};
|
|
263
|
+
case "CLEAR_REQUEST_IMAGE":
|
|
264
|
+
return {
|
|
265
|
+
...state,
|
|
266
|
+
requestImage: undefined,
|
|
267
|
+
};
|
|
268
|
+
case "UPDATE_FILTERS":
|
|
269
|
+
return {
|
|
270
|
+
...state,
|
|
271
|
+
filters: UpdateFilters(state.filters, action.key, action.values),
|
|
272
|
+
};
|
|
273
|
+
}
|
|
274
|
+
return state;
|
|
275
|
+
};
|
|
184
276
|
|
|
277
|
+
function ADDtoSelectedfilters(
|
|
278
|
+
selectedFilters: Map<string, string[]>,
|
|
279
|
+
key: string,
|
|
280
|
+
value: string
|
|
281
|
+
): Map<string, string[]> {
|
|
282
|
+
if (selectedFilters) {
|
|
283
|
+
let values = selectedFilters.get(key);
|
|
284
|
+
if (values) {
|
|
285
|
+
values.push(value);
|
|
286
|
+
} else {
|
|
287
|
+
values = new Array<string>(value);
|
|
185
288
|
}
|
|
186
|
-
|
|
187
|
-
}
|
|
289
|
+
selectedFilters.set(key, values);
|
|
290
|
+
}
|
|
291
|
+
console.log(selectedFilters);
|
|
292
|
+
return selectedFilters;
|
|
293
|
+
}
|
|
188
294
|
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
return selectedFilters;
|
|
295
|
+
function RemoveFromSelectedFilters(
|
|
296
|
+
selectedFilters: Map<string, string[]>,
|
|
297
|
+
key: string,
|
|
298
|
+
value: string
|
|
299
|
+
): Map<string, string[]> {
|
|
300
|
+
if (selectedFilters) {
|
|
301
|
+
let values = selectedFilters.get(key);
|
|
302
|
+
if (values) {
|
|
303
|
+
values = values.filter((x) => x !== value);
|
|
304
|
+
selectedFilters.set(key, values);
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
console.log(selectedFilters);
|
|
308
|
+
return selectedFilters;
|
|
204
309
|
}
|
|
205
310
|
|
|
206
|
-
function
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
311
|
+
function UpdateFilters(filters: Filter[], key: string, values: string[]) {
|
|
312
|
+
console.log(filters);
|
|
313
|
+
console.log(key);
|
|
314
|
+
console.log(values);
|
|
315
|
+
console.log(filters.find((x) => x.key === key));
|
|
316
|
+
if (filters && filters.length > 0 && filters.find((x) => x.key === key)) {
|
|
317
|
+
let idx = filters.findIndex((x) => x.key === key);
|
|
318
|
+
filters[idx].values = values;
|
|
319
|
+
console.log(filters);
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
return filters;
|
|
218
323
|
}
|
|
@@ -1,17 +1,20 @@
|
|
|
1
|
-
import React from
|
|
1
|
+
import React from "react";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
|
|
3
|
+
const CategoryFilter = ({ cats }: { cats: string[] }) => {
|
|
4
|
+
if (cats.length === 0) {
|
|
5
|
+
return null;
|
|
6
|
+
}
|
|
7
|
+
return (
|
|
8
|
+
<div id="catlist" style={{ textAlign: "center" }}>
|
|
9
|
+
{
|
|
10
|
+
cats.map((s) => (
|
|
11
|
+
<a key={s} href="#top">
|
|
12
|
+
{s}
|
|
13
|
+
</a>
|
|
14
|
+
)) // TODO fix link
|
|
15
|
+
}
|
|
16
|
+
</div>
|
|
17
|
+
);
|
|
15
18
|
};
|
|
16
19
|
|
|
17
20
|
export default CategoryFilter;
|
package/src/components/Codes.tsx
CHANGED
|
@@ -1,20 +1,24 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import {Code} from
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Code } from "@nyris/nyris-api";
|
|
3
3
|
|
|
4
4
|
interface Props {
|
|
5
|
-
|
|
5
|
+
codes: Code[];
|
|
6
6
|
}
|
|
7
|
-
const Codes = ({codes}: Props) =>
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
7
|
+
const Codes = ({ codes }: Props) => (
|
|
8
|
+
<>
|
|
9
|
+
<div className="codes" style={{ textAlign: "center" }}>
|
|
10
|
+
{codes.length > 0 && (
|
|
11
|
+
<span style={{ fontSize: "0.8em" }}>
|
|
12
|
+
Codes
|
|
13
|
+
<br />{" "}
|
|
14
|
+
</span>
|
|
15
|
+
)}
|
|
16
|
+
{codes.map((c, i) => (
|
|
17
|
+
<small key={i} title={c.type}>
|
|
18
|
+
{c.value}
|
|
19
|
+
</small>
|
|
20
|
+
))}
|
|
21
|
+
</div>
|
|
22
|
+
</>
|
|
23
|
+
);
|
|
20
24
|
export default Codes;
|
|
@@ -1,24 +1,34 @@
|
|
|
1
|
-
import React from
|
|
1
|
+
import React from "react";
|
|
2
2
|
|
|
3
3
|
interface ExampleImagesProps {
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
images: string[];
|
|
5
|
+
onExampleImageClicked: (url: string) => void;
|
|
6
6
|
}
|
|
7
7
|
|
|
8
|
-
const ExampleImages
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
8
|
+
const ExampleImages: React.FC<ExampleImagesProps> = ({
|
|
9
|
+
images,
|
|
10
|
+
onExampleImageClicked,
|
|
11
|
+
}) => {
|
|
12
|
+
if (images.length === 0) {
|
|
13
|
+
return null;
|
|
14
|
+
}
|
|
15
|
+
return (
|
|
16
|
+
<section className="useExampleImg">
|
|
17
|
+
You can also try one of these pictures:
|
|
18
|
+
<div className="exampleImages">
|
|
19
|
+
<div className="exImagesWrap">
|
|
20
|
+
{images.map((i) => (
|
|
21
|
+
<img
|
|
22
|
+
key={i}
|
|
23
|
+
src={i}
|
|
24
|
+
alt=""
|
|
25
|
+
onClick={() => onExampleImageClicked(i)}
|
|
26
|
+
/>
|
|
27
|
+
))}
|
|
28
|
+
</div>
|
|
29
|
+
</div>
|
|
30
|
+
</section>
|
|
31
|
+
);
|
|
22
32
|
};
|
|
23
33
|
|
|
24
34
|
export default ExampleImages;
|