Browse Source

Change MatSlideToggle to MatCheckbox

pull/1840/head
Thomas 2 years ago
parent
commit
c486fbdf94
  1. 6
      apps/client/src/app/components/admin-overview/admin-overview.component.ts
  2. 8
      apps/client/src/app/components/admin-overview/admin-overview.html
  3. 4
      apps/client/src/app/components/admin-overview/admin-overview.module.ts
  4. 15
      apps/client/src/app/pages/account/account-page.component.ts
  5. 16
      apps/client/src/app/pages/account/account-page.html
  6. 4
      apps/client/src/app/pages/account/account-page.module.ts

6
apps/client/src/app/components/admin-overview/admin-overview.component.ts

@ -1,5 +1,5 @@
import { ChangeDetectorRef, Component, OnDestroy, OnInit } from '@angular/core'; import { ChangeDetectorRef, Component, OnDestroy, OnInit } from '@angular/core';
import { MatLegacySlideToggleChange as MatSlideToggleChange } from '@angular/material/legacy-slide-toggle'; import { MatCheckboxChange } from '@angular/material/checkbox';
import { CacheService } from '@ghostfolio/client/services/cache.service'; import { CacheService } from '@ghostfolio/client/services/cache.service';
import { DataService } from '@ghostfolio/client/services/data.service'; import { DataService } from '@ghostfolio/client/services/data.service';
import { UserService } from '@ghostfolio/client/services/user/user.service'; import { UserService } from '@ghostfolio/client/services/user/user.service';
@ -166,14 +166,14 @@ export class AdminOverviewComponent implements OnDestroy, OnInit {
} }
} }
public onReadOnlyModeChange(aEvent: MatSlideToggleChange) { public onReadOnlyModeChange(aEvent: MatCheckboxChange) {
this.putAdminSetting({ this.putAdminSetting({
key: PROPERTY_IS_READ_ONLY_MODE, key: PROPERTY_IS_READ_ONLY_MODE,
value: aEvent.checked ? true : undefined value: aEvent.checked ? true : undefined
}); });
} }
public onEnableUserSignupModeChange(aEvent: MatSlideToggleChange) { public onEnableUserSignupModeChange(aEvent: MatCheckboxChange) {
this.putAdminSetting({ this.putAdminSetting({
key: PROPERTY_IS_USER_SIGNUP_ENABLED, key: PROPERTY_IS_USER_SIGNUP_ENABLED,
value: aEvent.checked ? undefined : false value: aEvent.checked ? undefined : false

8
apps/client/src/app/components/admin-overview/admin-overview.html

@ -101,21 +101,21 @@
<div class="d-flex my-3"> <div class="d-flex my-3">
<div class="w-50" i18n>User Signup</div> <div class="w-50" i18n>User Signup</div>
<div class="w-50"> <div class="w-50">
<mat-slide-toggle <mat-checkbox
color="primary" color="primary"
[checked]="info.globalPermissions.includes(permissions.createUserAccount)" [checked]="info.globalPermissions.includes(permissions.createUserAccount)"
(change)="onEnableUserSignupModeChange($event)" (change)="onEnableUserSignupModeChange($event)"
></mat-slide-toggle> ></mat-checkbox>
</div> </div>
</div> </div>
<div *ngIf="hasPermissionToToggleReadOnlyMode" class="d-flex my-3"> <div *ngIf="hasPermissionToToggleReadOnlyMode" class="d-flex my-3">
<div class="w-50" i18n>Read-only Mode</div> <div class="w-50" i18n>Read-only Mode</div>
<div class="w-50"> <div class="w-50">
<mat-slide-toggle <mat-checkbox
color="primary" color="primary"
[checked]="info?.isReadOnlyMode" [checked]="info?.isReadOnlyMode"
(change)="onReadOnlyModeChange($event)" (change)="onReadOnlyModeChange($event)"
></mat-slide-toggle> ></mat-checkbox>
</div> </div>
</div> </div>
<div *ngIf="hasPermissionForSystemMessage" class="d-flex my-3"> <div *ngIf="hasPermissionForSystemMessage" class="d-flex my-3">

4
apps/client/src/app/components/admin-overview/admin-overview.module.ts

@ -3,8 +3,8 @@ import { CUSTOM_ELEMENTS_SCHEMA, NgModule } from '@angular/core';
import { FormsModule, ReactiveFormsModule } from '@angular/forms'; import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { MatButtonModule } from '@angular/material/button'; import { MatButtonModule } from '@angular/material/button';
import { MatCardModule } from '@angular/material/card'; import { MatCardModule } from '@angular/material/card';
import { MatCheckboxModule } from '@angular/material/checkbox';
import { MatLegacySelectModule as MatSelectModule } from '@angular/material/legacy-select'; import { MatLegacySelectModule as MatSelectModule } from '@angular/material/legacy-select';
import { MatLegacySlideToggleModule as MatSlideToggleModule } from '@angular/material/legacy-slide-toggle';
import { CacheService } from '@ghostfolio/client/services/cache.service'; import { CacheService } from '@ghostfolio/client/services/cache.service';
import { GfValueModule } from '@ghostfolio/ui/value'; import { GfValueModule } from '@ghostfolio/ui/value';
@ -18,9 +18,9 @@ import { AdminOverviewComponent } from './admin-overview.component';
FormsModule, FormsModule,
GfValueModule, GfValueModule,
MatButtonModule, MatButtonModule,
MatCheckboxModule,
MatCardModule, MatCardModule,
MatSelectModule, MatSelectModule,
MatSlideToggleModule,
ReactiveFormsModule ReactiveFormsModule
], ],
providers: [CacheService], providers: [CacheService],

15
apps/client/src/app/pages/account/account-page.component.ts

@ -5,11 +5,8 @@ import {
OnInit, OnInit,
ViewChild ViewChild
} from '@angular/core'; } from '@angular/core';
import { MatCheckbox, MatCheckboxChange } from '@angular/material/checkbox';
import { MatLegacyDialog as MatDialog } from '@angular/material/legacy-dialog'; import { MatLegacyDialog as MatDialog } from '@angular/material/legacy-dialog';
import {
MatLegacySlideToggle as MatSlideToggle,
MatLegacySlideToggleChange as MatSlideToggleChange
} from '@angular/material/legacy-slide-toggle';
import { import {
MatSnackBar, MatSnackBar,
MatSnackBarRef, MatSnackBarRef,
@ -39,7 +36,7 @@ import { CreateOrUpdateAccessDialog } from './create-or-update-access-dialog/cre
}) })
export class AccountPageComponent implements OnDestroy, OnInit { export class AccountPageComponent implements OnDestroy, OnInit {
@ViewChild('toggleSignInWithFingerprintEnabledElement') @ViewChild('toggleSignInWithFingerprintEnabledElement')
signInWithFingerprintElement: MatSlideToggle; signInWithFingerprintElement: MatCheckbox;
public accesses: Access[]; public accesses: Access[];
public appearancePlaceholder = $localize`Auto`; public appearancePlaceholder = $localize`Auto`;
@ -215,7 +212,7 @@ export class AccountPageComponent implements OnDestroy, OnInit {
}); });
} }
public onExperimentalFeaturesChange(aEvent: MatSlideToggleChange) { public onExperimentalFeaturesChange(aEvent: MatCheckboxChange) {
this.dataService this.dataService
.putUserSetting({ isExperimentalFeatures: aEvent.checked }) .putUserSetting({ isExperimentalFeatures: aEvent.checked })
.pipe(takeUntil(this.unsubscribeSubject)) .pipe(takeUntil(this.unsubscribeSubject))
@ -280,7 +277,7 @@ export class AccountPageComponent implements OnDestroy, OnInit {
} }
} }
public onRestrictedViewChange(aEvent: MatSlideToggleChange) { public onRestrictedViewChange(aEvent: MatCheckboxChange) {
this.dataService this.dataService
.putUserSetting({ isRestrictedView: aEvent.checked }) .putUserSetting({ isRestrictedView: aEvent.checked })
.pipe(takeUntil(this.unsubscribeSubject)) .pipe(takeUntil(this.unsubscribeSubject))
@ -298,7 +295,7 @@ export class AccountPageComponent implements OnDestroy, OnInit {
}); });
} }
public onSignInWithFingerprintChange(aEvent: MatSlideToggleChange) { public onSignInWithFingerprintChange(aEvent: MatCheckboxChange) {
if (aEvent.checked) { if (aEvent.checked) {
this.registerDevice(); this.registerDevice();
} else { } else {
@ -314,7 +311,7 @@ export class AccountPageComponent implements OnDestroy, OnInit {
} }
} }
public onViewModeChange(aEvent: MatSlideToggleChange) { public onViewModeChange(aEvent: MatCheckboxChange) {
this.dataService this.dataService
.putUserSetting({ viewMode: aEvent.checked === true ? 'ZEN' : 'DEFAULT' }) .putUserSetting({ viewMode: aEvent.checked === true ? 'ZEN' : 'DEFAULT' })
.pipe(takeUntil(this.unsubscribeSubject)) .pipe(takeUntil(this.unsubscribeSubject))

16
apps/client/src/app/pages/account/account-page.html

@ -88,12 +88,12 @@
</div> </div>
</div> </div>
<div class="pl-1 w-50"> <div class="pl-1 w-50">
<mat-slide-toggle <mat-checkbox
color="primary" color="primary"
[checked]="user.settings.isRestrictedView" [checked]="user.settings.isRestrictedView"
[disabled]="!hasPermissionToUpdateUserSettings" [disabled]="!hasPermissionToUpdateUserSettings"
(change)="onRestrictedViewChange($event)" (change)="onRestrictedViewChange($event)"
></mat-slide-toggle> ></mat-checkbox>
</div> </div>
</div> </div>
<div class="d-flex mt-4 py-1"> <div class="d-flex mt-4 py-1">
@ -226,23 +226,23 @@
</div> </div>
</div> </div>
<div class="pl-1 w-50"> <div class="pl-1 w-50">
<mat-slide-toggle <mat-checkbox
color="primary" color="primary"
[checked]="user.settings.viewMode === 'ZEN'" [checked]="user.settings.viewMode === 'ZEN'"
[disabled]="!hasPermissionToUpdateViewMode" [disabled]="!hasPermissionToUpdateViewMode"
(change)="onViewModeChange($event)" (change)="onViewModeChange($event)"
></mat-slide-toggle> ></mat-checkbox>
</div> </div>
</div> </div>
<div class="align-items-center d-flex mt-4 py-1"> <div class="align-items-center d-flex mt-4 py-1">
<div class="pr-1 w-50" i18n>Sign in with fingerprint</div> <div class="pr-1 w-50" i18n>Sign in with fingerprint</div>
<div class="pl-1 w-50"> <div class="pl-1 w-50">
<mat-slide-toggle <mat-checkbox
#toggleSignInWithFingerprintEnabledElement #toggleSignInWithFingerprintEnabledElement
color="primary" color="primary"
[disabled]="!hasPermissionToUpdateUserSettings" [disabled]="!hasPermissionToUpdateUserSettings"
(change)="onSignInWithFingerprintChange($event)" (change)="onSignInWithFingerprintChange($event)"
></mat-slide-toggle> ></mat-checkbox>
</div> </div>
</div> </div>
<div <div
@ -256,12 +256,12 @@
</div> </div>
</div> </div>
<div class="pl-1 w-50"> <div class="pl-1 w-50">
<mat-slide-toggle <mat-checkbox
color="primary" color="primary"
[checked]="user.settings.isExperimentalFeatures" [checked]="user.settings.isExperimentalFeatures"
[disabled]="!hasPermissionToUpdateUserSettings" [disabled]="!hasPermissionToUpdateUserSettings"
(change)="onExperimentalFeaturesChange($event)" (change)="onExperimentalFeaturesChange($event)"
></mat-slide-toggle> ></mat-checkbox>
</div> </div>
</div> </div>
<div class="align-items-center d-flex mt-4 py-1"> <div class="align-items-center d-flex mt-4 py-1">

4
apps/client/src/app/pages/account/account-page.module.ts

@ -3,10 +3,10 @@ import { NgModule } from '@angular/core';
import { FormsModule, ReactiveFormsModule } from '@angular/forms'; import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { MatButtonModule } from '@angular/material/button'; import { MatButtonModule } from '@angular/material/button';
import { MatCardModule } from '@angular/material/card'; import { MatCardModule } from '@angular/material/card';
import { MatCheckboxModule } from '@angular/material/checkbox';
import { MatLegacyDialogModule as MatDialogModule } from '@angular/material/legacy-dialog'; import { MatLegacyDialogModule as MatDialogModule } from '@angular/material/legacy-dialog';
import { MatLegacyFormFieldModule as MatFormFieldModule } from '@angular/material/legacy-form-field'; import { MatLegacyFormFieldModule as MatFormFieldModule } from '@angular/material/legacy-form-field';
import { MatLegacySelectModule as MatSelectModule } from '@angular/material/legacy-select'; import { MatLegacySelectModule as MatSelectModule } from '@angular/material/legacy-select';
import { MatLegacySlideToggleModule as MatSlideToggleModule } from '@angular/material/legacy-slide-toggle';
import { RouterModule } from '@angular/router'; import { RouterModule } from '@angular/router';
import { GfPortfolioAccessTableModule } from '@ghostfolio/client/components/access-table/access-table.module'; import { GfPortfolioAccessTableModule } from '@ghostfolio/client/components/access-table/access-table.module';
import { GfPremiumIndicatorModule } from '@ghostfolio/ui/premium-indicator'; import { GfPremiumIndicatorModule } from '@ghostfolio/ui/premium-indicator';
@ -28,10 +28,10 @@ import { GfCreateOrUpdateAccessDialogModule } from './create-or-update-access-di
GfValueModule, GfValueModule,
MatButtonModule, MatButtonModule,
MatCardModule, MatCardModule,
MatCheckboxModule,
MatDialogModule, MatDialogModule,
MatFormFieldModule, MatFormFieldModule,
MatSelectModule, MatSelectModule,
MatSlideToggleModule,
ReactiveFormsModule, ReactiveFormsModule,
RouterModule RouterModule
] ]

Loading…
Cancel
Save