Refactor: Use global donation mapping instead of hardcoding donation address in footer

This commit is contained in:
Daniel Ternyak 2017-06-23 20:27:17 -05:00
parent 943a0532d7
commit 07bde87658
2 changed files with 359 additions and 251 deletions

View File

@ -1,100 +1,202 @@
import React, {Component} from 'react';
import translate, {getTranslators} from 'translations';
import React, { Component } from 'react';
import translate, { getTranslators } from 'translations';
import { DONATION_ADDRESSES_MAP } from 'config/data';
export default class Footer extends Component {
render() {
const translators = getTranslators()
return (
<footer role="contentinfo" aria-label="footer">
<div className="container">
<section className="row">
<section className="row">
<div className="col-sm-3 footer-1">
<p aria-hidden="true">
<a href="/">
{/* TODO - don't hardcode image path*/}
<img src={'https://www.myetherwallet.com/images/logo-myetherwallet.svg'}
height="55px" width="auto" alt="Ether Wallet"/>
</a>
</p>
<p><span>{translate('FOOTER_1')}</span>
<span>{translate('FOOTER_1b')}</span>
<a aria-label="kvhnuke's github"
href="https://github.com/kvhnuke"
target="_blank">kvhnuke</a>
{' & '}
<a aria-label="tayvano's github"
href="https://github.com/tayvano"
target="_blank">tayvano</a>.
</p>
<br/>
</div>
<div className="col-sm-6 footer-2">
<h5><i aria-hidden="true">💝</i>{translate('FOOTER_2')}</h5>
<ul>
<li> ETH: <span
className="mono wrap">0x7cB57B5A97eAbe94205C07890BE4c1aD31E486A8</span>
</li>
<li> BTC: <span className="mono wrap">1MEWT2SGbqtz6mPCgFcnea8XmWV5Z4Wc6</span></li>
</ul>
render() {
const translators = getTranslators();
return (
<footer role="contentinfo" aria-label="footer">
<div className="container">
<section className="row">
<section className="row">
<div className="col-sm-3 footer-1">
<p aria-hidden="true">
<a href="/">
{/* TODO - don't hardcode image path*/}
<img
src={
'https://www.myetherwallet.com/images/logo-myetherwallet.svg'
}
height="55px"
width="auto"
alt="Ether Wallet"
/>
</a>
</p>
<p>
<span>{translate('FOOTER_1')}</span>
<span>{translate('FOOTER_1b')}</span>
<a
aria-label="kvhnuke's github"
href="https://github.com/kvhnuke"
target="_blank"
>
kvhnuke
</a>
{' & '}
<a
aria-label="tayvano's github"
href="https://github.com/tayvano"
target="_blank"
>
tayvano
</a>.
</p>
<br />
</div>
<div className="col-sm-6 footer-2">
<h5><i aria-hidden="true">💝</i>{translate('FOOTER_2')}</h5>
<ul>
<li>
{' '}ETH:{' '}
<span className="mono wrap">
{DONATION_ADDRESSES_MAP.ETH}
</span>
</li>
<li>
{' '}BTC:{' '}
<span className="mono wrap">
{DONATION_ADDRESSES_MAP.BTC}
</span>
</li>
</ul>
<h5><i aria-hidden="true">👫</i>{translate('ADD_Warning_1')}</h5>
<p>Consider using our affiliate links to...</p>
<ul>
<li><a aria-label="Swap Ether or Bitcoin via Bity.com"
href="https://bity.com/af/jshkb37v" target="_blank">Swap ETH/BTC/EUR/CHF via
Bity.com</a></li>
<li><a href="https://www.ledgerwallet.com/r/fa4b?path=/products/" target="_blank">Buy
a
Ledger Nano S</a></li>
<li><a href="https://trezor.io/?a=myetherwallet.com" target="_blank">Buy a
TREZOR</a>
</li>
</ul>
<h5>
<i aria-hidden="true">👫</i>{translate('ADD_Warning_1')}
</h5>
<p>Consider using our affiliate links to...</p>
<ul>
<li>
<a
aria-label="Swap Ether or Bitcoin via Bity.com"
href="https://bity.com/af/jshkb37v"
target="_blank"
>
Swap ETH/BTC/EUR/CHF via
Bity.com
</a>
</li>
<li>
<a
href="https://www.ledgerwallet.com/r/fa4b?path=/products/"
target="_blank"
>
Buy
a
Ledger Nano S
</a>
</li>
<li>
<a
href="https://trezor.io/?a=myetherwallet.com"
target="_blank"
>
Buy a
TREZOR
</a>
</li>
</ul>
{!!translators.length &&
<h5> <i>🏅</i> <span>{translate('Translator_Desc')}</span></h5>
}
{!!translators.length &&
<ul>
<li>{translators.map(key => <span key={key}>{translate(key)}</span>)}</li>
</ul>
}
</div>
<div className="col-sm-3 footer-3">
<h5><i aria-hidden="true">🌎</i> On the Web</h5>
<ul>
<li><a aria-label="my ether wallet.com" href="https://www.MyEtherWallet.com"
target="_blank">www.MyEtherWallet.com</a></li>
<li><a aria-label="my ether wallet github"
href="https://github.com/kvhnuke/etherwallet"
target="_blank">Github: MyEtherWallet.com & CX</a></li>
<li><a aria-label="our organization on github"
href="https://github.com/MyEtherWallet"
target="_blank">Github: MyEtherWallet (Org)</a></li>
<li><a aria-label="join our slack" href="https://myetherwallet.herokuapp.com/"
target="_blank">Join Our Slack</a></li>
<li><a aria-label="twitter" href="https://twitter.com/myetherwallet"
target="_blank">Twitter</a>
</li>
<li><a aria-label="facebook" href="https://www.facebook.com/MyEtherWallet/"
target="_blank">Facebook</a></li>
</ul>
{!!translators.length &&
<h5>
{' '}<i>🏅</i> <span>{translate('Translator_Desc')}</span>
</h5>}
{!!translators.length &&
<ul>
<li>
{translators.map(key =>
<span key={key}>{translate(key)}</span>
)}
</li>
</ul>}
</div>
<div className="col-sm-3 footer-3">
<h5><i aria-hidden="true">🌎</i> On the Web</h5>
<ul>
<li>
<a
aria-label="my ether wallet.com"
href="https://www.MyEtherWallet.com"
target="_blank"
>
www.MyEtherWallet.com
</a>
</li>
<li>
<a
aria-label="my ether wallet github"
href="https://github.com/kvhnuke/etherwallet"
target="_blank"
>
Github: MyEtherWallet.com & CX
</a>
</li>
<li>
<a
aria-label="our organization on github"
href="https://github.com/MyEtherWallet"
target="_blank"
>
Github: MyEtherWallet (Org)
</a>
</li>
<li>
<a
aria-label="join our slack"
href="https://myetherwallet.herokuapp.com/"
target="_blank"
>
Join Our Slack
</a>
</li>
<li>
<a
aria-label="twitter"
href="https://twitter.com/myetherwallet"
target="_blank"
>
Twitter
</a>
</li>
<li>
<a
aria-label="facebook"
href="https://www.facebook.com/MyEtherWallet/"
target="_blank"
>
Facebook
</a>
</li>
</ul>
<h5><i aria-hidden="true">🙏</i> Support</h5>
<ul>
<li><a aria-label="email support at myetherwallet.com"
href="mailto:support@myetherwallet.com" target="_blank">Email</a></li>
<li><a aria-label="open a github issue"
href="https://github.com/kvhnuke/etherwallet/issues" target="_blank">Github
Issue</a></li>
</ul>
</div>
</section>
</section>
</div>
</footer>
)
}
<h5><i aria-hidden="true">🙏</i> Support</h5>
<ul>
<li>
<a
aria-label="email support at myetherwallet.com"
href="mailto:support@myetherwallet.com"
target="_blank"
>
Email
</a>
</li>
<li>
<a
aria-label="open a github issue"
href="https://github.com/kvhnuke/etherwallet/issues"
target="_blank"
>
Github
Issue
</a>
</li>
</ul>
</div>
</section>
</section>
</div>
</footer>
);
}
}

