From f79c622edf932ede9b5667cedebb431abcfb06ee Mon Sep 17 00:00:00 2001 From: Byron Eric Perez <89370060+ByronEricPerez@users.noreply.github.com> Date: Tue, 28 Jun 2022 17:01:19 -0300 Subject: [PATCH] Added checkbox to enable/disable background (#7630) * Added checkbox to enable/disable background * bug fix in enable disable button * small fix in translation * rename background setting to be disable backgroud; add default value for background setting. --- static/app-strings.json | 2 ++ ui/component/settingAppearance/index.js | 1 + ui/component/settingAppearance/view.jsx | 11 ++++++++++- ui/component/wallpaper/index.js | 20 ++++++++------------ ui/component/wallpaper/view.jsx | 6 ++++-- ui/constants/settings.js | 1 + ui/redux/reducers/settings.js | 1 + 7 files changed, 27 insertions(+), 15 deletions(-) diff --git a/static/app-strings.json b/static/app-strings.json index 6576939b8..61bdbd0bd 100644 --- a/static/app-strings.json +++ b/static/app-strings.json @@ -2312,5 +2312,7 @@ "Free --[legend, unused disk space]--": "Free", "Top content in %language%": "Top content in %language%", "Apply": "Apply", + "24-hour clock": "24-hour clock", + "Disable background": "Disable background", "--end--": "--end--" } diff --git a/ui/component/settingAppearance/index.js b/ui/component/settingAppearance/index.js index 45d1b44e8..7b3f9c2fa 100644 --- a/ui/component/settingAppearance/index.js +++ b/ui/component/settingAppearance/index.js @@ -5,6 +5,7 @@ import { makeSelectClientSetting } from 'redux/selectors/settings'; import SettingAppearance from './view'; const select = (state) => ({ + disableBackground: makeSelectClientSetting(SETTINGS.DISABLE_BACKGROUND)(state), clock24h: makeSelectClientSetting(SETTINGS.CLOCK_24H)(state), searchInLanguage: makeSelectClientSetting(SETTINGS.SEARCH_IN_LANGUAGE)(state), hideBalance: makeSelectClientSetting(SETTINGS.HIDE_BALANCE)(state), diff --git a/ui/component/settingAppearance/view.jsx b/ui/component/settingAppearance/view.jsx index 9425ec436..2065a5c7e 100644 --- a/ui/component/settingAppearance/view.jsx +++ b/ui/component/settingAppearance/view.jsx @@ -12,6 +12,7 @@ import ThemeSelector from 'component/themeSelector'; import homepages from 'homepages'; type Props = { + disableBackground: boolean, clock24h: boolean, searchInLanguage: boolean, hideBalance: boolean, @@ -20,7 +21,7 @@ type Props = { }; export default function SettingAppearance(props: Props) { - const { clock24h, searchInLanguage, hideBalance, setClientSetting, setSearchInLanguage } = props; + const { clock24h, disableBackground, searchInLanguage, hideBalance, setClientSetting, setSearchInLanguage } = props; return ( <> @@ -63,6 +64,14 @@ export default function SettingAppearance(props: Props) { checked={clock24h} /> + + setClientSetting(SETTINGS.DISABLE_BACKGROUND, !disableBackground)} + checked={disableBackground} + /> + { - if (props.uri && (props.uri.indexOf('@') !== -1 || props.uri.indexOf('#') !== -1)) { - return { - cover: makeSelectCoverForUri(props.uri)(state), - avatar: makeSelectAvatarForUri(props.uri)(state), - }; - } else return {}; -}; -*/ +const select = (state) => ({ + disableBackground: makeSelectClientSetting(SETTINGS.DISABLE_BACKGROUND)(state), +}); -export default connect()(Wallpaper); +const perform = {}; + +export default connect(select, perform)(Wallpaper); diff --git a/ui/component/wallpaper/view.jsx b/ui/component/wallpaper/view.jsx index 3b21a735f..8fd610165 100644 --- a/ui/component/wallpaper/view.jsx +++ b/ui/component/wallpaper/view.jsx @@ -8,10 +8,11 @@ type Props = { // cover: ?string, // avatar: ?string, reset: ?boolean, + disableBackground: ?boolean, }; const Wallpaper = (props: Props) => { - // const { cover, avatar } = props; + const { disableBackground } = props; /* if (avatar) { @@ -227,12 +228,13 @@ const Wallpaper = (props: Props) => { }} /> */ + return ( <>
diff --git a/ui/constants/settings.js b/ui/constants/settings.js index a56b28fc3..9121f71bc 100644 --- a/ui/constants/settings.js +++ b/ui/constants/settings.js @@ -14,6 +14,7 @@ export const THEME = 'theme'; export const THEMES = 'themes'; export const AUTOMATIC_DARK_MODE_ENABLED = 'automatic_dark_mode_enabled'; export const CLOCK_24H = 'clock_24h'; +export const DISABLE_BACKGROUND = 'disableBackground'; export const AUTOPLAY_MEDIA = 'autoplay'; export const AUTOPLAY_NEXT = 'autoplay_next'; export const OS_NOTIFICATIONS_ENABLED = 'os_notifications_enabled'; diff --git a/ui/redux/reducers/settings.js b/ui/redux/reducers/settings.js index 36e6250db..f82faf6f6 100644 --- a/ui/redux/reducers/settings.js +++ b/ui/redux/reducers/settings.js @@ -40,6 +40,7 @@ const defaultState = { [SETTINGS.OS_NOTIFICATIONS_ENABLED]: true, [SETTINGS.AUTOMATIC_DARK_MODE_ENABLED]: false, [SETTINGS.CLOCK_24H]: false, + [SETTINGS.DISABLE_BACKGROUND]: false, [SETTINGS.TILE_LAYOUT]: true, [SETTINGS.VIDEO_THEATER_MODE]: false, [SETTINGS.VIDEO_PLAYBACK_RATE]: 1,