Show pool addresses in a scrollable div with href

This commit is contained in:
nymkappa 2022-02-11 19:10:29 +09:00
parent 9e64592aca
commit 763ea0ce6f
No known key found for this signature in database
GPG Key ID: E155910B16E8BD04
3 changed files with 26 additions and 5 deletions

View File

@ -47,21 +47,26 @@
<div class="box"> <div class="box">
<div class="row"> <div class="row">
<div class="col-sm"> <div class="col-md-8">
<table class="table table-borderless table-striped" style="table-layout: fixed;"> <table class="table table-borderless table-striped" style="table-layout: fixed;">
<tbody> <tbody>
<tr> <tr>
<td>Address</td> <td class="col-4 col-lg-3">Addresses</td>
<td class="text-truncate">{{ poolStats.pool.addresses }}</td> <td class="text-truncate" *ngIf="poolStats.pool.addresses.length else noaddress">
<div class="scrollable">
<a *ngFor="let address of poolStats.pool.addresses" [routerLink]="['/address' | relativeUrl, address]">{{ address }}<br></a>
</div>
</td>
<ng-template #noaddress><td>~</td></ng-template>
</tr> </tr>
<tr> <tr>
<td>Coinbase Tag</td> <td class="col-4 col-lg-3">Coinbase Tags</td>
<td class="text-truncate">{{ poolStats.pool.regexes }}</td> <td class="text-truncate">{{ poolStats.pool.regexes }}</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
</div> </div>
<div class="col-sm"> <div class="col-md-4">
<table class="table table-borderless table-striped"> <table class="table table-borderless table-striped">
<tbody> <tbody>
<tr> <tr>

View File

@ -30,3 +30,12 @@
} }
} }
} }
div.scrollable {
width: 100%;
height: 100%;
margin: 0;
padding: 0;
overflow: auto;
max-height: 100px;
}

View File

@ -49,6 +49,13 @@ export class PoolComponent implements OnInit {
return this.apiService.getPoolStats$(this.poolId, params[1] ?? '1w'); return this.apiService.getPoolStats$(this.poolId, params[1] ?? '1w');
}), }),
map((poolStats) => { map((poolStats) => {
let regexes = '"';
for (const regex of JSON.parse(poolStats.pool.regexes)) {
regexes += regex + '", "';
}
poolStats.pool.regexes = regexes.slice(0, -3);
poolStats.pool.addresses = JSON.parse(poolStats.pool.addresses);
return Object.assign({ return Object.assign({
logo: `./resources/mining-pools/` + poolStats.pool.name.toLowerCase().replace(' ', '').replace('.', '') + '.svg' logo: `./resources/mining-pools/` + poolStats.pool.name.toLowerCase().replace(' ', '').replace('.', '') + '.svg'
}, poolStats); }, poolStats);