disabled auto dark mode if dark mode is selected
This commit is contained in:
parent
fcc26a1930
commit
e42c7aba83
1 changed files with 13 additions and 4 deletions
|
@ -14,6 +14,8 @@ class SettingsPage extends React.PureComponent {
|
||||||
this.state = {
|
this.state = {
|
||||||
clearingCache: false,
|
clearingCache: false,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
this.onAutomaticDarkModeChange = this.onAutomaticDarkModeChange.bind(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
clearCache() {
|
clearCache() {
|
||||||
|
@ -62,11 +64,16 @@ class SettingsPage extends React.PureComponent {
|
||||||
|
|
||||||
onThemeChange(event) {
|
onThemeChange(event) {
|
||||||
const { value } = event.target;
|
const { value } = event.target;
|
||||||
|
|
||||||
|
if (value === 'dark') {
|
||||||
|
this.onAutomaticDarkModeChange(false);
|
||||||
|
}
|
||||||
|
|
||||||
this.props.setClientSetting(settings.THEME, value);
|
this.props.setClientSetting(settings.THEME, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
onAutomaticDarkModeChange(event) {
|
onAutomaticDarkModeChange(value) {
|
||||||
this.props.setClientSetting(settings.AUTOMATIC_DARK_MODE_ENABLED, event.target.checked);
|
this.props.setClientSetting(settings.AUTOMATIC_DARK_MODE_ENABLED, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
onInstantPurchaseEnabledChange(enabled) {
|
onInstantPurchaseEnabledChange(enabled) {
|
||||||
|
@ -143,6 +150,7 @@ class SettingsPage extends React.PureComponent {
|
||||||
</main>
|
</main>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<main className="main--single-column">
|
<main className="main--single-column">
|
||||||
<SubHeader />
|
<SubHeader />
|
||||||
|
@ -325,8 +333,9 @@ class SettingsPage extends React.PureComponent {
|
||||||
|
|
||||||
<FormRow
|
<FormRow
|
||||||
type="checkbox"
|
type="checkbox"
|
||||||
onChange={this.onAutomaticDarkModeChange.bind(this)}
|
disabled={theme === 'dark'}
|
||||||
defaultChecked={automaticDarkModeEnabled}
|
onChange={(e) => this.onAutomaticDarkModeChange(e.target.checked)}
|
||||||
|
checked={automaticDarkModeEnabled}
|
||||||
label={__('Automatic dark mode (9pm to 8am)')}
|
label={__('Automatic dark mode (9pm to 8am)')}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in a new issue