From 42dbd88e2819e4cd02f4df11b92834c9e9d97d7f Mon Sep 17 00:00:00 2001 From: Rene Vergara Date: Mon, 7 Mar 2022 13:46:00 -0600 Subject: [PATCH] Enable front end setting for zats --- src/app/settings/settings.component.css | 8 ++++++-- src/app/settings/settings.component.html | 3 +++ src/app/settings/settings.component.ts | 11 ++++++++++- src/app/user.service.ts | 4 ++-- src/app/viewer/viewer.component.ts | 2 +- 5 files changed, 22 insertions(+), 6 deletions(-) diff --git a/src/app/settings/settings.component.css b/src/app/settings/settings.component.css index f54239a..72174fa 100644 --- a/src/app/settings/settings.component.css +++ b/src/app/settings/settings.component.css @@ -1,3 +1,7 @@ -.text { - font-family: 'Spartan', monospace; +* { + font-family: 'Spartan', sans-serif; +} + +.mat-dialog-content { + max-width: 300px; } diff --git a/src/app/settings/settings.component.html b/src/app/settings/settings.component.html index ae2360a..319360c 100644 --- a/src/app/settings/settings.component.html +++ b/src/app/settings/settings.component.html @@ -13,6 +13,9 @@ + + Display Zcash amount in zatoshis? + diff --git a/src/app/settings/settings.component.ts b/src/app/settings/settings.component.ts index 19293fa..3f7b63e 100644 --- a/src/app/settings/settings.component.ts +++ b/src/app/settings/settings.component.ts @@ -1,5 +1,6 @@ import { Inject, Component, OnInit, OnDestroy, ViewEncapsulation } from '@angular/core'; import { MatDialog, MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog'; +import { MatSlideToggleChange } from '@angular/material/slide-toggle'; import { FormBuilder, Validators, FormGroup, FormControl } from '@angular/forms'; import {User} from '../user.model'; import {Owner} from '../owner.model'; @@ -14,6 +15,7 @@ export class SettingsComponent implements OnInit { settingsForm: FormGroup; owner: Owner; + useZats: boolean; coins = [ { label: 'US Dollar', @@ -38,9 +40,11 @@ export class SettingsComponent implements OnInit { private dialogRef: MatDialogRef, @Inject(MAT_DIALOG_DATA) public data: Owner ) { + this.useZats = data.zats; this.settingsForm = fb.group({ name: [data.name, Validators.required], - currency: [data.currency, Validators.required] + currency: [data.currency, Validators.required], + useZats: [data.zats, Validators.required] }); this.owner = data; } @@ -55,6 +59,11 @@ export class SettingsComponent implements OnInit { save() { this.owner.name = this.settingsForm.value.name; this.owner.currency = this.settingsForm.value.currency; + this.owner.zats = this.useZats; this.dialogRef.close(this.owner); } + + onChange(ob: MatSlideToggleChange) { + this.useZats = ob.checked; + } } diff --git a/src/app/user.service.ts b/src/app/user.service.ts index b141ea6..82edb75 100644 --- a/src/app/user.service.ts +++ b/src/app/user.service.ts @@ -171,8 +171,8 @@ export class UserService{ this.http.post<{message: string, owner: Owner}>(this.beUrl+'api/updateowner', {owner: owner}, {headers: this.reqHeaders}). subscribe((responseData) => { console.log(responseData.message); - //this.dataStore.owner = responseData.owner; - //this._ownerUpdated.next(Object.assign({},this.dataStore).owner); + this.dataStore.owner = responseData.owner; + this._ownerUpdated.next(Object.assign({},this.dataStore).owner); }); } diff --git a/src/app/viewer/viewer.component.ts b/src/app/viewer/viewer.component.ts index 2d15e8f..65eaf34 100644 --- a/src/app/viewer/viewer.component.ts +++ b/src/app/viewer/viewer.component.ts @@ -121,7 +121,7 @@ export class ViewerComponent implements OnInit { this.owner = owner; this.userUpdate.subscribe((user) => { this.user = user; - console.log('Viewer loginCheck', this.user); + //console.log('Viewer loginCheck', this.user); if (!this.owner.paid || !this.user.validated || this.user.expired) { console.log('Log in expired!'); this.router.navigate(['/login']);