mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
Show correct description for empty Connected Sites modal (#8298)
This commit is contained in:
parent
a38d0d790e
commit
55228ef08c
@ -6,6 +6,10 @@
|
|||||||
"message": "$1 is connected to these sites. They can view your account address.",
|
"message": "$1 is connected to these sites. They can view your account address.",
|
||||||
"description": "$1 is the account name"
|
"description": "$1 is the account name"
|
||||||
},
|
},
|
||||||
|
"connectedSitesEmptyDescription": {
|
||||||
|
"message": "$1 is not connected to any sites.",
|
||||||
|
"description": "$1 is the account name"
|
||||||
|
},
|
||||||
"connectManually": {
|
"connectManually": {
|
||||||
"message": "Manually connect to current site"
|
"message": "Manually connect to current site"
|
||||||
},
|
},
|
||||||
|
@ -1,11 +0,0 @@
|
|||||||
import { connect } from 'react-redux'
|
|
||||||
import ConnectedSitesList from './connected-sites-list.component'
|
|
||||||
import { getRenderablePermissionsDomains } from '../../../selectors/selectors'
|
|
||||||
|
|
||||||
const mapStateToProps = (state) => {
|
|
||||||
return {
|
|
||||||
connectedDomains: getRenderablePermissionsDomains(state),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export default connect(mapStateToProps)(ConnectedSitesList)
|
|
@ -1 +1 @@
|
|||||||
export { default } from './connected-sites-list.container'
|
export { default } from './connected-sites-list.component'
|
||||||
|
@ -15,6 +15,7 @@ export default class ConnectSites extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static propTypes = {
|
static propTypes = {
|
||||||
|
connectedDomains: PropTypes.arrayOf(PropTypes.object).isRequired,
|
||||||
accountLabel: PropTypes.string.isRequired,
|
accountLabel: PropTypes.string.isRequired,
|
||||||
disconnectAccount: PropTypes.func.isRequired,
|
disconnectAccount: PropTypes.func.isRequired,
|
||||||
history: PropTypes.object.isRequired,
|
history: PropTypes.object.isRequired,
|
||||||
@ -58,13 +59,14 @@ export default class ConnectSites extends Component {
|
|||||||
renderConnectedSites () {
|
renderConnectedSites () {
|
||||||
return (
|
return (
|
||||||
<ConnectedSitesList
|
<ConnectedSitesList
|
||||||
|
connectedDomains={this.props.connectedDomains}
|
||||||
onDisconnectSite={this.setSitePendingDisconnect}
|
onDisconnectSite={this.setSitePendingDisconnect}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
render () {
|
render () {
|
||||||
const { accountLabel, history, legacyExposeAccount, tabToConnect } = this.props
|
const { accountLabel, history, legacyExposeAccount, tabToConnect, connectedDomains } = this.props
|
||||||
const { t } = this.context
|
const { t } = this.context
|
||||||
const { sitePendingDisconnect } = this.state
|
const { sitePendingDisconnect } = this.state
|
||||||
return (
|
return (
|
||||||
@ -90,7 +92,10 @@ export default class ConnectSites extends Component {
|
|||||||
: (
|
: (
|
||||||
<Popover
|
<Popover
|
||||||
title={t('connectedSites')}
|
title={t('connectedSites')}
|
||||||
subtitle={t('connectedSitesDescription', [accountLabel])}
|
subtitle={connectedDomains.length
|
||||||
|
? t('connectedSitesDescription', [accountLabel])
|
||||||
|
: t('connectedSitesEmptyDescription', [accountLabel])
|
||||||
|
}
|
||||||
onClose={() => history.push(DEFAULT_ROUTE)}
|
onClose={() => history.push(DEFAULT_ROUTE)}
|
||||||
footer={
|
footer={
|
||||||
tabToConnect
|
tabToConnect
|
||||||
|
@ -5,6 +5,7 @@ import {
|
|||||||
getCurrentAccountWithSendEtherInfo,
|
getCurrentAccountWithSendEtherInfo,
|
||||||
getPermissionsDomains,
|
getPermissionsDomains,
|
||||||
getPermittedAccountsForCurrentTab,
|
getPermittedAccountsForCurrentTab,
|
||||||
|
getRenderablePermissionsDomains,
|
||||||
getSelectedAddress,
|
getSelectedAddress,
|
||||||
} from '../../selectors/selectors'
|
} from '../../selectors/selectors'
|
||||||
import { getOriginFromUrl } from '../../helpers/utils/util'
|
import { getOriginFromUrl } from '../../helpers/utils/util'
|
||||||
@ -13,6 +14,7 @@ const mapStateToProps = (state) => {
|
|||||||
const { openMetaMaskTabs } = state.appState
|
const { openMetaMaskTabs } = state.appState
|
||||||
const { title, url, id } = state.activeTab
|
const { title, url, id } = state.activeTab
|
||||||
const permittedAccounts = getPermittedAccountsForCurrentTab(state)
|
const permittedAccounts = getPermittedAccountsForCurrentTab(state)
|
||||||
|
const connectedDomains = getRenderablePermissionsDomains(state)
|
||||||
|
|
||||||
let tabToConnect
|
let tabToConnect
|
||||||
if (url && permittedAccounts.length === 0 && !openMetaMaskTabs[id]) {
|
if (url && permittedAccounts.length === 0 && !openMetaMaskTabs[id]) {
|
||||||
@ -24,6 +26,7 @@ const mapStateToProps = (state) => {
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
accountLabel: getCurrentAccountWithSendEtherInfo(state).name,
|
accountLabel: getCurrentAccountWithSendEtherInfo(state).name,
|
||||||
|
connectedDomains,
|
||||||
domains: getPermissionsDomains(state),
|
domains: getPermissionsDomains(state),
|
||||||
selectedAddress: getSelectedAddress(state),
|
selectedAddress: getSelectedAddress(state),
|
||||||
tabToConnect,
|
tabToConnect,
|
||||||
|
Loading…
Reference in New Issue
Block a user