rename variable to themeUseSystem from darkModeUseSystem.

pull/280/head
Jason Kulatunga 2 years ago
parent 1c4dd33381
commit f4f5d16b4a

@ -52,7 +52,7 @@ export class TreoConfigService
//Store the config in localstorage //Store the config in localstorage
localStorage.setItem(SCRUTINY_CONFIG_LOCAL_STORAGE_KEY, JSON.stringify(config)); localStorage.setItem(SCRUTINY_CONFIG_LOCAL_STORAGE_KEY, JSON.stringify(config));
config.theme = this.determineTheme(config); config.theme = this.determineTheme(config);
// Execute the observable // Execute the observable
@ -73,7 +73,7 @@ export class TreoConfigService
* Checks if theme should be set to dark based on config & system settings * Checks if theme should be set to dark based on config & system settings
*/ */
private determineTheme(config:AppConfig): string { 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; temperatureUnit: string;
darkModeUseSystem: boolean; themeUseSystem: boolean;
} }
/** /**
@ -38,6 +38,6 @@ export const appConfig: AppConfig = {
temperatureUnit: "celsius", temperatureUnit: "celsius",
darkModeUseSystem: true, themeUseSystem: true,
}; };

@ -3,10 +3,10 @@
<div class="flex flex-col p-8 pb-0 overflow-hidden"> <div class="flex flex-col p-8 pb-0 overflow-hidden">
<div class="flex flex-col gt-md:flex-row"> <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> <mat-slide-toggle class="mb-2" [(ngModel)]="themeUseSystem">Use system settings for dark mode</mat-slide-toggle>
<p [class.text-hint]="darkModeUseSystem"> <p [class.text-hint]="themeUseSystem">
Theme: 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-button-toggle value="light" aria-label="Light mode">
<mat-icon>light_mode</mat-icon> <mat-icon>light_mode</mat-icon>
</mat-button-toggle> </mat-button-toggle>

@ -14,7 +14,7 @@ export class DashboardSettingsComponent implements OnInit {
dashboardDisplay: string; dashboardDisplay: string;
dashboardSort: string; dashboardSort: string;
temperatureUnit: string; temperatureUnit: string;
darkModeUseSystem: boolean; themeUseSystem: boolean;
theme: string; theme: string;
// Private // Private
@ -37,11 +37,11 @@ export class DashboardSettingsComponent implements OnInit {
this.dashboardDisplay = config.dashboardDisplay; this.dashboardDisplay = config.dashboardDisplay;
this.dashboardSort = config.dashboardSort; this.dashboardSort = config.dashboardSort;
this.temperatureUnit = config.temperatureUnit; this.temperatureUnit = config.temperatureUnit;
this.darkModeUseSystem = config.darkModeUseSystem; this.themeUseSystem = config.themeUseSystem;
this.theme = config.theme; this.theme = config.theme;
}); });
} }
saveSettings(): void { saveSettings(): void {
@ -49,7 +49,7 @@ export class DashboardSettingsComponent implements OnInit {
dashboardDisplay: this.dashboardDisplay, dashboardDisplay: this.dashboardDisplay,
dashboardSort: this.dashboardSort, dashboardSort: this.dashboardSort,
temperatureUnit: this.temperatureUnit, temperatureUnit: this.temperatureUnit,
darkModeUseSystem: this.darkModeUseSystem, themeUseSystem: this.themeUseSystem,
theme: this.theme theme: this.theme
} }
this._configService.config = newSettings this._configService.config = newSettings

Loading…
Cancel
Save