Added checkbox to enable/disable background #7630

Merged
ByronEricPerez merged 4 commits from Add_a_setting_to_disable_the_background_image_#7616 into master 2022-06-28 22:01:19 +02:00
6 changed files with 26 additions and 15 deletions
Showing only changes of commit 6aa914ab14 - Show all commits

View file

@ -2312,5 +2312,7 @@
"Free --[legend, unused disk space]--": "Free", "Free --[legend, unused disk space]--": "Free",
"Top content in %language%": "Top content in %language%", "Top content in %language%": "Top content in %language%",
"Apply": "Apply", "Apply": "Apply",
"24-hour clockss": "24-hour clockss",
"background": "background",
"--end--": "--end--" "--end--": "--end--"
} }

View file

@ -5,6 +5,7 @@ import { makeSelectClientSetting } from 'redux/selectors/settings';
import SettingAppearance from './view'; import SettingAppearance from './view';
const select = (state) => ({ const select = (state) => ({
background: makeSelectClientSetting(SETTINGS.BACKGROUND)(state),
clock24h: makeSelectClientSetting(SETTINGS.CLOCK_24H)(state), clock24h: makeSelectClientSetting(SETTINGS.CLOCK_24H)(state),
searchInLanguage: makeSelectClientSetting(SETTINGS.SEARCH_IN_LANGUAGE)(state), searchInLanguage: makeSelectClientSetting(SETTINGS.SEARCH_IN_LANGUAGE)(state),
hideBalance: makeSelectClientSetting(SETTINGS.HIDE_BALANCE)(state), hideBalance: makeSelectClientSetting(SETTINGS.HIDE_BALANCE)(state),

View file

@ -12,6 +12,7 @@ import ThemeSelector from 'component/themeSelector';
import homepages from 'homepages'; import homepages from 'homepages';
type Props = { type Props = {
background: boolean,
clock24h: boolean, clock24h: boolean,
searchInLanguage: boolean, searchInLanguage: boolean,
hideBalance: boolean, hideBalance: boolean,
@ -20,7 +21,7 @@ type Props = {
}; };
export default function SettingAppearance(props: Props) { export default function SettingAppearance(props: Props) {
const { clock24h, searchInLanguage, hideBalance, setClientSetting, setSearchInLanguage } = props; const { clock24h, background, searchInLanguage, hideBalance, setClientSetting, setSearchInLanguage } = props;
return ( return (
<> <>
@ -63,6 +64,14 @@ export default function SettingAppearance(props: Props) {
checked={clock24h} checked={clock24h}
/> />
</SettingsRow> </SettingsRow>
<SettingsRow title={__('Disable background')}>
<FormField
type="checkbox"
name="background"
onChange={() => setClientSetting(SETTINGS.BACKGROUND, !background)}
checked={background}
/>
</SettingsRow>
<SettingsRow title={__('Hide wallet balance in header')}> <SettingsRow title={__('Hide wallet balance in header')}>
<FormField <FormField
type="checkbox" type="checkbox"

View file

@ -1,16 +1,12 @@
import { connect } from 'react-redux'; import { connect } from 'react-redux';
// import { makeSelectCoverForUri, makeSelectAvatarForUri } from 'redux/selectors/claims';
import Wallpaper from './view'; import Wallpaper from './view';
import * as SETTINGS from 'constants/settings';
import { makeSelectClientSetting } from 'redux/selectors/settings';
jessopb commented 2022-06-28 19:38:34 +02:00 (Migrated from github.com)
Review

https://github.com/lbryio/lbry-desktop/blob/master/ui/redux/reducers/settings.js we've been making sure client settings have defaults

https://github.com/lbryio/lbry-desktop/blob/master/ui/redux/reducers/settings.js we've been making sure client settings have defaults
/* const select = (state) => ({
const select = (state, props) => { background: makeSelectClientSetting(SETTINGS.BACKGROUND)(state),
if (props.uri && (props.uri.indexOf('@') !== -1 || props.uri.indexOf('#') !== -1)) { });
return {
cover: makeSelectCoverForUri(props.uri)(state),
avatar: makeSelectAvatarForUri(props.uri)(state),
};
} else return {};
};
*/
export default connect()(Wallpaper); const perform = {};
export default connect(select, perform)(Wallpaper);

View file

@ -8,10 +8,11 @@ type Props = {
// cover: ?string, // cover: ?string,
// avatar: ?string, // avatar: ?string,
reset: ?boolean, reset: ?boolean,
background: ?boolean,
}; };
const Wallpaper = (props: Props) => { const Wallpaper = (props: Props) => {
// const { cover, avatar } = props; const { background } = props;
/* /*
if (avatar) { if (avatar) {
@ -227,12 +228,13 @@ const Wallpaper = (props: Props) => {
}} }}
/> />
*/ */
return ( return (
<> <>
<div <div
className={'background-image'} className={'background-image'}
style={{ style={{
backgroundImage: `url(${freeezepeach})`, backgroundImage: background ? `url(${freeezepeach})` : `none`,
}} }}
/> />
<div className={'theme'} /> <div className={'theme'} />

View file

@ -14,6 +14,7 @@ export const THEME = 'theme';
export const THEMES = 'themes'; export const THEMES = 'themes';
export const AUTOMATIC_DARK_MODE_ENABLED = 'automatic_dark_mode_enabled'; export const AUTOMATIC_DARK_MODE_ENABLED = 'automatic_dark_mode_enabled';
export const CLOCK_24H = 'clock_24h'; export const CLOCK_24H = 'clock_24h';
export const BACKGROUND = 'background';
export const AUTOPLAY_MEDIA = 'autoplay'; export const AUTOPLAY_MEDIA = 'autoplay';
export const AUTOPLAY_NEXT = 'autoplay_next'; export const AUTOPLAY_NEXT = 'autoplay_next';
export const OS_NOTIFICATIONS_ENABLED = 'os_notifications_enabled'; export const OS_NOTIFICATIONS_ENABLED = 'os_notifications_enabled';