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. 81
      ui/app/components/transaction-list-item/index.scss
  4. 53
      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 {
text-align: end; white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
@media screen and (max-width: $break-small) { &--primary {
text-align: end;
grid-area: primary-amount;
align-self: end;
@media screen and (max-width: $break-small) {
padding-bottom: 2px;
}
}
&--secondary {
text-align: end;
font-size: .75rem; font-size: .75rem;
color: #5e6064;
grid-area: secondary-amount;
align-self: start;
} }
} }
&__secondary-transaction-amount {
text-align: end;
font-size: .75rem;
color: #5e6064;
}
&: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,35 +45,33 @@ 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"> <Identicon
<Media query="(max-width: 575px)"> className="transaction-list-item__identicon"
{ address={txParams.to}
matches => ( diameter={34}
<Identicon />
address={txParams.to} <TransactionAction
diameter={matches ? 26 : 34} transaction={transaction}
/> className="transaction-list-item__action"
) />
} <div className="transaction-list-item__nonce">
</Media> { `#${nonce} - ${formatDate(transaction.time)}` }
</div> </div>
<div className="transaction-list-item__action-block"> <TransactionStatus
<TransactionAction className="transaction-list-item__status"
transaction={transaction} status={transaction.status}
className="transaction-list-item__action" />
/> <div
<div className="transaction-list-item__nonce"> className="transaction-list-item__amount transaction-list-item__amount--primary"
{ `#${nonce} - ${formatDate(transaction.time)}` } title={`-${fiatDisplayValue}`}
</div> >
{ `-${fiatDisplayValue}` }
</div> </div>
<TransactionStatus status={transaction.status} /> <div
<div className="transaction-list-item__transaction-amounts"> className="transaction-list-item__amount transaction-list-item__amount--secondary"
<div className="transaction-list-item__primary-transaction-amount"> title={`-${ethTransactionAmount} ETH`}
{ `-${fiatDisplayValue}` } >
</div> { `-${ethTransactionAmount} ETH` }
<div className="transaction-list-item__secondary-transaction-amount">
{ `-${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