-
Notifications
You must be signed in to change notification settings - Fork 3
/
selectors.es
48 lines (42 loc) · 1.04 KB
/
selectors.es
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
47
48
import {
createSelector,
} from 'reselect'
import { _ } from 'lodash'
import {
configLayoutSelector,
configDoubleTabbedSelector,
basicSelector,
constSelector,
mapsSelector,
} from 'views/utils/selectors'
import { exlist } from './lib/util'
const shipChecksumSelector = createSelector(
constSelector,
({$ships}) =>
_.sum(Object.keys($ships||{}).map(mstIdStr =>
parseInt(mstIdStr,10))))
const unclearedExListSelector = createSelector(
mapsSelector,
maps => _.flatMap(
exlist,
(exStr, index) => {
const mapIdStr = exStr.split('-').join('')
const cleared = _.get(maps, `${mapIdStr}.api_cleared`) === 1
return cleared ? [] : [exStr]
}))
const mainUISelector = createSelector(
configLayoutSelector,
configDoubleTabbedSelector,
basicSelector,
shipChecksumSelector,
mapsSelector,
unclearedExListSelector,
(layout, doubleTabbed, basic, shipChecksum, maps, unclearedExList) => ({
layout, doubleTabbed,
basic, maps,
shipChecksum,
unclearedExList,
}))
export {
mainUISelector,
}