aboutsummaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorkumavis <aaron@kumavis.me>2017-10-03 06:39:44 +0800
committerkumavis <aaron@kumavis.me>2017-10-03 06:39:44 +0800
commit2113d8348969f4da3c61ddf1cee4aa38f7a5958a (patch)
treebf8b10ee5baf421280ac640d4e50cfd13475d74d /ui
parent062eaa6a82f6730eb180c1a1fb61f035eb123451 (diff)
downloadtangerine-wallet-browser-2113d8348969f4da3c61ddf1cee4aa38f7a5958a.tar
tangerine-wallet-browser-2113d8348969f4da3c61ddf1cee4aa38f7a5958a.tar.gz
tangerine-wallet-browser-2113d8348969f4da3c61ddf1cee4aa38f7a5958a.tar.bz2
tangerine-wallet-browser-2113d8348969f4da3c61ddf1cee4aa38f7a5958a.tar.lz
tangerine-wallet-browser-2113d8348969f4da3c61ddf1cee4aa38f7a5958a.tar.xz
tangerine-wallet-browser-2113d8348969f4da3c61ddf1cee4aa38f7a5958a.tar.zst
tangerine-wallet-browser-2113d8348969f4da3c61ddf1cee4aa38f7a5958a.zip
ui - tx history - simplify error+warning display code
Diffstat (limited to 'ui')
-rw-r--r--ui/app/components/transaction-list-item.js34
1 files changed, 22 insertions, 12 deletions
diff --git a/ui/app/components/transaction-list-item.js b/ui/app/components/transaction-list-item.js
index 0e5c0b5a3..a9961f47c 100644
--- a/ui/app/components/transaction-list-item.js
+++ b/ui/app/components/transaction-list-item.js
@@ -133,7 +133,7 @@ function recipientField (txParams, transaction, isTx, isMsg) {
},
}, [
message,
- failIfFailed(transaction),
+ renderErrorOrWarning(transaction),
])
}
@@ -141,25 +141,35 @@ function formatDate (date) {
return vreme.format(new Date(date), 'March 16 2014 14:30')
}
-function failIfFailed (transaction) {
- if (transaction.status === 'rejected') {
+function renderErrorOrWarning (transaction) {
+ const { status, err, warning } = transaction
+
+ // show rejected
+ if (status === 'rejected') {
return h('span.error', ' (Rejected)')
}
- if (transaction.err || transaction.warning) {
- const { err, warning = {} } = transaction
- const errFirst = !!(( err && warning ) || err)
- const message = errFirst ? err.message : warning.message
-
- errFirst ? err.message : warning.message
+ // show error
+ if (err) {
+ const message = err.message || ''
+ return (
+ h(Tooltip, {
+ title: message,
+ position: 'bottom',
+ }, [
+ h(`span.error`, ` (Failed)`),
+ ])
+ )
+ }
+ // show warning
+ if (warning) {
+ const message = warning.message
return h(Tooltip, {
title: message,
position: 'bottom',
}, [
- h(`span.${errFirst ? 'error' : 'warning'}`,
- ` (${errFirst ? 'Failed' : 'Warning'})`
- ),
+ h(`span.warning`, ` (Warning)`),
])
}
}