Browse Source

txt: Add 90% mark and label to progress bar

master
fiatjaf 4 years ago
committed by GitHub
parent
commit
ee208e9c03
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 13
      txt/index.ts

13
txt/index.ts

@ -58,6 +58,14 @@ Donate via Lightning Network:
${bech32.encode("lnurl", bech32.toWords(new TextEncoder().encode(config.donation?.lnurlPayUrl)), 1024)}` ${bech32.encode("lnurl", bech32.toWords(new TextEncoder().encode(config.donation?.lnurlPayUrl)), 1024)}`
: ""; : "";
const progressBar =
">".repeat(Math.ceil(currentNumberOfSignallingBlocks / 25)) +
"-".repeat(Math.ceil(blocksLeftInThisPeriod / 25)) +
"<".repeat(Math.ceil(currentNumberOfNonSignallingBlocks / 25));
const pct90 = Math.round(progressBar.length * 0.9);
const label90Pct = " ".repeat(pct90 - 1) + "90%";
const progressBarWith90Pct = progressBar.slice(0, pct90) + "|" + progressBar.slice(pct90);
return ` return `
### ###
@ -69,9 +77,8 @@ ${config.fork.info.join("\n\n")}
Current signalling period of 2016 blocks Current signalling period of 2016 blocks
${">".repeat(Math.ceil(currentNumberOfSignallingBlocks / 25))}${"-".repeat( ${label90Pct}
Math.ceil(blocksLeftInThisPeriod / 25) ${progressBarWith90Pct}
)}${"<".repeat(Math.ceil(currentNumberOfNonSignallingBlocks / 25))}
blocks: ${currentNumberOfSignallingBlocks} signalling | ${blocksLeftInThisPeriod} upcoming | ${currentNumberOfNonSignallingBlocks} non-signalling blocks: ${currentNumberOfSignallingBlocks} signalling | ${blocksLeftInThisPeriod} upcoming | ${currentNumberOfNonSignallingBlocks} non-signalling
${notes.map((n) => "- " + n).join("\n")} ${notes.map((n) => "- " + n).join("\n")}

Loading…
Cancel
Save