mirror of
https://github.com/Ride-The-Lightning/RTL
synced 2024-11-15 18:13:00 +00:00
CLN: Fiat symbol fix
This commit is contained in:
parent
c84de364d1
commit
52a32b33dc
File diff suppressed because one or more lines are too long
1
frontend/125.e4a54e50f74a176f.js
Normal file
1
frontend/125.e4a54e50f74a176f.js
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
1
frontend/main.03ee3805b2a54702.js
Normal file
1
frontend/main.03ee3805b2a54702.js
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -1 +1 @@
|
||||
(()=>{"use strict";var e,v={},m={};function r(e){var o=m[e];if(void 0!==o)return o.exports;var t=m[e]={id:e,loaded:!1,exports:{}};return v[e].call(t.exports,t,t.exports,r),t.loaded=!0,t.exports}r.m=v,e=[],r.O=(o,t,i,f)=>{if(!t){var a=1/0;for(n=0;n<e.length;n++){for(var[t,i,f]=e[n],c=!0,l=0;l<t.length;l++)(!1&f||a>=f)&&Object.keys(r.O).every(b=>r.O[b](t[l]))?t.splice(l--,1):(c=!1,f<a&&(a=f));if(c){e.splice(n--,1);var d=i();void 0!==d&&(o=d)}}return o}f=f||0;for(var n=e.length;n>0&&e[n-1][2]>f;n--)e[n]=e[n-1];e[n]=[t,i,f]},r.d=(e,o)=>{for(var t in o)r.o(o,t)&&!r.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:o[t]})},r.f={},r.e=e=>Promise.all(Object.keys(r.f).reduce((o,t)=>(r.f[t](e,o),o),[])),r.u=e=>e+"."+{125:"c3fb60481b3a2dae",456:"63bc51caab0d66e7",570:"a3145b37b782ee55",758:"db0aa17832e6073d"}[e]+".js",r.miniCssF=e=>{},r.o=(e,o)=>Object.prototype.hasOwnProperty.call(e,o),(()=>{var e={},o="RTLApp:";r.l=(t,i,f,n)=>{if(e[t])e[t].push(i);else{var a,c;if(void 0!==f)for(var l=document.getElementsByTagName("script"),d=0;d<l.length;d++){var u=l[d];if(u.getAttribute("src")==t||u.getAttribute("data-webpack")==o+f){a=u;break}}a||(c=!0,(a=document.createElement("script")).type="module",a.charset="utf-8",a.timeout=120,r.nc&&a.setAttribute("nonce",r.nc),a.setAttribute("data-webpack",o+f),a.src=r.tu(t)),e[t]=[i];var s=(g,b)=>{a.onerror=a.onload=null,clearTimeout(p);var h=e[t];if(delete e[t],a.parentNode&&a.parentNode.removeChild(a),h&&h.forEach(y=>y(b)),g)return g(b)},p=setTimeout(s.bind(null,void 0,{type:"timeout",target:a}),12e4);a.onerror=s.bind(null,a.onerror),a.onload=s.bind(null,a.onload),c&&document.head.appendChild(a)}}})(),r.r=e=>{typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.nmd=e=>(e.paths=[],e.children||(e.children=[]),e),(()=>{var e;r.tt=()=>(void 0===e&&(e={createScriptURL:o=>o},typeof trustedTypes<"u"&&trustedTypes.createPolicy&&(e=trustedTypes.createPolicy("angular#bundler",e))),e)})(),r.tu=e=>r.tt().createScriptURL(e),r.p="",(()=>{var e={666:0};r.f.j=(i,f)=>{var n=r.o(e,i)?e[i]:void 0;if(0!==n)if(n)f.push(n[2]);else if(666!=i){var a=new Promise((u,s)=>n=e[i]=[u,s]);f.push(n[2]=a);var c=r.p+r.u(i),l=new Error;r.l(c,u=>{if(r.o(e,i)&&(0!==(n=e[i])&&(e[i]=void 0),n)){var s=u&&("load"===u.type?"missing":u.type),p=u&&u.target&&u.target.src;l.message="Loading chunk "+i+" failed.\n("+s+": "+p+")",l.name="ChunkLoadError",l.type=s,l.request=p,n[1](l)}},"chunk-"+i,i)}else e[i]=0},r.O.j=i=>0===e[i];var o=(i,f)=>{var l,d,[n,a,c]=f,u=0;if(n.some(p=>0!==e[p])){for(l in a)r.o(a,l)&&(r.m[l]=a[l]);if(c)var s=c(r)}for(i&&i(f);u<n.length;u++)r.o(e,d=n[u])&&e[d]&&e[d][0](),e[d]=0;return r.O(s)},t=self.webpackChunkRTLApp=self.webpackChunkRTLApp||[];t.forEach(o.bind(null,0)),t.push=o.bind(null,t.push.bind(t))})()})();
|
||||
(()=>{"use strict";var e,v={},m={};function r(e){var o=m[e];if(void 0!==o)return o.exports;var t=m[e]={id:e,loaded:!1,exports:{}};return v[e].call(t.exports,t,t.exports,r),t.loaded=!0,t.exports}r.m=v,e=[],r.O=(o,t,i,f)=>{if(!t){var a=1/0;for(n=0;n<e.length;n++){for(var[t,i,f]=e[n],c=!0,l=0;l<t.length;l++)(!1&f||a>=f)&&Object.keys(r.O).every(b=>r.O[b](t[l]))?t.splice(l--,1):(c=!1,f<a&&(a=f));if(c){e.splice(n--,1);var d=i();void 0!==d&&(o=d)}}return o}f=f||0;for(var n=e.length;n>0&&e[n-1][2]>f;n--)e[n]=e[n-1];e[n]=[t,i,f]},r.d=(e,o)=>{for(var t in o)r.o(o,t)&&!r.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:o[t]})},r.f={},r.e=e=>Promise.all(Object.keys(r.f).reduce((o,t)=>(r.f[t](e,o),o),[])),r.u=e=>e+"."+{125:"e4a54e50f74a176f",456:"63bc51caab0d66e7",570:"a3145b37b782ee55",758:"db0aa17832e6073d"}[e]+".js",r.miniCssF=e=>{},r.o=(e,o)=>Object.prototype.hasOwnProperty.call(e,o),(()=>{var e={},o="RTLApp:";r.l=(t,i,f,n)=>{if(e[t])e[t].push(i);else{var a,c;if(void 0!==f)for(var l=document.getElementsByTagName("script"),d=0;d<l.length;d++){var u=l[d];if(u.getAttribute("src")==t||u.getAttribute("data-webpack")==o+f){a=u;break}}a||(c=!0,(a=document.createElement("script")).type="module",a.charset="utf-8",a.timeout=120,r.nc&&a.setAttribute("nonce",r.nc),a.setAttribute("data-webpack",o+f),a.src=r.tu(t)),e[t]=[i];var s=(g,b)=>{a.onerror=a.onload=null,clearTimeout(p);var h=e[t];if(delete e[t],a.parentNode&&a.parentNode.removeChild(a),h&&h.forEach(y=>y(b)),g)return g(b)},p=setTimeout(s.bind(null,void 0,{type:"timeout",target:a}),12e4);a.onerror=s.bind(null,a.onerror),a.onload=s.bind(null,a.onload),c&&document.head.appendChild(a)}}})(),r.r=e=>{typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.nmd=e=>(e.paths=[],e.children||(e.children=[]),e),(()=>{var e;r.tt=()=>(void 0===e&&(e={createScriptURL:o=>o},typeof trustedTypes<"u"&&trustedTypes.createPolicy&&(e=trustedTypes.createPolicy("angular#bundler",e))),e)})(),r.tu=e=>r.tt().createScriptURL(e),r.p="",(()=>{var e={666:0};r.f.j=(i,f)=>{var n=r.o(e,i)?e[i]:void 0;if(0!==n)if(n)f.push(n[2]);else if(666!=i){var a=new Promise((u,s)=>n=e[i]=[u,s]);f.push(n[2]=a);var c=r.p+r.u(i),l=new Error;r.l(c,u=>{if(r.o(e,i)&&(0!==(n=e[i])&&(e[i]=void 0),n)){var s=u&&("load"===u.type?"missing":u.type),p=u&&u.target&&u.target.src;l.message="Loading chunk "+i+" failed.\n("+s+": "+p+")",l.name="ChunkLoadError",l.type=s,l.request=p,n[1](l)}},"chunk-"+i,i)}else e[i]=0},r.O.j=i=>0===e[i];var o=(i,f)=>{var l,d,[n,a,c]=f,u=0;if(n.some(p=>0!==e[p])){for(l in a)r.o(a,l)&&(r.m[l]=a[l]);if(c)var s=c(r)}for(i&&i(f);u<n.length;u++)r.o(e,d=n[u])&&e[d]&&e[d][0](),e[d]=0;return r.O(s)},t=self.webpackChunkRTLApp=self.webpackChunkRTLApp||[];t.forEach(o.bind(null,0)),t.push=o.bind(null,t.push.bind(t))})()})();
|
1
frontend/styles.87fad1dc7ee0b3f5.css
Normal file
1
frontend/styles.87fad1dc7ee0b3f5.css
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -17,12 +17,12 @@
|
||||
<mat-label>Amount</mat-label>
|
||||
<input matInput type="number" tabindex="3" name="invoiceValue" [step]="100" [min]="1" [(ngModel)]="invoiceValue" (keyup)="onInvoiceValueChange()">
|
||||
<span matSuffix> Sats </span>
|
||||
<mat-hint>
|
||||
<span *ngIf="invoiceValueHint !== ''">= </span>
|
||||
<span *ngIf="selCurrency && selCurrency.iconType === 'FA'">
|
||||
<fa-icon *ngIf="selCurrency && invoiceValueHint !== ''" [icon]="selCurrency.symbol" />
|
||||
<mat-hint fxLayout="row wrap" fxFlex="100">
|
||||
<span *ngIf="invoiceValueHint !== ''" class="mr-3px">= </span>
|
||||
<span *ngIf="convertedCurrency && convertedCurrency.iconType === 'FA'" fxLayoutAlign="center center" class="mr-3px">
|
||||
<fa-icon *ngIf="convertedCurrency && invoiceValueHint !== ''" [icon]="convertedCurrency.symbol" />
|
||||
</span>
|
||||
<span *ngIf="selCurrency && selCurrency.iconType === 'SVG'" [innerHTML]="selCurrency.symbol"></span>
|
||||
<span *ngIf="convertedCurrency && convertedCurrency.iconType === 'SVG'" fxLayoutAlign="center center" class="mr-3px" [innerHTML]="convertedCurrency.symbol"></span>
|
||||
{{invoiceValueHint}}
|
||||
</mat-hint>
|
||||
</mat-form-field>
|
||||
|
@ -1,5 +1,4 @@
|
||||
import { Component, OnInit, OnDestroy, Inject } from '@angular/core';
|
||||
import { DomSanitizer } from '@angular/platform-browser';
|
||||
import { DecimalPipe } from '@angular/common';
|
||||
import { Subject } from 'rxjs';
|
||||
import { filter, takeUntil } from 'rxjs/operators';
|
||||
@ -11,7 +10,7 @@ import { faExclamationTriangle } from '@fortawesome/free-solid-svg-icons';
|
||||
import { CLNInvoiceInformation } from '../../../../shared/models/alertData';
|
||||
import { TimeUnitEnum, CurrencyUnitEnum, TIME_UNITS, CURRENCY_UNIT_FORMATS, PAGE_SIZE, APICallStatusEnum, CLNActions, DEFAULT_INVOICE_EXPIRY, getSelectedCurrency } from '../../../../shared/services/consts-enums-functions';
|
||||
import { Node } from '../../../../shared/models/RTLconfig';
|
||||
import { FiatCurrency } from '../../../../shared/models/rtlModels';
|
||||
import { ConvertedCurrency } from '../../../../shared/models/rtlModels';
|
||||
import { GetInfo } from '../../../../shared/models/clnModels';
|
||||
import { CommonService } from '../../../../shared/services/common.service';
|
||||
|
||||
@ -27,7 +26,7 @@ import { clnNodeInformation, clnNodeSettings } from '../../../store/cln.selector
|
||||
export class CLNCreateInvoiceComponent implements OnInit, OnDestroy {
|
||||
|
||||
public faExclamationTriangle = faExclamationTriangle;
|
||||
public selCurrency: FiatCurrency = null;
|
||||
public convertedCurrency: ConvertedCurrency = null;
|
||||
public selNode: Node | null;
|
||||
public description = '';
|
||||
public expiry: number | null;
|
||||
@ -44,7 +43,7 @@ export class CLNCreateInvoiceComponent implements OnInit, OnDestroy {
|
||||
public invoiceError = '';
|
||||
private unSubs: Array<Subject<void>> = [new Subject(), new Subject(), new Subject(), new Subject(), new Subject()];
|
||||
|
||||
constructor(public sanitizer: DomSanitizer, public dialogRef: MatDialogRef<CLNCreateInvoiceComponent>, @Inject(MAT_DIALOG_DATA) public data: CLNInvoiceInformation, private store: Store<RTLState>, private decimalPipe: DecimalPipe, private commonService: CommonService, private actions: Actions) { }
|
||||
constructor(public dialogRef: MatDialogRef<CLNCreateInvoiceComponent>, @Inject(MAT_DIALOG_DATA) public data: CLNInvoiceInformation, private store: Store<RTLState>, private decimalPipe: DecimalPipe, private commonService: CommonService, private actions: Actions) { }
|
||||
|
||||
ngOnInit() {
|
||||
this.pageSize = this.data.pageSize;
|
||||
@ -103,13 +102,8 @@ export class CLNCreateInvoiceComponent implements OnInit, OnDestroy {
|
||||
pipe(takeUntil(this.unSubs[3])).
|
||||
subscribe({
|
||||
next: (data) => {
|
||||
if (!this.selCurrency) {
|
||||
this.selCurrency = getSelectedCurrency(data.symbol);
|
||||
if (this.selCurrency && this.selCurrency.iconType === 'SVG' && this.selCurrency.symbol && typeof this.selCurrency.symbol === 'string') {
|
||||
this.selCurrency.symbol = this.sanitizer.bypassSecurityTrustHtml(this.selCurrency.symbol);
|
||||
}
|
||||
}
|
||||
this.invoiceValueHint = this.decimalPipe.transform(data.OTHER, CURRENCY_UNIT_FORMATS.OTHER) + ' ' + data.unit;
|
||||
this.convertedCurrency = data;
|
||||
this.invoiceValueHint = this.decimalPipe.transform(this.convertedCurrency.OTHER, CURRENCY_UNIT_FORMATS.OTHER) + ' ' + this.convertedCurrency.unit;
|
||||
}, error: (err) => {
|
||||
this.invoiceValueHint = 'Conversion Error: ' + err;
|
||||
}
|
||||
|
@ -8,7 +8,14 @@
|
||||
<mat-label>Amount</mat-label>
|
||||
<input matInput name="invoiceValue" type="number" tabindex="3" [step]="100" [min]="1" [(ngModel)]="invoiceValue" (keyup)="onInvoiceValueChange()">
|
||||
<span matSuffix> Sats </span>
|
||||
<mat-hint>{{invoiceValueHint}}</mat-hint>
|
||||
<mat-hint fxLayout="row wrap" fxFlex="100">
|
||||
<span *ngIf="invoiceValueHint !== ''" class="mr-3px">= </span>
|
||||
<span *ngIf="convertedCurrency && convertedCurrency.iconType === 'FA'" fxLayoutAlign="center center" class="mr-3px">
|
||||
<fa-icon *ngIf="convertedCurrency && invoiceValueHint !== ''" [icon]="convertedCurrency.symbol" />
|
||||
</span>
|
||||
<span *ngIf="convertedCurrency && convertedCurrency.iconType === 'SVG'" fxLayoutAlign="center center" class="mr-3px" [innerHTML]="convertedCurrency.symbol"></span>
|
||||
{{invoiceValueHint}}
|
||||
</mat-hint>
|
||||
</mat-form-field>
|
||||
<div fxLayout="row" class="mt-1">
|
||||
<button class="mr-1" mat-stroked-button color="primary" tabindex="9" type="reset" (click)="resetData()">Clear Field</button>
|
||||
|
@ -8,6 +8,7 @@ import { faHistory } from '@fortawesome/free-solid-svg-icons';
|
||||
import { MatPaginator, MatPaginatorIntl } from '@angular/material/paginator';
|
||||
import { MatSort } from '@angular/material/sort';
|
||||
import { MatTableDataSource } from '@angular/material/table';
|
||||
import { MAT_SELECT_CONFIG } from '@angular/material/select';
|
||||
|
||||
import { CurrencyUnitEnum, CURRENCY_UNIT_FORMATS, PAGE_SIZE, PAGE_SIZE_OPTIONS, getPaginatorLabel, ScreenSizeEnum, APICallStatusEnum, UI_MESSAGES, CLNActions, CLN_DEFAULT_PAGE_SETTINGS, SortOrderEnum, CLN_PAGE_DEFS, DEFAULT_INVOICE_EXPIRY } from '../../../../shared/services/consts-enums-functions';
|
||||
import { ApiCallStatusPayload } from '../../../../shared/models/apiCallsPayload';
|
||||
@ -26,7 +27,7 @@ import { deleteExpiredInvoice, invoiceLookup, saveNewInvoice } from '../../../st
|
||||
import { clnNodeInformation, clnNodeSettings, clnPageSettings, listInvoices } from '../../../store/cln.selector';
|
||||
import { ColumnDefinition, PageSettings, TableSetting } from '../../../../shared/models/pageSettings';
|
||||
import { CamelCaseWithReplacePipe } from '../../../../shared/pipes/app.pipe';
|
||||
import { MAT_SELECT_CONFIG } from '@angular/material/select';
|
||||
import { ConvertedCurrency } from '../../../../shared/models/rtlModels';
|
||||
|
||||
@Component({
|
||||
selector: 'rtl-cln-lightning-invoices-table',
|
||||
@ -44,6 +45,7 @@ export class CLNLightningInvoicesTableComponent implements OnInit, AfterViewInit
|
||||
@ViewChild(MatPaginator, { static: false }) paginator: MatPaginator | undefined;
|
||||
faHistory = faHistory;
|
||||
public nodePageDefs = CLN_PAGE_DEFS;
|
||||
public convertedCurrency: ConvertedCurrency = null;
|
||||
public selFilterBy = 'all';
|
||||
public colWidth = '20rem';
|
||||
public PAGE_ID = 'transactions';
|
||||
@ -259,7 +261,8 @@ export class CLNLightningInvoicesTableComponent implements OnInit, AfterViewInit
|
||||
pipe(takeUntil(this.unSubs[6])).
|
||||
subscribe({
|
||||
next: (data) => {
|
||||
this.invoiceValueHint = '= ' + data.symbol + this.decimalPipe.transform(data.OTHER, CURRENCY_UNIT_FORMATS.OTHER) + ' ' + data.unit;
|
||||
this.convertedCurrency = data;
|
||||
this.invoiceValueHint = this.decimalPipe.transform(this.convertedCurrency.OTHER, CURRENCY_UNIT_FORMATS.OTHER) + ' ' + this.convertedCurrency.unit;
|
||||
}, error: (err) => {
|
||||
this.invoiceValueHint = 'Conversion Error: ' + err;
|
||||
}
|
||||
|
@ -3,7 +3,14 @@
|
||||
<mat-form-field fxLayout="column" fxFlex="100">
|
||||
<mat-label>Payment Request</mat-label>
|
||||
<textarea #paymentReq="ngModel" matInput name="paymentRequest" tabindex="1" required [perfectScrollbar] [ngModel]="paymentRequest" (ngModelChange)="onPaymentRequestEntry($event)" (matTextareaAutosize)="true"></textarea>
|
||||
<mat-hint *ngIf="paymentRequest && paymentDecodedHint !== ''">{{paymentDecodedHint}}</mat-hint>
|
||||
<mat-hint *ngIf="paymentRequest && paymentDecodedHintPre !== ''" fxLayout="row wrap" fxFlex="100">
|
||||
{{paymentDecodedHintPre}}
|
||||
<span *ngIf="convertedCurrency && convertedCurrency.iconType === 'FA'" fxLayoutAlign="center center" class="mr-3px">
|
||||
<fa-icon *ngIf="convertedCurrency && invoiceValueHint !== ''" [icon]="convertedCurrency.symbol" />
|
||||
</span>
|
||||
<span *ngIf="convertedCurrency && convertedCurrency.iconType === 'SVG'" fxLayoutAlign="center center" class="mr-3px" [innerHTML]="convertedCurrency.symbol"></span>
|
||||
{{paymentDecodedHintPost}}
|
||||
</mat-hint>
|
||||
<mat-error *ngIf="!paymentRequest">Payment request is required.</mat-error>
|
||||
</mat-form-field>
|
||||
<div fxLayout="row" class="mt-3">
|
||||
|
@ -8,6 +8,7 @@ import { faHistory } from '@fortawesome/free-solid-svg-icons';
|
||||
import { MatPaginator, MatPaginatorIntl } from '@angular/material/paginator';
|
||||
import { MatSort } from '@angular/material/sort';
|
||||
import { MatTableDataSource } from '@angular/material/table';
|
||||
import { MAT_SELECT_CONFIG } from '@angular/material/select';
|
||||
import { GetInfo, Payment, PayRequest } from '../../../shared/models/clnModels';
|
||||
import { PAGE_SIZE, PAGE_SIZE_OPTIONS, getPaginatorLabel, AlertTypeEnum, DataTypeEnum, ScreenSizeEnum, CurrencyUnitEnum, CURRENCY_UNIT_FORMATS, APICallStatusEnum, UI_MESSAGES, PaymentTypes, CLN_DEFAULT_PAGE_SETTINGS, SortOrderEnum, CLN_PAGE_DEFS } from '../../../shared/services/consts-enums-functions';
|
||||
import { ApiCallStatusPayload } from '../../../shared/models/apiCallsPayload';
|
||||
@ -25,7 +26,7 @@ import { sendPayment } from '../../store/cln.actions';
|
||||
import { clnNodeInformation, clnNodeSettings, clnPageSettings, payments } from '../../store/cln.selector';
|
||||
import { ColumnDefinition, PageSettings, TableSetting } from '../../../shared/models/pageSettings';
|
||||
import { CamelCaseWithReplacePipe } from '../../../shared/pipes/app.pipe';
|
||||
import { MAT_SELECT_CONFIG } from '@angular/material/select';
|
||||
import { ConvertedCurrency } from '../../../shared/models/rtlModels';
|
||||
|
||||
@Component({
|
||||
selector: 'rtl-cln-lightning-payments',
|
||||
@ -42,6 +43,7 @@ export class CLNLightningPaymentsComponent implements OnInit, AfterViewInit, OnD
|
||||
@ViewChild('sendPaymentForm', { static: false }) form;
|
||||
@ViewChild(MatSort, { static: false }) sort: MatSort | undefined;
|
||||
@ViewChild(MatPaginator, { static: false }) paginator: MatPaginator | undefined;
|
||||
public convertedCurrency: ConvertedCurrency = null;
|
||||
public nodePageDefs = CLN_PAGE_DEFS;
|
||||
public selFilterBy = 'all';
|
||||
public colWidth = '20rem';
|
||||
@ -57,7 +59,8 @@ export class CLNLightningPaymentsComponent implements OnInit, AfterViewInit, OnD
|
||||
public mppColumns: string[] = [];
|
||||
public paymentDecoded: PayRequest = {};
|
||||
public paymentRequest = '';
|
||||
public paymentDecodedHint = '';
|
||||
public paymentDecodedHintPre = '';
|
||||
public paymentDecodedHintPost = '';
|
||||
public pageSize = PAGE_SIZE;
|
||||
public pageSizeOptions = PAGE_SIZE_OPTIONS;
|
||||
public screenSize = '';
|
||||
@ -228,7 +231,8 @@ export class CLNLightningPaymentsComponent implements OnInit, AfterViewInit, OnD
|
||||
|
||||
onPaymentRequestEntry(event: any) {
|
||||
this.paymentRequest = event;
|
||||
this.paymentDecodedHint = '';
|
||||
this.paymentDecodedHintPre = '';
|
||||
this.paymentDecodedHintPost = '';
|
||||
if (this.paymentRequest && this.paymentRequest.length > 100) {
|
||||
this.dataService.decodePayment(this.paymentRequest, false).
|
||||
pipe(takeUntil(this.unSubs[5])).subscribe((decodedPayment: PayRequest) => {
|
||||
@ -239,20 +243,25 @@ export class CLNLightningPaymentsComponent implements OnInit, AfterViewInit, OnD
|
||||
pipe(takeUntil(this.unSubs[6])).
|
||||
subscribe({
|
||||
next: (data) => {
|
||||
this.paymentDecodedHint = 'Sending: ' + this.decimalPipe.transform(this.paymentDecoded.amount_msat ?
|
||||
(this.paymentDecoded.amount_msat / 1000) : 0) + ' Sats (' + data.symbol + this.decimalPipe.transform((data.OTHER ? data.OTHER : 0),
|
||||
CURRENCY_UNIT_FORMATS.OTHER) + ' ' + data.unit + ') | Memo: ' + this.paymentDecoded.description;
|
||||
this.convertedCurrency = data;
|
||||
this.paymentDecodedHintPre = 'Sending: ' + this.decimalPipe.transform(this.paymentDecoded.amount_msat ?
|
||||
(this.paymentDecoded.amount_msat / 1000) : 0) + ' Sats (';
|
||||
this.paymentDecodedHintPost = this.decimalPipe.transform((this.convertedCurrency.OTHER ? this.convertedCurrency.OTHER : 0),
|
||||
CURRENCY_UNIT_FORMATS.OTHER) + ' ' + this.convertedCurrency.unit + ') | Memo: ' + this.paymentDecoded.description;
|
||||
}, error: (error) => {
|
||||
this.paymentDecodedHint = 'Sending: ' + this.decimalPipe.transform(this.paymentDecoded.amount_msat ? this.paymentDecoded.amount_msat / 1000 : 0) +
|
||||
this.paymentDecodedHintPre = 'Sending: ' + this.decimalPipe.transform(this.paymentDecoded.amount_msat ? this.paymentDecoded.amount_msat / 1000 : 0) +
|
||||
' Sats | Memo: ' + this.paymentDecoded.description + '. Unable to convert currency.';
|
||||
this.paymentDecodedHintPost = '';
|
||||
}
|
||||
});
|
||||
} else {
|
||||
this.paymentDecodedHint = 'Sending: ' + this.decimalPipe.transform(this.paymentDecoded.amount_msat ? this.paymentDecoded.amount_msat / 1000 : 0) +
|
||||
this.paymentDecodedHintPre = 'Sending: ' + this.decimalPipe.transform(this.paymentDecoded.amount_msat ? this.paymentDecoded.amount_msat / 1000 : 0) +
|
||||
' Sats | Memo: ' + this.paymentDecoded.description;
|
||||
this.paymentDecodedHintPost = '';
|
||||
}
|
||||
} else {
|
||||
this.paymentDecodedHint = 'Zero Amount Invoice | Memo: ' + this.paymentDecoded.description;
|
||||
this.paymentDecodedHintPre = 'Zero Amount Invoice | Memo: ' + this.paymentDecoded.description;
|
||||
this.paymentDecodedHintPost = '';
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -30,7 +30,14 @@
|
||||
<mat-form-field fxLayout="column" fxFlex="100">
|
||||
<mat-label>Payment Request</mat-label>
|
||||
<textarea #paymentReq="ngModel" autoFocus matInput rows="4" name="paymentRequest" tabindex="4" required [ngModel]="paymentRequest" (ngModelChange)="onPaymentRequestEntry($event)" (matTextareaAutosize)="true"></textarea>
|
||||
<mat-hint *ngIf="paymentRequest && paymentDecodedHint !== ''">{{paymentDecodedHint}}</mat-hint>
|
||||
<mat-hint *ngIf="paymentRequest && paymentDecodedHintPre !== ''" fxLayout="row wrap" fxFlex="100">
|
||||
{{paymentDecodedHintPre}}
|
||||
<span *ngIf="convertedCurrency && convertedCurrency.iconType === 'FA'" fxLayoutAlign="center center" class="mr-3px">
|
||||
<fa-icon *ngIf="convertedCurrency && invoiceValueHint !== ''" [icon]="convertedCurrency.symbol" />
|
||||
</span>
|
||||
<span *ngIf="convertedCurrency && convertedCurrency.iconType === 'SVG'" fxLayoutAlign="center center" class="mr-3px" [innerHTML]="convertedCurrency.symbol"></span>
|
||||
{{paymentDecodedHintPost}}
|
||||
</mat-hint>
|
||||
<mat-error *ngIf="!paymentRequest">Payment request is required.</mat-error>
|
||||
<mat-error *ngIf="paymentReq.errors?.decodeError">{{paymentDecodedHint}}</mat-error>
|
||||
</mat-form-field>
|
||||
@ -48,8 +55,17 @@
|
||||
<mat-error *ngIf="!pubkey">Pubkey is required.</mat-error>
|
||||
</mat-form-field>
|
||||
<mat-form-field fxLayout="column" fxFlex="100">
|
||||
<mat-label>Amount (Sats)</mat-label>
|
||||
<input #keysendAmt="ngModel" matInput name="keysendAmount" tabindex="5" required [(ngModel)]="keysendAmount">
|
||||
<mat-label>Amount</mat-label>
|
||||
<input #keysendAmt="ngModel" matInput name="keysendAmount" tabindex="5" required [(ngModel)]="keysendAmount" (keyup)="onKeysendAmountChange()">
|
||||
<span matSuffix> Sats </span>
|
||||
<mat-hint fxLayout="row wrap" fxFlex="100">
|
||||
<span *ngIf="keysendValueHint !== ''" class="mr-3px">= </span>
|
||||
<span *ngIf="convertedCurrency && convertedCurrency.iconType === 'FA'" fxLayoutAlign="center center" class="mr-3px">
|
||||
<fa-icon *ngIf="convertedCurrency && keysendValueHint !== ''" [icon]="convertedCurrency.symbol" />
|
||||
</span>
|
||||
<span *ngIf="convertedCurrency && convertedCurrency.iconType === 'SVG'" fxLayoutAlign="center center" class="mr-3px" [innerHTML]="convertedCurrency.symbol"></span>
|
||||
{{keysendValueHint}}
|
||||
</mat-hint>
|
||||
<mat-error *ngIf="!keysendAmount">Keysend amount is required.</mat-error>
|
||||
</mat-form-field>
|
||||
</ng-template>
|
||||
@ -57,7 +73,14 @@
|
||||
<mat-form-field fxLayout="column" fxFlex="100">
|
||||
<mat-label>Offer Request</mat-label>
|
||||
<textarea #offerReq="ngModel" autoFocus matInput rows="4" name="offerRequest" tabindex="4" required [ngModel]="offerRequest" (ngModelChange)="onPaymentRequestEntry($event)" (matTextareaAutosize)="true"></textarea>
|
||||
<mat-hint *ngIf="offerRequest && offerDecodedHint !== ''">{{offerDecodedHint}}</mat-hint>
|
||||
<mat-hint *ngIf="offerRequest && offerDecodedHintPre !== ''" fxLayout="row wrap" fxFlex="100">
|
||||
{{offerDecodedHintPre}}
|
||||
<span *ngIf="convertedCurrency && convertedCurrency.iconType === 'FA'" fxLayoutAlign="center center" class="mr-3px">
|
||||
<fa-icon *ngIf="convertedCurrency && invoiceValueHint !== ''" [icon]="convertedCurrency.symbol" />
|
||||
</span>
|
||||
<span *ngIf="convertedCurrency && convertedCurrency.iconType === 'SVG'" fxLayoutAlign="center center" class="mr-3px" [innerHTML]="convertedCurrency.symbol"></span>
|
||||
{{offerDecodedHintPost}}
|
||||
</mat-hint>
|
||||
<mat-error *ngIf="!offerRequest">Offer request is required.</mat-error>
|
||||
<mat-error *ngIf="offerReq.errors?.decodeError">{{offerDecodedHint}}</mat-error>
|
||||
</mat-form-field>
|
||||
|
@ -9,7 +9,7 @@ import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
|
||||
import { faExclamationTriangle } from '@fortawesome/free-solid-svg-icons';
|
||||
|
||||
import { Node } from '../../../shared/models/RTLconfig';
|
||||
import { PayRequest, Channel, GetInfo, OfferRequest, OfferInvoice } from '../../../shared/models/clnModels';
|
||||
import { PayRequest, Channel, OfferRequest, OfferInvoice } from '../../../shared/models/clnModels';
|
||||
import { APICallStatusEnum, CLNActions, PaymentTypes, CurrencyUnitEnum, CURRENCY_UNIT_FORMATS, FEE_LIMIT_TYPES, UI_MESSAGES } from '../../../shared/services/consts-enums-functions';
|
||||
import { DataService } from '../../../shared/services/data.service';
|
||||
import { CommonService } from '../../../shared/services/common.service';
|
||||
@ -17,9 +17,10 @@ import { LoggerService } from '../../../shared/services/logger.service';
|
||||
|
||||
import { RTLState } from '../../../store/rtl.state';
|
||||
import { fetchOfferInvoice, sendPayment } from '../../store/cln.actions';
|
||||
import { channels, clnNodeInformation, clnNodeSettings } from '../../store/cln.selector';
|
||||
import { channels, clnNodeSettings } from '../../store/cln.selector';
|
||||
import { ApiCallStatusPayload } from '../../../shared/models/apiCallsPayload';
|
||||
import { CLNPaymentInformation } from '../../../shared/models/alertData';
|
||||
import { ConvertedCurrency } from '../../../shared/models/rtlModels';
|
||||
|
||||
@Component({
|
||||
selector: 'rtl-cln-lightning-send-payments',
|
||||
@ -45,13 +46,14 @@ export class CLNLightningSendPaymentsComponent implements OnInit, OnDestroy {
|
||||
}
|
||||
}
|
||||
public faExclamationTriangle = faExclamationTriangle;
|
||||
public convertedCurrency: ConvertedCurrency = null;
|
||||
public paymentTypes = PaymentTypes;
|
||||
public paymentType = PaymentTypes.INVOICE;
|
||||
public selNode: Node | null;
|
||||
|
||||
public offerDecoded: OfferRequest = {};
|
||||
public offerRequest = '';
|
||||
public offerDecodedHint = '';
|
||||
public offerDecodedHintPre = '';
|
||||
public offerDecodedHintPost = '';
|
||||
public offerDescription = '';
|
||||
public offerIssuer = '';
|
||||
public offerTitle = '';
|
||||
@ -62,12 +64,14 @@ export class CLNLightningSendPaymentsComponent implements OnInit, OnDestroy {
|
||||
|
||||
public paymentDecoded: PayRequest = {};
|
||||
public paymentRequest = '';
|
||||
public paymentDecodedHint = '';
|
||||
public paymentDecodedHintPre = '';
|
||||
public paymentDecodedHintPost = '';
|
||||
public zeroAmtInvoice = false;
|
||||
public paymentAmount = null;
|
||||
|
||||
public pubkey = '';
|
||||
public keysendAmount = null;
|
||||
public keysendValueHint = '';
|
||||
public selActiveChannel: Channel | null = {};
|
||||
public activeChannels = {};
|
||||
public feeLimit = null;
|
||||
@ -131,13 +135,18 @@ export class CLNLightningSendPaymentsComponent implements OnInit, OnDestroy {
|
||||
}
|
||||
if (action.payload.action === 'DecodePayment') {
|
||||
if (this.paymentType === PaymentTypes.INVOICE) {
|
||||
this.paymentDecodedHint = 'ERROR: ' + action.payload.message;
|
||||
this.paymentDecodedHintPre = 'ERROR: ' + action.payload.message;
|
||||
this.paymentDecodedHintPost = '';
|
||||
this.paymentReq.control.setErrors({ decodeError: true });
|
||||
}
|
||||
if (this.paymentType === PaymentTypes.OFFER) {
|
||||
this.offerDecodedHint = 'ERROR: ' + action.payload.message;
|
||||
this.offerDecodedHintPre = 'ERROR: ' + action.payload.message;
|
||||
this.offerDecodedHintPost = '';
|
||||
this.offerReq.control.setErrors({ decodeError: true });
|
||||
}
|
||||
if (this.paymentType === PaymentTypes.KEYSEND) {
|
||||
this.keysendValueHint = 'ERROR: ' + action.payload.message;
|
||||
}
|
||||
}
|
||||
if (action.payload.action === 'FetchOfferInvoice' && this.paymentType === PaymentTypes.OFFER) {
|
||||
this.paymentError = action.payload.message;
|
||||
@ -166,7 +175,8 @@ export class CLNLightningSendPaymentsComponent implements OnInit, OnDestroy {
|
||||
this.dataService.decodePayment(this.paymentRequest, true).
|
||||
pipe(takeUntil(this.unSubs[4])).subscribe((decodedPayment: PayRequest | OfferRequest) => {
|
||||
if (decodedPayment.type === 'bolt12 offer' && (<OfferRequest>decodedPayment).offer_id) {
|
||||
this.paymentDecodedHint = 'ERROR: Select Offer option to pay the bolt12 offer invoice.';
|
||||
this.paymentDecodedHintPre = 'ERROR: Select Offer option to pay the bolt12 offer invoice.';
|
||||
this.paymentDecodedHintPost = '';
|
||||
this.paymentReq.control.setErrors({ decodeError: true });
|
||||
} else {
|
||||
this.paymentDecoded = <PayRequest>decodedPayment;
|
||||
@ -189,7 +199,8 @@ export class CLNLightningSendPaymentsComponent implements OnInit, OnDestroy {
|
||||
this.dataService.decodePayment(this.offerRequest, true).
|
||||
pipe(takeUntil(this.unSubs[5])).subscribe((decodedOffer: PayRequest | OfferRequest) => {
|
||||
if (decodedOffer.type === 'bolt11 invoice' && (<PayRequest>decodedOffer).payment_hash) {
|
||||
this.offerDecodedHint = 'ERROR: Select Invoice option to pay the bolt11 invoice.';
|
||||
this.offerDecodedHintPre = 'ERROR: Select Invoice option to pay the bolt11 invoice.';
|
||||
this.offerDecodedHintPost = '';
|
||||
this.offerReq.control.setErrors({ decodeError: true });
|
||||
} else {
|
||||
this.offerDecoded = <OfferRequest>decodedOffer;
|
||||
@ -248,7 +259,8 @@ export class CLNLightningSendPaymentsComponent implements OnInit, OnDestroy {
|
||||
this.dataService.decodePayment(event, true).pipe(takeUntil(this.unSubs[6])).subscribe((decodedRequest: PayRequest | OfferRequest) => {
|
||||
if (this.paymentType === PaymentTypes.INVOICE) {
|
||||
if (decodedRequest.type === 'bolt12 offer' && (<OfferRequest>decodedRequest).offer_id) {
|
||||
this.paymentDecodedHint = 'ERROR: Select Offer option to pay the bolt12 offer invoice.';
|
||||
this.paymentDecodedHintPre = 'ERROR: Select Offer option to pay the bolt12 offer invoice.';
|
||||
this.paymentDecodedHintPost = '';
|
||||
this.paymentReq.control.setErrors({ decodeError: true });
|
||||
} else {
|
||||
this.paymentDecoded = <PayRequest>decodedRequest;
|
||||
@ -256,7 +268,8 @@ export class CLNLightningSendPaymentsComponent implements OnInit, OnDestroy {
|
||||
}
|
||||
} else if (this.paymentType === PaymentTypes.OFFER) {
|
||||
if (decodedRequest.type === 'bolt11 invoice' && (<PayRequest>decodedRequest).payment_hash) {
|
||||
this.offerDecodedHint = 'ERROR: Select Invoice option to pay the bolt11 invoice.';
|
||||
this.offerDecodedHintPre = 'ERROR: Select Invoice option to pay the bolt11 invoice.';
|
||||
this.offerDecodedHintPost = '';
|
||||
this.offerReq.control.setErrors({ decodeError: true });
|
||||
} else {
|
||||
this.offerDecoded = <OfferRequest>decodedRequest;
|
||||
@ -270,7 +283,8 @@ export class CLNLightningSendPaymentsComponent implements OnInit, OnDestroy {
|
||||
resetOfferDetails() {
|
||||
this.offerInvoice = null;
|
||||
this.offerAmount = null;
|
||||
this.offerDecodedHint = '';
|
||||
this.offerDecodedHintPre = '';
|
||||
this.offerDecodedHintPost = '';
|
||||
this.zeroAmtOffer = false;
|
||||
this.paymentError = '';
|
||||
if (this.offerReq) { this.offerReq.control.setErrors(null); }
|
||||
@ -278,7 +292,8 @@ export class CLNLightningSendPaymentsComponent implements OnInit, OnDestroy {
|
||||
|
||||
resetInvoiceDetails() {
|
||||
this.paymentAmount = null;
|
||||
this.paymentDecodedHint = '';
|
||||
this.paymentDecodedHintPre = '';
|
||||
this.paymentDecodedHintPost = '';
|
||||
this.zeroAmtInvoice = false;
|
||||
this.paymentError = '';
|
||||
if (this.paymentReq) { this.paymentReq.control.setErrors(null); }
|
||||
@ -297,8 +312,10 @@ export class CLNLightningSendPaymentsComponent implements OnInit, OnDestroy {
|
||||
|
||||
onPaymentTypeChange() {
|
||||
this.paymentError = '';
|
||||
this.paymentDecodedHint = '';
|
||||
this.offerDecodedHint = '';
|
||||
this.paymentDecodedHintPre = '';
|
||||
this.paymentDecodedHintPost = '';
|
||||
this.offerDecodedHintPre = '';
|
||||
this.offerDecodedHintPost = '';
|
||||
this.offerInvoice = null;
|
||||
}
|
||||
|
||||
@ -308,7 +325,8 @@ export class CLNLightningSendPaymentsComponent implements OnInit, OnDestroy {
|
||||
this.zeroAmtOffer = true;
|
||||
this.offerDescription = this.offerDecoded.offer_description || '';
|
||||
this.offerIssuer = this.offerDecoded.offer_issuer ? this.offerDecoded.offer_issuer : '';
|
||||
this.offerDecodedHint = 'Zero Amount Offer | Description: ' + this.offerDecoded.offer_description;
|
||||
this.offerDecodedHintPre = 'Zero Amount Offer | Description: ' + this.offerDecoded.offer_description;
|
||||
this.offerDecodedHintPost = '';
|
||||
} else {
|
||||
this.zeroAmtOffer = false;
|
||||
this.offerAmount = this.offerDecoded.offer_amount_msat ? this.offerDecoded.offer_amount_msat / 1000 : 0;
|
||||
@ -319,13 +337,17 @@ export class CLNLightningSendPaymentsComponent implements OnInit, OnDestroy {
|
||||
pipe(takeUntil(this.unSubs[7])).
|
||||
subscribe({
|
||||
next: (data) => {
|
||||
this.offerDecodedHint = 'Sending: ' + this.decimalPipe.transform(this.offerAmount) + ' Sats (' + data.symbol + this.decimalPipe.transform((data.OTHER ? data.OTHER : 0), CURRENCY_UNIT_FORMATS.OTHER) + ' ' + data.unit + ') | Description: ' + this.offerDecoded.offer_description;
|
||||
this.convertedCurrency = data;
|
||||
this.offerDecodedHintPre = 'Sending: ' + this.decimalPipe.transform(this.offerAmount) + ' Sats (';
|
||||
this.offerDecodedHintPost = this.decimalPipe.transform((this.convertedCurrency.OTHER ? this.convertedCurrency.OTHER : 0), CURRENCY_UNIT_FORMATS.OTHER) + ' ' + this.convertedCurrency.unit + ') | Description: ' + this.offerDecoded.offer_description;
|
||||
}, error: (error) => {
|
||||
this.offerDecodedHint = 'Sending: ' + this.decimalPipe.transform(this.offerAmount) + ' Sats | Description: ' + this.offerDecoded.offer_description + '. Unable to convert currency.';
|
||||
this.offerDecodedHintPre = 'Sending: ' + this.decimalPipe.transform(this.offerAmount) + ' Sats | Description: ' + this.offerDecoded.offer_description + '. Unable to convert currency.';
|
||||
this.offerDecodedHintPost = '';
|
||||
}
|
||||
});
|
||||
} else {
|
||||
this.offerDecodedHint = 'Sending: ' + this.decimalPipe.transform(this.offerAmount) + ' Sats | Description: ' + this.offerDecoded.offer_description;
|
||||
this.offerDecodedHintPre = 'Sending: ' + this.decimalPipe.transform(this.offerAmount) + ' Sats | Description: ' + this.offerDecoded.offer_description;
|
||||
this.offerDecodedHintPost = '';
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -334,7 +356,8 @@ export class CLNLightningSendPaymentsComponent implements OnInit, OnDestroy {
|
||||
if (this.paymentDecoded.created_at && !this.paymentDecoded.amount_msat) {
|
||||
this.paymentDecoded.amount_msat = 0;
|
||||
this.zeroAmtInvoice = true;
|
||||
this.paymentDecodedHint = 'Zero Amount Invoice | Memo: ' + this.paymentDecoded.description;
|
||||
this.paymentDecodedHintPre = 'Zero Amount Invoice | Memo: ' + this.paymentDecoded.description;
|
||||
this.paymentDecodedHintPost = '';
|
||||
} else {
|
||||
this.zeroAmtInvoice = false;
|
||||
if (this.selNode && this.selNode.settings.fiatConversion) {
|
||||
@ -343,14 +366,17 @@ export class CLNLightningSendPaymentsComponent implements OnInit, OnDestroy {
|
||||
pipe(takeUntil(this.unSubs[8])).
|
||||
subscribe({
|
||||
next: (data) => {
|
||||
this.paymentDecodedHint = 'Sending: ' + this.decimalPipe.transform(this.paymentDecoded.amount_msat ? this.paymentDecoded.amount_msat / 1000 : 0) + ' Sats (' + data.symbol +
|
||||
this.decimalPipe.transform((data.OTHER ? data.OTHER : 0), CURRENCY_UNIT_FORMATS.OTHER) + ' ' + data.unit + ') | Memo: ' + this.paymentDecoded.description;
|
||||
this.convertedCurrency = data;
|
||||
this.paymentDecodedHintPre = 'Sending: ' + this.decimalPipe.transform(this.paymentDecoded.amount_msat ? this.paymentDecoded.amount_msat / 1000 : 0) + ' Sats (';
|
||||
this.paymentDecodedHintPost = this.decimalPipe.transform((this.convertedCurrency.OTHER ? this.convertedCurrency.OTHER : 0), CURRENCY_UNIT_FORMATS.OTHER) + ' ' + this.convertedCurrency.unit + ') | Memo: ' + this.paymentDecoded.description;
|
||||
}, error: (error) => {
|
||||
this.paymentDecodedHint = 'Sending: ' + this.decimalPipe.transform(this.paymentDecoded.amount_msat ? this.paymentDecoded.amount_msat / 1000 : 0) + ' Sats | Memo: ' + this.paymentDecoded.description + '. Unable to convert currency.';
|
||||
this.paymentDecodedHintPre = 'Sending: ' + this.decimalPipe.transform(this.paymentDecoded.amount_msat ? this.paymentDecoded.amount_msat / 1000 : 0) + ' Sats | Memo: ' + this.paymentDecoded.description + '. Unable to convert currency.';
|
||||
this.paymentDecodedHintPost = '';
|
||||
}
|
||||
});
|
||||
} else {
|
||||
this.paymentDecodedHint = 'Sending: ' + this.decimalPipe.transform(this.paymentDecoded.amount_msat ? this.paymentDecoded.amount_msat / 1000 : 0) + ' Sats | Memo: ' + this.paymentDecoded.description;
|
||||
this.paymentDecodedHintPre = 'Sending: ' + this.decimalPipe.transform(this.paymentDecoded.amount_msat ? this.paymentDecoded.amount_msat / 1000 : 0) + ' Sats | Memo: ' + this.paymentDecoded.description;
|
||||
this.paymentDecodedHintPost = '';
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -359,6 +385,7 @@ export class CLNLightningSendPaymentsComponent implements OnInit, OnDestroy {
|
||||
switch (this.paymentType) {
|
||||
case PaymentTypes.KEYSEND:
|
||||
this.pubkey = '';
|
||||
this.keysendValueHint = '';
|
||||
this.keysendAmount = null;
|
||||
break;
|
||||
|
||||
@ -383,6 +410,25 @@ export class CLNLightningSendPaymentsComponent implements OnInit, OnDestroy {
|
||||
this.paymentError = '';
|
||||
}
|
||||
|
||||
onKeysendAmountChange() {
|
||||
if (this.selNode && this.selNode.settings.fiatConversion) {
|
||||
this.keysendValueHint = '';
|
||||
if (this.keysendAmount && this.keysendAmount > 99) {
|
||||
this.commonService.convertCurrency(this.keysendAmount, CurrencyUnitEnum.SATS, CurrencyUnitEnum.OTHER, (this.selNode.settings.currencyUnits && this.selNode.settings.currencyUnits.length > 2 ? this.selNode.settings.currencyUnits[2] : ''), this.selNode.settings.fiatConversion).
|
||||
pipe(takeUntil(this.unSubs[3])).
|
||||
subscribe({
|
||||
next: (data) => {
|
||||
this.convertedCurrency = data;
|
||||
this.keysendValueHint = this.decimalPipe.transform(this.convertedCurrency.OTHER, CURRENCY_UNIT_FORMATS.OTHER) + ' ' + this.convertedCurrency.unit;
|
||||
}, error: (err) => {
|
||||
this.keysendValueHint = 'Conversion Error: ' + err;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ngOnDestroy() {
|
||||
this.unSubs.forEach((completeSub) => {
|
||||
completeSub.next(<any>null);
|
||||
|
@ -32,12 +32,12 @@
|
||||
</div>
|
||||
<div fxLayout="row wrap" fxLayoutAlign="start center">
|
||||
<mat-slide-toggle tabindex="2" color="primary" name="fiatConversion" class="mr-2" [(ngModel)]="selNode.settings.fiatConversion" (change)="!selNode.settings.currencyUnit">Enable Fiat Conversion</mat-slide-toggle>
|
||||
<mat-form-field fxFlex="20">
|
||||
<mat-form-field fxFlex="25">
|
||||
<mat-label>Fiat Currency</mat-label>
|
||||
<mat-select #currencyUnit="ngModel" autoFocus tabindex="3" name="currencyUnit" [disabled]="!selNode.settings.fiatConversion" [required]="selNode.settings.fiatConversion" [(ngModel)]="selNode.settings.currencyUnit" (selectionChange)="onCurrencyChange($event)">
|
||||
<mat-option *ngFor="let currencyUnit of currencyUnits" [value]="currencyUnit.id">
|
||||
<span *ngIf="currencyUnit && currencyUnit.iconType === 'FA'" class="mr-1"><fa-icon [icon]="currencyUnit.symbol" /></span>
|
||||
<span *ngIf="currencyUnit && currencyUnit.iconType === 'SVG'" class="mr-1"><span [innerHTML]="currencyUnit.symbol"></span></span>
|
||||
<span *ngIf="currencyUnit && currencyUnit.iconType === 'SVG'" class="mr-1"><span fxLayoutAlign="center center" [innerHTML]="currencyUnit.symbol"></span></span>
|
||||
{{currencyUnit.name}} ({{currencyUnit.id}})
|
||||
</mat-option>
|
||||
</mat-select>
|
||||
|
@ -45,16 +45,16 @@ export class NodeSettingsComponent implements OnInit, OnDestroy {
|
||||
|
||||
constructor(private logger: LoggerService, private commonService: CommonService, private store: Store<RTLState>, public sanitizer: DomSanitizer) {
|
||||
this.screenSize = this.commonService.getScreenSize();
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.currencyUnits.map((currencyUnit) => {
|
||||
if (currencyUnit.iconType === 'SVG' && typeof currencyUnit.symbol === 'string') {
|
||||
currencyUnit.symbol = currencyUnit.symbol.replace('class= "currency-icon-small"', 'class= "currency-icon-medium"');
|
||||
currencyUnit.symbol = currencyUnit.symbol.replace('<svg class="currency-icon" ', '<svg class="currency-icon ' + currencyUnit.class + '"');
|
||||
currencyUnit.symbol = this.sanitizer.bypassSecurityTrustHtml(<string>currencyUnit.symbol);
|
||||
}
|
||||
return currencyUnit;
|
||||
});
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.store.select(rootSelectedNode).pipe(takeUntil(this.unSubs[0])).subscribe((selNode) => {
|
||||
this.selNode = selNode;
|
||||
this.selectedThemeMode = this.themeModes.find((themeMode) => this.selNode.settings.themeMode === themeMode.id) || this.themeModes[0];
|
||||
|
@ -46,4 +46,14 @@ export interface FiatCurrency {
|
||||
name: string;
|
||||
iconType: 'SVG' | 'FA';
|
||||
symbol: string | IconDefinition | SafeHtml;
|
||||
class?: string;
|
||||
}
|
||||
|
||||
export interface ConvertedCurrency {
|
||||
unit: string;
|
||||
iconType: 'FA' | 'SVG';
|
||||
symbol: string | IconDefinition | SafeHtml;
|
||||
Sats: number;
|
||||
BTC: number;
|
||||
OTHER: number;
|
||||
};
|
||||
|
@ -1,11 +1,12 @@
|
||||
import { Injectable, OnDestroy } from '@angular/core';
|
||||
import { DomSanitizer } from '@angular/platform-browser';
|
||||
import { DatePipe } from '@angular/common';
|
||||
import { Subject, of, Observable, throwError, BehaviorSubject } from 'rxjs';
|
||||
import { catchError, switchMap, takeUntil } from 'rxjs/operators';
|
||||
|
||||
import { LoggerService } from './logger.service';
|
||||
import { DataService } from './data.service';
|
||||
import { CurrencyUnitEnum, TimeUnitEnum, ScreenSizeEnum, APICallStatusEnum, HOUR_SECONDS } from './consts-enums-functions';
|
||||
import { CurrencyUnitEnum, TimeUnitEnum, ScreenSizeEnum, APICallStatusEnum, HOUR_SECONDS, getSelectedCurrency } from './consts-enums-functions';
|
||||
|
||||
@Injectable()
|
||||
export class CommonService implements OnDestroy {
|
||||
@ -19,7 +20,7 @@ export class CommonService implements OnDestroy {
|
||||
public containerSizeUpdated: BehaviorSubject<any> = new BehaviorSubject(this.containerSize);
|
||||
private unSubs = [new Subject(), new Subject(), new Subject()];
|
||||
|
||||
constructor(public dataService: DataService, private logger: LoggerService, private datePipe: DatePipe) { }
|
||||
constructor(public dataService: DataService, private logger: LoggerService, private datePipe: DatePipe, public sanitizer: DomSanitizer) { }
|
||||
|
||||
getScreenSize() {
|
||||
return this.screenSize;
|
||||
@ -141,7 +142,16 @@ export class CommonService implements OnDestroy {
|
||||
}
|
||||
|
||||
convertWithFiat(value: number, from: string, otherCurrencyUnit: string) {
|
||||
const returnValue = { unit: otherCurrencyUnit, symbol: this.conversionData.data[otherCurrencyUnit].symbol };
|
||||
const returnValue = { unit: otherCurrencyUnit, iconType: 'FA', symbol: null };
|
||||
if (otherCurrencyUnit) {
|
||||
const selCurrency = getSelectedCurrency(this.conversionData.data[otherCurrencyUnit].symbol);
|
||||
returnValue.iconType = selCurrency.iconType;
|
||||
if (selCurrency && selCurrency.iconType === 'SVG' && selCurrency.symbol && typeof selCurrency.symbol === 'string') {
|
||||
returnValue.symbol = this.sanitizer.bypassSecurityTrustHtml(selCurrency.symbol);
|
||||
} else {
|
||||
returnValue.symbol = selCurrency.symbol;
|
||||
}
|
||||
}
|
||||
returnValue[CurrencyUnitEnum.SATS] = 0;
|
||||
returnValue[CurrencyUnitEnum.BTC] = 0;
|
||||
returnValue[CurrencyUnitEnum.OTHER] = 0;
|
||||
|
@ -1258,7 +1258,7 @@ export const ECL_PAGE_DEFS: ECLPageDefinitions = {
|
||||
|
||||
export const FIAT_CURRENCY_ICONS_SGV = {
|
||||
CZK: `
|
||||
<svg class= "currency-icon-small" version='1.0' xmlns='http://www.w3.org/2000/svg' width='14' height='17' viewBox='0 0 137.000000 118.000000' preserveAspectRatio='xMidYMid meet'>
|
||||
<svg class="currency-icon" version='1.0' xmlns='http://www.w3.org/2000/svg' width="300px" height="300px" viewBox='0 0 137.000000 118.000000' preserveAspectRatio='xMidYMid meet'>
|
||||
<g transform='translate(0.000000,118.000000) scale(0.100000,-0.100000)' stroke='none'>
|
||||
<path d='M80 600 l0 -410 50 0 50 0 0 138 0 138 69 68 69 69 46 -64 c25 -35
|
||||
91 -128 146 -206 l101 -143 71 0 70 0 -24 33 c-99 130 -328 446 -328 451 0 4
|
||||
@ -1276,7 +1276,7 @@ export const FIAT_CURRENCY_ICONS_SGV = {
|
||||
</svg>
|
||||
`,
|
||||
DKK: `
|
||||
<svg class= "currency-icon-small" xmlns='http://www.w3.org/2000/svg' width='12' height='17' viewBox='0 0 100 74.18'>
|
||||
<svg class="currency-icon" xmlns='http://www.w3.org/2000/svg' width="300px" height="300px" viewBox='0 0 100 74.18'>
|
||||
<path d='M58.58 72.85H41.05L22 42.15l-6.53 4.68v26H0V0H15.44V33.33l6.09-8.57L41.24 0H58.38L33 32.24 58.58 72.85ZM95 16.12a25.27 25.27 0 0 1 5.14.44L99 30.81a18.05 18.05 0 0 0-4.49-.49q-7.28 0-11.32 3.74T79.09 44.52V72.85H63.91V17.14H75.42l2.22 9.39h.75a21.26 21.26 0 0 1 7-7.55A17.15 17.15 0 0 1 95 16.12Zm10.48 49.59q0-4.18Z' />
|
||||
</svg>
|
||||
`,
|
||||
@ -1285,9 +1285,9 @@ export const FIAT_CURRENCY_ICONS_SGV = {
|
||||
<!-- Generator: Adobe Illustrator 16.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||
<!-- License: CC0. Made by SVG Repo: https://www.svgrepo.com/svg/15766/croatia-kuna-currency-symbol -->
|
||||
<svg class= "currency-icon-small" version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
||||
width="75.045px" height="75.045px" viewBox="0 0 75.045 75.045" style="enable-background:new 0 0 75.045 75.045;"
|
||||
xml:space="preserve">
|
||||
<svg class="currency-icon" version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
||||
width="300px" height="300px" viewBox="0 0 75.045 75.045" style="enable-background:new 0 0 75.045 75.045;"
|
||||
xml:space="preserve">
|
||||
<g>
|
||||
<path d="M75.045,42.207v25.959c0,0.301-0.243,0.545-0.544,0.545h-6.817c-0.3,0-0.543-0.244-0.543-0.545V43.105
|
||||
c0-8.162-3.111-12.302-9.244-12.302c-4.526,0-8.375,3.021-9.809,7.7c-0.331,0.912-0.516,2.187-0.516,3.522v26.14
|
||||
@ -1304,19 +1304,25 @@ export const FIAT_CURRENCY_ICONS_SGV = {
|
||||
HUF: `
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- Generator: Adobe Illustrator 19.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
||||
<!-- License: CC0. Made by SVG Repo: https://www.svgrepo.com/svg/150474/forint -->
|
||||
<svg class= "currency-icon-small" version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
||||
width="445px" height="445px" viewBox="0 0 445 445" style="enable-background:new 0 0 445 445;" xml:space="preserve">
|
||||
<!-- License: CC0. Made by SVG Repo: https://www.svgrepo.com/svg/183602/forint-business-and-finance -->
|
||||
<svg class="currency-icon" version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
||||
width="300px" height="300px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
|
||||
<g>
|
||||
<polygon points="88.897,35 291.541,35 291.541,5 58.897,5 58.897,445 88.897,445 88.897,247.431 251.582,247.431 251.582,217.431
|
||||
88.897,217.431"/>
|
||||
<path d="M386.103,141.215v-30h-39.973V0h-30v111.215h-39.978v30h39.978v242.919c0,30.804,25.062,55.865,55.865,55.865h14.107v-30
|
||||
h-14.107c-14.262,0-25.865-11.603-25.865-25.865V141.215H386.103z"/>
|
||||
<path d="M265.485,0.03L151.71,0.015c-0.364-0.036-0.62,0.004-0.929,0.015H37.932
|
||||
c-15.708,0-28.444,12.735-28.444,28.444v455.082C9.489,499.264,22.224,512,37.932,512s28.444-12.735,28.444-28.444V287.128h142.408
|
||||
c15.708,0,28.444-12.735,28.444-28.444c0-15.708-12.735-28.444-28.444-28.444H66.376V56.917h199.105
|
||||
c15.708,0,28.442-12.733,28.444-28.442C293.927,12.769,281.193,0.032,265.485,0.03z"/>
|
||||
<path d="M474.067,455.114c-36.596,0-66.368-29.773-66.368-66.368V170.692h28.444
|
||||
c15.708,0,28.444-12.735,28.444-28.444s-12.735-28.444-28.444-28.444h-28.444V28.474c0-15.708-12.735-28.444-28.444-28.444
|
||||
c-15.708,0-28.444,12.735-28.444,28.444v85.331h-28.444c-15.708,0-28.444,12.735-28.444,28.444s12.735,28.444,28.444,28.444h28.444
|
||||
v218.052c0,67.963,55.292,123.256,123.256,123.256c15.708,0,28.444-12.735,28.444-28.444
|
||||
C502.511,467.848,489.776,455.114,474.067,455.114z"/>
|
||||
</g>
|
||||
</svg>
|
||||
`,
|
||||
PLN: `
|
||||
<svg class= "currency-icon-small" version='1.0' xmlns='http://www.w3.org/2000/svg' width='12' height='17' viewBox='0 0 154.000000 169.000000' preserveAspectRatio='xMidYMid meet'>
|
||||
<svg class="currency-icon" version='1.0' xmlns='http://www.w3.org/2000/svg'
|
||||
width="300px" height="300px" viewBox='0 0 154.000000 169.000000' preserveAspectRatio='xMidYMid meet'>
|
||||
<g transform='translate(0.000000,169.000000) scale(0.100000,-0.100000)' stroke='none'>
|
||||
<path d='M1070 1225 l0 -324 -122 -93 c-68 -50 -126 -96 -130 -102 -13 -18 -9
|
||||
-54 8 -70 27 -28 59 -17 147 49 48 36 89 65 92 65 3 0 5 -135 5 -300 l0 -300
|
||||
@ -1335,8 +1341,8 @@ export const FIAT_CURRENCY_ICONS_SGV = {
|
||||
<!-- Generator: Adobe Illustrator 16.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||
<!-- License: CC0. Made by SVG Repo: https://www.svgrepo.com/svg/64526/romania-lei-currency -->
|
||||
<svg class= "currency-icon-small" version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
||||
width="74.19px" height="74.19px" viewBox="0 0 74.19 74.19" style="enable-background:new 0 0 74.19 74.19;" xml:space="preserve"
|
||||
<svg class="currency-icon" version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
||||
width="300px" height="300px" viewBox="0 0 74.19 74.19" style="enable-background:new 0 0 74.19 74.19;" xml:space="preserve"
|
||||
>
|
||||
<g>
|
||||
<path d="M10.052,6.186v60.96c0,0.688-0.559,1.248-1.249,1.248H1.248C0.559,68.394,0,67.834,0,67.146V6.186
|
||||
@ -1356,7 +1362,7 @@ export const FIAT_CURRENCY_ICONS_SGV = {
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- Generator: Adobe Illustrator 19.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
||||
<!-- License: CC0. Made by SVG Repo: https://www.svgrepo.com/svg/142061/new-taiwan-dollar -->
|
||||
<svg class= "currency-icon-small" version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
||||
<svg class="currency-icon" version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
||||
width="300px" height="300px" viewBox="0 0 300 300" style="enable-background:new 0 0 300 300;" xml:space="preserve">
|
||||
<g id="XMLID_7_">
|
||||
<path id="XMLID_8_" d="M265,90c8.284,0,15-6.716,15-15s-6.716-15-15-15H35c-8.284,0-15,6.716-15,15s6.716,15,15,15h65v115
|
||||
@ -1369,19 +1375,24 @@ export const FIAT_CURRENCY_ICONS_SGV = {
|
||||
};
|
||||
|
||||
// Name and symbols confirmed from https://www.xe.com/symbols/
|
||||
// Most SVGs are copied from https://www.svgviewer.dev
|
||||
export const FIAT_CURRENCY_UNITS: FiatCurrency[] = [
|
||||
{ id: 'USD', name: 'United States Dollar', iconType: 'FA', symbol: faDollarSign }, { id: 'ARS', name: 'Argentina Peso', iconType: 'FA', symbol: faDollarSign }, { id: 'AUD', name: 'Australia Dollar', iconType: 'FA', symbol: faDollarSign },
|
||||
{ id: 'BRL', name: 'Brazil Real', iconType: 'FA', symbol: faBrazilianRealSign }, { id: 'CAD', name: 'Canada Dollar', iconType: 'FA', symbol: faDollarSign }, { id: 'CHF', name: 'Switzerland Franc', iconType: 'FA', symbol: faFrancSign },
|
||||
{ id: 'CLP', name: 'Chile Peso', iconType: 'FA', symbol: faDollarSign }, { id: 'CNY', name: 'China Yuan Renminbi', iconType: 'FA', symbol: faYenSign }, { id: 'CZK', name: 'Czech Republic Koruna', iconType: 'SVG', symbol: FIAT_CURRENCY_ICONS_SGV.CZK },
|
||||
{ id: 'DKK', name: 'Denmark Krone', iconType: 'SVG', symbol: FIAT_CURRENCY_ICONS_SGV.DKK }, { id: 'EUR', name: 'Euro Member Countries', iconType: 'FA', symbol: faEuroSign }, { id: 'GBP', name: 'United Kingdom Pound', iconType: 'FA', symbol: faSterlingSign },
|
||||
{ id: 'HKD', name: 'Hong Kong Dollar', iconType: 'FA', symbol: faDollarSign }, { id: 'HRK', name: 'Croatia Kuna', iconType: 'SVG', symbol: FIAT_CURRENCY_ICONS_SGV.HRK }, { id: 'HUF', name: 'Hungary Forint', iconType: 'SVG', symbol: FIAT_CURRENCY_ICONS_SGV.HUF },
|
||||
{ id: 'INR', name: 'India Rupee', iconType: 'FA', symbol: faIndianRupeeSign }, { id: 'ISK', name: 'Iceland Krona', iconType: 'SVG', symbol: FIAT_CURRENCY_ICONS_SGV.DKK }, { id: 'JPY', name: 'Japan Yen', iconType: 'FA', symbol: faYenSign },
|
||||
{ id: 'KRW', name: 'Korea (South) Won', iconType: 'FA', symbol: faWonSign }, { id: 'NZD', name: 'New Zealand Dollar', iconType: 'FA', symbol: faDollarSign }, { id: 'PLN', name: 'Poland Zloty', iconType: 'SVG', symbol: FIAT_CURRENCY_ICONS_SGV.PLN },
|
||||
{ id: 'RON', name: 'Romania Leu', iconType: 'SVG', symbol: FIAT_CURRENCY_ICONS_SGV.RON }, { id: 'RUB', name: 'Russia Ruble', iconType: 'FA', symbol: faRubleSign }, { id: 'SEK', name: 'Sweden Krona', iconType: 'SVG', symbol: FIAT_CURRENCY_ICONS_SGV.DKK },
|
||||
{ id: 'CLP', name: 'Chile Peso', iconType: 'FA', symbol: faDollarSign }, { id: 'CNY', name: 'China Yuan Renminbi', iconType: 'FA', symbol: faYenSign }, { id: 'CZK', name: 'Czech Republic Koruna', iconType: 'SVG', symbol: FIAT_CURRENCY_ICONS_SGV.CZK, class: 'currency-icon-x-large' },
|
||||
{ id: 'DKK', name: 'Denmark Krone', iconType: 'SVG', symbol: FIAT_CURRENCY_ICONS_SGV.DKK, class: 'currency-icon-medium' }, { id: 'EUR', name: 'Euro Member Countries', iconType: 'FA', symbol: faEuroSign }, { id: 'GBP', name: 'United Kingdom Pound', iconType: 'FA', symbol: faSterlingSign },
|
||||
{ id: 'HKD', name: 'Hong Kong Dollar', iconType: 'FA', symbol: faDollarSign }, { id: 'HRK', name: 'Croatia Kuna', iconType: 'SVG', symbol: FIAT_CURRENCY_ICONS_SGV.HRK, class: 'currency-icon-medium' }, { id: 'HUF', name: 'Hungary Forint', iconType: 'SVG', symbol: FIAT_CURRENCY_ICONS_SGV.HUF, class: 'currency-icon-small' },
|
||||
{ id: 'INR', name: 'India Rupee', iconType: 'FA', symbol: faIndianRupeeSign }, { id: 'ISK', name: 'Iceland Krona', iconType: 'SVG', symbol: FIAT_CURRENCY_ICONS_SGV.DKK, class: 'currency-icon-medium' }, { id: 'JPY', name: 'Japan Yen', iconType: 'FA', symbol: faYenSign },
|
||||
{ id: 'KRW', name: 'Korea (South) Won', iconType: 'FA', symbol: faWonSign }, { id: 'NZD', name: 'New Zealand Dollar', iconType: 'FA', symbol: faDollarSign }, { id: 'PLN', name: 'Poland Zloty', iconType: 'SVG', symbol: FIAT_CURRENCY_ICONS_SGV.PLN, class: 'currency-icon-large' },
|
||||
{ id: 'RON', name: 'Romania Leu', iconType: 'SVG', symbol: FIAT_CURRENCY_ICONS_SGV.RON, class: 'currency-icon-medium' }, { id: 'RUB', name: 'Russia Ruble', iconType: 'FA', symbol: faRubleSign }, { id: 'SEK', name: 'Sweden Krona', iconType: 'SVG', symbol: FIAT_CURRENCY_ICONS_SGV.DKK, class: 'currency-icon-medium' },
|
||||
{ id: 'SGD', name: 'Singapore Dollar', iconType: 'FA', symbol: faDollarSign }, { id: 'THB', name: 'Thailand Baht', iconType: 'FA', symbol: faBahtSign }, { id: 'TRY', name: 'Turkey Lira', iconType: 'FA', symbol: faTurkishLiraSign },
|
||||
{ id: 'TWD', name: 'Taiwan New Dollar', iconType: 'SVG', symbol: FIAT_CURRENCY_ICONS_SGV.TWD }
|
||||
{ id: 'TWD', name: 'Taiwan New Dollar', iconType: 'SVG', symbol: FIAT_CURRENCY_ICONS_SGV.TWD, class: 'currency-icon-small' }
|
||||
];
|
||||
|
||||
export function getSelectedCurrency(currencyID: string) {
|
||||
return FIAT_CURRENCY_UNITS.find((currencyUnit) => currencyUnit.id === currencyID);
|
||||
const foundCurrency = FIAT_CURRENCY_UNITS.find((currencyUnit) => currencyUnit.id === currencyID);
|
||||
if (foundCurrency.iconType === 'SVG' && typeof foundCurrency.symbol === 'string') {
|
||||
foundCurrency.symbol = foundCurrency.symbol.replace('<svg class="currency-icon"', '<svg class= "currency-icon ' + foundCurrency.class + '"');
|
||||
}
|
||||
return foundCurrency;
|
||||
}
|
||||
|
@ -1127,14 +1127,26 @@ mat-card-content.mat-mdc-card-content:first-child {
|
||||
border-radius: 2px;
|
||||
}
|
||||
|
||||
.currency-icon-small {
|
||||
max-width: $gap * 1.75;
|
||||
max-height: $gap * 1.75;
|
||||
}
|
||||
.currency-icon {
|
||||
&.currency-icon-small {
|
||||
max-width: $gap * 1.675;
|
||||
max-height: $gap * 1.675;
|
||||
}
|
||||
|
||||
.currency-icon-medium {
|
||||
max-width: $gap * 2;
|
||||
max-height: $gap * 2;
|
||||
&.currency-icon-medium {
|
||||
max-width: $gap * 2;
|
||||
max-height: $gap * 2;
|
||||
}
|
||||
|
||||
&.currency-icon-large {
|
||||
max-width: $gap * 2.25;
|
||||
max-height: $gap * 2.25;
|
||||
}
|
||||
|
||||
&.currency-icon-x-large {
|
||||
max-width: $gap * 2.5;
|
||||
max-height: $gap * 2.5;
|
||||
}
|
||||
}
|
||||
|
||||
.fa-icon-small, .top-icon-small {
|
||||
|
@ -508,7 +508,19 @@
|
||||
margin-bottom: $gap;
|
||||
}
|
||||
|
||||
.mat-mdc-form-field-hint .currency-icon-small {
|
||||
.mat-mdc-option.mdc-list-item:hover, .mat-mdc-option.mdc-list-item.mat-mdc-option-active {
|
||||
fa-icon svg path {
|
||||
fill: $primary-color;
|
||||
}
|
||||
& .currency-icon {
|
||||
color: $primary-color;
|
||||
& path {
|
||||
fill: $primary-color;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.mat-mdc-form-field-hint .currency-icon {
|
||||
color: $primary-color;
|
||||
& path {
|
||||
fill: $primary-color;
|
||||
|
@ -62,7 +62,7 @@
|
||||
background: $foreground-secondary-text;
|
||||
}
|
||||
}
|
||||
.currency-icon-medium path, .currency-icon-medium polygon {
|
||||
.currency-icon path, .currency-icon polygon {
|
||||
fill: $foreground-text;
|
||||
}
|
||||
.rtl-snack-bar.mat-mdc-snack-bar-container {
|
||||
|
@ -233,12 +233,12 @@
|
||||
}
|
||||
.mat-mdc-form-field-hint {
|
||||
color: $primary-color;
|
||||
.currency-icon-small path {
|
||||
.currency-icon path, .currency-icon polygon, fa-icon svg path {
|
||||
fill: $primary-color;
|
||||
}
|
||||
}
|
||||
.currency-icon-medium path {
|
||||
fill: $foreground-text;
|
||||
.currency-icon path, .currency-icon polygon {
|
||||
fill: $foreground-secondary-text;
|
||||
}
|
||||
svg {
|
||||
& .boltz-icon { stroke:$foreground-secondary-text; stroke-width:4; }
|
||||
|
Loading…
Reference in New Issue
Block a user