Fix remaining bugs from rebase

This commit is contained in:
natsoni 2024-04-04 16:33:50 +09:00
parent 79dd263fb1
commit c827953ca5
No known key found for this signature in database
GPG Key ID: C65917583181743B
4 changed files with 10 additions and 51 deletions

View File

@ -8,12 +8,12 @@ import { Observable, catchError, combineLatest, distinctUntilChanged, interval,
import { Color } from '../../block-overview-graph/sprite-types'; import { Color } from '../../block-overview-graph/sprite-types';
import { hexToColor } from '../../block-overview-graph/utils'; import { hexToColor } from '../../block-overview-graph/utils';
import TxView from '../../block-overview-graph/tx-view'; import TxView from '../../block-overview-graph/tx-view';
import { feeLevels, mempoolFeeColors } from '../../../app.constants'; import { feeLevels, defaultMempoolFeeColors } from '../../../app.constants';
import { ServicesApiServices } from '../../../services/services-api.service'; import { ServicesApiServices } from '../../../services/services-api.service';
import { detectWebGL } from '../../../shared/graphs.utils'; import { detectWebGL } from '../../../shared/graphs.utils';
const acceleratedColor: Color = hexToColor('8F5FF6'); const acceleratedColor: Color = hexToColor('8F5FF6');
const normalColors = mempoolFeeColors.map(hex => hexToColor(hex + '5F')); const normalColors = defaultMempoolFeeColors.map(hex => hexToColor(hex + '5F'));
interface AccelerationBlock extends BlockExtended { interface AccelerationBlock extends BlockExtended {
accelerationCount: number, accelerationCount: number,
@ -128,7 +128,7 @@ export class AcceleratorDashboardComponent implements OnInit {
} else { } else {
const rate = tx.fee / tx.vsize; // color by simple single-tx fee rate const rate = tx.fee / tx.vsize; // color by simple single-tx fee rate
const feeLevelIndex = feeLevels.findIndex((feeLvl) => Math.max(1, rate) < feeLvl) - 1; const feeLevelIndex = feeLevels.findIndex((feeLvl) => Math.max(1, rate) < feeLvl) - 1;
return normalColors[feeLevelIndex] || normalColors[mempoolFeeColors.length - 1]; return normalColors[feeLevelIndex] || normalColors[defaultMempoolFeeColors.length - 1];
} }
} }

View File

@ -1,4 +1,4 @@
import { feeLevels, mempoolFeeColors } from '../../app.constants'; import { feeLevels, defaultMempoolFeeColors } from '../../app.constants';
import { Color } from './sprite-types'; import { Color } from './sprite-types';
import TxView from './tx-view'; import TxView from './tx-view';
@ -38,7 +38,7 @@ export function setOpacity(color: Color, opacity: number): Color {
} }
// precomputed colors // precomputed colors
export const defaultFeeColors = mempoolFeeColors.map(hexToColor); export const defaultFeeColors = defaultMempoolFeeColors.map(hexToColor);
export const defaultAuditFeeColors = defaultFeeColors.map((color) => darken(desaturate(color, 0.3), 0.9)); export const defaultAuditFeeColors = defaultFeeColors.map((color) => darken(desaturate(color, 0.3), 0.9));
export const defaultMarginalFeeColors = defaultFeeColors.map((color) => darken(desaturate(color, 0.8), 1.1)); export const defaultMarginalFeeColors = defaultFeeColors.map((color) => darken(desaturate(color, 0.8), 1.1));
export const defaultAuditColors = { export const defaultAuditColors = {
@ -58,7 +58,7 @@ export function defaultColorFunction(
): Color { ): Color {
const rate = tx.fee / tx.vsize; // color by simple single-tx fee rate const rate = tx.fee / tx.vsize; // color by simple single-tx fee rate
const feeLevelIndex = feeLevels.findIndex((feeLvl) => Math.max(1, rate) < feeLvl) - 1; const feeLevelIndex = feeLevels.findIndex((feeLvl) => Math.max(1, rate) < feeLvl) - 1;
const feeLevelColor = feeColors[feeLevelIndex] || feeColors[mempoolFeeColors.length - 1]; const feeLevelColor = feeColors[feeLevelIndex] || feeColors[defaultMempoolFeeColors.length - 1];
// Normal mode // Normal mode
if (!tx.scene?.highlightingEnabled) { if (!tx.scene?.highlightingEnabled) {
if (tx.acc) { if (tx.acc) {
@ -75,7 +75,7 @@ export function defaultColorFunction(
case 'missing': case 'missing':
case 'sigop': case 'sigop':
case 'rbf': case 'rbf':
return marginalFeeColors[feeLevelIndex] || marginalFeeColors[mempoolFeeColors.length - 1]; return marginalFeeColors[feeLevelIndex] || marginalFeeColors[defaultMempoolFeeColors.length - 1];
case 'fresh': case 'fresh':
case 'freshcpfp': case 'freshcpfp':
return auditColors.missing; return auditColors.missing;
@ -84,12 +84,12 @@ export function defaultColorFunction(
case 'prioritized': case 'prioritized':
return auditColors.prioritized; return auditColors.prioritized;
case 'selected': case 'selected':
return marginalFeeColors[feeLevelIndex] || marginalFeeColors[mempoolFeeColors.length - 1]; return marginalFeeColors[feeLevelIndex] || marginalFeeColors[defaultMempoolFeeColors.length - 1];
case 'accelerated': case 'accelerated':
return auditColors.accelerated; return auditColors.accelerated;
case 'found': case 'found':
if (tx.context === 'projected') { if (tx.context === 'projected') {
return auditFeeColors[feeLevelIndex] || auditFeeColors[mempoolFeeColors.length - 1]; return auditFeeColors[feeLevelIndex] || auditFeeColors[defaultMempoolFeeColors.length - 1];
} else { } else {
return feeLevelColor; return feeLevelColor;
} }

View File

@ -101,47 +101,6 @@
</div> </div>
<div class="symbol"> <div class="symbol">
<span i18n="difficulty-box.new-subsidy">New subsidy</span> <span i18n="difficulty-box.new-subsidy">New subsidy</span>
<div class="item">
<h5 class="card-title" i18n="difficulty-box.remaining">Remaining</h5>
<div class="card-text">
<ng-container *ngTemplateOutlet="epochData.remainingBlocks === 1 ? blocksSingular : blocksPlural; context: {$implicit: epochData.remainingBlocks }"></ng-container>
<ng-template #blocksPlural let-i i18n="shared.blocks">{{ i }} <span class="shared-block">blocks</span></ng-template>
<ng-template #blocksSingular let-i i18n="shared.block">{{ i }} <span class="shared-block">block</span></ng-template>
</div>
<div class="symbol"><app-time-until [time]="epochData.estimatedRetargetDate" [fastRender]="true"></app-time-until></div>
</div>
<div class="item">
<h5 class="card-title" i18n="difficulty-box.estimate">Estimate</h5>
<div *ngIf="epochData.remainingBlocks < 1870; else recentlyAdjusted" class="card-text" [ngStyle]="{'color': epochData.colorAdjustments}">
<span *ngIf="epochData.change > 0; else arrowDownDifficulty" >
<fa-icon class="retarget-sign" [icon]="['fas', 'caret-up']" [fixedWidth]="true"></fa-icon>
</span>
<ng-template #arrowDownDifficulty >
<fa-icon class="retarget-sign" [icon]="['fas', 'caret-down']" [fixedWidth]="true"></fa-icon>
</ng-template>
{{ epochData.change | absolute | number: '1.2-2' }}
<span class="symbol">%</span>
</div>
<ng-template #recentlyAdjusted>
<div class="card-text">&#8212;</div>
</ng-template>
<div class="symbol">
<span i18n="difficulty-box.previous">Previous</span>:
<span [ngStyle]="{'color': epochData.colorPreviousAdjustments}">
<span *ngIf="epochData.previousRetarget > 0; else arrowDownPreviousDifficulty" >
<fa-icon class="previous-retarget-sign" [icon]="['fas', 'caret-up']" [fixedWidth]="true"></fa-icon>
</span>
<ng-template #arrowDownPreviousDifficulty >
<fa-icon class="previous-retarget-sign" [icon]="['fas', 'caret-down']" [fixedWidth]="true"></fa-icon>
</ng-template>
{{ epochData.previousRetarget | absolute | number: '1.2-2' }} </span> %
</div>
</div>
<div class="item" *ngIf="showProgress">
<h5 class="card-title" i18n="difficulty-box.current-period">Current Period</h5>
<div class="card-text">{{ epochData.progress | number: '1.2-2' }} <span class="symbol">%</span></div>
<div class="progress small-bar">
<div class="progress-bar" role="progressbar" style="width: 15%; background-color: var(--primary)" [ngStyle]="{'width': epochData.base}">&nbsp;</div>
</div> </div>
</div> </div>
<div class="item"> <div class="item">

View File

@ -57,7 +57,7 @@ $dropdown-link-hover-bg: $active-bg;
$dropdown-link-active-color: $fg; $dropdown-link-active-color: $fg;
$dropdown-link-active-bg: $active-bg; $dropdown-link-active-bg: $active-bg;
@import "~bootstrap/scss/bootstrap"; @import "bootstrap/scss/bootstrap";
:root { :root {
--bg: #{$bg}; --bg: #{$bg};