mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-11-22 18:00:18 +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",
|
"ganache:start": "./development/run-ganache",
|
||||||
"sentry:publish": "node ./development/sentry-publish.js",
|
"sentry:publish": "node ./development/sentry-publish.js",
|
||||||
"lint": "eslint . --ext js,json",
|
"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": "{ 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: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",
|
"lint:shellcheck": "./development/shellcheck.sh",
|
||||||
|
@ -55,7 +55,7 @@ export default class ConnectSites extends Component {
|
|||||||
this.clearSitePendingDisconnect()
|
this.clearSitePendingDisconnect()
|
||||||
}
|
}
|
||||||
|
|
||||||
renderConnectedSites () {
|
renderConnectedSitesList () {
|
||||||
return (
|
return (
|
||||||
<ConnectedSitesList
|
<ConnectedSitesList
|
||||||
connectedDomains={this.props.connectedDomains}
|
connectedDomains={this.props.connectedDomains}
|
||||||
@ -64,50 +64,71 @@ export default class ConnectSites extends Component {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
render () {
|
renderConnectedSitesPopover () {
|
||||||
const { accountLabel, closePopover, connectedDomains, legacyExposeAccount, tabToConnect } = this.props
|
|
||||||
|
const {
|
||||||
|
accountLabel,
|
||||||
|
closePopover,
|
||||||
|
connectedDomains,
|
||||||
|
legacyExposeAccount,
|
||||||
|
tabToConnect,
|
||||||
|
} = this.props
|
||||||
const { t } = this.context
|
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
|
const { sitePendingDisconnect } = this.state
|
||||||
return (
|
return (
|
||||||
sitePendingDisconnect
|
sitePendingDisconnect
|
||||||
? (
|
? this.renderDisconnectSitePopover()
|
||||||
<Popover
|
: this.renderConnectedSitesPopover()
|
||||||
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>
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,10 @@
|
|||||||
import { connect } from 'react-redux'
|
import { connect } from 'react-redux'
|
||||||
import ConnectedSites from './connected-sites.component'
|
import ConnectedSites from './connected-sites.component'
|
||||||
import { getOpenMetamaskTabsIds, legacyExposeAccounts, removePermissionsFor } from '../../store/actions'
|
import {
|
||||||
|
getOpenMetamaskTabsIds,
|
||||||
|
legacyExposeAccounts,
|
||||||
|
removePermissionsFor,
|
||||||
|
} from '../../store/actions'
|
||||||
import {
|
import {
|
||||||
getConnectedDomainsForSelectedAddress,
|
getConnectedDomainsForSelectedAddress,
|
||||||
getCurrentAccountWithSendEtherInfo,
|
getCurrentAccountWithSendEtherInfo,
|
||||||
|
Loading…
Reference in New Issue
Block a user