Use css grid for TransactionListItem for responsive layout

feature/default_network_editable
Alexander Tseung 6 years ago
parent 01f00a9ca6
commit 5de48c67a0
  1. 12
      app/_locales/en/messages.json
  2. 3
      ui/app/components/identicon.js
  3. 71
      ui/app/components/transaction-list-item/index.scss
  4. 31
      ui/app/components/transaction-list-item/transaction-list-item.component.js
  5. 2
      ui/app/components/transaction-list/transaction-list.component.js
  6. 4
      ui/app/components/transaction-status/index.scss
  7. 5
      ui/app/components/transaction-status/transaction-status.component.js
  8. 4
      ui/app/constants/transactions.js
  9. 2
      ui/app/util.js

@ -705,9 +705,6 @@
"pasteSeed": { "pasteSeed": {
"message": "Paste your seed phrase here!" "message": "Paste your seed phrase here!"
}, },
"pending": {
"message": "Pending"
},
"personalAddressDetected": { "personalAddressDetected": {
"message": "Personal address detected. Input the token contract address." "message": "Personal address detected. Input the token contract address."
}, },
@ -736,6 +733,9 @@
"qrCode": { "qrCode": {
"message": "Show QR Code" "message": "Show QR Code"
}, },
"queue": {
"message": "Queue"
},
"readdToken": { "readdToken": {
"message": "You can add this token back in the future by going go to “Add token” in your accounts options menu." "message": "You can add this token back in the future by going go to “Add token” in your accounts options menu."
}, },
@ -900,9 +900,6 @@
"sendETH": { "sendETH": {
"message": "Send ETH" "message": "Send ETH"
}, },
"sendEther": {
"message": "Send Ether"
},
"sendTokens": { "sendTokens": {
"message": "Send Tokens" "message": "Send Tokens"
}, },
@ -919,6 +916,9 @@
"orderOneHere": { "orderOneHere": {
"message": "Order a Trezor or Ledger and keep your funds in cold storage" "message": "Order a Trezor or Ledger and keep your funds in cold storage"
}, },
"outgoing": {
"message": "Outgoing"
},
"searchTokens": { "searchTokens": {
"message": "Search Tokens" "message": "Search Tokens"
}, },

