review fixup

feature/default_network_editable
Erik Marks 5 years ago
parent 7100a36ed3
commit b397aa5725
  1. 1
      ui/app/components/app/account-menu/account-menu.container.js
  2. 2
      ui/app/components/ui/popover/index.scss
  3. 19
      ui/app/pages/connected-sites/connected-sites.component.js
  4. 10
      ui/app/pages/connected-sites/connected-sites.container.js
  5. 8
      ui/app/pages/connected-sites/index.scss
  6. 4
      ui/app/selectors/permissions.js
  7. 9
      ui/app/selectors/selectors.js

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

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

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

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

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

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

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

Loading…
Cancel
Save