-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathroute.js
46 lines (37 loc) · 1.3 KB
/
route.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import React from 'react';
import * as _discoverySel from './state';
import {featureRoute,
PRIORITY} from 'feature-router';
import featureName from './featureName';
import DiscoveryFilterScreen from './comp/DiscoveryFilterScreen';
import DiscoveryListScreen from './comp/DiscoveryListScreen';
// ***
// *** The routes for this feature.
// ***
export default [
featureRoute({
priority: PRIORITY.HIGH,
content({fassets, appState}) {
// display DiscoveryFilterScreen, when form is active (accomplished by our logic)
// ... this is done as a priority route, because this screen can be used to
// actually change the view - so we display it regarless of the state of the active view
if (_discoverySel.isFormFilterActive(appState)) {
return <DiscoveryFilterScreen/>;
}
}
}),
featureRoute({
//priority: PRIORITY.STANDARD,
content({fassets, appState}) {
// allow other down-stream features to route, when the active view is NOT ours
if (fassets.sel.getView(appState) !== featureName) {
return null;
}
// ***
// *** at this point we know the active view is ours
// ***
// display our DiscoveryListScreen
return <DiscoveryListScreen/>;
}
}),
];