rename variable to themeUseSystem from darkModeUseSystem.
This commit is contained in:
@@ -52,7 +52,7 @@ export class TreoConfigService
|
||||
|
||||
//Store the config in localstorage
|
||||
localStorage.setItem(SCRUTINY_CONFIG_LOCAL_STORAGE_KEY, JSON.stringify(config));
|
||||
|
||||
|
||||
config.theme = this.determineTheme(config);
|
||||
|
||||
// Execute the observable
|
||||
@@ -73,7 +73,7 @@ export class TreoConfigService
|
||||
* Checks if theme should be set to dark based on config & system settings
|
||||
*/
|
||||
private determineTheme(config:AppConfig): string {
|
||||
return (config.darkModeUseSystem && this.systemPrefersDark) ? "dark" : config.theme;
|
||||
return (config.themeUseSystem && this.systemPrefersDark) ? "dark" : config.theme;
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -18,7 +18,7 @@ export interface AppConfig
|
||||
|
||||
temperatureUnit: string;
|
||||
|
||||
darkModeUseSystem: boolean;
|
||||
themeUseSystem: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -38,6 +38,6 @@ export const appConfig: AppConfig = {
|
||||
|
||||
temperatureUnit: "celsius",
|
||||
|
||||
darkModeUseSystem: true,
|
||||
themeUseSystem: true,
|
||||
};
|
||||
|
||||
|
||||
+3
-3
@@ -3,10 +3,10 @@
|
||||
|
||||
<div class="flex flex-col p-8 pb-0 overflow-hidden">
|
||||
<div class="flex flex-col gt-md:flex-row">
|
||||
<mat-slide-toggle class="mb-2" [(ngModel)]="darkModeUseSystem">Use system settings for dark mode</mat-slide-toggle>
|
||||
<p [class.text-hint]="darkModeUseSystem">
|
||||
<mat-slide-toggle class="mb-2" [(ngModel)]="themeUseSystem">Use system settings for dark mode</mat-slide-toggle>
|
||||
<p [class.text-hint]="themeUseSystem">
|
||||
Theme:
|
||||
<mat-button-toggle-group class="ml-2" #group="matButtonToggleGroup" [(ngModel)]="theme" [disabled]="darkModeUseSystem">
|
||||
<mat-button-toggle-group class="ml-2" #group="matButtonToggleGroup" [(ngModel)]="theme" [disabled]="themeUseSystem">
|
||||
<mat-button-toggle value="light" aria-label="Light mode">
|
||||
<mat-icon>light_mode</mat-icon>
|
||||
</mat-button-toggle>
|
||||
|
||||
+4
-4
@@ -14,7 +14,7 @@ export class DashboardSettingsComponent implements OnInit {
|
||||
dashboardDisplay: string;
|
||||
dashboardSort: string;
|
||||
temperatureUnit: string;
|
||||
darkModeUseSystem: boolean;
|
||||
themeUseSystem: boolean;
|
||||
theme: string;
|
||||
|
||||
// Private
|
||||
@@ -37,11 +37,11 @@ export class DashboardSettingsComponent implements OnInit {
|
||||
this.dashboardDisplay = config.dashboardDisplay;
|
||||
this.dashboardSort = config.dashboardSort;
|
||||
this.temperatureUnit = config.temperatureUnit;
|
||||
this.darkModeUseSystem = config.darkModeUseSystem;
|
||||
this.themeUseSystem = config.themeUseSystem;
|
||||
this.theme = config.theme;
|
||||
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
saveSettings(): void {
|
||||
@@ -49,7 +49,7 @@ export class DashboardSettingsComponent implements OnInit {
|
||||
dashboardDisplay: this.dashboardDisplay,
|
||||
dashboardSort: this.dashboardSort,
|
||||
temperatureUnit: this.temperatureUnit,
|
||||
darkModeUseSystem: this.darkModeUseSystem,
|
||||
themeUseSystem: this.themeUseSystem,
|
||||
theme: this.theme
|
||||
}
|
||||
this._configService.config = newSettings
|
||||
|
||||
Reference in New Issue
Block a user