multiple ux fixes

This commit is contained in:
Matias Alejo Garcia 2014-04-21 07:27:45 -03:00
parent a50f4cc638
commit dcd903904e
6 changed files with 53 additions and 54 deletions

View File

@ -243,3 +243,5 @@ button.secondary:hover { background-color: #FFDF00 !important;}
.m30v {margin: 30px 0;}
.m30a {margin: 30px auto;}
.br100 {border-radius: 100%;}

View File

@ -18,8 +18,8 @@
</figure>
<div class="text-right" ng-show="$root.wallet">
<h5 ng-show="$root.wallet.id">Wallet ID: {{$root.wallet.id}}</h5>
<p ng-show="totalBalance">{{totalBalance}} BTC</p>
<p ng-show="!totalBalance">0 BTC</p>
<p ng-show="totalBalance">{{totalBalance}} <i class="fi-bitcoin"></i></p>
<p ng-show="!totalBalance">0 <i class="fi-bitcoin"></i></p>
</div>
</div>
@ -215,11 +215,11 @@
<h3>Address</h3>
<div class="row">
<div class="large-6 columns">
<a class="panel db" ng-repeat="addr in addrs" ng-click="selectAddr(addr)">{{addr}} <span class="right">{{balanceByAddr[addr] || 0}} BTC</span></a>
<a class="panel db" ng-repeat="addr in addrs" ng-click="selectAddr(addr)">{{addr}} <span class="right">{{balanceByAddr[addr] || 0}} <i class="fi-bitcoin"></i></span></a>
</div>
<div class="large-3 columns line-dashed-v text-center">
<qrcode size="160" data="{{selectedAddr}}"></qrcode>
<p class="m10t" ng-repeat="addr in addrs" ng-if="selectedAddr==addr"> <strong> {{balanceByAddr[addr]}} BTC </strong> </p>
<p class="m10t" ng-repeat="addr in addrs" ng-if="selectedAddr==addr"> <strong> {{balanceByAddr[addr]}} <i class="fi-bitcoin"></i> </strong> </p>
</div>
<div class="large-3 columns text-center">
<p> Create a New <strong> Address </strong> </p>
@ -241,7 +241,7 @@
<div class="txheader">
<div class="row">
<div class="large-8 columns">
ntxid: {{tx.ntxid}}
Proposal ID: {{tx.ntxid}}
</div>
<div class="large-4 columns text-right">
created at {{tx.createdTs | date:'medium'}}
@ -251,20 +251,23 @@
<div class="row">
<div class="large-12 columns">
<table>
<thead>
<tr>
<th>Creator</th>
<th class="text-center"><i class="fi-arrow-right"></i></th>
<th>To address</th>
</tr>
</thead>
<table style="width:100%">
<tbody>
<tr ng-repeat="o in tx.outs">
<td>{{tx.creator}}</td>
<td class="text-center">{{o.value}} BTC</td>
<td>{{o.address}}</td>
<td class="text-right size-24">{{o.value}} <i class="fi-bitcoin"></i></td>
<td class="text-center size-48"> <i class="fi-arrow-right size-40">
<td class="text-left size-24">{{o.address}}</td>
</tr>
<tr ng-repeat="(peer, actions) in tx.peerActions">
<td colspan="3" >
<span ng-if="peer == $root.wallet.network.peerId"> You</span>
<span ng-if="peer != $root.wallet.network.peerId"> {{peer}}</span>
:
<span ng-repeat="(action, ts) in actions">
<a title="{{ts | date:'medium'}}"> {{action}}</a>
</span>
</tr>
</tbody>
</table>
</div>
@ -272,7 +275,7 @@
<div class="txbottom">
<div class="row">
<div class="large-6 columns">
<div class="large-6 columns" ng-show="!tx.sentTs">
<div ng-show="tx.signedByUs">
<i class="fi-check size-40"></i> Signed by you already
</div>
@ -294,7 +297,9 @@
</span>
<span ng-show="!tx.missingSignatures && tx.sentTs">
<i class="fi-arrow-right size-40"></i>
Sent at {{tx.sentTs | date:'medium'}}
TXID: tx.sentTxid
</span>
<span ng-show="tx.missingSignatures==1">
One signature missing

View File

@ -14,11 +14,7 @@ console.log('[transactions.js.10:_updateTxs:]'); //TODO
var txs = [];
inT.forEach(function(i){
var b = i.txp.builder;
var tx = b.build();
var one = {
feeSat: b.feeSat,
};
var tx = i.builder.build();
var outs = [];
tx.outs.forEach(function(o) {
@ -30,19 +26,13 @@ console.log('[transactions.js.10:_updateTxs:]'); //TODO
});
}
});
one.outs = outs;
// TOD: check missingSignatures === in al inputs?
one.missingSignatures = tx.countInputMissingSignatures(0);
one.signedByUs = i.signedByUs;
one.ntxid = i.ntxid;
one.creator = i.txp.creator;
one.createdTs = i.txp.createdTs;
one.sentTs = i.txp.sentTs;
txs.push(one);
// extra fields
i.outs = outs;
i.fee = i.feeSat/bitcore.util.COIN;
i.missingSignatures = tx.countInputMissingSignatures(0);
txs.push(i);
});
$scope.txs = txs;
console.log('[transactions.js.55] SET HANDL+'); //TODO
w.removeListener('txProposalsUpdated',_updateTxs)
w.once('txProposalsUpdated',_updateTxs);
};

