mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
New Sidebar uplift
This commit is contained in:
parent
6d3f261b2f
commit
a63373401b
@ -103,7 +103,6 @@ AccountMenu.prototype.renderAccounts = function () {
|
|||||||
showAccountDetail,
|
showAccountDetail,
|
||||||
} = this.props
|
} = this.props
|
||||||
|
|
||||||
console.log({ accounts })
|
|
||||||
return Object.keys(identities).map((key, index) => {
|
return Object.keys(identities).map((key, index) => {
|
||||||
const identity = identities[key]
|
const identity = identities[key]
|
||||||
const isSelected = identity.address === selected
|
const isSelected = identity.address === selected
|
||||||
|
@ -3,7 +3,8 @@ const connect = require('react-redux').connect
|
|||||||
const h = require('react-hyperscript')
|
const h = require('react-hyperscript')
|
||||||
const inherits = require('util').inherits
|
const inherits = require('util').inherits
|
||||||
const Identicon = require('./identicon')
|
const Identicon = require('./identicon')
|
||||||
const AccountDropdowns = require('./dropdowns/index.js').AccountDropdowns
|
// const AccountDropdowns = require('./dropdowns/index.js').AccountDropdowns
|
||||||
|
const copyToClipboard = require('copy-to-clipboard')
|
||||||
const actions = require('../actions')
|
const actions = require('../actions')
|
||||||
const BalanceComponent = require('./balance-component')
|
const BalanceComponent = require('./balance-component')
|
||||||
const TokenList = require('./token-list')
|
const TokenList = require('./token-list')
|
||||||
@ -19,6 +20,7 @@ function mapStateToProps (state) {
|
|||||||
identities: state.metamask.identities,
|
identities: state.metamask.identities,
|
||||||
accounts: state.metamask.accounts,
|
accounts: state.metamask.accounts,
|
||||||
tokens: state.metamask.tokens,
|
tokens: state.metamask.tokens,
|
||||||
|
keyrings: state.metamask.keyrings,
|
||||||
selectedAddress: selectors.getSelectedAddress(state),
|
selectedAddress: selectors.getSelectedAddress(state),
|
||||||
selectedIdentity: selectors.getSelectedIdentity(state),
|
selectedIdentity: selectors.getSelectedIdentity(state),
|
||||||
selectedAccount: selectors.getSelectedAccount(state),
|
selectedAccount: selectors.getSelectedAccount(state),
|
||||||
@ -28,9 +30,12 @@ function mapStateToProps (state) {
|
|||||||
|
|
||||||
function mapDispatchToProps (dispatch) {
|
function mapDispatchToProps (dispatch) {
|
||||||
return {
|
return {
|
||||||
showSendPage: () => { dispatch(actions.showSendPage()) },
|
showSendPage: () => dispatch(actions.showSendPage()),
|
||||||
hideSidebar: () => { dispatch(actions.hideSidebar()) },
|
hideSidebar: () => dispatch(actions.hideSidebar()),
|
||||||
unsetSelectedToken: () => dispatch(actions.setSelectedToken()),
|
unsetSelectedToken: () => dispatch(actions.setSelectedToken()),
|
||||||
|
showAccountDetailModal: () => {
|
||||||
|
dispatch(actions.showModal({ name: 'ACCOUNT_DETAILS' }))
|
||||||
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -47,7 +52,7 @@ WalletView.prototype.renderWalletBalance = function () {
|
|||||||
hideSidebar,
|
hideSidebar,
|
||||||
sidebarOpen,
|
sidebarOpen,
|
||||||
} = this.props
|
} = this.props
|
||||||
console.log({ selectedAccount })
|
|
||||||
const selectedClass = selectedTokenAddress
|
const selectedClass = selectedTokenAddress
|
||||||
? ''
|
? ''
|
||||||
: 'wallet-balance-wrapper--active'
|
: 'wallet-balance-wrapper--active'
|
||||||
@ -73,13 +78,24 @@ WalletView.prototype.renderWalletBalance = function () {
|
|||||||
|
|
||||||
WalletView.prototype.render = function () {
|
WalletView.prototype.render = function () {
|
||||||
const {
|
const {
|
||||||
network, responsiveDisplayClassname, identities,
|
responsiveDisplayClassname,
|
||||||
selectedAddress, accounts,
|
selectedAddress,
|
||||||
selectedIdentity,
|
selectedIdentity,
|
||||||
|
keyrings,
|
||||||
|
showAccountDetailModal,
|
||||||
|
hideSidebar,
|
||||||
} = this.props
|
} = this.props
|
||||||
// temporary logs + fake extra wallets
|
// temporary logs + fake extra wallets
|
||||||
// console.log('walletview, selectedAccount:', selectedAccount)
|
// console.log('walletview, selectedAccount:', selectedAccount)
|
||||||
|
|
||||||
|
const keyring = keyrings.find((kr) => {
|
||||||
|
return kr.accounts.includes(selectedAddress) ||
|
||||||
|
kr.accounts.includes(selectedIdentity.address)
|
||||||
|
})
|
||||||
|
|
||||||
|
const type = keyring.type
|
||||||
|
const isLoose = type !== 'HD Key Tree'
|
||||||
|
|
||||||
return h('div.wallet-view.flex-column' + (responsiveDisplayClassname || ''), {
|
return h('div.wallet-view.flex-column' + (responsiveDisplayClassname || ''), {
|
||||||
style: {},
|
style: {},
|
||||||
}, [
|
}, [
|
||||||
@ -88,57 +104,15 @@ WalletView.prototype.render = function () {
|
|||||||
h('div.flex-column.wallet-view-account-details', {
|
h('div.flex-column.wallet-view-account-details', {
|
||||||
style: {},
|
style: {},
|
||||||
}, [
|
}, [
|
||||||
|
h('div.wallet-view__sidebar-close', {
|
||||||
|
onClick: hideSidebar,
|
||||||
|
}),
|
||||||
|
|
||||||
h('div.flex-row.account-options-menu', {
|
h('div.wallet-view__keyring-label', isLoose ? 'IMPORTED' : ''),
|
||||||
style: {
|
|
||||||
position: 'relative',
|
|
||||||
},
|
|
||||||
}, [
|
|
||||||
|
|
||||||
h(AccountDropdowns, {
|
|
||||||
selected: selectedAddress,
|
|
||||||
network,
|
|
||||||
identities,
|
|
||||||
useCssTransition: true,
|
|
||||||
enableAccountOptions: true,
|
|
||||||
dropdownWrapperStyle: {
|
|
||||||
padding: '1px 15px',
|
|
||||||
marginLeft: '-25px',
|
|
||||||
position: 'absolute',
|
|
||||||
width: '122%', // TODO, refactor all of this component out into media queries
|
|
||||||
},
|
|
||||||
menuItemStyles: {
|
|
||||||
padding: '0px 0px',
|
|
||||||
margin: '22px 0px',
|
|
||||||
},
|
|
||||||
}, []),
|
|
||||||
|
|
||||||
]),
|
|
||||||
|
|
||||||
h('div.flex-column.flex-center', {
|
h('div.flex-column.flex-center', {
|
||||||
|
style: { margin: '0 auto' },
|
||||||
}, [
|
}, [
|
||||||
h('div', {
|
|
||||||
style: {
|
|
||||||
position: 'relative',
|
|
||||||
},
|
|
||||||
}, [
|
|
||||||
h(AccountDropdowns, {
|
|
||||||
accounts,
|
|
||||||
style: {
|
|
||||||
position: 'absolute',
|
|
||||||
left: 'calc(50% + 28px + 5.5px)',
|
|
||||||
top: '14px',
|
|
||||||
},
|
|
||||||
innerStyle: {
|
|
||||||
padding: '10px 16px',
|
|
||||||
},
|
|
||||||
useCssTransition: true,
|
|
||||||
selected: selectedAddress,
|
|
||||||
network,
|
|
||||||
identities,
|
|
||||||
}, []),
|
|
||||||
]),
|
|
||||||
|
|
||||||
h(Identicon, {
|
h(Identicon, {
|
||||||
diameter: 54,
|
diameter: 54,
|
||||||
address: selectedAddress,
|
address: selectedAddress,
|
||||||
@ -149,14 +123,20 @@ WalletView.prototype.render = function () {
|
|||||||
}, [
|
}, [
|
||||||
selectedIdentity.name,
|
selectedIdentity.name,
|
||||||
]),
|
]),
|
||||||
|
|
||||||
]),
|
]),
|
||||||
]),
|
]),
|
||||||
|
|
||||||
|
h('button.wallet-view__details-button', { onClick: showAccountDetailModal }, 'DETAILS'),
|
||||||
|
|
||||||
|
h('div.wallet-view__address', { onClick: () => copyToClipboard(selectedAddress) }, [
|
||||||
|
`${selectedAddress.slice(0, 4)}...${selectedAddress.slice(-4)}`,
|
||||||
|
h('i.fa.fa-clipboard', { style: { marginLeft: '8px' } }),
|
||||||
|
]),
|
||||||
|
|
||||||
// 'Wallet' - Title
|
// 'Wallet' - Title
|
||||||
// Not visible on mobile
|
// Not visible on mobile
|
||||||
h('div.flex-column.wallet-view-title-wrapper', {}, [
|
h('div.flex-column.wallet-view-title-wrapper', [
|
||||||
h('span.wallet-view-title', {}, [
|
h('span.wallet-view-title', [
|
||||||
'Wallet',
|
'Wallet',
|
||||||
]),
|
]),
|
||||||
]),
|
]),
|
||||||
|
@ -46,6 +46,7 @@ $wallet-view-bg: $wild-sand;
|
|||||||
flex: 33.5 0 33.5%;
|
flex: 33.5 0 33.5%;
|
||||||
background: $wallet-view-bg;
|
background: $wallet-view-bg;
|
||||||
z-index: 200;
|
z-index: 200;
|
||||||
|
position: relative;
|
||||||
|
|
||||||
@media screen and (min-width: 576px) {
|
@media screen and (min-width: 576px) {
|
||||||
overflow-y: scroll;
|
overflow-y: scroll;
|
||||||
@ -55,6 +56,57 @@ $wallet-view-bg: $wild-sand;
|
|||||||
.wallet-view-account-details {
|
.wallet-view-account-details {
|
||||||
flex: 0 0 150px;
|
flex: 0 0 150px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&__keyring-label {
|
||||||
|
height: 40px;
|
||||||
|
color: $dusty-gray;
|
||||||
|
font-family: Roboto;
|
||||||
|
font-size: 10px;
|
||||||
|
line-height: 40px;
|
||||||
|
text-align: right;
|
||||||
|
padding: 0 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__details-button {
|
||||||
|
color: $curious-blue;
|
||||||
|
font-size: 10px;
|
||||||
|
line-height: 13px;
|
||||||
|
text-align: center;
|
||||||
|
border: 1px solid $curious-blue;
|
||||||
|
border-radius: 10.5px;
|
||||||
|
background-color: transparent;
|
||||||
|
margin: 0 auto;
|
||||||
|
padding: 4px 12px;
|
||||||
|
flex: 0 0 auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__address {
|
||||||
|
border-radius: 3px;
|
||||||
|
background-color: $alto;
|
||||||
|
color: $scorpion;
|
||||||
|
font-size: 14px;
|
||||||
|
line-height: 12px;
|
||||||
|
padding: 4px 12px;
|
||||||
|
margin: 24px auto;
|
||||||
|
font-weight: 300;
|
||||||
|
cursor: pointer;
|
||||||
|
flex: 0 0 auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__sidebar-close {
|
||||||
|
|
||||||
|
@media screen and (max-width: 575px) {
|
||||||
|
&::after {
|
||||||
|
content: '\00D7';
|
||||||
|
font-size: 40px;
|
||||||
|
color: $tundora;
|
||||||
|
position: absolute;
|
||||||
|
top: 15px;
|
||||||
|
left: 15px;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@media screen and (min-width: 576px) {
|
@media screen and (min-width: 576px) {
|
||||||
@ -174,15 +226,11 @@ $wallet-view-bg: $wild-sand;
|
|||||||
|
|
||||||
// wallet view
|
// wallet view
|
||||||
.account-name {
|
.account-name {
|
||||||
|
font-size: 24px;
|
||||||
@media screen and (max-width: 575px) {
|
font-weight: 200;
|
||||||
font-size: 102%;
|
line-height: 20px;
|
||||||
margin-left: 3%;
|
color: $scorpion;
|
||||||
}
|
margin-top: 8px;
|
||||||
|
|
||||||
@media screen and (max-width: 575px) {
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// account options dropdown
|
// account options dropdown
|
||||||
|
Loading…
Reference in New Issue
Block a user