diff --git a/src/components/Form/Settings/Switch/Switch.jsx b/src/components/Form/Settings/Switch/Switch.jsx index 29a1a25f..006388d3 100644 --- a/src/components/Form/Settings/Switch/Switch.jsx +++ b/src/components/Form/Settings/Switch/Switch.jsx @@ -20,6 +20,10 @@ class Switch extends PureComponent { checked: value, }); + if (this.props.onChange) { + this.props.onChange(value); + } + variables.stats.postEvent( 'setting', `${this.props.name} ${this.state.checked === true ? 'enabled' : 'disabled'}`, diff --git a/src/features/background/options/BackgroundOptions.jsx b/src/features/background/options/BackgroundOptions.jsx index 6bb8c489..1a85f00c 100644 --- a/src/features/background/options/BackgroundOptions.jsx +++ b/src/features/background/options/BackgroundOptions.jsx @@ -87,7 +87,6 @@ class BackgroundOptions extends PureComponent { } render() { - const APISettings = ( <> @@ -149,17 +148,19 @@ class BackgroundOptions extends PureComponent { {this.state.backgroundAPI === 'unsplash' && ( - { ); const [enableBirthday, setEnableBirthday] = useState( - localStorage.getItem('birthdayenabled') === 'true' ? '' : 'preferencesInactive' + localStorage.getItem('birthdayenabled') === 'true' ? 'preferences' : 'preferencesInactive' ); const [enableCustomEvents, setEnableCustomEvents] = useState( - localStorage.getItem('events') === 'true' ? '' : 'preferencesInactive' + localStorage.getItem('events') === 'true' ? 'preferences' : 'preferencesInactive' ); const changeDate = (e) => { @@ -137,8 +139,9 @@ const GreetingOptions = () => { name="birthdayenabled" text={variables.getMessage('modals.main.settings.enabled')} category="greeting" + onChange={(value) => { setEnableBirthday(value ? 'preferences' : 'preferencesInactive'); }} /> -
+
{ const CustomEventsSection = () => { return ( -
+
@@ -303,6 +306,7 @@ const GreetingOptions = () => { name="events" text={variables.getMessage(`${GREETING_SECTION}.events`)} category="greeting" + onChange={(value) => { setEnableCustomEvents(value ? 'preferences' : 'preferencesInactive'); }} />