Bare-bones transaction history.
This commit is contained in:
parent
0221761a5a
commit
1687518c6e
1 changed files with 36 additions and 1 deletions
|
@ -117,13 +117,44 @@ var WalletPage = React.createClass({
|
||||||
getInitialState: function() {
|
getInitialState: function() {
|
||||||
return {
|
return {
|
||||||
balance: "Checking balance...",
|
balance: "Checking balance...",
|
||||||
|
txlog: "Loading transactions...",
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
componentWillMount: function() {
|
componentWillMount: function() {
|
||||||
lbry.getBalance((results) => {
|
lbry.getBalance((results) => {
|
||||||
this.setState({
|
this.setState({
|
||||||
balance: results,
|
balance: results,
|
||||||
|
})
|
||||||
});
|
});
|
||||||
|
lbry.call('get_transaction_history', {}, (results) => {
|
||||||
|
var out = 'Transaction history loaded.'
|
||||||
|
if (results.length == 0) {
|
||||||
|
out = 'No transactions yet.';
|
||||||
|
} else {
|
||||||
|
var rows = [];
|
||||||
|
rows.push(<tr className="transaction_history">
|
||||||
|
<th className="transaction_history">Amount</th>
|
||||||
|
<th className="transaction_history">Time</th>
|
||||||
|
<th className="transaction_history">Date</th>
|
||||||
|
<th className="transaction_history">Transaction</th>
|
||||||
|
</tr>);
|
||||||
|
results.forEach(function(tx) {
|
||||||
|
rows.push(<tr className="transaction_history">
|
||||||
|
<td className="transaction_history">{ (tx["amount"]>0 ? '+' : '' ) + tx["amount"] }</td>
|
||||||
|
<td className="transaction_history">{ (new Date(tx["time"])).toLocaleTimeString() }</td>
|
||||||
|
<td className="transaction_history">{ (new Date(tx["time"])).toLocaleDateString() }</td>
|
||||||
|
<td className="transaction_history">
|
||||||
|
<a className="transaction_explorer_link" href={"https://explorer.lbry.io/tx/"+tx["txid"]}>
|
||||||
|
{ tx["txid"] }
|
||||||
|
</a>
|
||||||
|
</td>
|
||||||
|
</tr>)
|
||||||
|
});
|
||||||
|
out = <table className="transaction_history">{rows}</table>
|
||||||
|
}
|
||||||
|
this.setState({
|
||||||
|
txlog: out,
|
||||||
|
})
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
render: function() {
|
render: function() {
|
||||||
|
@ -139,6 +170,10 @@ var WalletPage = React.createClass({
|
||||||
<h3>Claim Invite Code</h3>
|
<h3>Claim Invite Code</h3>
|
||||||
<Link href="?claim" label="Claim a LBRY beta invite code" button="alt" />
|
<Link href="?claim" label="Claim a LBRY beta invite code" button="alt" />
|
||||||
</section>
|
</section>
|
||||||
|
<section className="card">
|
||||||
|
<h3>Transaction History</h3>
|
||||||
|
{this.state.txlog}
|
||||||
|
</section>
|
||||||
</main>
|
</main>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue