Add more block info, reduce font size

This commit is contained in:
Mononaut 2023-10-01 17:59:55 +01:00
parent d69cdacd5e
commit 642be969a3
No known key found for this signature in database
GPG Key ID: A3F058E41374C04E
3 changed files with 34 additions and 24 deletions

View File

@ -16,10 +16,12 @@
></app-block-overview-graph> ></app-block-overview-graph>
<div *ngIf="showInfo && blockInfo[i]" class="info" @infoChange> <div *ngIf="showInfo && blockInfo[i]" class="info" @infoChange>
<h1>{{ blockInfo[i].height }}</h1> <h1>{{ blockInfo[i].height }}</h1>
<p class="hash">{{ blockInfo[i].hash }}</p> <p class="hash">{{ blockInfo[i].id.slice(0, 32) }}<br>{{ blockInfo[i].id.slice(32) }}</p>
<h2>{{ blockInfo[i].time }}</h2> <h2>{{ blockInfo[i].timeString }}</h2>
<h2>{{ blockInfo[i].count }}</h2> <h2>{{ blockInfo[i].tx_count }} transactions</h2>
<h2>{{ blockInfo[i].size }}</h2> <h2>{{ blockInfo[i].extras.medianFee | feeRounding }} sat/vB</h2>
<h2>{{ blockInfo[i].size | bytes: 2 : 'B' : 'MB' : true }}</h2>
<h2>Mined by {{ blockInfo[i].extras.pool.name || 'Unknown' }}</h2>
</div> </div>
</div> </div>
</div> </div>

View File

@ -21,30 +21,37 @@
.info { .info {
position: absolute; position: absolute;
left: 10%; left: 5%;
top: 10%; top: 5%;
right: 10%; right: 5%;
bottom: 10%; bottom: 5%;
height: 80%; height: 90%;
width: 80%; width: 90%;
overflow: hidden; font-size: calc(var(--block-width) * 0.03);
font-size: calc(var(--block-width) * 0.04); text-shadow: 0 0 calc(var(--block-width) * 0.05) black;
h1 { h1 {
font-size: 4em; font-size: 3em;
margin-bottom: 0.1em; line-height: 1;
margin-bottom: calc(var(--block-width) * 0.03);
} }
h2 { h2 {
font-size: 2.5em; font-size: 1.5em;
margin-bottom: 0.1em; line-height: 1;
margin-bottom: calc(var(--block-width) * 0.03);
} }
.hash { .hash {
font-family: monospace; font-family: monospace;
word-wrap: break-word; word-wrap: break-word;
font-size: 1em; font-size: 1.2em;
margin-bottom: 0.1em; line-height: 1;
margin-bottom: calc(var(--block-width) * 0.03);
} }
} }
} }
.block-container {
overflow: hidden;
}
} }

View File

@ -26,6 +26,10 @@ function bestFitResolution(min, max, n): number {
return best; return best;
} }
interface BlockInfo extends BlockExtended {
timeString: string;
}
@Component({ @Component({
selector: 'app-eight-blocks', selector: 'app-eight-blocks',
templateUrl: './eight-blocks.component.html', templateUrl: './eight-blocks.component.html',
@ -70,7 +74,7 @@ export class EightBlocksComponent implements OnInit, OnDestroy {
testShiftTimeout: number; testShiftTimeout: number;
showInfo: boolean = true; showInfo: boolean = true;
blockInfo: { [key: string]: string}[] = []; blockInfo: BlockInfo[] = [];
wrapperStyle = { wrapperStyle = {
'--block-width': '1080px', '--block-width': '1080px',
@ -213,11 +217,8 @@ export class EightBlocksComponent implements OnInit, OnDestroy {
setTimeout(() => { setTimeout(() => {
this.blockInfo = blocks.map(block => { this.blockInfo = blocks.map(block => {
return { return {
height: `${block.height}`, ...block,
hash: block.id, timeString: (new Date(block.timestamp * 1000)).toLocaleTimeString(),
time: (new Date(block.timestamp * 1000)).toLocaleTimeString(),
count: `${block.tx_count} txs`,
size: `${this.bytesPipe.transform(block.size, 2, 'B', 'MB', true)}`,
}; };
}); });
this.showInfo = true; this.showInfo = true;