lbry-desktop/src/renderer/redux/selectors/settings.js
2017-12-27 20:48:11 -03:00

24 lines
841 B
JavaScript

import * as SETTINGS from 'constants/settings';
import { createSelector } from 'reselect';
const selectState = state => state.settings || {};
export const selectDaemonSettings = createSelector(selectState, state => state.daemonSettings);
export const selectClientSettings = createSelector(
selectState,
state => state.clientSettings || {}
);
export const makeSelectClientSetting = setting =>
createSelector(selectClientSettings, settings => (settings ? settings[setting] : undefined));
// refactor me
export const selectShowNsfw = makeSelectClientSetting(SETTINGS.SHOW_NSFW);
export const selectLanguages = createSelector(selectState, state => state.languages || {});
export const selectThemePath = createSelector(
makeSelectClientSetting(SETTINGS.THEME),
theme => `${staticResourcesPath}/themes/${theme || 'light'}.css`
);