mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-01 21:57:06 +01:00
95c37e1ba3
* feat: add yaml feature management Add yaml feature file per build type. Also add method to parse yaml and set enabled features env to true. The build process will then replace any process.env[feature] that exists on the config by its value * chore: add example for desktop * Added initial draft of build features * [TMP] Sync between computers * Is able to succesfully build stable extension with snaps feature * Removing var context from builds.yml * Add asssets to builds.yml * Minor bug fixes and removing debug logs * [WIP] Test changes * Removed TODOs * Fix regession bug Also * remove debug logs * merge Variables.set and Variables.setMany with an overload * Fix build, lint and a bunch of issues * Update LavaMoat policies * Re-add desktop build type * Fix some tests * Fix desktop build * Define some env variables used by MV3 * Fix lint * Fix remove-fenced-code tests * Fix README typo * Move new code * Fix missing asset copy * Move Jest env setup * Fix path for test after rebase * Fix code fences * Fix fencing and LavaMoat policies * Fix MMI code-fencing after rebase * Fix MMI code fencing after merge * Fix more MMI code fencing --------- Co-authored-by: cryptotavares <joao.tavares@consensys.net> Co-authored-by: Frederik Bolding <frederik.bolding@gmail.com> Co-authored-by: Brad Decker <bhdecker84@gmail.com>
250 lines
7.5 KiB
JavaScript
250 lines
7.5 KiB
JavaScript
import React, { PureComponent } from 'react';
|
|
import PropTypes from 'prop-types';
|
|
|
|
import Button from '../../../components/ui/button';
|
|
import { Tag } from '../../../components/component-library';
|
|
|
|
import {
|
|
SUPPORT_REQUEST_LINK,
|
|
///: BEGIN:ONLY_INCLUDE_IN(build-mmi)
|
|
MMI_WEB_SITE,
|
|
///: END:ONLY_INCLUDE_IN
|
|
} from '../../../helpers/constants/common';
|
|
import { isBeta } from '../../../helpers/utils/build-types';
|
|
import {
|
|
getNumberOfSettingsInSection,
|
|
handleSettingsRefs,
|
|
} from '../../../helpers/utils/settings-search';
|
|
import {
|
|
MetaMetricsContextProp,
|
|
MetaMetricsEventCategory,
|
|
MetaMetricsEventName,
|
|
} from '../../../../shared/constants/metametrics';
|
|
import { SUPPORT_LINK } from '../../../../shared/lib/ui-utils';
|
|
|
|
export default class InfoTab extends PureComponent {
|
|
state = {
|
|
version: global.platform.getVersion(),
|
|
};
|
|
|
|
static contextTypes = {
|
|
t: PropTypes.func,
|
|
trackEvent: PropTypes.func,
|
|
};
|
|
|
|
settingsRefs = Array(
|
|
getNumberOfSettingsInSection(this.context.t, this.context.t('about')),
|
|
)
|
|
.fill(undefined)
|
|
.map(() => {
|
|
return React.createRef();
|
|
});
|
|
|
|
componentDidUpdate() {
|
|
const { t } = this.context;
|
|
handleSettingsRefs(t, t('about'), this.settingsRefs);
|
|
}
|
|
|
|
componentDidMount() {
|
|
const { t } = this.context;
|
|
handleSettingsRefs(t, t('about'), this.settingsRefs);
|
|
}
|
|
|
|
renderInfoLinks() {
|
|
const { t } = this.context;
|
|
let privacyUrl, siteUrl;
|
|
|
|
///: BEGIN:ONLY_INCLUDE_IN(build-mmi)
|
|
privacyUrl = 'https://consensys.net/codefi/about/privacy-policy/';
|
|
siteUrl = MMI_WEB_SITE;
|
|
///: END:ONLY_INCLUDE_IN
|
|
|
|
///: BEGIN:ONLY_INCLUDE_IN(build-main,build-beta,build-flask)
|
|
privacyUrl = 'https://metamask.io/privacy.html';
|
|
siteUrl = 'https://metamask.io/';
|
|
///: END:ONLY_INCLUDE_IN
|
|
|
|
return (
|
|
<div className="settings-page__content-item settings-page__content-item--without-height">
|
|
<div ref={this.settingsRefs[1]} className="info-tab__link-header">
|
|
{t('links')}
|
|
</div>
|
|
<div ref={this.settingsRefs[2]} className="info-tab__link-item">
|
|
<Button
|
|
type="link"
|
|
href={privacyUrl}
|
|
target="_blank"
|
|
rel="noopener noreferrer"
|
|
className="info-tab__link-text"
|
|
>
|
|
{t('privacyMsg')}
|
|
</Button>
|
|
</div>
|
|
<div ref={this.settingsRefs[3]} className="info-tab__link-item">
|
|
<Button
|
|
type="link"
|
|
href="https://metamask.io/terms.html"
|
|
target="_blank"
|
|
rel="noopener noreferrer"
|
|
className="info-tab__link-text"
|
|
>
|
|
{t('terms')}
|
|
</Button>
|
|
</div>
|
|
{isBeta() ? (
|
|
<div ref={this.settingsRefs[8]} className="info-tab__link-item">
|
|
<Button
|
|
type="link"
|
|
href="https://metamask.io/beta-terms.html"
|
|
target="_blank"
|
|
rel="noopener noreferrer"
|
|
className="info-tab__link-text"
|
|
>
|
|
{t('betaTerms')}
|
|
<Tag label={t('new')} className="info-tab__tag" />
|
|
</Button>
|
|
</div>
|
|
) : null}
|
|
<div ref={this.settingsRefs[4]} className="info-tab__link-item">
|
|
<Button
|
|
type="link"
|
|
href="https://metamask.io/attributions.html"
|
|
target="_blank"
|
|
rel="noopener noreferrer"
|
|
className="info-tab__link-text"
|
|
>
|
|
{t('attributions')}
|
|
</Button>
|
|
</div>
|
|
<hr className="info-tab__separator" />
|
|
<div ref={this.settingsRefs[5]} className="info-tab__link-item">
|
|
<Button
|
|
type="link"
|
|
href={SUPPORT_LINK}
|
|
target="_blank"
|
|
rel="noopener noreferrer"
|
|
className="info-tab__link-text"
|
|
onClick={() => {
|
|
this.context.trackEvent(
|
|
{
|
|
category: MetaMetricsEventCategory.Settings,
|
|
event: MetaMetricsEventName.SupportLinkClicked,
|
|
properties: {
|
|
url: SUPPORT_LINK,
|
|
},
|
|
},
|
|
{
|
|
contextPropsIntoEventProperties: [
|
|
MetaMetricsContextProp.PageTitle,
|
|
],
|
|
},
|
|
);
|
|
}}
|
|
>
|
|
{t('supportCenter')}
|
|
</Button>
|
|
</div>
|
|
<div ref={this.settingsRefs[6]} className="info-tab__link-item">
|
|
<Button
|
|
type="link"
|
|
href={siteUrl}
|
|
target="_blank"
|
|
rel="noopener noreferrer"
|
|
className="info-tab__link-text"
|
|
>
|
|
{t('visitWebSite')}
|
|
</Button>
|
|
</div>
|
|
<div ref={this.settingsRefs[7]} className="info-tab__link-item">
|
|
<Button
|
|
type="link"
|
|
href={SUPPORT_REQUEST_LINK}
|
|
target="_blank"
|
|
rel="noopener noreferrer"
|
|
className="info-tab__link-text"
|
|
onClick={() => {
|
|
this.context.trackEvent(
|
|
{
|
|
category: MetaMetricsEventCategory.Settings,
|
|
event: MetaMetricsEventName.SupportLinkClicked,
|
|
properties: {
|
|
url: SUPPORT_REQUEST_LINK,
|
|
},
|
|
},
|
|
{
|
|
contextPropsIntoEventProperties: [
|
|
MetaMetricsContextProp.PageTitle,
|
|
],
|
|
},
|
|
);
|
|
}}
|
|
>
|
|
{t('contactUs')}
|
|
</Button>
|
|
</div>
|
|
</div>
|
|
);
|
|
}
|
|
|
|
render() {
|
|
const { t } = this.context;
|
|
|
|
return (
|
|
<div className="settings-page__body">
|
|
<div className="settings-page__content-row">
|
|
<div className="settings-page__content-item settings-page__content-item--without-height">
|
|
{
|
|
///: BEGIN:ONLY_INCLUDE_IN(build-mmi)
|
|
<div className="info-tab__logo-wrapper">
|
|
<img
|
|
src="images/info-logo.png"
|
|
className="info-tab__logo"
|
|
alt=""
|
|
/>
|
|
</div>
|
|
///: END:ONLY_INCLUDE_IN
|
|
}
|
|
<div className="info-tab__item">
|
|
<div
|
|
ref={this.settingsRefs[0]}
|
|
className="info-tab__version-header"
|
|
>
|
|
{isBeta() ? t('betaMetamaskVersion') : t('metamaskVersion')}
|
|
</div>
|
|
<div className="info-tab__version-number">
|
|
{this.state.version}
|
|
</div>
|
|
</div>
|
|
<div className="info-tab__item">
|
|
<div className="info-tab__about">
|
|
{
|
|
///: BEGIN:ONLY_INCLUDE_IN(build-main,build-beta,build-flask)
|
|
t('builtAroundTheWorld')
|
|
///: END:ONLY_INCLUDE_IN
|
|
}
|
|
{
|
|
///: BEGIN:ONLY_INCLUDE_IN(build-mmi)
|
|
t('mmiBuiltAroundTheWorld')
|
|
///: END:ONLY_INCLUDE_IN
|
|
}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
{this.renderInfoLinks()}
|
|
</div>
|
|
{
|
|
///: BEGIN:ONLY_INCLUDE_IN(build-main,build-beta,build-flask)
|
|
<div className="info-tab__logo-wrapper">
|
|
<img
|
|
src="./images/logo/metamask-fox.svg"
|
|
className="info-tab__logo"
|
|
alt="MetaMask Logo"
|
|
/>
|
|
</div>
|
|
///: END:ONLY_INCLUDE_IN
|
|
}
|
|
</div>
|
|
);
|
|
}
|
|
}
|