From b93638b6935e7fb179385cd38a1691372b4c8432 Mon Sep 17 00:00:00 2001
From: Florian Dold <florian.dold@gmail.com>
Date: Thu, 17 Dec 2015 13:30:34 +0100
Subject: Add types, simplify balance display.

---
 extension/popup/balance-overview.tsx | 30 +++---------------------------
 1 file changed, 3 insertions(+), 27 deletions(-)

(limited to 'extension/popup/balance-overview.tsx')

diff --git a/extension/popup/balance-overview.tsx b/extension/popup/balance-overview.tsx
index b1ee0fa27..88ff1bccb 100644
--- a/extension/popup/balance-overview.tsx
+++ b/extension/popup/balance-overview.tsx
@@ -19,33 +19,9 @@ 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 = <div />;
-    
-    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("wallet ", JSON.stringify(wallet));
-      let html = template(wallet);
-      console.log("Hb generated html", html);
-      table.innerHTML = html;
-      let p = document.getElementById("content");
-      p.replaceChild(table, p.firstElementChild);
-    }
-
-    /*
-    for (let curr in wallet) {
-      n++;
-      let x = wallet[curr];
-      let num = x.value + x.fraction / 10e6;
-      table.appendChild(<p>{num} <a>{x.currency}</a></p>);
-    }
-    if (n != 0) {
-      let p = document.getElementById("content");
-      p.replaceChild(table, p.firstElementChild);
-    } */
+    let context = document.getElementById("balance-template").innerHTML;
+    let template = Handlebars.compile(context);
+    document.getElementById("content").innerHTML = template(wallet);
   });
 
   document.getElementById("debug").addEventListener("click", (e) => {
-- 
cgit v1.2.3

