no mature for simplesite

This commit is contained in:
zeppi 2021-03-24 20:38:40 -04:00 committed by jessopb
parent 3e0a83d10b
commit 9f89242d85

View file

@ -2,44 +2,45 @@ import { SETTINGS, DAEMON_SETTINGS } from 'lbry-redux';
import { createSelector } from 'reselect'; import { createSelector } from 'reselect';
import homepages from 'homepages'; import homepages from 'homepages';
import { getDefaultHomepageKey, getDefaultLanguage } from 'util/default-languages'; import { getDefaultHomepageKey, getDefaultLanguage } from 'util/default-languages';
import { SIMPLE_SITE } from 'config';
const selectState = state => state.settings || {}; const selectState = (state) => state.settings || {};
export const selectDaemonSettings = createSelector(selectState, state => state.daemonSettings); export const selectDaemonSettings = createSelector(selectState, (state) => state.daemonSettings);
export const selectDaemonStatus = createSelector(selectState, state => state.daemonStatus); export const selectDaemonStatus = createSelector(selectState, (state) => state.daemonStatus);
export const selectFfmpegStatus = createSelector(selectDaemonStatus, status => status.ffmpeg_status); export const selectFfmpegStatus = createSelector(selectDaemonStatus, (status) => status.ffmpeg_status);
export const selectFindingFFmpeg = createSelector(selectState, state => state.findingFFmpeg || false); export const selectFindingFFmpeg = createSelector(selectState, (state) => state.findingFFmpeg || false);
export const selectClientSettings = createSelector(selectState, state => state.clientSettings || {}); export const selectClientSettings = createSelector(selectState, (state) => state.clientSettings || {});
export const selectLoadedLanguages = createSelector(selectState, state => state.loadedLanguages || {}); export const selectLoadedLanguages = createSelector(selectState, (state) => state.loadedLanguages || {});
export const makeSelectClientSetting = setting => export const makeSelectClientSetting = (setting) =>
createSelector(selectClientSettings, settings => (settings ? settings[setting] : undefined)); createSelector(selectClientSettings, (settings) => (settings ? settings[setting] : undefined));
// refactor me // refactor me
export const selectShowMatureContent = makeSelectClientSetting(SETTINGS.SHOW_MATURE); export const selectShowMatureContent = SIMPLE_SITE ? false : makeSelectClientSetting(SETTINGS.SHOW_MATURE);
// and me // and me
export const selectShowRepostedContent = makeSelectClientSetting(SETTINGS.HIDE_REPOSTS); export const selectShowRepostedContent = makeSelectClientSetting(SETTINGS.HIDE_REPOSTS);
export const selectTheme = makeSelectClientSetting(SETTINGS.THEME); export const selectTheme = makeSelectClientSetting(SETTINGS.THEME);
export const selectAutomaticDarkModeEnabled = makeSelectClientSetting(SETTINGS.AUTOMATIC_DARK_MODE_ENABLED); export const selectAutomaticDarkModeEnabled = makeSelectClientSetting(SETTINGS.AUTOMATIC_DARK_MODE_ENABLED);
export const selectIsNight = createSelector(selectState, state => state.isNight); export const selectIsNight = createSelector(selectState, (state) => state.isNight);
export const selectSavedWalletServers = createSelector(selectState, state => state.customWalletServers); export const selectSavedWalletServers = createSelector(selectState, (state) => state.customWalletServers);
export const selectSharedPreferences = createSelector(selectState, state => state.sharedPreferences); export const selectSharedPreferences = createSelector(selectState, (state) => state.sharedPreferences);
export const makeSelectSharedPreferencesForKey = key => export const makeSelectSharedPreferencesForKey = (key) =>
createSelector(selectSharedPreferences, prefs => (prefs ? prefs[key] : undefined)); createSelector(selectSharedPreferences, (prefs) => (prefs ? prefs[key] : undefined));
export const selectHasWalletServerPrefs = createSelector( export const selectHasWalletServerPrefs = createSelector(
makeSelectSharedPreferencesForKey(DAEMON_SETTINGS.LBRYUM_SERVERS), makeSelectSharedPreferencesForKey(DAEMON_SETTINGS.LBRYUM_SERVERS),
servers => { (servers) => {
return !!(servers && servers.length); return !!(servers && servers.length);
} }
); );
@ -54,18 +55,18 @@ export const selectThemePath = createSelector(
} }
); );
export const selectHomepageCode = createSelector(makeSelectClientSetting(SETTINGS.HOMEPAGE), setting => { export const selectHomepageCode = createSelector(makeSelectClientSetting(SETTINGS.HOMEPAGE), (setting) => {
return homepages[setting] ? setting : getDefaultHomepageKey(); return homepages[setting] ? setting : getDefaultHomepageKey();
}); });
export const selectLanguage = createSelector(makeSelectClientSetting(SETTINGS.LANGUAGE), setting => { export const selectLanguage = createSelector(makeSelectClientSetting(SETTINGS.LANGUAGE), (setting) => {
return setting || getDefaultLanguage(); return setting || getDefaultLanguage();
}); });
export const selectHomepageData = createSelector( export const selectHomepageData = createSelector(
// using homepage setting, // using homepage setting,
selectHomepageCode, selectHomepageCode,
homepageCode => { (homepageCode) => {
// homepages = { 'en': homepageFile, ... } // homepages = { 'en': homepageFile, ... }
return homepages[homepageCode]; return homepages[homepageCode];
} }