feat(ui): OLED dark mode variant (#1560)

This commit is contained in:
Alex
2026-05-29 06:56:04 +01:00
committed by GitHub
parent e4bf4c5659
commit 5e0eac5764
19 changed files with 156 additions and 49 deletions
@@ -42,6 +42,17 @@
</p-select>
</div>
@if (showOledDarkModeToggle()) {
<div class="theme-toggle-row">
<label class="field-label" for="oled-dark-mode">{{ 'settingsView.theme.oledDarkMode' | transloco }}</label>
<p-toggleswitch
inputId="oled-dark-mode"
[ngModel]="oledDarkMode()"
(ngModelChange)="configService.setOledDarkMode($event)">
</p-toggleswitch>
</div>
}
<div class="form-field">
<label class="field-label" for="app-theme">{{ 'layout.theme.theme' | transloco }}</label>
<p-select
@@ -154,6 +154,17 @@ fieldset.form-field {
gap: 0.5rem;
}
.theme-toggle-row {
display: flex;
align-items: center;
justify-content: space-between;
gap: 1rem;
.field-label {
margin: 0;
}
}
.edit-actions {
margin-top: 0.5rem;
@@ -3,6 +3,7 @@ import {Button} from 'primeng/button';
import {AbstractControl, FormBuilder, FormGroup, FormsModule, ReactiveFormsModule, ValidationErrors, ValidatorFn, Validators} from '@angular/forms';
import {InputText} from 'primeng/inputtext';
import {Password} from 'primeng/password';
import {ToggleSwitch} from 'primeng/toggleswitch';
import {User, UserService, UserUpdateRequest} from '../user-management/user.service';
import {MessageService} from 'primeng/api';
import {DynamicDialogRef} from 'primeng/dynamicdialog';
@@ -17,8 +18,6 @@ import {
AppTheme,
CUSTOM_PRIMARY_OPTIONS,
CustomPrimary,
DEFAULT_APP_THEME,
DEFAULT_CUSTOM_PRIMARY,
} from '../../../shared/model/app-state.model';
export const passwordMatchValidator: ValidatorFn = (control: AbstractControl): ValidationErrors | null => {
@@ -41,6 +40,7 @@ export const passwordMatchValidator: ValidatorFn = (control: AbstractControl): V
InputText,
Password,
Select,
ToggleSwitch,
TranslocoDirective,
TranslocoPipe,
],
@@ -66,10 +66,12 @@ export class UserProfileDialogComponent {
private readonly t = inject(TranslocoService);
private readonly destroyRef = inject(DestroyRef);
protected readonly activeLang = toSignal(this.t.langChanges$, {initialValue: this.t.getActiveLang()});
protected readonly selectedThemePreference = computed(() => this.configService.appState().themePreference ?? DEFAULT_APP_THEME);
protected readonly selectedAppearancePreference = computed(() => this.configService.appState().appearancePreference ?? 'system');
protected readonly selectedThemePreference = computed(() => this.configService.appState().themePreference);
protected readonly selectedAppearancePreference = computed(() => this.configService.appState().appearancePreference);
protected readonly oledDarkMode = computed(() => this.configService.appState().oledDarkMode);
protected readonly showOledDarkModeToggle = computed(() => this.configService.effectiveAppearance() === 'dark');
protected readonly selectedCustomPrimary = computed<CustomPrimary>(
() => this.configService.appState().customPrimary ?? DEFAULT_CUSTOM_PRIMARY,
() => this.configService.appState().customPrimary,
);
protected readonly customPrimaryOptions = CUSTOM_PRIMARY_OPTIONS;
protected readonly themeOptions = computed(() => {