From 40506c714266246f166d18ed2a2f16f4b87bb312 Mon Sep 17 00:00:00 2001 From: yksolanki9 Date: Tue, 11 Oct 2022 00:13:59 +0530 Subject: [PATCH] Remove AUTO mode from api --- apps/api/src/app/user/update-user-setting.dto.ts | 2 +- apps/api/src/app/user/user.service.ts | 5 ----- apps/client/src/app/app.component.ts | 9 ++++----- apps/client/src/app/pages/account/account-page.html | 4 +++- apps/client/src/styles.scss | 12 ++++++++++++ libs/common/src/lib/types/appearance.type.ts | 2 +- 6 files changed, 21 insertions(+), 13 deletions(-) diff --git a/apps/api/src/app/user/update-user-setting.dto.ts b/apps/api/src/app/user/update-user-setting.dto.ts index a237a77dc..6c0d614e5 100644 --- a/apps/api/src/app/user/update-user-setting.dto.ts +++ b/apps/api/src/app/user/update-user-setting.dto.ts @@ -48,7 +48,7 @@ export class UpdateUserSettingDto { @IsOptional() viewMode?: ViewMode; - @IsIn(['AUTO', 'DARK', 'LIGHT']) + @IsIn(['DARK', 'LIGHT']) @IsOptional() appearance?: Appearance; } diff --git a/apps/api/src/app/user/user.service.ts b/apps/api/src/app/user/user.service.ts index 7cba3467f..13f82aa47 100644 --- a/apps/api/src/app/user/user.service.ts +++ b/apps/api/src/app/user/user.service.ts @@ -154,11 +154,6 @@ export class UserService { (user.Settings.settings as UserSettings).viewMode = 'DEFAULT'; } - // Set default appearance value to AUTO - if (!(user.Settings.settings as UserSettings).appearance) { - (user.Settings.settings as UserSettings).appearance = 'AUTO'; - } - if (this.configurationService.get('ENABLE_FEATURE_SUBSCRIPTION')) { user.subscription = this.subscriptionService.getSubscription(Subscription); diff --git a/apps/client/src/app/app.component.ts b/apps/client/src/app/app.component.ts index 8f6baa870..ed3897230 100644 --- a/apps/client/src/app/app.component.ts +++ b/apps/client/src/app/app.component.ts @@ -100,11 +100,10 @@ export class AppComponent implements OnDestroy, OnInit { this.unsubscribeSubject.complete(); } - private initializeTheme(userPreferredAppearance: Appearance = 'AUTO') { - const isDarkTheme = - userPreferredAppearance === 'DARK' || - (userPreferredAppearance === 'AUTO' && - window.matchMedia('(prefers-color-scheme: dark)').matches); + private initializeTheme(userPreferredAppearance?: Appearance) { + const isDarkTheme = userPreferredAppearance + ? userPreferredAppearance === 'DARK' + : window.matchMedia('(prefers-color-scheme: dark)').matches; this.materialCssVarsService.setDarkTheme(isDarkTheme); diff --git a/apps/client/src/app/pages/account/account-page.html b/apps/client/src/app/pages/account/account-page.html index 249aa534f..b40141d27 100644 --- a/apps/client/src/app/pages/account/account-page.html +++ b/apps/client/src/app/pages/account/account-page.html @@ -204,8 +204,10 @@ [disabled]="!hasPermissionToUpdateUserSettings" [value]="user.settings.appearance" (selectionChange)="onChangeUserSetting('appearance', $event.value)" + placeholder="AUTO" + class="with-placeholder-as-option" > - AUTO + AUTO LIGHT DARK diff --git a/apps/client/src/styles.scss b/apps/client/src/styles.scss index ae0ef8c40..2e6fe722a 100644 --- a/apps/client/src/styles.scss +++ b/apps/client/src/styles.scss @@ -97,6 +97,12 @@ body { color: rgba(var(--light-primary-text)); } } + + .with-placeholder-as-option { + .mat-select-placeholder { + color: rgba(var(--light-primary-text)); + } + } } } @@ -228,3 +234,9 @@ ngx-skeleton-loader { .with-info-message { height: calc(100vh - 5rem - 3.5rem) !important; } + +.with-placeholder-as-option { + .mat-select-placeholder { + color: rgba(var(--dark-primary-text)); + } +} diff --git a/libs/common/src/lib/types/appearance.type.ts b/libs/common/src/lib/types/appearance.type.ts index b549dbc0a..dd944df33 100644 --- a/libs/common/src/lib/types/appearance.type.ts +++ b/libs/common/src/lib/types/appearance.type.ts @@ -1 +1 @@ -export type Appearance = 'AUTO' | 'LIGHT' | 'DARK'; +export type Appearance = 'LIGHT' | 'DARK';