diff --git a/extension/background/emscriptif.js b/extension/background/emscriptif.js index 26c0c631d..fbd05fe6a 100644 --- a/extension/background/emscriptif.js +++ b/extension/background/emscriptif.js @@ -363,7 +363,7 @@ class SignatureStruct { constructor(x) { this.members = {}; for (let k in x) { - this.set(k[0], k[1]); + this.set(x, x[k]); } } toPurpose(a) { diff --git a/extension/pages/debug.html b/extension/pages/debug.html index e4466bc47..7dfa7a9cc 100644 --- a/extension/pages/debug.html +++ b/extension/pages/debug.html @@ -5,6 +5,7 @@

Debug Pages

- Show DB + Show DB
+ Show balance diff --git a/extension/popup/balance-overview.html b/extension/popup/balance-overview.html index 9131bc710..7c0674c1e 100644 --- a/extension/popup/balance-overview.html +++ b/extension/popup/balance-overview.html @@ -5,9 +5,18 @@ + - + + +
-

- Looks like your wallet is empty. Want to get some KUDOS? -

+
+

Looks like your wallet is empty. Want to get some + KUDOS? +

+
diff --git a/extension/popup/balance-overview.js b/extension/popup/balance-overview.js index e244e5c05..0df0dae9f 100644 --- a/extension/popup/balance-overview.js +++ b/extension/popup/balance-overview.js @@ -19,17 +19,28 @@ document.addEventListener('DOMContentLoaded', (e) => { chrome.runtime.sendMessage({ type: "balances" }, function (wallet) { console.log("got balance"); let n = 0; - let table = React.createElement("div", null); + /*let table =
;*/ + let source = document.getElementById("balance-template").innerHTML; + console.log("size", Object.keys(wallet).length); + if (Object.keys(wallet).length > 0) { + let template = Handlebars.compile(source); + console.log("DB error? ", chrome.runtime.lastError); + console.log("wallet ", JSON.stringify(wallet)); + let html = template({ wallet: wallet, walletEmpty: wallet.length == 0 }); + console.log("Hb generated html", html); + document.getElementById("content").innerHTML = html; + } + /* for (let curr in wallet) { - n++; - let x = wallet[curr]; - let num = x.value + x.fraction / 10e6; - table.appendChild(React.createElement("p", null, num, " ", React.createElement("a", null, x.currency))); + n++; + let x = wallet[curr]; + let num = x.value + x.fraction / 10e6; + table.appendChild(

{num} {x.currency}

); } if (n != 0) { - let p = document.getElementById("content"); - p.replaceChild(table, p.firstElementChild); - } + let p = document.getElementById("content"); + p.replaceChild(table, p.firstElementChild); + } */ }); document.getElementById("debug").addEventListener("click", (e) => { chrome.tabs.create({ diff --git a/extension/popup/balance-overview.tsx b/extension/popup/balance-overview.tsx index de992a46d..9435918f3 100644 --- a/extension/popup/balance-overview.tsx +++ b/extension/popup/balance-overview.tsx @@ -16,13 +16,25 @@ let React = { } } - document.addEventListener('DOMContentLoaded', (e) => { console.log("content loaded"); chrome.runtime.sendMessage({type: "balances"}, function(wallet) { console.log("got balance"); let n = 0; - let table =
; + /*let table =
;*/ + + let source = document.getElementById("balance-template").innerHTML; + console.log("size", Object.keys(wallet).length); + if (Object.keys(wallet).length > 0){ + let template = Handlebars.compile(source); + console.log("DB error? ", chrome.runtime.lastError); + console.log("wallet ", JSON.stringify(wallet)); + let html = template({wallet: wallet, walletEmpty: wallet.length == 0}); + console.log("Hb generated html", html); + document.getElementById("content").innerHTML = html; + } + + /* for (let curr in wallet) { n++; let x = wallet[curr]; @@ -32,7 +44,7 @@ document.addEventListener('DOMContentLoaded', (e) => { if (n != 0) { let p = document.getElementById("content"); p.replaceChild(table, p.firstElementChild); - } + } */ }); document.getElementById("debug").addEventListener("click", (e) => {