import React, { PureComponent } from 'react'
import PropTypes from 'prop-types'
import { exportAsFile } from '../../../helpers/utils/util'
import ToggleButton from '../../../components/ui/toggle-button'
import { REVEAL_SEED_ROUTE } from '../../../helpers/constants/routes'
import Button from '../../../components/ui/button'
export default class SecurityTab extends PureComponent {
static contextTypes = {
t: PropTypes.func,
metricsEvent: PropTypes.func,
}
static propTypes = {
setPrivacyMode: PropTypes.func,
privacyMode: PropTypes.bool,
displayWarning: PropTypes.func,
revealSeedConfirmation: PropTypes.func,
showClearApprovalModal: PropTypes.func,
warning: PropTypes.string,
history: PropTypes.object,
mobileSync: PropTypes.bool,
participateInMetaMetrics: PropTypes.bool,
setParticipateInMetaMetrics: PropTypes.func,
}
renderStateLogs () {
const { t } = this.context
const { displayWarning } = this.props
return (
{ t('stateLogs') }
{ t('stateLogsDescription') }
)
}
renderClearApproval () {
const { t } = this.context
const { showClearApprovalModal } = this.props
return (
{ t('approvalData') }
{ t('approvalDataDescription') }
)
}
renderSeedWords () {
const { t } = this.context
const { history } = this.props
return (
{ t('revealSeedWords') }
)
}
renderPrivacyOptIn () {
const { t } = this.context
const { privacyMode, setPrivacyMode } = this.props
return (
{ t('privacyMode') }
{ t('privacyModeDescription') }
setPrivacyMode(!value)}
offLabel={t('off')}
onLabel={t('on')}
/>
)
}
renderMetaMetricsOptIn () {
const { t } = this.context
const { participateInMetaMetrics, setParticipateInMetaMetrics } = this.props
return (
{ t('participateInMetaMetrics') }
{ t('participateInMetaMetricsDescription') }
setParticipateInMetaMetrics(!value)}
offLabel={t('off')}
onLabel={t('on')}
/>
)
}
renderContent () {
const { warning } = this.props
return (
{ warning &&
{ warning }
}
{ this.renderPrivacyOptIn() }
{ this.renderClearApproval() }
{ this.renderSeedWords() }
{ this.renderMetaMetricsOptIn() }
)
}
render () {
return this.renderContent()
}
}