View File

@ -1,162 +1,168 @@
export const DONATION_ADDRESSES_MAP = {
BTC: '1MEWT2SGbqtz6mPCgFcnea8XmWV5Z4Wc6',
ETH: '0x7cB57B5A97eAbe94205C07890BE4c1aD31E486A8',
REP: '0x7cB57B5A97eAbe94205C07890BE4c1aD31E486A8'
};
export const languages = [
{
sign: 'en',
name: 'English'
},
{
sign: 'de',
name: 'Deutsch'
},
{
sign: 'el',
name: 'Ελληνικά'
},
{
sign: 'es',
name: 'Español'
},
{
sign: 'fi',
name: 'Suomi'
},
{
sign: 'fr',
name: 'Français'
},
{
sign: 'hu',
name: 'Magyar'
},
{
sign: 'id',
name: 'Indonesian'
},
{
sign: 'it',
name: 'Italiano'
},
{
sign: 'ja',
name: '日本語'
},
{
sign: 'nl',
name: 'Nederlands'
},
{
sign: 'no',
name: 'Norsk Bokmål'
},
{
sign: 'pl',
name: 'Polski'
},
{
sign: 'pt',
name: 'Português'
},
{
sign: 'ru',
name: 'Русский'
},
{
sign: 'ko',
name: 'Korean'
},
// {
// 'sign': 'sk',
// 'name': 'Slovenčina'
// },
// {
// 'sign': 'sl',
// 'name': 'Slovenščina'
// },
// {
// 'sign': 'sv',
// 'name': 'Svenska'
// },
{
sign: 'tr',
name: 'Türkçe'
},
{
sign: 'vi',
name: 'Tiếng Việt'
},
{
sign: 'zhcn',
name: '简体中文'
},
{
sign: 'zhtw',
name: '繁體中文'
}
{
sign: 'en',
name: 'English'
},
{
sign: 'de',
name: 'Deutsch'
},
{
sign: 'el',
name: 'Ελληνικά'
},
{
sign: 'es',
name: 'Español'
},
{
sign: 'fi',
name: 'Suomi'
},
{
sign: 'fr',
name: 'Français'
},
{
sign: 'hu',
name: 'Magyar'
},
{
sign: 'id',
name: 'Indonesian'
},
{
sign: 'it',
name: 'Italiano'
},
{
sign: 'ja',
name: '日本語'
},
{
sign: 'nl',
name: 'Nederlands'
},
{
sign: 'no',
name: 'Norsk Bokmål'
},
{
sign: 'pl',
name: 'Polski'
},
{
sign: 'pt',
name: 'Português'
},
{
sign: 'ru',
name: 'Русский'
},
{
sign: 'ko',
name: 'Korean'
},
// {
// 'sign': 'sk',
// 'name': 'Slovenčina'
// },
// {
// 'sign': 'sl',
// 'name': 'Slovenščina'
// },
// {
// 'sign': 'sv',
// 'name': 'Svenska'
// },
{
sign: 'tr',
name: 'Türkçe'
},
{
sign: 'vi',
name: 'Tiếng Việt'
},
{
sign: 'zhcn',
name: '简体中文'
},
{
sign: 'zhtw',
name: '繁體中文'
}
];
export const nodeList = [
{
name: 'ETH',
blockExplorerTX: 'https://etherscan.io/tx/[[txHash]]',
blockExplorerAddr: 'https://etherscan.io/address/[[address]]',
// 'type': nodes.nodeTypes.ETH,
eip155: true,
chainId: 1,
// 'tokenList': require('./tokens/ethTokens.json'),
// 'abiList': require('./abiDefinitions/ethAbi.json'),
estimateGas: true,
service: 'MyEtherWallet'
// 'lib': new nodes.customNode('https://api.myetherapi.com/eth', '')
},
{
name: 'ETH',
blockExplorerTX: 'https://etherscan.io/tx/[[txHash]]',
blockExplorerAddr: 'https://etherscan.io/address/[[address]]',
// 'type': nodes.nodeTypes.ETH,
eip155: true,
chainId: 1,
// 'tokenList': require('./tokens/ethTokens.json'),
// 'abiList': require('./abiDefinitions/ethAbi.json'),
estimateGas: false,
service: 'Etherscan.io'
// 'lib': require('./nodeHelpers/etherscan')
},
{
name: 'Ropsten',
// 'type': nodes.nodeTypes.Ropsten,
blockExplorerTX: 'https://ropsten.etherscan.io/tx/[[txHash]]',
blockExplorerAddr: 'https://ropsten.etherscan.io/address/[[address]]',
eip155: true,
chainId: 3,
// 'tokenList': require('./tokens/ropstenTokens.json'),
// 'abiList': require('./abiDefinitions/ropstenAbi.json'),
estimateGas: false,
service: 'MyEtherWallet'
// 'lib': new nodes.customNode('https://api.myetherapi.com/rop', '')
},
{
name: 'Kovan',
// 'type': nodes.nodeTypes.Kovan,
blockExplorerTX: 'https://kovan.etherscan.io/tx/[[txHash]]',
blockExplorerAddr: 'https://kovan.etherscan.io/address/[[address]]',
eip155: true,
chainId: 42,
// 'tokenList': require('./tokens/kovanTokens.json'),
// 'abiList': require('./abiDefinitions/kovanAbi.json'),
estimateGas: false,
service: 'Etherscan.io'
// 'lib': require('./nodeHelpers/etherscanKov')
},
{
name: 'ETC',
blockExplorerTX: 'https://gastracker.io/tx/[[txHash]]',
blockExplorerAddr: 'https://gastracker.io/addr/[[address]]',
// 'type': nodes.nodeTypes.ETC,
eip155: true,
chainId: 61,
// 'tokenList': require('./tokens/etcTokens.json'),
// 'abiList': require('./abiDefinitions/etcAbi.json'),
estimateGas: false,
service: 'Epool.io'
// 'lib': new nodes.customNode('https://mewapi.epool.io', '')
}
{
name: 'ETH',
blockExplorerTX: 'https://etherscan.io/tx/[[txHash]]',
blockExplorerAddr: 'https://etherscan.io/address/[[address]]',
// 'type': nodes.nodeTypes.ETH,
eip155: true,
chainId: 1,
// 'tokenList': require('./tokens/ethTokens.json'),
// 'abiList': require('./abiDefinitions/ethAbi.json'),
estimateGas: true,
service: 'MyEtherWallet'
// 'lib': new nodes.customNode('https://api.myetherapi.com/eth', '')
},
{
name: 'ETH',
blockExplorerTX: 'https://etherscan.io/tx/[[txHash]]',
blockExplorerAddr: 'https://etherscan.io/address/[[address]]',
// 'type': nodes.nodeTypes.ETH,
eip155: true,
chainId: 1,
// 'tokenList': require('./tokens/ethTokens.json'),
// 'abiList': require('./abiDefinitions/ethAbi.json'),
estimateGas: false,
service: 'Etherscan.io'
// 'lib': require('./nodeHelpers/etherscan')
},
{
name: 'Ropsten',
// 'type': nodes.nodeTypes.Ropsten,
blockExplorerTX: 'https://ropsten.etherscan.io/tx/[[txHash]]',
blockExplorerAddr: 'https://ropsten.etherscan.io/address/[[address]]',
eip155: true,
chainId: 3,
// 'tokenList': require('./tokens/ropstenTokens.json'),
// 'abiList': require('./abiDefinitions/ropstenAbi.json'),
estimateGas: false,
service: 'MyEtherWallet'
// 'lib': new nodes.customNode('https://api.myetherapi.com/rop', '')
},
{
name: 'Kovan',
// 'type': nodes.nodeTypes.Kovan,
blockExplorerTX: 'https://kovan.etherscan.io/tx/[[txHash]]',
blockExplorerAddr: 'https://kovan.etherscan.io/address/[[address]]',
eip155: true,
chainId: 42,
// 'tokenList': require('./tokens/kovanTokens.json'),
// 'abiList': require('./abiDefinitions/kovanAbi.json'),
estimateGas: false,
service: 'Etherscan.io'
// 'lib': require('./nodeHelpers/etherscanKov')
},
{
name: 'ETC',
blockExplorerTX: 'https://gastracker.io/tx/[[txHash]]',
blockExplorerAddr: 'https://gastracker.io/addr/[[address]]',
// 'type': nodes.nodeTypes.ETC,
eip155: true,
chainId: 61,
// 'tokenList': require('./tokens/etcTokens.json'),
// 'abiList': require('./abiDefinitions/etcAbi.json'),
estimateGas: false,
service: 'Epool.io'
// 'lib': new nodes.customNode('https://mewapi.epool.io', '')
}
];