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

Merge pull request #920 from luisivan/dev

Interface enhancements
This commit is contained in:
Dan Finlay 2016-12-14 16:46:36 -08:00 committed by GitHub
commit e6c01abba4
11 changed files with 54 additions and 101 deletions

View File

@ -70,54 +70,43 @@ AccountDetailScreen.prototype.render = function () {
// large identicon and addresses // large identicon and addresses
h('.identicon-wrapper.select-none', [ h('.identicon-wrapper.select-none', [
h(Identicon, { h(Identicon, {
diameter: 62, diameter: 48,
address: selected, address: selected,
}), }),
]), ]),
h('flex-column', { h('flex-column', {
style: { style: {
width: '100%',
lineHeight: '10px', lineHeight: '10px',
marginLeft: '15px', marginLeft: '15px',
}, },
}, [ }, [
h(EditableLabel, { h(EditableLabel, {
textValue: identity ? identity.name : '', textValue: identity ? identity.name : '',
state: {
isEditingLabel: false,
},
saveText: (text) => { saveText: (text) => {
props.dispatch(actions.saveAccountLabel(selected, text)) props.dispatch(actions.saveAccountLabel(selected, text))
}, },
}, [ }, [
// What is shown when not editing + edit text: // What is shown when not editing + edit text:
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),
]), ]),
h('.flex-row', { h('.flex-row', {
style: { style: {
width: '15em', width: '100%',
justifyContent: 'space-between', justifyContent: 'space-between',
alignItems: 'baseline', alignItems: 'baseline',
}, },
}, [ }, [
// address // balance
h(EthBalance, {
h('div', { value: account && account.balance,
style: { style: {
overflow: 'hidden', lineHeight: '7px',
textOverflow: 'ellipsis',
paddingTop: '3px',
width: '5em',
fontSize: '13px',
fontFamily: 'Montserrat Light',
textRendering: 'geometricPrecision',
marginTop: '10px', marginTop: '10px',
marginBottom: '15px',
color: '#AEAEAE',
}, },
}, ethUtil.toChecksumAddress(selected)), }),
// copy and export // copy and export
@ -171,33 +160,18 @@ AccountDetailScreen.prototype.render = function () {
]), ]),
]), ]),
]), ]),
// account ballence
]), ]),
]), ]),
h('.flex-row', { h('.flex-row', {
style: { style: {
justifyContent: 'space-between', justifyContent: 'flex-end',
alignItems: 'flex-start',
}, },
}, [ }, [
h(EthBalance, {
value: account && account.balance,
style: {
lineHeight: '7px',
marginTop: '10px',
},
}),
h('button', { h('button', {
onClick: () => props.dispatch(actions.buyEthView(selected)), onClick: () => props.dispatch(actions.buyEthView(selected)),
style: { style: {
marginBottom: '20px', marginBottom: '20px',
marginRight: '8px', marginRight: '8px',
position: 'absolute',
left: '219px',
}, },
}, 'BUY'), }, 'BUY'),

View File

@ -114,7 +114,6 @@ App.prototype.renderAppBar = function () {
alignItems: 'center', alignItems: 'center',
visibility: props.isUnlocked ? 'visible' : 'none', visibility: props.isUnlocked ? 'visible' : 'none',
background: props.isUnlocked ? 'white' : 'none', background: props.isUnlocked ? 'white' : 'none',
height: '36px',
position: 'relative', position: 'relative',
zIndex: 2, zIndex: 2,
}, },
@ -127,14 +126,6 @@ App.prototype.renderAppBar = function () {
alignItems: 'center', alignItems: 'center',
}, },
}, [ }, [
// mini logo
h('img', {
height: 24,
width: 24,
src: '/images/icon-128.png',
}),
h(NetworkIndicator, { h(NetworkIndicator, {
network: this.props.network, network: this.props.network,
provider: this.props.provider, provider: this.props.provider,
@ -149,8 +140,9 @@ App.prototype.renderAppBar = function () {
// metamask name // metamask name
h('h1', { h('h1', {
style: { style: {
position: 'relative', position: 'absolute',
left: '9px', left: '50%',
transform: 'translateX(-50%)',
}, },
}, 'MetaMask'), }, 'MetaMask'),

View File

@ -11,40 +11,18 @@ function EditableLabel () {
} }
EditableLabel.prototype.render = function () { EditableLabel.prototype.render = function () {
const props = this.props
const state = this.state
if (state && state.isEditingLabel) {
return h('div.editable-label', [
h('input.sizing-input', {
defaultValue: props.textValue,
maxLength: '20',
onKeyPress: (event) => {
this.saveIfEnter(event)
},
}),
h('button.editable-button', {
onClick: () => this.saveText(),
}, 'Save'),
])
} else {
return h('div.name-label', { return h('div.name-label', {
onClick: (event) => { contentEditable: true,
this.setState({ isEditingLabel: true }) style: {
outline: 'none',
marginTop: '0.5rem',
}, },
onInput: (event) => this.saveText(),
}, this.props.children) }, this.props.children)
} }
}
EditableLabel.prototype.saveIfEnter = function (event) {
if (event.key === 'Enter') {
this.saveText()
}
}
EditableLabel.prototype.saveText = function () { EditableLabel.prototype.saveText = function () {
var container = findDOMNode(this) var text = findDOMNode(this).textContent.trim()
var text = container.querySelector('.editable-label input').value
var truncatedText = text.substring(0, 20) var truncatedText = text.substring(0, 20)
this.props.saveText(truncatedText) this.props.saveText(truncatedText)
this.setState({ isEditingLabel: false, textLabel: truncatedText }) this.setState({ isEditingLabel: false, textLabel: truncatedText })

View File

@ -12,7 +12,7 @@ inherits(IdenticonComponent, Component)
function IdenticonComponent () { function IdenticonComponent () {
Component.call(this) Component.call(this)
this.defaultDiameter = 46 this.defaultDiameter = 32
} }
IdenticonComponent.prototype.render = function () { IdenticonComponent.prototype.render = function () {

View File

@ -17,6 +17,6 @@ Tooltip.prototype.render = function () {
return h(ReactTooltip, { return h(ReactTooltip, {
position: position || 'left', position: position || 'left',
title, title,
fixed: false, fixed: true,
}, children) }, children)
} }

View File

@ -79,10 +79,9 @@ TransactionList.prototype.render = function () {
height: '100%', height: '100%',
}, },
}, [ }, [
'No transaction history.', 'No transaction history',
]), ]),
]), ]),
]) ])
) )
} }

