Refactor accelerator dashboard
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
<span *ngIf="valueOverride !== undefined">{{ valueOverride }}</span>
|
||||
<span *ngIf="valueOverride === undefined">‎{{ addPlus && satoshis >= 0 ? '+' : '' }}{{ value | number }} </span>
|
||||
<span class="symbol">
|
||||
<ng-template [ngIf]="network === 'liquid'">L-</ng-template>
|
||||
<ng-template [ngIf]="network === 'liquidtestnet'">tL-</ng-template>
|
||||
<ng-template [ngIf]="network === 'testnet'">t-</ng-template>
|
||||
<ng-template [ngIf]="network === 'signet'">s-</ng-template>{{ unit }}
|
||||
</span>
|
||||
44
frontend/src/app/shared/components/btc/btc.component.ts
Normal file
44
frontend/src/app/shared/components/btc/btc.component.ts
Normal file
@@ -0,0 +1,44 @@
|
||||
import { Component, Input, OnChanges, OnInit, SimpleChanges } from '@angular/core';
|
||||
import { Subscription } from 'rxjs';
|
||||
import { StateService } from '../../../services/state.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-btc',
|
||||
templateUrl: './btc.component.html',
|
||||
styleUrls: ['./btc.component.scss']
|
||||
})
|
||||
export class BtcComponent implements OnInit, OnChanges {
|
||||
@Input() satoshis: number;
|
||||
@Input() addPlus = false;
|
||||
@Input() valueOverride: string | undefined = undefined;
|
||||
|
||||
value: number;
|
||||
unit: string;
|
||||
|
||||
network = '';
|
||||
stateSubscription: Subscription;
|
||||
|
||||
constructor(
|
||||
private stateService: StateService,
|
||||
) { }
|
||||
|
||||
ngOnInit() {
|
||||
this.stateSubscription = this.stateService.networkChanged$.subscribe((network) => this.network = network);
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
if (this.stateSubscription) {
|
||||
this.stateSubscription.unsubscribe();
|
||||
}
|
||||
}
|
||||
|
||||
ngOnChanges(changes: SimpleChanges): void {
|
||||
if (this.satoshis >= 1_000_000) {
|
||||
this.value = (this.satoshis / 100_000_000);
|
||||
this.unit = 'BTC'
|
||||
} else {
|
||||
this.value = Math.round(this.satoshis);
|
||||
this.unit = 'sats'
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -73,6 +73,7 @@ import { IndexingProgressComponent } from '../components/indexing-progress/index
|
||||
import { SvgImagesComponent } from '../components/svg-images/svg-images.component';
|
||||
import { ChangeComponent } from '../components/change/change.component';
|
||||
import { SatsComponent } from './components/sats/sats.component';
|
||||
import { BtcComponent } from './components/btc/btc.component';
|
||||
import { FeeRateComponent } from './components/fee-rate/fee-rate.component';
|
||||
import { TruncateComponent } from './components/truncate/truncate.component';
|
||||
import { SearchResultsComponent } from '../components/search-form/search-results/search-results.component';
|
||||
@@ -85,8 +86,9 @@ import { GlobalFooterComponent } from './components/global-footer/global-footer.
|
||||
import { AcceleratePreviewComponent } from '../components/accelerate-preview/accelerate-preview.component';
|
||||
import { AccelerateFeeGraphComponent } from '../components/accelerate-preview/accelerate-fee-graph.component';
|
||||
import { MempoolErrorComponent } from './components/mempool-error/mempool-error.component';
|
||||
import { AccelerationsListComponent } from '../components/accelerations-list/accelerations-list.component';
|
||||
import { AccelerationStatsComponent } from '../components/acceleration-stats/acceleration-stats.component';
|
||||
import { AccelerationsListComponent } from '../components/acceleration/accelerations-list/accelerations-list.component';
|
||||
import { PendingStatsComponent } from '../components/acceleration/pending-stats/pending-stats.component';
|
||||
import { AccelerationStatsComponent } from '../components/acceleration/acceleration-stats/acceleration-stats.component';
|
||||
|
||||
import { BlockViewComponent } from '../components/block-view/block-view.component';
|
||||
import { EightBlocksComponent } from '../components/eight-blocks/eight-blocks.component';
|
||||
@@ -169,6 +171,7 @@ import { OnlyVsizeDirective, OnlyWeightDirective } from './components/weight-dir
|
||||
SvgImagesComponent,
|
||||
ChangeComponent,
|
||||
SatsComponent,
|
||||
BtcComponent,
|
||||
FeeRateComponent,
|
||||
TruncateComponent,
|
||||
SearchResultsComponent,
|
||||
@@ -194,6 +197,7 @@ import { OnlyVsizeDirective, OnlyWeightDirective } from './components/weight-dir
|
||||
MempoolErrorComponent,
|
||||
AccelerationsListComponent,
|
||||
AccelerationStatsComponent,
|
||||
PendingStatsComponent,
|
||||
],
|
||||
imports: [
|
||||
CommonModule,
|
||||
@@ -291,6 +295,7 @@ import { OnlyVsizeDirective, OnlyWeightDirective } from './components/weight-dir
|
||||
SvgImagesComponent,
|
||||
ChangeComponent,
|
||||
SatsComponent,
|
||||
BtcComponent,
|
||||
FeeRateComponent,
|
||||
TruncateComponent,
|
||||
SearchResultsComponent,
|
||||
@@ -306,6 +311,7 @@ import { OnlyVsizeDirective, OnlyWeightDirective } from './components/weight-dir
|
||||
MempoolErrorComponent,
|
||||
AccelerationsListComponent,
|
||||
AccelerationStatsComponent,
|
||||
PendingStatsComponent,
|
||||
|
||||
MempoolBlockOverviewComponent,
|
||||
ClockchainComponent,
|
||||
|
||||
Reference in New Issue
Block a user