1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-22 17:33:23 +01:00

ui - redesign - account details

This commit is contained in:
kumavis 2016-05-11 02:11:31 -07:00
parent 82f9955f21
commit 2913dcb82c
4 changed files with 97 additions and 44 deletions

View File

@ -5,9 +5,12 @@ const h = require('react-hyperscript')
const connect = require('react-redux').connect const connect = require('react-redux').connect
const copyToClipboard = require('copy-to-clipboard') const copyToClipboard = require('copy-to-clipboard')
const actions = require('./actions') const actions = require('./actions')
const addressSummary = require('./util').addressSummary
const formatBalance = require('./util').formatBalance
const ReactCSSTransitionGroup = require('react-addons-css-transition-group') const ReactCSSTransitionGroup = require('react-addons-css-transition-group')
const AccountPanel = require('./components/account-panel') const AccountPanel = require('./components/account-panel')
const Identicon = require('./components/identicon')
const transactionList = require('./components/transaction-list') const transactionList = require('./components/transaction-list')
const ExportAccountView = require('./components/account-export') const ExportAccountView = require('./components/account-export')
@ -41,49 +44,80 @@ AccountDetailScreen.prototype.render = function() {
h('.account-detail-section.flex-column.flex-grow', { h('.account-detail-section.flex-column.flex-grow', {
style: { style: {
width: '330px', width: 330,
'margin-top': 28,
}, },
}, [ }, [
// subtitle and nav h('.flex-row.flex-space-between', [
h('.section-title.flex-row.flex-center', [
h('i.fa.fa-arrow-left.fa-lg.cursor-pointer', { // invisible placeholder for later
h('i.fa.fa-users.fa-lg.color-orange', {
style: {
visibility: 'hidden',
},
}),
// large identicon
h('.identicon-wrapper.flex-column.flex-center.select-none', [
h(Identicon, {
diameter: 62,
address: account.address
}),
]),
// small accounts nav
h('i.fa.fa-users.fa-lg.cursor-pointer.color-orange', {
onClick: this.navigateToAccounts.bind(this), onClick: this.navigateToAccounts.bind(this),
}), }),
h('h2.page-subtitle', 'Account Detail'),
]), ]),
// account summary, with embedded action buttons h('h2.font-medium.color-forest.flex-center', {
h(AccountPanel, {
showFullAddress: true,
identity: identity,
account: account,
key: 'accountPanel'
}),
h('div', {
style: { style: {
display: 'flex', 'padding-top': 8,
} 'margin-bottom': 32,
},
}, identity && identity.name),
h('.flex-row.flex-space-between', {
style: {
'margin-bottom': 16,
},
}, [ }, [
h('button', { h('div', {
onClick: () => { style: {
copyToClipboard(identity.address) 'line-height': 16,
}, },
}, 'COPY ADDR'), }, addressSummary(account.address)),
h('i.fa.fa-download.fa-md.cursor-pointer.color-orange', {
onClick: () => this.requestAccountExport(account.address),
}),
h('i.fa.fa-qrcode.fa-md.cursor-disabled.color-orange', {
onClick: () => console.warn('QRCode not implented...'),
}),
h('i.fa.fa-clipboard.fa-md.cursor-pointer.color-orange', {
onClick: () => copyToClipboard(account.address),
}),
]),
h('.flex-row.flex-space-between', [
h('div', {
style: {
'line-height': 50,
},
}, formatBalance(account.balance)),
h('button', { h('button', {
onClick: () => { onClick: () => this.props.dispatch(actions.showSendPage()),
this.props.dispatch(actions.showSendPage()) }, 'SEND ETH'),
},
}, 'SEND'),
h('button', {
onClick: () => {
this.requestAccountExport(identity.address)
},
}, 'EXPORT'),
]), ]),
h(ReactCSSTransitionGroup, { h(ReactCSSTransitionGroup, {
@ -93,12 +127,7 @@ AccountDetailScreen.prototype.render = function() {
}, [ }, [
this.subview(), this.subview(),
]), ]),
// transaction table
/*
h('section.flex-column', [
h('span', 'your transaction history will go here.'),
]),
*/
]) ])
) )
} }

View File

@ -10,18 +10,20 @@ inherits(IdenticonComponent, Component)
function IdenticonComponent() { function IdenticonComponent() {
Component.call(this) Component.call(this)
this.diameter = 46 this.defaultDiameter = 46
} }
IdenticonComponent.prototype.render = function() { IdenticonComponent.prototype.render = function() {
var state = this.props
var diameter = state.diameter || this.defaultDiameter
return ( return (
h('div', { h('div', {
key: 'identicon-' + this.props.address, key: 'identicon-' + this.props.address,
style: { style: {
display: 'inline-block', display: 'inline-block',
height: this.diameter, height: diameter,
width: this.diameter, width: diameter,
borderRadius: this.diameter / 2, borderRadius: diameter / 2,
overflow: 'hidden', overflow: 'hidden',
}, },
}) })
@ -33,12 +35,12 @@ IdenticonComponent.prototype.componentDidMount = function(){
var address = state.address var address = state.address
if (!address) return if (!address) return
console.log('rendering for address ' + address)
var numericRepresentation = jsNumberForAddress(address) var numericRepresentation = jsNumberForAddress(address)
var container = findDOMNode(this) var container = findDOMNode(this)
// jazzicon with hack to fix inline svg error // jazzicon with hack to fix inline svg error
var identicon = jazzicon(this.diameter, numericRepresentation) var diameter = state.diameter || this.defaultDiameter
var identicon = jazzicon(diameter, numericRepresentation)
var identiconSrc = identicon.innerHTML var identiconSrc = identicon.innerHTML
var dataUri = 'data:image/svg+xml;charset=utf-8,'+encodeURIComponent(identiconSrc) var dataUri = 'data:image/svg+xml;charset=utf-8,'+encodeURIComponent(identiconSrc)
var img = document.createElement('img') var img = document.createElement('img')

View File

@ -28,18 +28,18 @@ html, body {
} }
button { button {
font-family: 'Transat Black';
outline: none; outline: none;
cursor: pointer; cursor: pointer;
margin: 10px; margin: 10px;
padding: 6px; padding: 8px 12px;
border: none; border: none;
border-radius: 3px;
background: #F7861C; background: #F7861C;
font-weight: 500;
color: white; color: white;
transform-origin: center center; transform-origin: center center;
transition: transform 50ms ease-in; transition: transform 50ms ease-in;
} }
button:hover { button:hover {
transform: scale(1.1); transform: scale(1.1);
} }

View File

@ -1,3 +1,13 @@
/* color */
.color-orange {
color: #F7861C;
}
.color-forest {
color: #08525D;
}
/* lib */ /* lib */
.full-width { .full-width {
@ -47,6 +57,10 @@
flex: none; flex: none;
} }
.flex-basis-auto {
flex-basis: auto;
}
.flex-grow { .flex-grow {
flex: 1 1 auto; flex: 1 1 auto;
} }
@ -105,6 +119,10 @@
transform: scale(0.95); transform: scale(0.95);
} }
.cursor-disabled {
cursor: not-allowed;
}
.margin-bottom-sml { .margin-bottom-sml {
margin-bottom: 20px; margin-bottom: 20px;
} }
@ -125,6 +143,10 @@
font-size: 12px; font-size: 12px;
} }
.font-medium {
font-size: 1.2em;
}
/* Send Screen */ /* Send Screen */
.send-screen { .send-screen {
margin: 0 20px; margin: 0 20px;