diff --git a/frontend/src/app/features/settings/user-profile-dialog/user-profile-dialog.component.html b/frontend/src/app/features/settings/user-profile-dialog/user-profile-dialog.component.html index d9d7bc1ab..862742cb0 100644 --- a/frontend/src/app/features/settings/user-profile-dialog/user-profile-dialog.component.html +++ b/frontend/src/app/features/settings/user-profile-dialog/user-profile-dialog.component.html @@ -22,6 +22,71 @@
+
+

+ + {{ 'settingsView.language.sectionTitle' | transloco }} +

+ + + +
+ +
+ +
+
+

+ + {{ 'settingsView.theme.sectionTitle' | transloco }} +

+ +
+ {{ 'layout.theme.primary' | transloco }} +
+ @for (primaryColor of primaryColors; track primaryColor.name) { + + } +
+
+ +
+ {{ 'layout.theme.surface' | transloco }} +
+ @for (surface of surfaces; track surface.name) { + + } +
+
+
+
+ +
+

diff --git a/frontend/src/app/features/settings/user-profile-dialog/user-profile-dialog.component.scss b/frontend/src/app/features/settings/user-profile-dialog/user-profile-dialog.component.scss index 2b22ff255..c78e6003a 100644 --- a/frontend/src/app/features/settings/user-profile-dialog/user-profile-dialog.component.scss +++ b/frontend/src/app/features/settings/user-profile-dialog/user-profile-dialog.component.scss @@ -1,4 +1,5 @@ @use '../../../shared/styles/panel-shared' as panel; +@use '../../../../assets/layout/styles/layout/variables'; .user-profile-dialog { min-width: 300px; @@ -33,7 +34,7 @@ max-height: 60vh; overflow-y: auto; - @media (width <= 480px) { + @media #{variables.$mobile-shell-media-query} { padding: 1rem; gap: 1.25rem; } @@ -66,6 +67,62 @@ } } +.preferences-section { + gap: 1rem; +} + +.language-select { + width: 11rem; + max-width: 100%; + min-width: 0; +} + +.preference-group { + display: flex; + flex-direction: column; + gap: 0.75rem; +} + +.theme-row { + display: flex; + flex-direction: column; + gap: 0.625rem; + padding: 0.75rem; + background: var(--ground-background); + border-radius: 8px; + box-shadow: inset 0 0 0 1px var(--border-color); +} + +.theme-row-label { + color: var(--text-color-secondary); + font-size: var(--text-sm); + font-weight: 500; + line-height: 1.25rem; +} + +.color-swatches { + display: flex; + flex-wrap: wrap; + gap: 0.375rem; + min-width: 0; + + button { + width: 1.5rem; + height: 1.5rem; + padding: 0; + border: 0; + border-radius: 50%; + cursor: pointer; + outline: transparent solid 2px; + outline-offset: 1px; + + &:focus-visible, + &.active-color { + outline-color: var(--primary-color); + } + } +} + .form-field { display: flex; flex-direction: column; @@ -80,10 +137,11 @@ .field-input { width: 100%; - &:disabled { - background-color: var(--surface-100); + &.p-inputtext:disabled { + background: color-mix(in srgb, var(--ground-background) 50%, var(--p-surface-800) 50%) !important; color: var(--text-color-secondary); - opacity: 0.6; + -webkit-text-fill-color: var(--text-color-secondary); + opacity: 1; cursor: not-allowed; } } @@ -155,3 +213,9 @@ color: var(--text-secondary-color); } } + +@media #{variables.$mobile-shell-media-query} { + .language-select { + width: 100%; + } +} diff --git a/frontend/src/app/features/settings/user-profile-dialog/user-profile-dialog.component.ts b/frontend/src/app/features/settings/user-profile-dialog/user-profile-dialog.component.ts index 1ea653d0e..7ff69b07b 100644 --- a/frontend/src/app/features/settings/user-profile-dialog/user-profile-dialog.component.ts +++ b/frontend/src/app/features/settings/user-profile-dialog/user-profile-dialog.component.ts @@ -1,4 +1,5 @@ -import {Component, effect, inject} from '@angular/core'; +import {NgClass} from '@angular/common'; +import {Component, DestroyRef, computed, effect, inject} from '@angular/core'; import {Button} from 'primeng/button'; import {AbstractControl, FormBuilder, FormGroup, FormsModule, ReactiveFormsModule, ValidationErrors, ValidatorFn, Validators} from '@angular/forms'; import {InputText} from 'primeng/inputtext'; @@ -7,6 +8,19 @@ import {User, UserService, UserUpdateRequest} from '../user-management/user.serv import {MessageService} from 'primeng/api'; import {DynamicDialogRef} from 'primeng/dynamicdialog'; import {TranslocoDirective, TranslocoPipe, TranslocoService} from '@jsverse/transloco'; +import {Select} from 'primeng/select'; +import {takeUntilDestroyed, toSignal} from '@angular/core/rxjs-interop'; +import {AVAILABLE_LANGS, LANG_LABELS} from '../../../core/config/transloco-loader'; +import {LANG_STORAGE_KEY} from '../../../core/config/language-initializer'; +import {AppConfigService} from '../../../shared/service/app-config.service'; +import Aura from '../../../shared/layout/theme-palette-extend'; + +type ColorPalette = Record; + +interface Palette { + name: string; + palette: ColorPalette; +} export const passwordMatchValidator: ValidatorFn = (control: AbstractControl): ValidationErrors | null => { const newPassword = control.get('newPassword'); @@ -27,8 +41,10 @@ export const passwordMatchValidator: ValidatorFn = (control: AbstractControl): V ReactiveFormsModule, InputText, Password, + Select, + NgClass, TranslocoDirective, - TranslocoPipe + TranslocoPipe, ], templateUrl: './user-profile-dialog.component.html', styleUrls: ['./user-profile-dialog.component.scss'] @@ -39,12 +55,23 @@ export class UserProfileDialogComponent { currentUser: User | null = null; editUserData: Partial = {}; changePasswordForm: FormGroup; + readonly languageOptions = AVAILABLE_LANGS.map(value => ({ + value, + label: LANG_LABELS[value] ?? value, + })); protected readonly userService = inject(UserService); + protected readonly configService = inject(AppConfigService); private readonly messageService = inject(MessageService); private readonly fb = inject(FormBuilder); private readonly dialogRef = inject(DynamicDialogRef); private readonly t = inject(TranslocoService); + private readonly destroyRef = inject(DestroyRef); + protected readonly activeLang = toSignal(this.t.langChanges$, {initialValue: this.t.getActiveLang()}); + protected readonly selectedPrimaryColor = computed(() => this.configService.appState().primary); + protected readonly selectedSurfaceColor = computed(() => this.configService.appState().surface); + protected readonly surfaces = this.configService.surfaces; + protected readonly primaryColors = this.getPrimaryColors(); constructor() { this.changePasswordForm = this.fb.group( @@ -82,6 +109,43 @@ export class UserProfileDialogComponent { } } + onLanguageChange(lang: string): void { + if (lang === this.activeLang()) return; + this.t.load(lang).pipe(takeUntilDestroyed(this.destroyRef)).subscribe({ + next: () => { + this.t.setActiveLang(lang); + localStorage.setItem(LANG_STORAGE_KEY, lang); + }, + }); + } + + updateThemeColor(event: Event, type: 'primary' | 'surface', color: { name: string; palette?: ColorPalette }): void { + this.configService.appState.update((state) => ({ + ...state, + [type]: color.name, + })); + event.stopPropagation(); + } + + private getPrimaryColors(): Palette[] { + const presetPalette = (Aura.primitive ?? {}) as Record; + const colors = [ + 'orange', 'amber', 'yellow', 'lime', 'green', 'emerald', + 'teal', 'cyan', 'sky', 'blue', 'indigo', 'violet', + 'purple', 'fuchsia', 'pink', 'rose', 'red', + 'coralSunset', 'roseBlush', 'melonBlush', 'cottonCandy', + 'apricotSunrise', 'antiqueBronze', 'butteryYellow', 'vanillaCream', + 'citrusMint', 'freshMint', 'sagePearl', 'skyBlue', 'periwinkleCream', + 'pastelRoyalBlue', 'lavenderDream', 'dustyNeutral', + ]; + return [{name: 'noir', palette: {}}].concat( + colors.map(name => ({ + name, + palette: presetPalette[name] ?? {}, + })), + ); + } + updateProfile(): void { if (!this.currentUser) { this.messageService.add({ diff --git a/frontend/src/app/features/settings/view-preferences-parent/language-preferences/language-preferences.component.html b/frontend/src/app/features/settings/view-preferences-parent/language-preferences/language-preferences.component.html deleted file mode 100644 index ca83987ac..000000000 --- a/frontend/src/app/features/settings/view-preferences-parent/language-preferences/language-preferences.component.html +++ /dev/null @@ -1,32 +0,0 @@ - -
-
-

- - {{ t('sectionTitle') }} -

-

{{ t('sectionDesc') }}

-
- -
-
-
- {{ t('label') }} -
-
-
- - -
-
-
-
-
-
diff --git a/frontend/src/app/features/settings/view-preferences-parent/language-preferences/language-preferences.component.scss b/frontend/src/app/features/settings/view-preferences-parent/language-preferences/language-preferences.component.scss deleted file mode 100644 index 03d545786..000000000 --- a/frontend/src/app/features/settings/view-preferences-parent/language-preferences/language-preferences.component.scss +++ /dev/null @@ -1,41 +0,0 @@ -@use '../../../../shared/styles/settings-shared' as settings; - -.settings-card { - @include settings.settings-card; -} - -.section-header { - @include settings.settings-section-header; -} - -.section-title { - @include settings.settings-section-title; -} - -.section-description { - @include settings.settings-section-description; -} - -.section-body { - @include settings.settings-section-body; -} - -.setting-item { - @include settings.settings-item; -} - -.setting-header-standalone { - @include settings.settings-item-header-standalone; -} - -.setting-label { - @include settings.settings-label; -} - -.setting-options { - @include settings.settings-options; -} - -.select-group { - @include settings.settings-select-group; -} diff --git a/frontend/src/app/features/settings/view-preferences-parent/language-preferences/language-preferences.component.ts b/frontend/src/app/features/settings/view-preferences-parent/language-preferences/language-preferences.component.ts deleted file mode 100644 index 3f22bb84f..000000000 --- a/frontend/src/app/features/settings/view-preferences-parent/language-preferences/language-preferences.component.ts +++ /dev/null @@ -1,35 +0,0 @@ -import {Component, DestroyRef, inject} from '@angular/core'; -import {FormsModule} from '@angular/forms'; -import {takeUntilDestroyed, toSignal} from '@angular/core/rxjs-interop'; -import {Select} from 'primeng/select'; -import {TranslocoDirective, TranslocoService} from '@jsverse/transloco'; -import {AVAILABLE_LANGS, LANG_LABELS} from '../../../../core/config/transloco-loader'; -import {LANG_STORAGE_KEY} from '../../../../core/config/language-initializer'; - -@Component({ - selector: 'app-language-preferences', - standalone: true, - imports: [FormsModule, Select, TranslocoDirective], - templateUrl: './language-preferences.component.html', - styleUrl: './language-preferences.component.scss', -}) -export class LanguagePreferencesComponent { - readonly languageOptions = AVAILABLE_LANGS.map(value => ({ - value, - label: LANG_LABELS[value] ?? value, - })); - - private readonly t = inject(TranslocoService); - private readonly destroyRef = inject(DestroyRef); - readonly activeLang = toSignal(this.t.langChanges$, {initialValue: this.t.getActiveLang()}); - - onLanguageChange(lang: string): void { - if (lang === this.activeLang()) return; - this.t.load(lang).pipe(takeUntilDestroyed(this.destroyRef)).subscribe({ - next: () => { - this.t.setActiveLang(lang); - localStorage.setItem(LANG_STORAGE_KEY, lang); - }, - }); - } -} diff --git a/frontend/src/app/features/settings/view-preferences-parent/theme-preferences/theme-preferences.component.html b/frontend/src/app/features/settings/view-preferences-parent/theme-preferences/theme-preferences.component.html deleted file mode 100644 index fa749a85b..000000000 --- a/frontend/src/app/features/settings/view-preferences-parent/theme-preferences/theme-preferences.component.html +++ /dev/null @@ -1,15 +0,0 @@ - -
-
-

- - {{ t('sectionTitle') }} -

-

{{ t('sectionDesc') }}

-
- -
- -
-
-
diff --git a/frontend/src/app/features/settings/view-preferences-parent/theme-preferences/theme-preferences.component.scss b/frontend/src/app/features/settings/view-preferences-parent/theme-preferences/theme-preferences.component.scss deleted file mode 100644 index da8ba5afc..000000000 --- a/frontend/src/app/features/settings/view-preferences-parent/theme-preferences/theme-preferences.component.scss +++ /dev/null @@ -1,21 +0,0 @@ -@use '../../../../shared/styles/settings-shared' as settings; - -.settings-card { - @include settings.settings-card; -} - -.section-header { - @include settings.settings-section-header; -} - -.section-title { - @include settings.settings-section-title; -} - -.section-description { - @include settings.settings-section-description; -} - -.section-body { - @include settings.settings-section-body; -} diff --git a/frontend/src/app/features/settings/view-preferences-parent/theme-preferences/theme-preferences.component.ts b/frontend/src/app/features/settings/view-preferences-parent/theme-preferences/theme-preferences.component.ts deleted file mode 100644 index 1ff20cb3e..000000000 --- a/frontend/src/app/features/settings/view-preferences-parent/theme-preferences/theme-preferences.component.ts +++ /dev/null @@ -1,12 +0,0 @@ -import {Component} from '@angular/core'; -import {TranslocoDirective} from '@jsverse/transloco'; -import {ThemeConfiguratorComponent} from '../../../../shared/layout/theme-configurator/theme-configurator.component'; - -@Component({ - selector: 'app-theme-preferences', - standalone: true, - imports: [TranslocoDirective, ThemeConfiguratorComponent], - templateUrl: './theme-preferences.component.html', - styleUrl: './theme-preferences.component.scss', -}) -export class ThemePreferencesComponent {} diff --git a/frontend/src/app/features/settings/view-preferences-parent/view-preferences-parent.component.html b/frontend/src/app/features/settings/view-preferences-parent/view-preferences-parent.component.html index 2ce2ad8bc..379964248 100644 --- a/frontend/src/app/features/settings/view-preferences-parent/view-preferences-parent.component.html +++ b/frontend/src/app/features/settings/view-preferences-parent/view-preferences-parent.component.html @@ -10,11 +10,6 @@

- -

- -

-

diff --git a/frontend/src/app/features/settings/view-preferences-parent/view-preferences-parent.component.ts b/frontend/src/app/features/settings/view-preferences-parent/view-preferences-parent.component.ts index 2abfae2fb..8385810a7 100644 --- a/frontend/src/app/features/settings/view-preferences-parent/view-preferences-parent.component.ts +++ b/frontend/src/app/features/settings/view-preferences-parent/view-preferences-parent.component.ts @@ -6,8 +6,6 @@ import {ViewPreferencesComponent} from './view-preferences/view-preferences.comp import {SidebarSortingPreferencesComponent} from './sidebar-sorting-preferences/sidebar-sorting-preferences.component'; import {MetaCenterViewModeComponent} from './meta-center-view-mode/meta-center-view-mode-component'; import {FilterPreferencesComponent} from './filter-preferences/filter-preferences.component'; -import {LanguagePreferencesComponent} from './language-preferences/language-preferences.component'; -import {ThemePreferencesComponent} from './theme-preferences/theme-preferences.component'; import {TranslocoDirective, TranslocoService} from '@jsverse/transloco'; import {Slider} from 'primeng/slider'; import {MessageService} from 'primeng/api'; @@ -23,8 +21,6 @@ import {LayoutService, SIDEBAR_MAX_WIDTH, SIDEBAR_MIN_WIDTH} from '../../../shar SidebarSortingPreferencesComponent, MetaCenterViewModeComponent, FilterPreferencesComponent, - LanguagePreferencesComponent, - ThemePreferencesComponent, TranslocoDirective, Slider, ], diff --git a/frontend/src/app/shared/layout/theme-configurator/theme-configurator.component.html b/frontend/src/app/shared/layout/theme-configurator/theme-configurator.component.html deleted file mode 100644 index 46c95424f..000000000 --- a/frontend/src/app/shared/layout/theme-configurator/theme-configurator.component.html +++ /dev/null @@ -1,43 +0,0 @@ - -
-
- {{ t('primary') }} -
-
-
- @for (primaryColor of primaryColors(); track primaryColor.name) { - - } -
-
-
- -
-
- {{ t('surface') }} -
-
-
- @for (surface of surfaces; track surface.name) { - - } -
-
-
-
diff --git a/frontend/src/app/shared/layout/theme-configurator/theme-configurator.component.scss b/frontend/src/app/shared/layout/theme-configurator/theme-configurator.component.scss deleted file mode 100644 index 42cfd78e5..000000000 --- a/frontend/src/app/shared/layout/theme-configurator/theme-configurator.component.scss +++ /dev/null @@ -1,49 +0,0 @@ -@use '../../styles/settings-shared' as settings; - -:host { - display: flex; - flex-direction: column; - gap: settings.$settings-section-body-gap; - width: 100%; -} - -.setting-item { - @include settings.settings-item; -} - -.setting-header-standalone { - @include settings.settings-item-header-standalone; -} - -.setting-label { - @include settings.settings-label; -} - -.setting-options { - @include settings.settings-options; -} - -.color-swatches { - display: flex; - flex-wrap: wrap; - gap: 0.5rem; - - button { - border: none; - width: 1.25rem; - height: 1.25rem; - border-radius: 50%; - padding: 0; - cursor: pointer; - outline: transparent solid 2px; - outline-offset: 1px; - - &:focus-visible { - outline-color: var(--primary-color); - } - - &.active-color { - outline-color: var(--primary-color); - } - } -} diff --git a/frontend/src/app/shared/layout/theme-configurator/theme-configurator.component.spec.ts b/frontend/src/app/shared/layout/theme-configurator/theme-configurator.component.spec.ts deleted file mode 100644 index 409bef286..000000000 --- a/frontend/src/app/shared/layout/theme-configurator/theme-configurator.component.spec.ts +++ /dev/null @@ -1,17 +0,0 @@ -import {describe, it} from 'vitest'; - -// NOTE(frontend-seam): Real coverage here needs a stable app-config signal seam plus favicon -// side-effect interception. The component is mostly computed/effect wiring over `AppConfigService` -// state, palette tokens, and `FaviconService`, so a useful spec should validate those reactions -// without reaching through private signal internals. -describe.skip('ThemeConfiguratorComponent', () => { - it('needs an app-config seam to verify selected palette derivation and color updates', () => { - // TODO(seam): Cover computed primary/surface selections and updateColors state writes once - // the config signal can be driven through a stable public harness. - }); - - it('needs a favicon side-effect seam to verify palette-to-favicon synchronization', () => { - // TODO(seam): Cover favicon updates after exposing a testable effect boundary around the - // config-driven favicon sync. - }); -}); diff --git a/frontend/src/app/shared/layout/theme-configurator/theme-configurator.component.ts b/frontend/src/app/shared/layout/theme-configurator/theme-configurator.component.ts deleted file mode 100644 index c77535d46..000000000 --- a/frontend/src/app/shared/layout/theme-configurator/theme-configurator.component.ts +++ /dev/null @@ -1,61 +0,0 @@ -import {ChangeDetectionStrategy, Component, computed, inject} from '@angular/core'; -import {FormsModule} from '@angular/forms'; -import {AppConfigService} from '../../service/app-config.service'; -import {TranslocoDirective} from '@jsverse/transloco'; -import {NgClass} from '@angular/common'; -import Aura from '../theme-palette-extend'; - -type ColorPalette = Record; - -interface Palette { - name: string; - palette: ColorPalette; -} - -@Component({ - selector: 'app-theme-configurator', - standalone: true, - changeDetection: ChangeDetectionStrategy.OnPush, - templateUrl: './theme-configurator.component.html', - styleUrl: './theme-configurator.component.scss', - imports: [ - NgClass, - FormsModule, - TranslocoDirective - ] -}) -export class ThemeConfiguratorComponent { - readonly configService = inject(AppConfigService); - - readonly surfaces = this.configService.surfaces; - - readonly selectedPrimaryColor = computed(() => this.configService.appState().primary); - readonly selectedSurfaceColor = computed(() => this.configService.appState().surface); - - readonly primaryColors = computed(() => { - const presetPalette = (Aura.primitive ?? {}) as Record; - const colors = [ - 'orange', 'amber', 'yellow', 'lime', 'green', 'emerald', - 'teal', 'cyan', 'sky', 'blue', 'indigo', 'violet', - 'purple', 'fuchsia', 'pink', 'rose', 'red', - 'coralSunset', 'roseBlush', 'melonBlush', 'cottonCandy', - 'apricotSunrise', 'antiqueBronze', 'butteryYellow', 'vanillaCream', - 'citrusMint', 'freshMint', 'sagePearl', 'skyBlue','periwinkleCream', - 'pastelRoyalBlue', 'lavenderDream', 'dustyNeutral' - ]; - return [{name: 'noir', palette: {}}].concat( - colors.map(name => ({ - name, - palette: presetPalette[name] ?? {} - })) - ); - }); - - updateColors(event: Event, type: 'primary' | 'surface', color: { name: string; palette?: ColorPalette }) { - this.configService.appState.update((state) => ({ - ...state, - [type]: color.name - })); - event.stopPropagation(); - } -}