@ -47,7 +47,8 @@ IdenticonComponent.prototype.render = function () {
}) })
) )
: ( : (
h('img.balance-icon', { h('img', {
className: `${className} balance-icon`,
src: './images/eth_logo.svg', src: './images/eth_logo.svg',
style: { style: {
height: diameter, height: diameter,

@ -1,41 +1,51 @@
.transaction-list-item { .transaction-list-item {
box-sizing: border-box; box-sizing: border-box;
height: 74px; min-height: 74px;
padding: 0 21px; padding: 8px 20px;
display: flex; display: grid;
flex-direction: row; grid-template-columns: 45px 1fr 1fr 1fr;
align-items: center; grid-template-areas:
"identicon action status primary-amount"
"identicon nonce status secondary-amount";
border-bottom: 1px solid $geyser; border-bottom: 1px solid $geyser;
cursor: pointer; cursor: pointer;
@media screen and (max-width: $break-small) { @media screen and (max-width: $break-small) {
padding: 0 12px; padding: 8px 20px 12px;
grid-template-columns: 45px 5fr 3fr;
grid-template-areas:
"nonce nonce nonce"
"identicon action primary-amount"
"identicon status secondary-amount";
} }
&__identicon-wrapper { &__identicon {
padding-top: 2px; grid-area: identicon;
} grid-row: 1 / span 2;
align-self: center;
&__action-block {
padding: 0 8px 0 12px;
width: 180px;
@media screen and (max-width: $break-small) { @media screen and (max-width: $break-small) {
padding: 0 8px; grid-row: 2 / span 2;
width: 160px;
} }
} }
&__action { &__action {
text-transform: capitalize; text-transform: capitalize;
padding-bottom: 2px; padding: 0 8px 2px 0;
white-space: nowrap; white-space: nowrap;
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
grid-area: action;
align-self: end;
}
&__status {
grid-area: status;
grid-row: 1 / span 2;
align-self: center;
@media screen and (max-width: $break-small) { @media screen and (max-width: $break-small) {
padding-bottom: 0; grid-row: 3;
font-size: .875rem;
} }
} }
@ -45,25 +55,38 @@
white-space: nowrap; white-space: nowrap;
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
} grid-area: nonce;
align-self: start;
&__transaction-amounts { @media screen and (max-width: $break-small) {
flex: 1; padding-bottom: 4px;
}
} }
&__primary-transaction-amount { &__amount {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
&--primary {
text-align: end; text-align: end;
grid-area: primary-amount;
align-self: end;
@media screen and (max-width: $break-small) { @media screen and (max-width: $break-small) {
font-size: .75rem; padding-bottom: 2px;
} }
} }
&__secondary-transaction-amount { &--secondary {
text-align: end; text-align: end;
font-size: .75rem; font-size: .75rem;
color: #5e6064; color: #5e6064;
grid-area: secondary-amount;
align-self: start;
} }
}
&:hover { &:hover {
background: rgba($alto, .2); background: rgba($alto, .2);

@ -1,6 +1,5 @@
import React, { PureComponent } from 'react' import React, { PureComponent } from 'react'
import PropTypes from 'prop-types' import PropTypes from 'prop-types'
import Media from 'react-media'
import Identicon from '../identicon' import Identicon from '../identicon'
import TransactionStatus from '../transaction-status' import TransactionStatus from '../transaction-status'
import TransactionAction from '../transaction-action' import TransactionAction from '../transaction-action'
@ -46,19 +45,11 @@ export default class TransactionListItem extends PureComponent {
className="transaction-list-item" className="transaction-list-item"
onClick={this.handleClick} onClick={this.handleClick}
> >
<div className="transaction-list-item__identicon-wrapper">
<Media query="(max-width: 575px)">
{
matches => (
<Identicon <Identicon
className="transaction-list-item__identicon"
address={txParams.to} address={txParams.to}
diameter={matches ? 26 : 34} diameter={34}
/> />
)
}
</Media>
</div>
<div className="transaction-list-item__action-block">
<TransactionAction <TransactionAction
transaction={transaction} transaction={transaction}
className="transaction-list-item__action" className="transaction-list-item__action"
@ -66,17 +57,23 @@ export default class TransactionListItem extends PureComponent {
<div className="transaction-list-item__nonce"> <div className="transaction-list-item__nonce">
{ `#${nonce} - ${formatDate(transaction.time)}` } { `#${nonce} - ${formatDate(transaction.time)}` }
</div> </div>
</div> <TransactionStatus
<TransactionStatus status={transaction.status} /> className="transaction-list-item__status"
<div className="transaction-list-item__transaction-amounts"> status={transaction.status}
<div className="transaction-list-item__primary-transaction-amount"> />
<div
className="transaction-list-item__amount transaction-list-item__amount--primary"
title={`-${fiatDisplayValue}`}
>
{ `-${fiatDisplayValue}` } { `-${fiatDisplayValue}` }
</div> </div>
<div className="transaction-list-item__secondary-transaction-amount"> <div
className="transaction-list-item__amount transaction-list-item__amount--secondary"
title={`-${ethTransactionAmount} ETH`}
>
{ `-${ethTransactionAmount} ETH` } { `-${ethTransactionAmount} ETH` }
</div> </div>
</div> </div>
</div>
) )
} }
} }

@ -27,7 +27,7 @@ export default class TransactionList extends PureComponent {
pendingTransactions.length > 0 && ( pendingTransactions.length > 0 && (
<div className="transaction-list__pending-transactions"> <div className="transaction-list__pending-transactions">
<div className="transaction-list__header"> <div className="transaction-list__header">
{ `${t('pending')} (${pendingTransactions.length})` } { `${t('queue')} (${pendingTransactions.length})` }
</div> </div>
{ {
pendingTransactions.map(transaction => { pendingTransactions.map(transaction => {

@ -11,8 +11,8 @@
align-items: center; align-items: center;
@media screen and (max-width: $break-small) { @media screen and (max-width: $break-small) {
height: 24px; height: 16px;
width: 74px; width: 70px;
font-size: .5rem; font-size: .5rem;
} }

@ -30,13 +30,14 @@ const statusToTextHash = {
export default class TransactionStatus extends PureComponent { export default class TransactionStatus extends PureComponent {
static propTypes = { static propTypes = {
status: PropTypes.string, status: PropTypes.string,
className: PropTypes.string,
} }
render () { render () {
const { status } = this.props const { className, status } = this.props
return ( return (
<div className={classnames('transaction-status', statusToClassNameHash[status])}> <div className={classnames('transaction-status', className, statusToClassNameHash[status])}>
{ statusToTextHash[status] || status } { statusToTextHash[status] || status }
</div> </div>
) )

@ -11,8 +11,8 @@ export const TOKEN_METHOD_TRANSFER = 'transfer'
export const TOKEN_METHOD_APPROVE = 'approve' export const TOKEN_METHOD_APPROVE = 'approve'
export const TOKEN_METHOD_TRANSFER_FROM = 'transferfrom' export const TOKEN_METHOD_TRANSFER_FROM = 'transferfrom'
export const SEND_ETHER_ACTION_KEY = 'sendEther' export const SEND_ETHER_ACTION_KEY = 'outgoing'
export const DEPLOY_CONTRACT_ACTION_KEY = 'contractDeployment' export const DEPLOY_CONTRACT_ACTION_KEY = 'contractDeployment'
export const APPROVE_ACTION_KEY = 'approve' export const APPROVE_ACTION_KEY = 'approve'
export const SEND_TOKEN_ACTION_KEY = 'sendToken' export const SEND_TOKEN_ACTION_KEY = 'outgoing'
export const TRANSFER_FROM_ACTION_KEY = 'transferFrom' export const TRANSFER_FROM_ACTION_KEY = 'transferFrom'

@ -9,7 +9,7 @@ const MIN_GAS_PRICE_BN = MIN_GAS_PRICE_GWEI_BN.mul(GWEI_FACTOR)
// formatData :: ( date: <Unix Timestamp> ) -> String // formatData :: ( date: <Unix Timestamp> ) -> String
function formatDate (date) { function formatDate (date) {
return vreme.format(new Date(date), 'March 16 2014 14:30') return vreme.format(new Date(date), 'March 16 2014, at 14:30')
} }
var valueTable = { var valueTable = {

Loading…
Cancel
Save