-
Check balance of wallet
-
-
-
Balance:
-
-
+
\ No newline at end of file
diff --git a/packages/editor/templates/Coin/app/app.js b/packages/editor/templates/Coin/app/app.js
index 70f566a0..43f0824c 100755
--- a/packages/editor/templates/Coin/app/app.js
+++ b/packages/editor/templates/Coin/app/app.js
@@ -1,5 +1,5 @@
// The object 'Contracts' will be injected here, which contains all data for all contracts, keyed on contract name:
-// Contracts['HelloWorld'] = {
+// Contracts['Coin'] = {
// abi: [],
// address: "0x..",
// endpoint: "http://...."
@@ -158,10 +158,33 @@ Coin.prototype.bindButtons = function() {
});
}
+// Remove the welcome content, and display the main content.
+// Called once a contract has been deployed
+Coin.prototype.updateDisplayContent = function() {
+ this.hideWelcomeContent();
+ this.showMainContent();
+};
+
+// A contract will not have its address set until it has been deployed
+Coin.prototype.hasContractDeployed = function() {
+ return this.instance && this.instance.address;
+};
+
+Coin.prototype.hideWelcomeContent = function() {
+ $('#welcome-container').addClass('hidden');
+};
+
+Coin.prototype.showMainContent = function() {
+ $('#main-container').removeClass('hidden');
+};
+
// Create the instance of the `Coin` object
Coin.prototype.onReady = function() {
- this.bindButtons();
this.init();
+ if (this.hasContractDeployed()) {
+ this.updateDisplayContent();
+ this.bindButtons();
+ }
};
if(typeof(Contracts) === "undefined") var Contracts={ Coin: { abi: [] }};
diff --git a/packages/editor/templates/Crypto Pizzas/app/app.css b/packages/editor/templates/Crypto Pizzas/app/app.css
index b648cfa9..0f27a7e7 100755
--- a/packages/editor/templates/Crypto Pizzas/app/app.css
+++ b/packages/editor/templates/Crypto Pizzas/app/app.css
@@ -35,7 +35,7 @@ hr {
opacity: .6;
}
-.error {
+.error, .hidden {
display: none;
}
diff --git a/packages/editor/templates/Crypto Pizzas/app/app.html b/packages/editor/templates/Crypto Pizzas/app/app.html
index 71f45e89..94a602ad 100755
--- a/packages/editor/templates/Crypto Pizzas/app/app.html
+++ b/packages/editor/templates/Crypto Pizzas/app/app.html
@@ -31,8 +31,12 @@
+
+
Welcome!
+
Please deploy (
) your contract to begin.
+
-
+
CryptoPizza
diff --git a/packages/editor/templates/Crypto Pizzas/app/app.js b/packages/editor/templates/Crypto Pizzas/app/app.js
index 9b909311..dfe404f9 100755
--- a/packages/editor/templates/Crypto Pizzas/app/app.js
+++ b/packages/editor/templates/Crypto Pizzas/app/app.js
@@ -37,6 +37,10 @@ Pizza.prototype.init = function() {
// Create the contract instance for the specific address provided in the configuration.
this.instance = this.Contract.address ? contract_interface.at(this.Contract.address) : { getPizzasByOwner: () => {} };
+
+ if (this.hasContractDeployed()) {
+ this.updateDisplayContent();
+ }
}
// Generate random DNA from string
@@ -351,6 +355,26 @@ Pizza.prototype.bindInputs = function() {
});
}
+// Remove the welcome content, and display the main content.
+// Called once a contract has been deployed
+Pizza.prototype.updateDisplayContent = function() {
+ this.hideWelcomeContent();
+ this.showMainContent();
+}
+
+Pizza.prototype.hideWelcomeContent = function() {
+ $('#welcome-container').addClass('hidden');
+}
+
+Pizza.prototype.showMainContent = function() {
+ $('#main-container').removeClass('hidden');
+}
+
+// A contract will not have its address set until it has been deployed
+Pizza.prototype.hasContractDeployed = function() {
+ return this.instance && this.instance.address;
+};
+
// Show status on bottom of the page when some action happens
function showStatus(text) {
var status = document.getElementById("status");
diff --git a/packages/editor/templates/Hello World/app/app.css b/packages/editor/templates/Hello World/app/app.css
index c203b507..910decc9 100755
--- a/packages/editor/templates/Hello World/app/app.css
+++ b/packages/editor/templates/Hello World/app/app.css
@@ -5,7 +5,7 @@ body {
text-align: center;
}
-.text {
+.text, .hidden {
display: none;
}
@@ -13,7 +13,7 @@ body {
color: red;
}
-.input-group {
+.input-group, .display-message {
display: flex;
flex-direction: column;
align-items: center;
diff --git a/packages/editor/templates/Hello World/app/app.html b/packages/editor/templates/Hello World/app/app.html
index 096482fc..a3a6546a 100755
--- a/packages/editor/templates/Hello World/app/app.html
+++ b/packages/editor/templates/Hello World/app/app.html
@@ -11,20 +11,28 @@
-
- Message:
-
- Block number:
- There was an error communicating with the contract.
-
-