FIx error handling logic in ord-data

This commit is contained in:
natsoni 2024-10-08 11:24:17 +09:00
parent 3b9601a82e
commit 65f080d526
No known key found for this signature in database
GPG Key ID: C65917583181743B
3 changed files with 50 additions and 60 deletions

View File

@ -1,16 +1,11 @@
@if (error) {
<div>
<i>Error fetching data (code {{ error.status }})</i>
</div>
} @else {
@if (minted) {
@if (minted) {
<ng-container i18n="ord.mint-n-runes">
<span>Mint</span>
<span class="amount"> {{ minted >= 100000 ? (minted | amountShortener:undefined:undefined:true) : minted }} </span>
<ng-container *ngTemplateOutlet="runeName; context: { $implicit: runestone.mint.toString() }"></ng-container>
</ng-container>
}
@if (runestone?.etching?.supply) {
}
@if (runestone?.etching?.supply) {
@if (runestone?.etching.premine > 0) {
<ng-container i18n="ord.premine-n-runes">
<span>Premine</span>
@ -26,17 +21,17 @@
<span class="name">{{ runestone.etching.spacedName }}</span>
</ng-container>
}
}
@if (transferredRunes?.length && type === 'vout') {
}
@if (transferredRunes?.length && type === 'vout') {
<div *ngFor="let rune of transferredRunes">
<ng-container i18n="ord.transfer-rune">
<span>Transfer</span>
<ng-container *ngTemplateOutlet="runeName; context: { $implicit: rune.key }"></ng-container>
</ng-container>
</div>
}
}
@if (inscriptions?.length && type === 'vin') {
@if (inscriptions?.length && type === 'vin') {
<div *ngFor="let contentType of inscriptionsData | keyvalue">
<div>
<span class="badge badge-ord mr-1">{{ contentType.value.count > 1 ? contentType.value.count + " " : "" }}{{ contentType.value?.tag || contentType.key }}</span>
@ -48,17 +43,14 @@
<pre *ngIf="contentType.value.json" class="name" style="white-space: pre-wrap; word-break: break-word;">{{ contentType.value.json | json }}</pre>
<pre *ngIf="contentType.value.text" class="name" style="white-space: pre-wrap; word-break: break-word;">{{ contentType.value.text }}</pre>
</div>
}
}
@if (!runestone && type === 'vout') {
@if (!runestone && type === 'vout') {
<div class="skeleton-loader" style="width: 50%;"></div>
}
}
@if (!inscriptions?.length && type === 'vin') {
<div>
<i>Error decoding inscription data</i>
</div>
}
@if ((runestone && !minted && !runestone.etching?.supply && !transferredRunes?.length && type === 'vout') || (!inscriptions?.length && type === 'vin')) {
<i i18n="error.decoding-data">Error decoding data</i>
}
<ng-template #runeName let-id>

View File

@ -1,5 +1,4 @@
import { ChangeDetectionStrategy, Component, Input, OnChanges, SimpleChanges } from '@angular/core';
import { HttpErrorResponse } from '@angular/common/http';
import { Runestone, Etching } from '../../shared/ord/rune.utils';
export interface Inscription {
@ -20,7 +19,6 @@ export class OrdDataComponent implements OnChanges {
@Input() inscriptions: Inscription[];
@Input() runestone: Runestone;
@Input() runeInfo: { [id: string]: { etching: Etching; txid: string } };
@Input() error: HttpErrorResponse;
@Input() type: 'vin' | 'vout';
toNumber = (value: bigint): number => Number(value);

View File

@ -103,7 +103,7 @@
}">
<td></td>
<td colspan="2">
<app-ord-data [inscriptions]="showOrdData[tx.txid + '-vin-' + vindex]['inscriptions']" [type]="'vin'" [error]="showOrdData[tx.txid + '-vin-' + vindex]['error']"></app-ord-data>
<app-ord-data [inscriptions]="showOrdData[tx.txid + '-vin-' + vindex]['inscriptions']" [type]="'vin'"></app-ord-data>
</td>
</tr>
<tr *ngIf="(showDetails$ | async) === true">
@ -297,7 +297,7 @@
'highlight': this.address !== '' && (vout.scriptpubkey_address === this.address || (vout.scriptpubkey_type === 'p2pk' && vout.scriptpubkey.slice(2, -2) === this.address))
}">
<td colspan="3">
<app-ord-data [runestone]="showOrdData[tx.txid + '-vout-' + vindex]['runestone']" [runeInfo]="showOrdData[tx.txid + '-vout-' + vindex]['runeInfo']" [type]="'vout'" [error]="showOrdData[tx.txid + '-vout-' + vindex]['error']"></app-ord-data>
<app-ord-data [runestone]="showOrdData[tx.txid + '-vout-' + vindex]['runestone']" [runeInfo]="showOrdData[tx.txid + '-vout-' + vindex]['runeInfo']" [type]="'vout'"></app-ord-data>
</td>
</tr>
<tr *ngIf="(showDetails$ | async) === true">