aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Finlay <dan@danfinlay.com>2016-05-27 05:32:45 +0800
committerDan Finlay <dan@danfinlay.com>2016-05-27 05:32:45 +0800
commit5da6fd5ab18812929cbf790527a3029fd8d7123c (patch)
treea93ca3f0f32e715c9c5174dfe5e205239de59e9d
parentd31189b2066d0225eb57e86d077d579cf223658c (diff)
downloadtangerine-wallet-browser-5da6fd5ab18812929cbf790527a3029fd8d7123c.tar
tangerine-wallet-browser-5da6fd5ab18812929cbf790527a3029fd8d7123c.tar.gz
tangerine-wallet-browser-5da6fd5ab18812929cbf790527a3029fd8d7123c.tar.bz2
tangerine-wallet-browser-5da6fd5ab18812929cbf790527a3029fd8d7123c.tar.lz
tangerine-wallet-browser-5da6fd5ab18812929cbf790527a3029fd8d7123c.tar.xz
tangerine-wallet-browser-5da6fd5ab18812929cbf790527a3029fd8d7123c.tar.zst
tangerine-wallet-browser-5da6fd5ab18812929cbf790527a3029fd8d7123c.zip
Add clicking txs in list shows tx conf screen
-rw-r--r--ui/app/account-detail.js3
-rw-r--r--ui/app/actions.js9
-rw-r--r--ui/app/components/transaction-list-item.js9
-rw-r--r--ui/app/components/transaction-list.js6
-rw-r--r--ui/app/reducers/app.js28
5 files changed, 50 insertions, 5 deletions
diff --git a/ui/app/account-detail.js b/ui/app/account-detail.js
index 1dcce1d08..2f412c5be 100644
--- a/ui/app/account-detail.js
+++ b/ui/app/account-detail.js
@@ -201,6 +201,9 @@ AccountDetailScreen.prototype.transactionList = function() {
network,
unconfTxs,
unconfMsgs,
+ viewPendingTx:(txId) => {
+ this.props.dispatch(actions.viewPendingTx(txId))
+ }
})
}
diff --git a/ui/app/actions.js b/ui/app/actions.js
index 5b058aaed..ae6125b20 100644
--- a/ui/app/actions.js
+++ b/ui/app/actions.js
@@ -76,6 +76,8 @@ var actions = {
txError: txError,
nextTx: nextTx,
previousTx: previousTx,
+ viewPendingTx: viewPendingTx,
+ VIEW_PENDING_TX: 'VIEW_PENDING_TX',
// app messages
showAccountDetail: showAccountDetail,
BACK_TO_ACCOUNT_DETAIL: 'BACK_TO_ACCOUNT_DETAIL',
@@ -387,6 +389,13 @@ function nextTx() {
}
}
+function viewPendingTx(txId) {
+ return {
+ type: actions.VIEW_PENDING_TX,
+ value: txId,
+ }
+}
+
function previousTx() {
return {
type: actions.PREVIOUS_TX,
diff --git a/ui/app/components/transaction-list-item.js b/ui/app/components/transaction-list-item.js
index cff9a47b2..ac74046f3 100644
--- a/ui/app/components/transaction-list-item.js
+++ b/ui/app/components/transaction-list-item.js
@@ -25,6 +25,7 @@ TransactionListItem.prototype.render = function() {
var isMsg = ('msgParams' in transaction)
var isTx = ('txParams' in transaction)
+ var isPending = transaction.status === 'unconfirmed'
let txParams
if (isTx) {
@@ -33,10 +34,16 @@ TransactionListItem.prototype.render = function() {
txParams = transaction.msgParams
}
+ const isClickable = ('hash' in transaction) || isPending
+
return (
- h(`.transaction-list-item.flex-row.flex-space-between${transaction.hash ? '.pointer' : ''}`, {
+ h(`.transaction-list-item.flex-row.flex-space-between${isClickable ? '.pointer' : ''}`, {
key: `tx-${transaction.id + i}`,
onClick: (event) => {
+ if (isPending) {
+ this.props.showTx(transaction.id)
+ }
+
if (!transaction.hash) return
var url = explorerLink(transaction.hash, parseInt(network))
chrome.tabs.create({ url })
diff --git a/ui/app/components/transaction-list.js b/ui/app/components/transaction-list.js
index 3c778b19d..5ebb3e563 100644
--- a/ui/app/components/transaction-list.js
+++ b/ui/app/components/transaction-list.js
@@ -16,7 +16,6 @@ TransactionList.prototype.render = function() {
const { txsToRender, network, unconfTxs, unconfMsgs } = this.props
const transactions = txsToRender.concat(unconfMsgs)
.sort((a, b) => b.time - a.time)
- console.dir(transactions)
return (
@@ -53,7 +52,10 @@ TransactionList.prototype.render = function() {
transactions.length ?
transactions.map((transaction, i) => {
return h(TransactionListItem, {
- transaction, i
+ transaction, i,
+ showTx:(txId) => {
+ this.props.viewPendingTx(txId)
+ },
})
})
:
diff --git a/ui/app/reducers/app.js b/ui/app/reducers/app.js
index a98b809d6..08c2268c1 100644
--- a/ui/app/reducers/app.js
+++ b/ui/app/reducers/app.js
@@ -12,10 +12,10 @@ function reduceApp(state, action) {
const pendingTxs = hasPendingTxs(state)
let name = 'accounts'
if (selectedAccount) {
- defaultView = 'accountDetail'
+ name = 'accountDetail'
}
if (pendingTxs) {
- defaultView = 'confTx'
+ name = 'confTx'
}
var defaultView = {
@@ -270,6 +270,17 @@ function reduceApp(state, action) {
}
})
+ case actions.VIEW_PENDING_TX:
+ const context = indexForPending(state, action.value)
+ return extend(appState, {
+ transForward: true,
+ currentView: {
+ name: 'confTx',
+ context,
+ warning: null,
+ }
+ })
+
case actions.PREVIOUS_TX:
return extend(appState, {
transForward: false,
@@ -366,3 +377,16 @@ function hasPendingTxs (state) {
var unconfTxList = txHelper(unconfTxs, unconfMsgs)
return unconfTxList.length > 0
}
+
+function indexForPending(state, txId) {
+ var unconfTxs = state.metamask.unconfTxs
+ var unconfMsgs = state.metamask.unconfMsgs
+ var unconfTxList = txHelper(unconfTxs, unconfMsgs)
+ let idx
+ unconfTxList.forEach((tx, i) => {
+ if (tx.id === txId) {
+ idx = i
+ }
+ })
+ return idx
+}