1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 09:52:26 +01:00

review fixup

This commit is contained in:
Erik Marks 2020-05-01 18:52:23 -07:00
parent 7100a36ed3
commit b397aa5725
7 changed files with 22 additions and 31 deletions

View File

@ -15,7 +15,6 @@ import {
getMetaMaskKeyrings,
getOriginOfCurrentTab,
getSelectedAddress,
// getPermittedAccounts,
} from '../../../selectors/selectors'
import AccountMenu from './account-menu.component'

View File

@ -61,7 +61,7 @@
&__button {
background: none;
font-size: inherit;
padding: 0 0 0 10px;
padding: 0;
}
i {

View File

@ -89,6 +89,7 @@ export default class ConnectedSites extends Component {
return (
<Popover
className="connected-sites"
title={t('connectedSites')}
subtitle={connectedDomains.length
? t('connectedSitesDescription', [accountLabel])
@ -98,12 +99,12 @@ export default class ConnectedSites extends Component {
footer={
tabToConnect
? (
<div
<a
className="connected-sites__text-button"
onClick={legacyExposeAccount}
>
{t('connectManually')}
</div>
</a>
)
: null
}
@ -141,20 +142,20 @@ export default class ConnectedSites extends Component {
{ t('disconnect') }
</Button>
</div>
<div className="connected-sites__footer-row">
{
numPermittedAccounts > 1
? (
<div
className="connected-sites__text-button"
onClick={this.disconnectAllAccounts}
>
{t('disconnectAllAccounts')}
<div className="connected-sites__footer-row">
<a
className="connected-sites__text-button"
onClick={this.disconnectAllAccounts}
>
{t('disconnectAllAccounts')}
</a>
</div>
)
: null
}
</div>
</>
)}
footerClassName="connected-sites__confirmation"

View File

@ -10,10 +10,12 @@ import {
getConnectedDomainsForSelectedAddress,
getCurrentAccountWithSendEtherInfo,
getOriginOfCurrentTab,
getPermissionsDomains,
getPermittedAccountsByOrigin,
getSelectedAddress,
} from '../../selectors/selectors'
import {
getPermissionsDomains,
getPermittedAccountsByOrigin,
} from '../../selectors/permissions'
import { DEFAULT_ROUTE } from '../../helpers/constants/routes'
import { getOriginFromUrl } from '../../helpers/utils/util'
@ -25,12 +27,12 @@ const mapStateToProps = (state) => {
const permittedAccountsByOrigin = getPermittedAccountsByOrigin(state)
const selectedAddress = getSelectedAddress(state)
const currentTabHasAccounts = permittedAccountsByOrigin[
const currentTabHasNoAccounts = !permittedAccountsByOrigin[
originOfCurrentTab
]?.length
let tabToConnect
if (url && !currentTabHasAccounts && !openMetaMaskTabs[id]) {
if (url && currentTabHasNoAccounts && !openMetaMaskTabs[id]) {
tabToConnect = {
title,
origin: getOriginFromUrl(url),

View File

@ -1,6 +1,7 @@
.connected-sites {
h2 {
text-overflow: ellipsis;
margin-right: 10px;
}
&__confirmation {
@ -22,13 +23,10 @@
margin-top: 15px;
}
&__text-button {
display: flex;
flex-direction: column;
justify-content: center;
a, a:hover {
font-size: 14px;
line-height: 20px;
color: #2f9ae0;
color: #037DD6;
cursor: pointer;
}
}

View File

@ -25,7 +25,7 @@ export function getPermittedAccounts (state, origin) {
* @returns {Object} Permitted accounts by origin.
*/
export function getPermittedAccountsByOrigin (state) {
const domains = allDomainsSelector(state)
const domains = getPermissionsDomains(state)
return Object.keys(domains).reduce((acc, domainKey) => {
const accounts = getAccountsFromPermission(
getAccountsPermissionFromDomain(domains[domainKey])
@ -67,7 +67,7 @@ function getAccountsCaveatFromPermission (accountsPermission = {}) {
)
}
function allDomainsSelector (state) {
export function getPermissionsDomains (state) {
return state.metamask.domains || {}
}

View File

@ -14,11 +14,6 @@ import {
import { getPermittedAccountsByOrigin } from './permissions'
export {
getPermittedAccounts,
getPermittedAccountsByOrigin,
} from './permissions'
export function getNetworkIdentifier (state) {
const { metamask: { provider: { type, nickname, rpcTarget } } } = state
@ -434,10 +429,6 @@ export function hasPermissionRequests (state) {
return Boolean(getFirstPermissionRequest(state))
}
export function getPermissionsDomains (state) {
return state.metamask.domains
}
export function getAddressConnectedDomainMap (state) {
const {
domainMetadata,