Add balance card to home page, enable pull-to-refresh
parent
a92b59f0a4
commit
fd17454fa2
@ -0,0 +1,32 @@
|
||||
/*
|
||||
This Source Code Form is subject to the terms of the Mozilla Public
|
||||
License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
/*
|
||||
Created on : Mar 26, 2019, 1:03:44 PM
|
||||
Author : Skylar Ittner
|
||||
*/
|
||||
|
||||
h1.display {
|
||||
font-size: 8rem;
|
||||
font-weight: 300;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
h2.display {
|
||||
font-size: 6rem;
|
||||
font-weight: 300;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
h3.display {
|
||||
font-size: 4rem;
|
||||
font-weight: 300;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.card-header .secondary-text {
|
||||
font-weight: 300;
|
||||
margin-left: 1em;
|
||||
}
|
@ -0,0 +1,38 @@
|
||||
/*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
var accountBalance = 0.0;
|
||||
|
||||
$(".view-main").on("ptr:refresh", ".ptr-content", function () {
|
||||
loadHomePage(function () {
|
||||
setTimeout(app.ptr.done, 750);
|
||||
});
|
||||
});
|
||||
|
||||
function loadBalance(callback) {
|
||||
$("#balance-error-icon").css("display", "none");
|
||||
$("#balance-loading").css("display", "");
|
||||
callAPI("checkbalance", {
|
||||
key: localStorage.getItem("key")
|
||||
}, function (data) {
|
||||
accountBalance = data.balance;
|
||||
$("#balance-amount").text(data.balance);
|
||||
$("#balance-loading").css("display", "none");
|
||||
$("#balance-error").text("");
|
||||
callback(true);
|
||||
}, function (msg) {
|
||||
$("#balance-loading").css("display", "none");
|
||||
$("#balance-error-icon").css("display", "");
|
||||
$("#balance-error").text(msg);
|
||||
callback(false);
|
||||
});
|
||||
}
|
||||
|
||||
function loadHomePage(callback) {
|
||||
loadBalance(function () {
|
||||
callback();
|
||||
});
|
||||
}
|
Loading…
Reference in New Issue