2017-06-06 23:19:12 +02:00
|
|
|
import { createSelector } from "reselect";
|
2017-05-17 23:52:45 +02:00
|
|
|
|
2017-06-06 06:21:55 +02:00
|
|
|
const _selectState = state => state.settings || {};
|
2017-05-17 23:52:45 +02:00
|
|
|
|
|
|
|
export const selectDaemonSettings = createSelector(
|
|
|
|
_selectState,
|
2017-06-06 23:19:12 +02:00
|
|
|
state => state.daemonSettings || {}
|
2017-06-06 06:21:55 +02:00
|
|
|
);
|
2017-05-17 23:52:45 +02:00
|
|
|
|
|
|
|
export const selectClientSettings = createSelector(
|
|
|
|
_selectState,
|
2017-06-28 09:12:01 +02:00
|
|
|
state => state.clientSettings || {}
|
2017-06-06 06:21:55 +02:00
|
|
|
);
|
2017-05-17 23:52:45 +02:00
|
|
|
|
|
|
|
export const selectSettingsIsGenerous = createSelector(
|
|
|
|
selectDaemonSettings,
|
2017-06-06 23:19:12 +02:00
|
|
|
settings => settings && settings.is_generous_host
|
2017-06-06 06:21:55 +02:00
|
|
|
);
|
2017-06-28 09:12:01 +02:00
|
|
|
|
|
|
|
export const selectShowNsfw = createSelector(
|
|
|
|
selectClientSettings,
|
|
|
|
clientSettings => !!clientSettings.showNsfw
|
|
|
|
);
|