import PropTypes from 'prop-types'; import React, { PureComponent } from 'react'; import PermissionsConnectHeader from '../../permissions-connect-header'; import Tooltip from '../../../ui/tooltip'; import CheckBox from '../../../ui/check-box'; export default class PermissionPageContainerContent extends PureComponent { static propTypes = { domainMetadata: PropTypes.shape({ extensionId: PropTypes.string, icon: PropTypes.string, host: PropTypes.string.isRequired, name: PropTypes.string.isRequired, origin: PropTypes.string.isRequired, }), selectedPermissions: PropTypes.object.isRequired, onPermissionToggle: PropTypes.func.isRequired, selectedIdentities: PropTypes.array, allIdentitiesSelected: PropTypes.bool, }; static defaultProps = { selectedIdentities: [], allIdentitiesSelected: false, }; static contextTypes = { t: PropTypes.func, }; renderRequestedPermissions() { const { selectedPermissions, onPermissionToggle } = this.props; const { t } = this.context; const items = Object.keys(selectedPermissions).map((permissionName) => { const description = t(permissionName); // don't allow deselecting eth_accounts const isDisabled = permissionName === 'eth_accounts'; const isChecked = Boolean(selectedPermissions[permissionName]); const title = isChecked ? t('permissionCheckedIconDescription') : t('permissionUncheckedIconDescription'); return (