aboutsummaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorChi Kei Chan <chikeichan@gmail.com>2017-09-07 18:14:53 +0800
committerChi Kei Chan <chikeichan@gmail.com>2017-09-07 18:14:53 +0800
commit983fa2a11721aa7d1307ef76d516e25a50d0eedf (patch)
treebfe3cc63c9b3169e7116535f551749694073d714 /ui
parent14b2f3e391752cca02c05ae0137e490bfdcdd7a7 (diff)
downloadtangerine-wallet-browser-983fa2a11721aa7d1307ef76d516e25a50d0eedf.tar
tangerine-wallet-browser-983fa2a11721aa7d1307ef76d516e25a50d0eedf.tar.gz
tangerine-wallet-browser-983fa2a11721aa7d1307ef76d516e25a50d0eedf.tar.bz2
tangerine-wallet-browser-983fa2a11721aa7d1307ef76d516e25a50d0eedf.tar.lz
tangerine-wallet-browser-983fa2a11721aa7d1307ef76d516e25a50d0eedf.tar.xz
tangerine-wallet-browser-983fa2a11721aa7d1307ef76d516e25a50d0eedf.tar.zst
tangerine-wallet-browser-983fa2a11721aa7d1307ef76d516e25a50d0eedf.zip
Add Contract Tx List Item; Update Token Tx on select
Diffstat (limited to 'ui')
-rw-r--r--ui/app/components/token-balance.js6
-rw-r--r--ui/app/components/token-cell.js2
-rw-r--r--ui/app/components/tx-list.js42
-rw-r--r--ui/app/components/wallet-view.js4
-rw-r--r--ui/app/css/itcss/components/newui-sections.scss7
-rw-r--r--ui/app/css/itcss/components/token-list.scss28
-rw-r--r--ui/app/css/itcss/components/transaction-list.scss56
-rw-r--r--ui/app/selectors.js9
8 files changed, 96 insertions, 58 deletions
diff --git a/ui/app/components/token-balance.js b/ui/app/components/token-balance.js
index d7fe168eb..b4a249300 100644
--- a/ui/app/components/token-balance.js
+++ b/ui/app/components/token-balance.js
@@ -77,13 +77,15 @@ TokenBalance.prototype.createFreshTokenTracker = function () {
TokenBalance.prototype.componentDidUpdate = function (nextProps) {
const {
userAddress: oldAddress,
+ token: { address: oldTokenAddress },
} = this.props
const {
userAddress: newAddress,
+ token: { address: newTokenAddress },
} = nextProps
- if (!oldAddress || !newAddress) return
- if (oldAddress === newAddress) return
+ if ((!oldAddress || !newAddress) && (!oldTokenAddress || !newTokenAddress)) return
+ if ((oldAddress === newAddress) && (oldTokenAddress === newTokenAddress)) return
this.setState({ isLoading: true })
this.createFreshTokenTracker()
diff --git a/ui/app/components/token-cell.js b/ui/app/components/token-cell.js
index e3ed734f4..a6fe8fc61 100644
--- a/ui/app/components/token-cell.js
+++ b/ui/app/components/token-cell.js
@@ -42,7 +42,7 @@ TokenCell.prototype.render = function () {
return (
h('div.token-list-item', {
- className: `token-list-item ${selectedTokenAddress ? 'token-list-item--active' : ''}`,
+ className: `token-list-item ${selectedTokenAddress === address ? 'token-list-item--active' : ''}`,
// style: { cursor: network === '1' ? 'pointer' : 'default' },
// onClick: this.view.bind(this, address, userAddress, network),
onClick: () => setSelectedToken(address),
diff --git a/ui/app/components/tx-list.js b/ui/app/components/tx-list.js
index 524808e2e..04d2eaa79 100644
--- a/ui/app/components/tx-list.js
+++ b/ui/app/components/tx-list.js
@@ -20,14 +20,9 @@ function TxList () {
Component.call(this)
}
-const contentDivider = h('div.tx-list-content-divider', {
- style: {},
-})
-
TxList.prototype.render = function () {
- const { txsToRender } = this.props
- console.log('transactions to render', txsToRender)
+ // console.log('transactions to render', txsToRender)
return h('div.flex-column.tx-list-container', {}, [
@@ -46,15 +41,31 @@ TxList.prototype.render = function () {
]),
- contentDivider,
-
- txsToRender.map((transaction) => {
- return this.renderTransactionListItem(transaction)
- }),
+ this.renderTranstions(),
])
}
+TxList.prototype.getAddressText = function (transaction) {
+ const {
+ txParams: { to },
+ } = transaction
+
+ return to
+ ? `${to.slice(0, 10)}...${to.slice(-4)}`
+ : 'Contract Published'
+}
+
+TxList.prototype.renderTranstions = function () {
+ const { txsToRender } = this.props
+
+ return txsToRender.length
+ ? txsToRender.map((transaction) => {
+ return this.renderTransactionListItem(transaction)
+ })
+ : h('div.tx-list-item.tx-list-item--empty', [ 'No Transactions' ])
+}
+
// TODO: Consider moving TxListItem into a separate component
TxList.prototype.renderTransactionListItem = function (transaction) {
const props = {
@@ -70,12 +81,10 @@ TxList.prototype.renderTransactionListItem = function (transaction) {
dateString,
} = props
- if (!address) return null
-
- return h('div', {
+ return h('div.tx-list-item', {
key: transaction.id,
}, [
- h('div.flex-column.tx-list-item-wrapper', {
+ h('div.flex-column.tx-list-item__wrapper', {
style: {},
}, [
@@ -105,7 +114,7 @@ TxList.prototype.renderTransactionListItem = function (transaction) {
style: {},
}, [
h('span.tx-list-account', {}, [
- `${address.slice(0, 10)}...${address.slice(-4)}`,
+ this.getAddressText(transaction),
]),
]),
@@ -134,7 +143,6 @@ TxList.prototype.renderTransactionListItem = function (transaction) {
]),
]),
- contentDivider,
])
}
diff --git a/ui/app/components/wallet-view.js b/ui/app/components/wallet-view.js
index 08c28f1dc..b306fb7d4 100644
--- a/ui/app/components/wallet-view.js
+++ b/ui/app/components/wallet-view.js
@@ -64,11 +64,11 @@ WalletView.prototype.renderWalletBalance = function () {
WalletView.prototype.render = function () {
const {
network, responsiveDisplayClassname, identities,
- selectedAddress, selectedAccount, accounts,
+ selectedAddress, accounts,
selectedIdentity,
} = this.props
// temporary logs + fake extra wallets
- console.log('walletview, selectedAccount:', selectedAccount)
+ // console.log('walletview, selectedAccount:', selectedAccount)
return h('div.wallet-view.flex-column' + (responsiveDisplayClassname || ''), {
style: {},
diff --git a/ui/app/css/itcss/components/newui-sections.scss b/ui/app/css/itcss/components/newui-sections.scss
index 53c0023c3..b576e5ca5 100644
--- a/ui/app/css/itcss/components/newui-sections.scss
+++ b/ui/app/css/itcss/components/newui-sections.scss
@@ -6,13 +6,6 @@
$tx-view-bg: $white;
$wallet-view-bg: $wild-sand;
-html {
-
- @media screen and (max-width: 575px) {
- height: 500px;
- }
-}
-
// Main container
.main-container {
position: absolute;
diff --git a/ui/app/css/itcss/components/token-list.scss b/ui/app/css/itcss/components/token-list.scss
index 2195dc1b8..9a772f666 100644
--- a/ui/app/css/itcss/components/token-list.scss
+++ b/ui/app/css/itcss/components/token-list.scss
@@ -10,6 +10,23 @@ $wallet-balance-breakpoint-range: "screen and (min-width: #{$break-large}) and (
transition: linear 200ms;
background-color: rgba($wallet-balance-bg, 0);
+ &__token-balance {
+ font-size: 130%;
+
+ @media #{$wallet-balance-breakpoint-range} {
+ font-size: 105%;
+ }
+ }
+
+ &__fiat-amount {
+ margin-top: .25%;
+ font-size: 105%;
+
+ @media #{$wallet-balance-breakpoint-range} {
+ font-size: 95%;
+ }
+ }
+
@media #{$wallet-balance-breakpoint-range} {
padding: 10% 4%;
}
@@ -21,14 +38,9 @@ $wallet-balance-breakpoint-range: "screen and (min-width: #{$break-large}) and (
&__identicon {
margin-right: 15px;
border: '1px solid #dedede';
- }
- &__token-balance {
- font-size: 130%;
- }
-
- &__fiat-amount {
- margin-top: .25%;
- font-size: 105%;
+ @media #{$wallet-balance-breakpoint-range} {
+ margin-right: 4%;
+ }
}
}
diff --git a/ui/app/css/itcss/components/transaction-list.scss b/ui/app/css/itcss/components/transaction-list.scss
index 8dca35a17..bdf84b919 100644
--- a/ui/app/css/itcss/components/transaction-list.scss
+++ b/ui/app/css/itcss/components/transaction-list.scss
@@ -61,14 +61,6 @@
flex: 0 0 70px;
align-items: stretch;
justify-content: flex-start;
-
- @media screen and (max-width: $break-small) {
- margin: 0 1.3em .95em;
- }
-
- @media screen and (min-width: $break-large) {
- margin: 0 2.37em;
- }
}
.tx-list-date-wrapper {
@@ -93,11 +85,13 @@
.tx-list-date {
color: $dusty-gray;
font-size: 12px;
+ font-family: "Montserrat UltraLight";
}
.tx-list-identicon-wrapper {
align-self: center;
- flex: 0.5 1 auto;
+ flex: 0 0 auto;
+ margin-right: 16px;
}
.tx-list-account-and-status-wrapper {
@@ -118,6 +112,7 @@
.tx-list-account-wrapper {
flex: 1.3 2 auto;
+ min-width: 153px;
}
.tx-list-status-wrapper {
@@ -137,18 +132,41 @@
}
}
-.tx-list-details-wrapper {
- align-self: center;
- flex: 2 2 auto;
- color: $dusty-gray;
+.tx-list-item {
+ border-top: 1px solid rgb(231, 231, 231);
- .tx-list-value {
- font-size: 16px;
- text-align: right;
+ @media screen and (max-width: $break-small) {
+ margin: 0 1.3em .95em;
}
- .tx-list-fiat-value {
- font-size: 12px;
- text-align: right;
+ @media screen and (min-width: $break-large) {
+ margin: 0 2.37em;
+ }
+
+ &:last-of-type {
+ border-bottom: 1px solid rgb(231, 231, 231);
+ margin-bottom: 32px;
+ }
+
+ &__wrapper {
+ align-self: center;
+ flex: 2 2 auto;
+ color: $dusty-gray;
+
+ .tx-list-value {
+ font-size: 16px;
+ text-align: right;
+ }
+
+ .tx-list-fiat-value {
+ font-size: 12px;
+ text-align: right;
+ }
+ }
+
+ &--empty {
+ text-align: center;
+ border-bottom: none !important;
+ padding: 16px;
}
}
diff --git a/ui/app/selectors.js b/ui/app/selectors.js
index 400f5cd45..d8764b488 100644
--- a/ui/app/selectors.js
+++ b/ui/app/selectors.js
@@ -45,11 +45,16 @@ function conversionRateSelector (state) {
}
function transactionsSelector (state) {
- const { network } = state.metamask
+ const { network, selectedTokenAddress } = state.metamask
const unapprovedMsgs = valuesFor(state.metamask.unapprovedMsgs)
const shapeShiftTxList = (network === '1') ? state.metamask.shapeShiftTxList : undefined
const transactions = state.metamask.selectedAddressTxList || []
const txsToRender = !shapeShiftTxList ? transactions.concat(unapprovedMsgs) : transactions.concat(unapprovedMsgs, shapeShiftTxList)
- return txsToRender.sort((a, b) => b.time - a.time)
+ return selectedTokenAddress
+ ? txsToRender
+ .filter(({ to }) => to === selectedTokenAddress)
+ .sort((a, b) => b.time - a.time)
+ : txsToRender
+ .sort((a, b) => b.time - a.time)
}