View File

@ -20,6 +20,7 @@ function TxProposal(opts) {
this.signedBy = opts.signedBy || {};
this.builder = opts.builder;
this.sentTs = opts.sentTs || null;
this.sentTxid = opts.sentTxid || null;
}
TxProposal.prototype.toObj = function() {
@ -30,7 +31,8 @@ TxProposal.prototype.toObj = function() {
};
TxProposal.prototype.setSent = function() {
TxProposal.prototype.setSent = function(sentTxid) {
this.sentTxid = txid;
this.sentTs = Date.now();;
};
@ -143,8 +145,9 @@ console.log('[TxProposals.js.127:v0:]',v0, v1); //TODO
}
});
if (!v0.sentTs && v1.sentTs) {
v0.sentTs = v1.sentTs;
if (!v0.sentTxid && v1.sentTxid) {
v0.sentTs = v1.sentTs;
v0.sentTxid = v1.sentTxid;
hasChanged++;
}

View File

@ -77,12 +77,7 @@ Wallet.prototype._handleTxProposals = function(senderId, data, isInbound) {
var recipients;
var inTxp = copay.TxProposals.fromObj(data.txProposals);
var mergeInfo = this.txProposals.merge(inTxp, true);
console.log('[Wallet.js.79:inTxp:]',inTxp); //TODO
var addSeen = this.addSeenToTxProposals();
console.log('[Wallet.js.81]', addSeen, mergeInfo); //TODO
// if ((mergeInfo.merged && !data.isBroadcast) || addSeen) {
if (mergeInfo.hasChanged || addSeen) {
this.log('### BROADCASTING txProposals. ' );
recipients = null;
@ -168,7 +163,6 @@ Wallet.prototype.getMyPeerId = function() {
};
Wallet.prototype.netStart = function() {
console.log('[Wallet.js.159:netStart:]'); //TODO
var self = this;
var net = this.network;
net.removeAllListeners();
@ -188,7 +182,6 @@ console.log('[Wallet.js.159:netStart:]'); //TODO
peerId: myPeerId
};
net.start(function() {
console.log('[Wallet.js.177] NET START: emit CREATED'); //TODO
self.emit('created');
for (var i=0; i<self.publicKeyRing.registeredCopayers(); i++) {
var otherPeerId = self.getPeerId(i);
@ -296,9 +289,24 @@ Wallet.prototype.getTxProposals = function() {
var ret = [];
for(var k in this.txProposals.txps) {
var txp = this.txProposals.txps[k];
var i = {txp:txp};
var i = JSON.parse(JSON.stringify(txp));
i.builder = txp.builder;
i.ntxid = k;
i.signedByUs = txp.signedBy[this.getMyPeerId()]?true:false;
i.peerActions = {};
for(var p in txp.seenBy){
i.peerActions[p]={seen: txp.seenBy[p]};
}
for(var p in txp.signedBy){
i.peerActions[p]= i.peerActions[p] || {};
i.peerActions[p].sign = txp.signedBy[p];
}
var c = txp.creator;
i.peerActions[c] = i.peerActions[c] || {};
i.peerActions[c].create = txp.createdTs;
ret.push(i);
}
return ret;
@ -363,10 +371,8 @@ Wallet.prototype.addSeenToTxProposals = function() {
for(var k in this.txProposals.txps) {
var txp = this.txProposals.txps[k];
console.log('[Wallet.js.364:txp:] ADD SEEN',txp); //TODO
if (!txp.seenBy[myId]) {
console.log('[Wallet.js.367] ADDING'); //TODO
txp.seenBy[myId] = Date.now();
ret = true;
}
@ -446,12 +452,9 @@ Wallet.prototype.createTx = function(toAddress, amountSatStr, opts, cb) {
}
self.getUnspent(function(unspentList) {
// TODO check enough funds, etc.
console.log('[Wallet.js.452]', self); //TODO
self.createTxSync(toAddress, amountSatStr, unspentList, opts);
self.sendPublicKeyRing(); // Change Address
self.sendTxProposals();
console.log('[Wallet.js.452]', self); //TODO
self.store();
return cb();
});
@ -488,8 +491,6 @@ Wallet.prototype.createTxSync = function(toAddress, amountSatStr, utxos, opts) {
if (priv) me[myId] = now;
console.log('[Wallet.js.485:me:]',myId, me); //TODO
var data = {
signedBy: (priv && b.signaturesAdded ? me : {}),
seenBy: (priv ? me : {}),
@ -498,8 +499,6 @@ console.log('[Wallet.js.485:me:]',myId, me); //TODO
builder: b,
};
console.log('[Wallet.js.499:data:]',data); //TODO
this.txProposals.add(data);
};

View File

@ -135,7 +135,7 @@ WalletFactory.prototype.getWalletIds = function() {
WalletFactory.prototype.remove = function(walletId) {
// TODO remove wallet contents
console.log('TODO: remove wallet contents');
this.log('TODO: remove wallet contents');
};