REF: Channel size GUI

This commit is contained in:
ncoelho 2021-02-17 17:29:22 +01:00 committed by Overtorment
parent 36ae5c5f4e
commit 5457d377f3
3 changed files with 9 additions and 4 deletions

View File

@ -26,13 +26,14 @@ function updateLightning() {
lightningListChannels = response; lightningListChannels = response;
let channels = []; let channels = [];
for (let channel of lightningListChannels.channels) { for (let channel of lightningListChannels.channels) {
let magic = 104287;
let divider = 0.01; let divider = 0.01;
let max = 100;
let ascii_length1 = channel.local_balance * divider; let ascii_length1 = channel.local_balance * divider;
let ascii_length2 = channel.remote_balance * divider; let ascii_length2 = channel.remote_balance * divider;
channel.local = (Math.round(ascii_length1)); channel.local = (Math.round(ascii_length1));
channel.remote = (max - (Math.round(ascii_length1))); channel.remote = (Math.round(ascii_length2));
channel.total = ((channel.local) + (channel.remote); channel.total = (channel.local) + (channel.remote);
channel.size = (channel.capacity / magic);
channel.capacity_btc = channel.capacity / 100000000; channel.capacity_btc = channel.capacity / 100000000;
channel.name = pubkey2name[channel.remote_pubkey]; channel.name = pubkey2name[channel.remote_pubkey];
if (channel.name) { if (channel.name) {

View File

@ -112,10 +112,13 @@ body {
appearance: none; appearance: none;
margin: 0; margin: 0;
padding: 0; padding: 0;
max-width : 100%;
-webkit-appearance: none;
} }
#progressbar[max]::-webkit-progress-value { #progressbar[max]::-webkit-progress-value {
border-radius: 8px 0 0 8px; border-radius: 8px 0 0 8px;
background: linear-gradient(0deg, rgba(104,187,225,1) 0%, rgba(139,215,249,1) 100%); background: linear-gradient(0deg, rgba(104,187,225,1) 0%, rgba(139,215,249,1) 100%);
-webkit-appearance: none;
} }
#progressbar[value]::-webkit-progress-bar { #progressbar[value]::-webkit-progress-bar {
background: linear-gradient(0deg, rgba(47,95,179,1) 0%, rgba(63,120,220,1) 100%); background: linear-gradient(0deg, rgba(47,95,179,1) 0%, rgba(63,120,220,1) 100%);
@ -123,6 +126,7 @@ body {
border-radius: 8px; border-radius: 8px;
transition: 0.4s linear; transition: 0.4s linear;
transition-property: width, background-color; transition-property: width, background-color;
-webkit-appearance: none;
} }
.row { .row {
padding: 8px 0; padding: 8px 0;

View File

@ -106,7 +106,7 @@
{{/name}} {{/name}}
<span class="amount">{{capacity_btc}} BTC</span> <span class="amount">{{capacity_btc}} BTC</span>
</div> </div>
<div class="graph"><progress id="progressbar" class="" value="{{local}}" max="{{remote}}" style="width:{{total}}%"></progress></div> <div class="graph"><progress id="progressbar" class="" value="{{local}}" max="{{total}}" style="width: {{size}}%"></progress></div>
{{^active}} {{^active}}
<div class="status"><span class="label right" title="inactive"></span></div> <div class="status"><span class="label right" title="inactive"></span></div>
{{/active}} {{/active}}