Enable front end setting for zats

This commit is contained in:
Rene Vergara 2022-03-07 13:46:00 -06:00
parent 29a90b8614
commit 42dbd88e28
5 changed files with 22 additions and 6 deletions

View File

@ -1,3 +1,7 @@
.text {
font-family: 'Spartan', monospace;
* {
font-family: 'Spartan', sans-serif;
}
.mat-dialog-content {
max-width: 300px;
}

View File

@ -13,6 +13,9 @@
</mat-option>
</mat-select>
</mat-form-field>
<mat-slide-toggle formControlName="useZats" (change)="onChange($event)">
Display Zcash amount in zatoshis?
</mat-slide-toggle>
</mat-dialog-content>
<mat-dialog-actions>

View File

@ -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<SettingsComponent>,
@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;
}
}

View File

@ -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);
});
}

View File

@ -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']);