diff --git a/internal/api/userpage/static/webapp.html b/internal/api/userpage/static/webapp.html index 6714d71..cd21358 100644 --- a/internal/api/userpage/static/webapp.html +++ b/internal/api/userpage/static/webapp.html @@ -13,6 +13,8 @@ + + LNURL @@ -43,10 +45,7 @@ display: block; width: 100%; font-size: 14px; - margin: 15px 0; - padding: 12px 20px; border: none; - border-radius: 4px; background-color: var(--tg-theme-button-color, #50a8eb); color: var(--tg-theme-button-text-color, #ffffff); cursor: pointer; @@ -61,10 +60,7 @@ input { font-size: 14px; text-align: center; - padding: 12px 20px; - margin: 15px 0; border: none; - border-radius: 4px; background-color: var(--tg-theme-bg-color, #f5f5f5); color: var(--tg-theme-text-color, #1a1a1a); } @@ -218,6 +214,7 @@ padding: 12px 20px; column-gap: 10px; row-gap: 1em; + align-items: center; } @@ -235,11 +232,15 @@
-
- + +
+ +
+
sat
+
- +
@@ -271,8 +272,6 @@ } - - // listen for enter in input field var el = document.getElementById("invoiceAmount"); el.addEventListener("keydown", function(event) { @@ -280,6 +279,8 @@ document.getElementById("requestInvoice").click(); } document.getElementById("requestInvoice").innerHTML = "Invoice" + // revert color of button + $('#requestInvoice').removeClass('btn-danger').addClass('btn-primary'); }); // ------------------ functions ------------------ @@ -292,6 +293,13 @@ window.scrollTo(0, 0); } + function invoiceButtonDisplayError(message) { + btn = document.getElementById("requestInvoice") + btn.innerHTML = message + // update color of button + $('#requestInvoice').removeClass('btn-primary').addClass('btn-danger'); + } + function webviewClose() { Telegram.WebApp.close(); } @@ -319,8 +327,8 @@ console.log(r); var invoiceAmount = Number(document.getElementById("invoiceAmount").value); if (!Number.isInteger(invoiceAmount) || invoiceAmount < 1) { - document.getElementById("requestInvoice").innerHTML = "Error" - return true; + invoiceButtonDisplayError("Invalid") + return false; } console.log("requesting invoice with amount " + invoiceAmount); fetch(r.callback + '?amount='+ invoiceAmount * 1000).then(data => { @@ -333,13 +341,17 @@ renderQr(r.pr); document.querySelector('#greeting').innerHTML = "Pay " + invoiceAmount + " sat"; } else { - document.getElementById("requestInvoice").innerHTML = "Error" + invoiceButtonDisplayError("Error") + return false; } }) }) } + + +