lbry-desktop/ui/js/selectors/settings.js

36 lines
837 B
JavaScript
Raw Normal View History

2017-06-06 23:19:12 +02:00
import { createSelector } from "reselect";
2017-06-06 06:21:55 +02:00
const _selectState = state => state.settings || {};
export const selectDaemonSettings = createSelector(
_selectState,
state => state.daemonSettings
2017-06-06 06:21:55 +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-08-21 05:06:26 +02:00
export const makeSelectClientSetting = setting => {
return createSelector(
selectClientSettings,
settings => (settings ? settings[setting] : undefined)
);
};
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
);
2017-08-08 11:36:14 +02:00
2017-08-19 20:03:51 +02:00
export const selectLanguages = createSelector(
2017-08-08 11:36:14 +02:00
_selectState,
2017-08-19 20:03:51 +02:00
state => state.languages || {}
2017-08-08 11:36:14 +02:00
);