View File

@ -67,7 +67,7 @@ button.spaced {
} }
button:not([disabled]):hover { button:not([disabled]):hover {
transform: scale(1.1); transform: scale(1.05);
} }
button:not([disabled]):active { button:not([disabled]):active {
transform: scale(0.95); transform: scale(0.95);
@ -112,9 +112,7 @@ button.btn-thin {
font-size: 13px; font-size: 13px;
} }
.app-header { .app-header {}
padding: 6px 8px;
}
.app-header h1 { .app-header h1 {
font-family: 'Montserrat Regular'; font-family: 'Montserrat Regular';
@ -165,9 +163,6 @@ textarea.twelve-word-phrase {
} }
.network-name { .network-name {
position: absolute;
top: 8px;
left: 60px;
width: 5.2em; width: 5.2em;
line-height: 9px; line-height: 9px;
text-rendering: geometricPrecision; text-rendering: geometricPrecision;

View File

@ -29,7 +29,8 @@ DisclaimerScreen.prototype.render = function () {
style: { style: {
background: '#EBEBEB', background: '#EBEBEB',
color: '#AEAEAE', color: '#AEAEAE',
marginBottom: 24, marginTop: 0,
marginBottom: 0,
width: '100%', width: '100%',
fontSize: '20px', fontSize: '20px',
textAlign: 'center', textAlign: 'center',
@ -42,8 +43,8 @@ DisclaimerScreen.prototype.render = function () {
h('style', ` h('style', `
.markdown { .markdown {
font-family: Times New Roman;
overflow-x: hidden; overflow-x: hidden;
font-weight: lighter;
} }
.markdown h1, .markdown h2, .markdown h3 { .markdown h1, .markdown h2, .markdown h3 {
margin: 10px 0; margin: 10px 0;
@ -75,10 +76,10 @@ DisclaimerScreen.prototype.render = function () {
} }
}, },
style: { style: {
background: 'rgb(235, 235, 235)', background: 'transparent',
height: '310px', height: '415px',
padding: '6px', padding: '0 5px',
width: '80%', width: '100%',
overflowY: 'scroll', overflowY: 'scroll',
}, },
}, [ }, [
@ -91,7 +92,12 @@ DisclaimerScreen.prototype.render = function () {
]), ]),
h('button', { h('button', {
style: { marginTop: '18px' }, style: {
width: '100%',
position: 'absolute',
bottom: 0,
left: 0,
},
disabled, disabled,
onClick: () => this.props.dispatch(actions.agreeToDisclaimer()), onClick: () => this.props.dispatch(actions.agreeToDisclaimer()),
}, disabled ? 'Scroll Down to Enable' : 'I Agree'), }, disabled ? 'Scroll Down to Enable' : 'I Agree'),

View File

@ -114,7 +114,10 @@ InitializeMenuScreen.prototype.renderMenu = function (state) {
h('button.primary', { h('button.primary', {
onClick: this.createNewVaultAndKeychain.bind(this), onClick: this.createNewVaultAndKeychain.bind(this),
style: { style: {
margin: 12, position: 'absolute',
left: 0,
bottom: 0,
width: '100%',
}, },
}, 'Create'), }, 'Create'),

View File

@ -35,7 +35,7 @@ CreateVaultCompleteScreen.prototype.render = function () {
style: { style: {
background: '#EBEBEB', background: '#EBEBEB',
color: '#AEAEAE', color: '#AEAEAE',
marginTop: 36, marginTop: 0,
marginBottom: 8, marginBottom: 8,
width: '100%', width: '100%',
fontSize: '20px', fontSize: '20px',
@ -60,8 +60,10 @@ CreateVaultCompleteScreen.prototype.render = function () {
h('button.primary', { h('button.primary', {
onClick: () => this.confirmSeedWords(), onClick: () => this.confirmSeedWords(),
style: { style: {
margin: '24px', position: 'absolute',
fontSize: '0.9em', left: 0,
bottom: 0,
width: '100%',
}, },
}, 'I\'ve copied it somewhere safe'), }, 'I\'ve copied it somewhere safe'),
]) ])

View File

@ -63,7 +63,10 @@ UnlockScreen.prototype.render = function () {
h('button.primary.cursor-pointer', { h('button.primary.cursor-pointer', {
onClick: this.onSubmit.bind(this), onClick: this.onSubmit.bind(this),
style: { style: {
margin: 10, position: 'absolute',
bottom: 0,
left: 0,
width: '100%',
}, },
}, 'Unlock'), }, 'Unlock'),
]), ]),
@ -72,11 +75,12 @@ UnlockScreen.prototype.render = function () {
h('p.pointer', { h('p.pointer', {
onClick: () => this.props.dispatch(actions.goBackToInitView()), onClick: () => this.props.dispatch(actions.goBackToInitView()),
style: { style: {
marginTop: '1rem',
fontSize: '0.8em', fontSize: '0.8em',
color: 'rgb(247, 134, 28)', color: 'rgb(247, 134, 28)',
textDecoration: 'underline', textDecoration: 'underline',
}, },
}, 'I forgot my password.'), }, 'I forgot my password'),
]), ]),
]) ])
) )