summaryrefslogtreecommitdiff
path: root/src/core/plugins/layout/selectors.js
blob: 7d75d37dc88a85fb069a823f7268139bd7072aea (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import { createSelector } from "reselect"
import { normalizeArray } from "core/utils"
import { fromJS } from "immutable"

const state = state => state

export const current = state => state.get("layout")

export const currentFilter = state => state.get("filter")

export const isShown = (state, thing, def) => {
  thing = normalizeArray(thing)
  return state.get("shown", fromJS({})).get(fromJS(thing), def)
}

export const whatMode = (state, thing, def="") => {
  thing = normalizeArray(thing)
  return state.getIn(["modes", ...thing], def)
}

export const showSummary = createSelector(
  state,
  state => !isShown(state, "editor")
)