1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-22 17:33:23 +01:00

Add number indicating pending txs to account list

This commit is contained in:
Dan Finlay 2016-05-25 16:54:43 -07:00
parent 294b16a275
commit 5669f44300
5 changed files with 39 additions and 1 deletions

View File

@ -3,6 +3,8 @@
## Current Master
- Added copy address button to account list.
- Fixed back button on confirm transaction screen.
- Add indication of pending transactions to account list screen.
## 2.0.0 2016-05-23

View File

@ -34,6 +34,7 @@ NewComponent.prototype.render = function() {
}, [
h('.identicon-wrapper.flex-column.flex-center.select-none', [
this.pendingOrNot(),
h(Identicon, {
address: identity.address
}),
@ -61,3 +62,9 @@ NewComponent.prototype.render = function() {
])
)
}
NewComponent.prototype.pendingOrNot = function() {
const pending = this.props.pending
if (pending.length === 0) return null
return h('.pending-dot', pending.length)
}

View File

@ -12,6 +12,10 @@ module.exports = connect(mapStateToProps)(AccountsScreen)
function mapStateToProps(state) {
const pendingTxs = valuesFor(state.metamask.unconfTxs)
const pendingMsgs = valuesFor(state.metamask.unconfMsgs)
const pending = pendingTxs.concat(pendingMsgs)
return {
accounts: state.metamask.accounts,
identities: state.metamask.identities,
@ -19,6 +23,7 @@ function mapStateToProps(state) {
selectedAddress: state.metamask.selectedAddress,
currentDomain: state.appState.currentDomain,
scrollToBottom: state.appState.scrollToBottom,
pending,
}
}
@ -62,12 +67,23 @@ AccountsScreen.prototype.render = function() {
},
[
identityList.map((identity) => {
const pending = this.props.pending.filter((txOrMsg) => {
if ('txParams' in txOrMsg) {
return txOrMsg.txParams.from === identity.address
} else if ('msgParams' in txOrMsg) {
return txOrMsg.msgParams.from === identity.address
} else {
return false
}
})
return h(AccountPanel, {
key: `acct-panel-${identity.address}`,
identity,
selectedAddress: this.props.selectedAddress,
accounts: this.props.accounts,
onShowDetail: this.onShowDetail.bind(this),
pending,
})
}),

View File

@ -166,3 +166,17 @@ hr.horizontal-line {
.hover-white:hover {
background: white;
}
.pending-dot {
background: red;
left: 57px;
color: white;
border-radius: 10px;
height: 20px;
min-width: 20px;
position: absolute;
display: flex;
align-items: center;
justify-content: center;
padding: 4px;
}

View File

@ -356,7 +356,6 @@ function reduceApp(state, action) {
default:
return appState
}
}