mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-11-22 09:57:02 +01:00
add connected sites popovers render methods
This commit is contained in:
parent
c7d945e62d
commit
d45956b2b7
@ -40,7 +40,7 @@
|
||||
"ganache:start": "./development/run-ganache",
|
||||
"sentry:publish": "node ./development/sentry-publish.js",
|
||||
"lint": "eslint . --ext js,json",
|
||||
"lint:fix": "eslint . --ext js,json --fix",
|
||||
"lint:fix": "eslint --ext js,json --fix",
|
||||
"lint:changed": "{ git ls-files --others --exclude-standard ; git diff-index --name-only --diff-filter=d HEAD ; } | grep --regexp='[.]js$' --regexp='[.]json$' | tr '\\n' '\\0' | xargs -0 eslint",
|
||||
"lint:changed:fix": "{ git ls-files --others --exclude-standard ; git diff-index --name-only --diff-filter=d HEAD ; } | grep --regexp='[.]js$' --regexp='[.]json$' | tr '\\n' '\\0' | xargs -0 eslint --fix",
|
||||
"lint:shellcheck": "./development/shellcheck.sh",
|
||||
|
@ -55,7 +55,7 @@ export default class ConnectSites extends Component {
|
||||
this.clearSitePendingDisconnect()
|
||||
}
|
||||
|
||||
renderConnectedSites () {
|
||||
renderConnectedSitesList () {
|
||||
return (
|
||||
<ConnectedSitesList
|
||||
connectedDomains={this.props.connectedDomains}
|
||||
@ -64,50 +64,71 @@ export default class ConnectSites extends Component {
|
||||
)
|
||||
}
|
||||
|
||||
render () {
|
||||
const { accountLabel, closePopover, connectedDomains, legacyExposeAccount, tabToConnect } = this.props
|
||||
renderConnectedSitesPopover () {
|
||||
|
||||
const {
|
||||
accountLabel,
|
||||
closePopover,
|
||||
connectedDomains,
|
||||
legacyExposeAccount,
|
||||
tabToConnect,
|
||||
} = this.props
|
||||
const { t } = this.context
|
||||
|
||||
return (
|
||||
<Popover
|
||||
title={t('connectedSites')}
|
||||
subtitle={connectedDomains.length
|
||||
? t('connectedSitesDescription', [accountLabel])
|
||||
: t('connectedSitesEmptyDescription', [accountLabel])
|
||||
}
|
||||
onClose={closePopover}
|
||||
footer={
|
||||
tabToConnect
|
||||
? (
|
||||
<a onClick={legacyExposeAccount}>{ t('connectManually') }</a>
|
||||
)
|
||||
: null
|
||||
}
|
||||
footerClassName="connected-sites__add-site-manually"
|
||||
>
|
||||
{this.renderConnectedSitesList()}
|
||||
</Popover>
|
||||
)
|
||||
}
|
||||
|
||||
renderDisconnectSitePopover () {
|
||||
|
||||
const { closePopover } = this.props
|
||||
const { t } = this.context
|
||||
const { sitePendingDisconnect } = this.state
|
||||
|
||||
return (
|
||||
<Popover
|
||||
title={t('disconnectSite', [sitePendingDisconnect.domainName])}
|
||||
subtitle={t('disconnectSiteConfirmationDescription')}
|
||||
onClose={closePopover}
|
||||
footer={(
|
||||
<>
|
||||
<Button type="secondary" onClick={this.clearSitePendingDisconnect}>
|
||||
{ t('cancel') }
|
||||
</Button>
|
||||
<Button type="primary" onClick={this.disconnect}>
|
||||
{ t('disconnect') }
|
||||
</Button>
|
||||
</>
|
||||
)}
|
||||
footerClassName="connected-sites__confirmation"
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
render () {
|
||||
const { sitePendingDisconnect } = this.state
|
||||
return (
|
||||
sitePendingDisconnect
|
||||
? (
|
||||
<Popover
|
||||
title={t('disconnectSite', [sitePendingDisconnect.domainName])}
|
||||
subtitle={t('disconnectSiteConfirmationDescription')}
|
||||
onClose={closePopover}
|
||||
footer={(
|
||||
<>
|
||||
<Button type="secondary" onClick={this.clearSitePendingDisconnect}>
|
||||
{ t('cancel') }
|
||||
</Button>
|
||||
<Button type="primary" onClick={this.disconnect}>
|
||||
{ t('disconnect') }
|
||||
</Button>
|
||||
</>
|
||||
)}
|
||||
footerClassName="connected-sites__confirmation"
|
||||
/>
|
||||
)
|
||||
: (
|
||||
<Popover
|
||||
title={t('connectedSites')}
|
||||
subtitle={connectedDomains.length
|
||||
? t('connectedSitesDescription', [accountLabel])
|
||||
: t('connectedSitesEmptyDescription', [accountLabel])
|
||||
}
|
||||
onClose={closePopover}
|
||||
footer={
|
||||
tabToConnect
|
||||
? (
|
||||
<a onClick={legacyExposeAccount}>{ t('connectManually') }</a>
|
||||
)
|
||||
: null
|
||||
}
|
||||
footerClassName="connected-sites__add-site-manually"
|
||||
>
|
||||
{this.renderConnectedSites()}
|
||||
</Popover>
|
||||
)
|
||||
? this.renderDisconnectSitePopover()
|
||||
: this.renderConnectedSitesPopover()
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,10 @@
|
||||
import { connect } from 'react-redux'
|
||||
import ConnectedSites from './connected-sites.component'
|
||||
import { getOpenMetamaskTabsIds, legacyExposeAccounts, removePermissionsFor } from '../../store/actions'
|
||||
import {
|
||||
getOpenMetamaskTabsIds,
|
||||
legacyExposeAccounts,
|
||||
removePermissionsFor,
|
||||
} from '../../store/actions'
|
||||
import {
|
||||
getConnectedDomainsForSelectedAddress,
|
||||
getCurrentAccountWithSendEtherInfo,
|
||||
|
Loading…
Reference in New Issue
Block a user