1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-10-22 19:26:13 +02:00

WIP: Working on new layout

This commit is contained in:
Frankie 2016-06-30 11:15:32 -07:00
parent 4433618e95
commit 5252504e3f
4 changed files with 120 additions and 88 deletions

View File

@ -44,35 +44,36 @@ AccountDetailScreen.prototype.render = function () {
return ( return (
h('.account-detail-section.flex-column.flex-grow', [ h('.account-detail-section', [
// identicon, label, balance, etc // identicon, label, balance, etc
h('.account-data-subsection.flex-column.flex-grow', { h('.account-data-subsection', {
style: { style: {
margin: '0 20px', margin: '0 20px',
}, },
}, [ }, [
// header - identicon + nav // header - identicon + nav
h('.flex-row.flex-center', { h('div', {
style: { style: {
marginTop: 28, marginTop: 28,
display: 'flex',
justifyContent: 'flex-start',
alignItems: 'flex-start',
}, },
}, [ }, [
// large identicon // large identicon and addresses
h('.identicon-wrapper.flex-column.flex-center.select-none', [ h('.identicon-wrapper.select-none', [
h(Identicon, { h(Identicon, {
diameter: 62, diameter: 62,
address: selected, address: selected,
}), }),
]), ]),
]), h('flex-column', {
h('.flex-center', {
style: { style: {
height: '62px', lineHeight: '10px',
paddingTop: '8px', marginLeft: '15px',
}, },
}, [ }, [
h(EditableLabel, { h(EditableLabel, {
@ -89,23 +90,29 @@ AccountDetailScreen.prototype.render = function () {
h('label.editing-label', [h('.edit-text', 'edit')]), h('label.editing-label', [h('.edit-text', 'edit')]),
h('h2.font-medium.color-forest', {name: 'edit'}, identity && identity.name), h('h2.font-medium.color-forest', {name: 'edit'}, identity && identity.name),
]), ]),
]),
// address and getter actions
h('.flex-row',{ h('.flex-row',{
style:{ style:{
marginBottom: 16, width: '15em',
}, justifyContent: 'space-between',
alignItems: 'baseline',
}
},[ },[
h('div', { h('div', {
style: { style: {
overflow: 'hidden', overflow: 'hidden',
textOverflow: 'ellipsis', textOverflow: 'ellipsis',
paddingTop: '3px', paddingTop: '3px',
width: '5em',
fontSize: 'smaller',
}, },
}, ethUtil.toChecksumAddress(selected)), }, ethUtil.toChecksumAddress(selected)),
h('.flex-row', {
style: {
justifyContent: 'flex-end',
},
}, [
h(CopyButton, { h(CopyButton, {
value: ethUtil.toChecksumAddress(selected), value: ethUtil.toChecksumAddress(selected),
}), }),
@ -132,16 +139,19 @@ AccountDetailScreen.prototype.render = function () {
}), }),
]), ]),
]), ]),
]), ]),
]),
// balance + send h('.flex-row', {
h('.flex-row.flex-space-between', [ style: {
justifyContent: 'space-between',
alignItems: 'flex-start',
}
}, [
h(EtherBalance, { h(EtherBalance, {
value: account && account.balance, value: account && account.balance,
style: { style: {
lineHeight: '50px', lineHeight: '7px',
}, },
}), }),
@ -155,6 +165,13 @@ AccountDetailScreen.prototype.render = function () {
]), ]),
]), ]),
]),
// address and getter actions
// balance + send
]),
// subview (tx history, pk export confirm) // subview (tx history, pk export confirm)
h(ReactCSSTransitionGroup, { h(ReactCSSTransitionGroup, {
@ -214,4 +231,3 @@ AccountDetailScreen.prototype.transactionList = function () {
AccountDetailScreen.prototype.requestAccountExport = function () { AccountDetailScreen.prototype.requestAccountExport = function () {
this.props.dispatch(actions.requestExportAccount()) this.props.dispatch(actions.requestExportAccount())
} }

View File

@ -24,8 +24,24 @@ EthBalanceComponent.prototype.render = function () {
style: { style: {
display: 'inline', display: 'inline',
}, },
}, value), }, this.renderBalance(value)),
]) ])
) )
} }
EthBalanceComponent.prototype.renderBalance = function (value) {
if (value === 'None') return value
var balance = value[0]
var label = value[1]
return (
h('.flex-column',[
h('div', balance),
h('div', label)
])
)
}

View File

@ -387,7 +387,7 @@ input.large-input {
} }
.name-label{ .name-label{
margin-bottom: 14px;
} }
.edit-text { .edit-text {
height: 100%; height: 100%;

View File

@ -105,14 +105,14 @@ function formatBalance (balance, decimalsToKeep) {
if (afterDecimal !== '0') { if (afterDecimal !== '0') {
var sigFigs = afterDecimal.match(/^0*(.{2})/) // default: grabs 2 most significant digits var sigFigs = afterDecimal.match(/^0*(.{2})/) // default: grabs 2 most significant digits
if (sigFigs) { afterDecimal = sigFigs[0] } if (sigFigs) { afterDecimal = sigFigs[0] }
formatted = '0.' + afterDecimal + ' ETH' formatted = ['0.' + afterDecimal, ' ETH']
} }
} else { } else {
formatted = beforeDecimal + '.' + afterDecimal.slice(0, 3) + ' ETH' formatted = [beforeDecimal + '.' + afterDecimal.slice(0, 3), ' ETH']
} }
} else { } else {
afterDecimal += Array(decimalsToKeep).join('0') afterDecimal += Array(decimalsToKeep).join('0')
formatted = beforeDecimal + '.' + afterDecimal.slice(0, decimalsToKeep) + ' ETH' formatted = [beforeDecimal + '.' + afterDecimal.slice(0, decimalsToKeep), ' ETH']
} }
return formatted return formatted
} }