aboutsummaryrefslogtreecommitdiffstats
path: root/ui/responsive
diff options
context:
space:
mode:
authorsdtsui <szehungdanieltsui@gmail.com>2017-07-19 00:29:52 +0800
committersdtsui <szehungdanieltsui@gmail.com>2017-07-19 01:51:11 +0800
commit9e8e445695585f47e9cc3f63b2ec8313b4fc4eb8 (patch)
treef66c331820ef10fa6e61df8e2d8c129d70c8cc4c /ui/responsive
parentf329c232a23e849a178381e92f3042d1d97303f2 (diff)
downloadtangerine-wallet-browser-9e8e445695585f47e9cc3f63b2ec8313b4fc4eb8.tar
tangerine-wallet-browser-9e8e445695585f47e9cc3f63b2ec8313b4fc4eb8.tar.gz
tangerine-wallet-browser-9e8e445695585f47e9cc3f63b2ec8313b4fc4eb8.tar.bz2
tangerine-wallet-browser-9e8e445695585f47e9cc3f63b2ec8313b4fc4eb8.tar.lz
tangerine-wallet-browser-9e8e445695585f47e9cc3f63b2ec8313b4fc4eb8.tar.xz
tangerine-wallet-browser-9e8e445695585f47e9cc3f63b2ec8313b4fc4eb8.tar.zst
tangerine-wallet-browser-9e8e445695585f47e9cc3f63b2ec8313b4fc4eb8.zip
Reorder Account Selector and Account Options
Diffstat (limited to 'ui/responsive')
-rw-r--r--ui/responsive/app/app.js5
-rw-r--r--ui/responsive/app/components/account-dropdowns.js238
2 files changed, 128 insertions, 115 deletions
diff --git a/ui/responsive/app/app.js b/ui/responsive/app/app.js
index 1ac9bea78..1cfa2d7a9 100644
--- a/ui/responsive/app/app.js
+++ b/ui/responsive/app/app.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,
]
),
+
])
}
diff --git a/ui/responsive/app/components/account-dropdowns.js b/ui/responsive/app/components/account-dropdowns.js
index f77d2fe9c..d1d319477 100644
--- a/ui/responsive/app/components/account-dropdowns.js
+++ b/ui/responsive/app/components/account-dropdowns.js
@@ -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,9 +49,122 @@ class AccountDropdowns extends Component {
})
}
+ renderAccountSelector () {
+ const { actions } = this.props
+ const { accountSelectorActive } = this.state
+
+ return h(
+ Dropdown,
+ {
+ style: {
+ marginLeft: '-125px',
+ minWidth: '180px',
+ },
+ isOpen: accountSelectorActive,
+ onClickOutside: () => { this.setState({ accountSelectorActive: false }) },
+ },
+ [
+ ...this.renderAccounts(),
+ h(
+ DropdownMenuItem,
+ {
+ 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: '-162px',
+ minWidth: '180px',
+ },
+ isOpen: optionsMenuActive,
+ onClickOutside: () => { this.setState({ optionsMenuActive: false }) },
+ },
+ [
+ h(
+ DropdownMenuItem,
+ {
+ closeMenu: () => {},
+ onClick: () => actions.showConfigPage(),
+ },
+ 'Account Settings',
+ ),
+ h(
+ DropdownMenuItem,
+ {
+ closeMenu: () => {},
+ onClick: () => {
+ const { selected, network } = this.props
+ const url = genAccountLink(selected, network)
+ global.platform.openWindow({ url })
+ },
+ },
+ 'View account on Etherscan',
+ ),
+ h(
+ DropdownMenuItem,
+ {
+ closeMenu: () => {},
+ onClick: () => {
+ const { selected } = this.props
+ const checkSumAddress = selected && ethUtil.toChecksumAddress(selected)
+ copyToClipboard(checkSumAddress)
+ },
+ },
+ 'Copy Address to clipboard',
+ ),
+ h(
+ DropdownMenuItem,
+ {
+ closeMenu: () => {},
+ onClick: () => {
+ actions.requestAccountExport()
+ },
+ },
+ 'Export Private Key',
+ ),
+ ]
+ )
+ }
+
render () {
- const { style, actions } = this.props
- const { switchingMenuActive, overflowMenuActive } = this.state
+ const { style } = this.props
+ const { optionsMenuActive, accountSelectorActive } = this.state
return h(
'span',
@@ -66,68 +179,12 @@ class AccountDropdowns extends Component {
onClick: (event) => {
event.stopPropagation()
this.setState({
- switchingMenuActive: !switchingMenuActive,
- overflowMenuActive: false,
+ accountSelectorActive: !accountSelectorActive,
+ optionsMenuActive: false,
})
},
},
- [
- h(
- Dropdown,
- {
- style: {
- marginLeft: '-140px',
- minWidth: '180px',
- },
- isOpen: switchingMenuActive,
- onClickOutside: () => { this.setState({ switchingMenuActive: false}) },
- },
- [
- h(
- DropdownMenuItem,
- {
- closeMenu: () => {},
- onClick: () => actions.showConfigPage(),
- },
- 'Account Settings',
- ),
- h(
- DropdownMenuItem,
- {
- closeMenu: () => {},
- onClick: () => {
- const { selected, network } = this.props
- const url = genAccountLink(selected, network)
- global.platform.openWindow({ url })
- },
- },
- 'View account on Etherscan',
- ),
- h(
- DropdownMenuItem,
- {
- closeMenu: () => {},
- onClick: () => {
- const { selected } = this.props
- const checkSumAddress = selected && ethUtil.toChecksumAddress(selected)
- copyToClipboard(checkSumAddress)
- },
- },
- 'Copy Address to clipboard',
- ),
- h(
- DropdownMenuItem,
- {
- closeMenu: () => {},
- onClick: () => {
- actions.requestAccountExport()
- },
- },
- 'Export Private Key',
- ),
- ]
- ),
- ],
+ this.renderAccountSelector(),
),
h(
'i.fa.fa-ellipsis-h',
@@ -136,59 +193,12 @@ class AccountDropdowns extends Component {
onClick: (event) => {
event.stopPropagation()
this.setState({
- overflowMenuActive: !overflowMenuActive,
- switchingMenuActive: false,
+ accountSelectorActive: false,
+ optionsMenuActive: !optionsMenuActive,
})
},
},
- [
- 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'),
- ],
- ),
- h(
- DropdownMenuItem,
- {
- closeMenu: () => {},
- onClick: () => actions.showImportPage(),
- },
- [
- h(
- Identicon,
- {
- diameter: 16,
- },
- ),
- h('span', { style: { marginLeft: '10px' } }, 'Import Account'),
- ]
- ),
- ]
- ),
- ]
+ this.renderAccountOptions()
),
]
)