eight blocks

This commit is contained in:
Mononaut
2023-09-28 15:48:37 +01:00
parent 108d1762d6
commit ec8fc53dcb
9 changed files with 370 additions and 28 deletions

View File

@@ -17,7 +17,7 @@ export class BytesPipe implements PipeTransform {
'TB': {max: Number.MAX_SAFE_INTEGER, prev: 'GB'}
};
transform(input: any, decimal: number = 0, from: ByteUnit = 'B', to?: ByteUnit, sigfigs?: number): any {
transform(input: any, decimal: number = 0, from: ByteUnit = 'B', to?: ByteUnit, plaintext = false, sigfigs?: number): any {
if (!(isNumberFinite(input) &&
isNumberFinite(decimal) &&
@@ -42,7 +42,7 @@ export class BytesPipe implements PipeTransform {
const result = numberFormat(BytesPipe.calculateResult(format, bytes));
return BytesPipe.formatResult(result, to);
return BytesPipe.formatResult(result, to, plaintext);
}
for (const key in BytesPipe.formats) {
@@ -51,13 +51,17 @@ export class BytesPipe implements PipeTransform {
const result = numberFormat(BytesPipe.calculateResult(format, bytes));
return BytesPipe.formatResult(result, key);
return BytesPipe.formatResult(result, key, plaintext);
}
}
}
static formatResult(result: string, unit: string): string {
return `${result} <span class="symbol">${unit}</span>`;
static formatResult(result: string, unit: string, plaintext): string {
if (plaintext) {
return `${result} ${unit}`;
} else {
return `${result} <span class="symbol">${unit}</span>`;
}
}
static calculateResult(format: { max: number, prev?: ByteUnit }, bytes: number) {

View File

@@ -87,6 +87,7 @@ import { AccelerateFeeGraphComponent } from '../components/accelerate-preview/ac
import { MempoolErrorComponent } from './components/mempool-error/mempool-error.component';
import { BlockViewComponent } from '../components/block-view/block-view.component';
import { EightBlocksComponent } from '../components/eight-blocks/eight-blocks.component';
import { MempoolBlockViewComponent } from '../components/mempool-block-view/mempool-block-view.component';
import { MempoolBlockOverviewComponent } from '../components/mempool-block-overview/mempool-block-overview.component';
import { ClockchainComponent } from '../components/clockchain/clockchain.component';
@@ -126,6 +127,7 @@ import { OnlyVsizeDirective, OnlyWeightDirective } from './components/weight-dir
ColoredPriceDirective,
BlockchainComponent,
BlockViewComponent,
EightBlocksComponent,
MempoolBlockViewComponent,
MempoolBlocksComponent,
BlockchainBlocksComponent,
@@ -179,6 +181,7 @@ import { OnlyVsizeDirective, OnlyWeightDirective } from './components/weight-dir
CalculatorComponent,
BitcoinsatoshisPipe,
BlockViewComponent,
EightBlocksComponent,
MempoolBlockViewComponent,
MempoolBlockOverviewComponent,
ClockchainComponent,
@@ -202,6 +205,7 @@ import { OnlyVsizeDirective, OnlyWeightDirective } from './components/weight-dir
FontAwesomeModule,
],
providers: [
BytesPipe,
VbytesPipe,
WuBytesPipe,
RelativeUrlPipe,