Show correct currency label in 'Latest transactions' widget

This commit is contained in:
nymkappa 2023-02-15 16:22:06 +09:00
parent 6c0dc34dd6
commit 28bd813fb8
No known key found for this signature in database
GPG Key ID: E155910B16E8BD04
2 changed files with 15 additions and 8 deletions

View File

@ -122,7 +122,7 @@
<thead> <thead>
<th class="table-cell-txid" i18n="dashboard.latest-transactions.txid">TXID</th> <th class="table-cell-txid" i18n="dashboard.latest-transactions.txid">TXID</th>
<th class="table-cell-satoshis" i18n="dashboard.latest-transactions.amount">Amount</th> <th class="table-cell-satoshis" i18n="dashboard.latest-transactions.amount">Amount</th>
<th class="table-cell-fiat" *ngIf="(network$ | async) === ''" i18n="dashboard.latest-transactions.USD">USD</th> <th class="table-cell-fiat" *ngIf="(network$ | async) === ''">{{ currency }}</th>
<th class="table-cell-fees" i18n="transaction.fee|Transaction fee">Fee</th> <th class="table-cell-fees" i18n="transaction.fee|Transaction fee">Fee</th>
</thead> </thead>
<tbody> <tbody>

View File

@ -1,5 +1,5 @@
import { ChangeDetectionStrategy, Component, Inject, LOCALE_ID, OnInit } from '@angular/core'; import { ChangeDetectionStrategy, Component, OnDestroy, OnInit } from '@angular/core';
import { combineLatest, merge, Observable, of } from 'rxjs'; import { combineLatest, merge, Observable, of, Subscription } from 'rxjs';
import { filter, map, scan, share, switchMap, tap } from 'rxjs/operators'; import { filter, map, scan, share, switchMap, tap } from 'rxjs/operators';
import { BlockExtended, OptimizedMempoolStats } from '../interfaces/node-api.interface'; import { BlockExtended, OptimizedMempoolStats } from '../interfaces/node-api.interface';
import { MempoolInfo, TransactionStripped } from '../interfaces/websocket.interface'; import { MempoolInfo, TransactionStripped } from '../interfaces/websocket.interface';
@ -7,7 +7,6 @@ import { ApiService } from '../services/api.service';
import { StateService } from '../services/state.service'; import { StateService } from '../services/state.service';
import { WebsocketService } from '../services/websocket.service'; import { WebsocketService } from '../services/websocket.service';
import { SeoService } from '../services/seo.service'; import { SeoService } from '../services/seo.service';
import { StorageService } from '../services/storage.service';
interface MempoolBlocksData { interface MempoolBlocksData {
blocks: number; blocks: number;
@ -32,7 +31,7 @@ interface MempoolStatsData {
styleUrls: ['./dashboard.component.scss'], styleUrls: ['./dashboard.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush changeDetection: ChangeDetectionStrategy.OnPush
}) })
export class DashboardComponent implements OnInit { export class DashboardComponent implements OnInit, OnDestroy {
featuredAssets$: Observable<any>; featuredAssets$: Observable<any>;
network$: Observable<string>; network$: Observable<string>;
mempoolBlocksData$: Observable<MempoolBlocksData>; mempoolBlocksData$: Observable<MempoolBlocksData>;
@ -47,16 +46,20 @@ export class DashboardComponent implements OnInit {
transactionsWeightPerSecondOptions: any; transactionsWeightPerSecondOptions: any;
isLoadingWebSocket$: Observable<boolean>; isLoadingWebSocket$: Observable<boolean>;
liquidPegsMonth$: Observable<any>; liquidPegsMonth$: Observable<any>;
currencySubscription: Subscription;
currency: string;
constructor( constructor(
@Inject(LOCALE_ID) private locale: string,
public stateService: StateService, public stateService: StateService,
private apiService: ApiService, private apiService: ApiService,
private websocketService: WebsocketService, private websocketService: WebsocketService,
private seoService: SeoService, private seoService: SeoService
private storageService: StorageService,
) { } ) { }
ngOnDestroy(): void {
this.currencySubscription.unsubscribe();
}
ngOnInit(): void { ngOnInit(): void {
this.isLoadingWebSocket$ = this.stateService.isLoadingWebSocket$; this.isLoadingWebSocket$ = this.stateService.isLoadingWebSocket$;
this.seoService.resetTitle(); this.seoService.resetTitle();
@ -213,6 +216,10 @@ export class DashboardComponent implements OnInit {
share(), share(),
); );
} }
this.currencySubscription = this.stateService.fiatCurrency$.subscribe((fiat) => {
this.currency = fiat;
});
} }
handleNewMempoolData(mempoolStats: OptimizedMempoolStats[]) { handleNewMempoolData(mempoolStats: OptimizedMempoolStats[]) {