You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
158 lines
4.8 KiB
158 lines
4.8 KiB
4 years ago
|
import React, { PureComponent } from 'react';
|
||
|
import PropTypes from 'prop-types';
|
||
|
import ToggleButton from '../../../components/ui/toggle-button';
|
||
|
import { REVEAL_SEED_ROUTE } from '../../../helpers/constants/routes';
|
||
|
import Button from '../../../components/ui/button';
|
||
6 years ago
|
|
||
|
export default class SecurityTab extends PureComponent {
|
||
|
static contextTypes = {
|
||
|
t: PropTypes.func,
|
||
|
metricsEvent: PropTypes.func,
|
||
4 years ago
|
};
|
||
6 years ago
|
|
||
|
static propTypes = {
|
||
|
warning: PropTypes.string,
|
||
|
history: PropTypes.object,
|
||
5 years ago
|
participateInMetaMetrics: PropTypes.bool.isRequired,
|
||
|
setParticipateInMetaMetrics: PropTypes.func.isRequired,
|
||
|
showIncomingTransactions: PropTypes.bool.isRequired,
|
||
|
setShowIncomingTransactionsFeatureFlag: PropTypes.func.isRequired,
|
||
|
setUsePhishDetect: PropTypes.func.isRequired,
|
||
|
usePhishDetect: PropTypes.bool.isRequired,
|
||
4 years ago
|
};
|
||
6 years ago
|
|
||
4 years ago
|
renderSeedWords() {
|
||
4 years ago
|
const { t } = this.context;
|
||
|
const { history } = this.props;
|
||
6 years ago
|
|
||
|
return (
|
||
|
<div className="settings-page__content-row">
|
||
|
<div className="settings-page__content-item">
|
||
4 years ago
|
<span>{t('revealSeedWords')}</span>
|
||
6 years ago
|
</div>
|
||
|
<div className="settings-page__content-item">
|
||
|
<div className="settings-page__content-item-col">
|
||
|
<Button
|
||
6 years ago
|
type="danger"
|
||
6 years ago
|
large
|
||
5 years ago
|
onClick={(event) => {
|
||
4 years ago
|
event.preventDefault();
|
||
6 years ago
|
this.context.metricsEvent({
|
||
|
eventOpts: {
|
||
|
category: 'Settings',
|
||
|
action: 'Reveal Seed Phrase',
|
||
|
name: 'Reveal Seed Phrase',
|
||
|
},
|
||
4 years ago
|
});
|
||
|
history.push(REVEAL_SEED_ROUTE);
|
||
6 years ago
|
}}
|
||
|
>
|
||
4 years ago
|
{t('revealSeedWords')}
|
||
6 years ago
|
</Button>
|
||
|
</div>
|
||
|
</div>
|
||
|
</div>
|
||
4 years ago
|
);
|
||
6 years ago
|
}
|
||
|
|
||
4 years ago
|
renderMetaMetricsOptIn() {
|
||
4 years ago
|
const { t } = this.context;
|
||
|
const {
|
||
|
participateInMetaMetrics,
|
||
|
setParticipateInMetaMetrics,
|
||
|
} = this.props;
|
||
6 years ago
|
|
||
|
return (
|
||
|
<div className="settings-page__content-row">
|
||
|
<div className="settings-page__content-item">
|
||
4 years ago
|
<span>{t('participateInMetaMetrics')}</span>
|
||
6 years ago
|
<div className="settings-page__content-description">
|
||
4 years ago
|
<span>{t('participateInMetaMetricsDescription')}</span>
|
||
6 years ago
|
</div>
|
||
|
</div>
|
||
|
<div className="settings-page__content-item">
|
||
|
<div className="settings-page__content-item-col">
|
||
|
<ToggleButton
|
||
|
value={participateInMetaMetrics}
|
||
5 years ago
|
onToggle={(value) => setParticipateInMetaMetrics(!value)}
|
||
5 years ago
|
offLabel={t('off')}
|
||
|
onLabel={t('on')}
|
||
6 years ago
|
/>
|
||
|
</div>
|
||
|
</div>
|
||
|
</div>
|
||
4 years ago
|
);
|
||
6 years ago
|
}
|
||
|
|
||
4 years ago
|
renderIncomingTransactionsOptIn() {
|
||
4 years ago
|
const { t } = this.context;
|
||
4 years ago
|
const {
|
||
|
showIncomingTransactions,
|
||
|
setShowIncomingTransactionsFeatureFlag,
|
||
4 years ago
|
} = this.props;
|
||
5 years ago
|
|
||
|
return (
|
||
|
<div className="settings-page__content-row">
|
||
|
<div className="settings-page__content-item">
|
||
4 years ago
|
<span>{t('showIncomingTransactions')}</span>
|
||
5 years ago
|
<div className="settings-page__content-description">
|
||
4 years ago
|
{t('showIncomingTransactionsDescription')}
|
||
5 years ago
|
</div>
|
||
|
</div>
|
||
|
<div className="settings-page__content-item">
|
||
|
<div className="settings-page__content-item-col">
|
||
|
<ToggleButton
|
||
|
value={showIncomingTransactions}
|
||
4 years ago
|
onToggle={(value) =>
|
||
|
setShowIncomingTransactionsFeatureFlag(!value)
|
||
|
}
|
||
5 years ago
|
offLabel={t('off')}
|
||
|
onLabel={t('on')}
|
||
|
/>
|
||
|
</div>
|
||
|
</div>
|
||
|
</div>
|
||
4 years ago
|
);
|
||
5 years ago
|
}
|
||
|
|
||
4 years ago
|
renderPhishingDetectionToggle() {
|
||
4 years ago
|
const { t } = this.context;
|
||
|
const { usePhishDetect, setUsePhishDetect } = this.props;
|
||
5 years ago
|
|
||
|
return (
|
||
|
<div className="settings-page__content-row">
|
||
|
<div className="settings-page__content-item">
|
||
4 years ago
|
<span>{t('usePhishingDetection')}</span>
|
||
5 years ago
|
<div className="settings-page__content-description">
|
||
4 years ago
|
{t('usePhishingDetectionDescription')}
|
||
5 years ago
|
</div>
|
||
|
</div>
|
||
|
<div className="settings-page__content-item">
|
||
|
<div className="settings-page__content-item-col">
|
||
|
<ToggleButton
|
||
|
value={usePhishDetect}
|
||
|
onToggle={(value) => setUsePhishDetect(!value)}
|
||
|
offLabel={t('off')}
|
||
|
onLabel={t('on')}
|
||
|
/>
|
||
|
</div>
|
||
|
</div>
|
||
|
</div>
|
||
4 years ago
|
);
|
||
5 years ago
|
}
|
||
|
|
||
4 years ago
|
render() {
|
||
4 years ago
|
const { warning } = this.props;
|
||
6 years ago
|
|
||
|
return (
|
||
|
<div className="settings-page__body">
|
||
4 years ago
|
{warning && <div className="settings-tab__error">{warning}</div>}
|
||
|
{this.renderSeedWords()}
|
||
|
{this.renderIncomingTransactionsOptIn()}
|
||
|
{this.renderPhishingDetectionToggle()}
|
||
|
{this.renderMetaMetricsOptIn()}
|
||
6 years ago
|
</div>
|
||
4 years ago
|
);
|
||
6 years ago
|
}
|
||
|
}
|