From 84db54babdc2bd2a42ab620aaa91f5bb3eeb307a Mon Sep 17 00:00:00 2001 From: RaviTejaVattem <43704759+RaviTejaVattem@users.noreply.github.com> Date: Tue, 17 Oct 2023 19:49:54 +0100 Subject: [PATCH] Change checkboxes to slide toggles on user settings page (#2497) * Change checkboxes to slide toggles on user settings page * Update changelog --- CHANGELOG.md | 1 + .../user-account-settings.component.ts | 10 +++++----- .../user-account-settings.html | 20 +++++++++++-------- .../user-account-settings.module.ts | 4 ++-- apps/client/src/styles.scss | 9 +++++++++ 5 files changed, 29 insertions(+), 15 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 33f52cbcc..72f8eca9a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed +- Changed the checkboxes to slide toggles in the user settings of the user account page - Extended the `copy-assets` `Nx` target to copy the locales to the server’s assets - Upgraded `@simplewebauthn/browser` and `@simplewebauthn/server` from version `5.2.1` to `8.3` diff --git a/apps/client/src/app/components/user-account-settings/user-account-settings.component.ts b/apps/client/src/app/components/user-account-settings/user-account-settings.component.ts index 6fb8d5c15..3fb3592e0 100644 --- a/apps/client/src/app/components/user-account-settings/user-account-settings.component.ts +++ b/apps/client/src/app/components/user-account-settings/user-account-settings.component.ts @@ -5,7 +5,7 @@ import { OnDestroy, OnInit } from '@angular/core'; -import { MatCheckboxChange } from '@angular/material/checkbox'; +import { MatSlideToggleChange } from '@angular/material/slide-toggle'; import { DataService } from '@ghostfolio/client/services/data.service'; import { STAY_SIGNED_IN, @@ -117,7 +117,7 @@ export class UserAccountSettingsComponent implements OnDestroy, OnInit { }); } - public onExperimentalFeaturesChange(aEvent: MatCheckboxChange) { + public onExperimentalFeaturesChange(aEvent: MatSlideToggleChange) { this.dataService .putUserSetting({ isExperimentalFeatures: aEvent.checked }) .pipe(takeUntil(this.unsubscribeSubject)) @@ -155,7 +155,7 @@ export class UserAccountSettingsComponent implements OnDestroy, OnInit { }); } - public onRestrictedViewChange(aEvent: MatCheckboxChange) { + public onRestrictedViewChange(aEvent: MatSlideToggleChange) { this.dataService .putUserSetting({ isRestrictedView: aEvent.checked }) .pipe(takeUntil(this.unsubscribeSubject)) @@ -173,7 +173,7 @@ export class UserAccountSettingsComponent implements OnDestroy, OnInit { }); } - public onSignInWithFingerprintChange(aEvent: MatCheckboxChange) { + public onSignInWithFingerprintChange(aEvent: MatSlideToggleChange) { if (aEvent.checked) { this.registerDevice(); } else { @@ -189,7 +189,7 @@ export class UserAccountSettingsComponent implements OnDestroy, OnInit { } } - public onViewModeChange(aEvent: MatCheckboxChange) { + public onViewModeChange(aEvent: MatSlideToggleChange) { this.dataService .putUserSetting({ viewMode: aEvent.checked === true ? 'ZEN' : 'DEFAULT' }) .pipe(takeUntil(this.unsubscribeSubject)) diff --git a/apps/client/src/app/components/user-account-settings/user-account-settings.html b/apps/client/src/app/components/user-account-settings/user-account-settings.html index 66829d55e..87762d449 100644 --- a/apps/client/src/app/components/user-account-settings/user-account-settings.html +++ b/apps/client/src/app/components/user-account-settings/user-account-settings.html @@ -11,12 +11,13 @@
- + >
@@ -139,12 +140,13 @@
- + >
@@ -153,12 +155,13 @@
Sign in with fingerprint
- + >
- + >
diff --git a/apps/client/src/app/components/user-account-settings/user-account-settings.module.ts b/apps/client/src/app/components/user-account-settings/user-account-settings.module.ts index 24e57ff20..7a40cf641 100644 --- a/apps/client/src/app/components/user-account-settings/user-account-settings.module.ts +++ b/apps/client/src/app/components/user-account-settings/user-account-settings.module.ts @@ -3,9 +3,9 @@ import { NgModule } from '@angular/core'; import { FormsModule, ReactiveFormsModule } from '@angular/forms'; import { MatButtonModule } from '@angular/material/button'; import { MatCardModule } from '@angular/material/card'; -import { MatCheckboxModule } from '@angular/material/checkbox'; import { MatFormFieldModule } from '@angular/material/form-field'; import { MatSelectModule } from '@angular/material/select'; +import { MatSlideToggleModule } from '@angular/material/slide-toggle'; import { RouterModule } from '@angular/router'; import { GfValueModule } from '@ghostfolio/ui/value'; @@ -20,9 +20,9 @@ import { UserAccountSettingsComponent } from './user-account-settings.component' GfValueModule, MatButtonModule, MatCardModule, - MatCheckboxModule, MatFormFieldModule, MatSelectModule, + MatSlideToggleModule, ReactiveFormsModule, RouterModule ] diff --git a/apps/client/src/styles.scss b/apps/client/src/styles.scss index 36099a249..175194cac 100644 --- a/apps/client/src/styles.scss +++ b/apps/client/src/styles.scss @@ -462,6 +462,15 @@ ngx-skeleton-loader { } } +/** + * Fix for https://github.com/angular/components/issues/26818 + */ +.mat-mdc-slide-toggle { + .mdc-switch__track { + background-color: rgba(var(--palette-primary-500), 1); + } +} + .mat-stepper-vertical, .mat-stepper-horizontal { background: transparent !important;