From 9dfc5b9adfd9b51ba50cd905b0aed3b299de70fb Mon Sep 17 00:00:00 2001 From: Giovanni Cappellotto Date: Wed, 13 Sep 2017 23:16:16 -0400 Subject: [PATCH] Add campaign page prototype It shows basic campaign info and it exposes a form to call the `campaignFunds` getter to get the amount funded by an address. See https://github.com/issuehunter/dapp/issues/3. --- campaign/index.html | 44 ++++++++++++++++++++++++++++++++++++++++++++ src/campaign.js | 18 ++++++++++++++++++ 2 files changed, 62 insertions(+) create mode 100644 campaign/index.html create mode 100644 src/campaign.js diff --git a/campaign/index.html b/campaign/index.html new file mode 100644 index 0000000..d093b86 --- /dev/null +++ b/campaign/index.html @@ -0,0 +1,44 @@ + + + + + issuehunter + + + + + + + + +
+ + +

Back

+ +

Campaign

+

+ Executed:
+ Total amount:
+ Created by:
+ Reward period expires at:
+ Execute period expires at:
+ Resolved by: +

+ +
+ + +
+
+ +
+ +

+ Amount: +

+
+ + diff --git a/src/campaign.js b/src/campaign.js new file mode 100644 index 0000000..792f064 --- /dev/null +++ b/src/campaign.js @@ -0,0 +1,18 @@ +var issueId = decodeURIComponent(window.location.search.substr(1)) + +issueHunter.campaigns(issueId, function(err, campaign) { + console.log(campaign) + document.querySelector("#executed").innerText = campaign[0] + document.querySelector("#totalAmount").innerText = web3.fromWei(campaign[1]) + document.querySelector("#createdBy").innerText = campaign[2] + document.querySelector("#rewardPeriodExpiresAt").innerText = Date(campaign[3]) + document.querySelector("#executePeriodExpiresAt").innerText = Date(campaign[4]) + document.querySelector("#resolutor").innerText = campaign[5] +}) + +function campaignFunds() { + var account = document.querySelector("#account").value + issueHunter.campaignFunds.call(issueId, account, function (err, amount) { + document.querySelector("#amount").innerText = web3.fromWei(amount) + }) +}