Reorder Account Selector and Account Options

feature/default_network_editable
sdtsui 7 years ago
parent f329c232a2
commit 9e8e445695
  1. 5
      ui/responsive/app/app.js
  2. 148
      ui/responsive/app/components/account-dropdowns.js

@ -210,6 +210,7 @@ App.prototype.renderNetworkDropdown = function () {
},
innerStyle: {},
}, [
h(
DropdownMenuItem,
{
@ -233,7 +234,8 @@ App.prototype.renderNetworkDropdown = function () {
h('.menu-icon.red-dot'),
'Ropsten Test Network',
providerType === 'ropsten' ? h('.check', '✓') : null,
]),
]
),
h(
DropdownMenuItem,
@ -289,6 +291,7 @@ App.prototype.renderNetworkDropdown = function () {
activeNetwork === 'custom' ? h('.check', '✓') : null,
]
),
])
}

@ -14,12 +14,12 @@ class AccountDropdowns extends Component {
constructor (props) {
super(props)
this.state = {
overflowMenuActive: false,
switchingMenuActive: false,
accountSelectorActive: false,
optionsMenuActive: false,
}
}
getAccounts () {
renderAccounts () {
const { identities, selected } = this.props
return Object.keys(identities).map((key) => {
@ -49,38 +49,71 @@ class AccountDropdowns extends Component {
})
}
render () {
const { style, actions } = this.props
const { switchingMenuActive, overflowMenuActive } = this.state
renderAccountSelector () {
const { actions } = this.props
const { accountSelectorActive } = this.state
return h(
'span',
Dropdown,
{
style: style,
style: {
marginLeft: '-125px',
minWidth: '180px',
},
isOpen: accountSelectorActive,
onClickOutside: () => { this.setState({ accountSelectorActive: false }) },
},
[
...this.renderAccounts(),
h(
'i.fa.fa-angle-down',
DropdownMenuItem,
{
style: {},
onClick: (event) => {
event.stopPropagation()
this.setState({
switchingMenuActive: !switchingMenuActive,
overflowMenuActive: false,
})
closeMenu: () => {},
onClick: () => actions.addNewAccount(),
},
[
h(
Identicon,
{
diameter: 16,
},
),
h('span', { style: { marginLeft: '10px' } }, 'Create Account'),
],
),
h(
DropdownMenuItem,
{
closeMenu: () => {},
onClick: () => actions.showImportPage(),
},
[
h(
Identicon,
{
diameter: 16,
},
),
h('span', { style: { marginLeft: '10px' } }, 'Import Account'),
]
),
]
)
}
renderAccountOptions () {
const { actions } = this.props
const { optionsMenuActive } = this.state
return h(
Dropdown,
{
style: {
marginLeft: '-140px',
marginLeft: '-162px',
minWidth: '180px',
},
isOpen: switchingMenuActive,
onClickOutside: () => { this.setState({ switchingMenuActive: false}) },
isOpen: optionsMenuActive,
onClickOutside: () => { this.setState({ optionsMenuActive: false }) },
},
[
h(
@ -126,69 +159,46 @@ class AccountDropdowns extends Component {
'Export Private Key',
),
]
),
],
),
)
}
render () {
const { style } = this.props
const { optionsMenuActive, accountSelectorActive } = this.state
return h(
'span',
{
style: style,
},
[
h(
'i.fa.fa-ellipsis-h',
'i.fa.fa-angle-down',
{
style: { 'marginLeft': '10px'},
style: {},
onClick: (event) => {
event.stopPropagation()
this.setState({
overflowMenuActive: !overflowMenuActive,
switchingMenuActive: false,
accountSelectorActive: !accountSelectorActive,
optionsMenuActive: false,
})
},
},
[
h(
Dropdown,
{
style: {
marginLeft: '-155px',
minWidth: '180px',
},
isOpen: overflowMenuActive,
onClickOutside: () => { this.setState({ overflowMenuActive: false}) },
},
[
...this.getAccounts(),
h(
DropdownMenuItem,
{
closeMenu: () => {},
onClick: () => actions.addNewAccount(),
},
[
h(
Identicon,
{
diameter: 16,
},
),
h('span', { style: { marginLeft: '10px' } }, 'Create Account'),
],
this.renderAccountSelector(),
),
h(
DropdownMenuItem,
'i.fa.fa-ellipsis-h',
{
closeMenu: () => {},
onClick: () => actions.showImportPage(),
style: { 'marginLeft': '10px'},
onClick: (event) => {
event.stopPropagation()
this.setState({
accountSelectorActive: false,
optionsMenuActive: !optionsMenuActive,
})
},
[
h(
Identicon,
{
diameter: 16,
},
),
h('span', { style: { marginLeft: '10px' } }, 'Import Account'),
]
),
]
),
]
this.renderAccountOptions()
),
]
)

Loading…
Cancel
Save