Unverified Commit c3a86f5f authored by Amaury Martiny's avatar Amaury Martiny Committed by GitHub
Browse files

Merge pull request #113 from parity-js/am-feedback

Feedback on copy
parents c3b7755d e0bf89c3
......@@ -39,6 +39,7 @@
"@parity/light.js": "https://github.com/parity-js/light.js#9646ce15d9dd9c4cf11776ddd613d5bd86016f94",
"@parity/shared": "^3.0.2",
"bignumber.js": "^4.1.0",
"debug": "^3.1.0",
"fether-ui": "^0.1.0",
"is-electron": "^2.1.0",
"light-hoc": "^0.1.0",
......
......@@ -17,9 +17,9 @@ import Accounts from '../Accounts';
import Onboarding from '../Onboarding';
import Overlay from '../Overlay';
import Send from '../Send';
import Settings from '../Settings';
import { STATUS } from '../stores/healthStore';
import Tokens from '../Tokens';
import Whitelist from '../Whitelist';
// Use MemoryRouter for production viewing in file:// protocol
// https://github.com/facebook/create-react-app/issues/3591
......@@ -67,7 +67,7 @@ class App extends Component {
<Route path='/accounts' component={Accounts} />
<Route path='/onboarding' component={Onboarding} />
<Route path='/send' component={Send} />
<Route path='/settings' component={Settings} />
<Route path='/whitelist' component={Whitelist} />
<Route path='/tokens' component={Tokens} />
<Redirect from='*' to='/' />
</Switch>
......
......@@ -17,8 +17,8 @@ import TokensList from './TokensList';
defaultAccount: defaultAccount$
})
class Tokens extends PureComponent {
handleGoToSettings = () => {
this.props.history.push('/settings');
handleGoToWhitelist = () => {
this.props.history.push('/whitelist');
};
render () {
......@@ -64,8 +64,8 @@ class Tokens extends PureComponent {
<Health />
</div>
<div className='footer-nav_icons'>
<button className='button -tiny' onClick={this.handleGoToSettings}>
Add token
<button className='button -tiny' onClick={this.handleGoToWhitelist}>
Add tokens
</button>
</div>
</nav>
......
......@@ -6,22 +6,18 @@
import React, { Component } from 'react';
import { inject, observer } from 'mobx-react';
import { TokenCard } from 'fether-ui';
import { withRouter } from 'react-router-dom';
@inject('tokensStore')
@observer
@withRouter
class NewTokenItem extends Component {
handleAddToken = () => {
const { token, tokensStore } = this.props;
tokensStore.addToken(token.address, token);
this.forceUpdate(); // TODO: I assume this is not the preferred way to do this!
};
handleRemoveToken = () => {
const { token, tokensStore } = this.props;
tokensStore.removeToken(token.address);
this.forceUpdate();
};
render () {
......
......@@ -19,7 +19,7 @@ import NewTokenItem from './NewTokenItem';
})
@inject('tokensStore')
@observer
class Settings extends Component {
class Whitelist extends Component {
state = {
db: null,
dbMap: null,
......@@ -106,7 +106,7 @@ class Settings extends Component {
Close
</Link>
}
title={<h1>Token whitelist</h1>}
title={<h1>My tokens</h1>}
/>
<div className='window_content'>
......@@ -146,4 +146,4 @@ class Settings extends Component {
}
}
export default Settings;
export default Whitelist;
......@@ -3,6 +3,6 @@
//
// SPDX-License-Identifier: BSD-3-Clause
import Settings from './Settings';
import Whitelist from './Whitelist';
export default Settings;
export default Whitelist;
......@@ -11,6 +11,11 @@ import App from './App';
import rootStore from './stores';
import './index.css';
// Show debug logs in dev environment
if (process.env.NODE_ENV === 'development') {
window.localStorage.debug = 'fether*'; // https://github.com/visionmedia/debug#browser-support
}
ReactDOM.render(
<Provider {...rootStore}>
<App />
......
......@@ -118,7 +118,6 @@ class HealthStore {
}
const message = details[0];
console.log(message); // TODO WIP, to catch potential other messages
if (
message ===
......
......@@ -11,9 +11,11 @@ import memoize from 'lodash/memoize';
import noop from 'lodash/noop';
import { toWei } from '@parity/api/lib/util/wei';
import Debug from '../utils/debug';
import parityStore from './parityStore';
import tokensStore from './tokensStore';
const debug = Debug('sendStore');
const DEFAULT_GAS = new BigNumber(21000); // Default gas amount to show
const GAS_MULT_FACTOR = 1.33; // Since estimateGas is not always accurate, we add a 33% factor for buffer.
......@@ -109,6 +111,11 @@ class SendStore {
this.txForErc20.options
);
debug(
'Sending tx.',
this.tokenAddress === 'ETH' ? this.txForEth : this.txForErc20
);
return new Promise((resolve, reject) => {
send$.subscribe(txStatus => {
// When we arrive to the `requested` stage, we accept the request
......@@ -118,6 +125,7 @@ class SendStore {
.catch(reject);
}
this.setTxStatus(txStatus);
debug('Tx status updated.', txStatus);
});
});
};
......
// Copyright 2015-2018 Parity Technologies (UK) Ltd.
// This file is part of Parity.
//
// SPDX-License-Identifier: BSD-3-Clause
import debug from 'debug';
import { name } from '../../package.json';
const Debug = namespace => debug(`${name}:${namespace}`);
export default Debug;
......@@ -32,10 +32,8 @@
"start": "yarn build --watch"
},
"dependencies": {
"rc-tooltip": "^3.7.2",
"react-blockies": "^1.3.0",
"react-content-loader": "^3.1.2",
"react-copy-to-clipboard": "^5.0.1",
"react-tooltip": "^3.6.1"
},
"devDependencies": {
......
......@@ -5,27 +5,18 @@
import React from 'react';
import Blockies from 'react-blockies';
import { CopyToClipboard } from 'react-copy-to-clipboard';
import PropTypes from 'prop-types';
import ReactTooltip from 'react-tooltip';
import ClickToCopy from '../ClickToCopy';
import Header from '../Header';
const NormalContainer = ({ children }) => (
<h1 className='account'>{children}</h1>
);
const CopyContainer = ({ address, children, ...otherProps }) => (
<CopyToClipboard text={address}>
<a className='account' data-tip='Copy address'>
{children}
<ReactTooltip
effect='solid'
event='mouseover'
eventOff='mouseout click'
place='bottom'
/>
</a>
</CopyToClipboard>
<ClickToCopy label='Copy address' textToCopy={address} {...otherProps}>
<a className='account'>{children}</a>
</ClickToCopy>
);
const AccountHeader = ({ address, copyAddress, name, ...otherProps }) => {
......
// Copyright 2015-2018 Parity Technologies (UK) Ltd.
// This file is part of Parity.
//
// SPDX-License-Identifier: BSD-3-Clause
import React, { PureComponent } from 'react';
import PropTypes from 'prop-types';
import ReactTooltip from 'react-tooltip';
class ClickToCopy extends PureComponent {
static defaultProps = {
label: 'Click to copy'
};
static propTypes = {
children: PropTypes.node,
label: PropTypes.string.isRequired
};
state = {
copied: false
};
componentWillUnmount () {
window.clearTimeout(this.timeout);
}
handleCopy = () => {
// https://hackernoon.com/copying-text-to-clipboard-with-javascript-df4d4988697f
// Note react-copy-to-clipboard created a bug, https://github.com/nkbt/react-copy-to-clipboard/issues/92
const el = document.createElement('textarea');
el.value = this.props.textToCopy;
document.body.appendChild(el);
el.select();
document.execCommand('copy');
document.body.removeChild(el);
this.setState({ copied: true });
// Show the copied state only for 1s
if (this.timeout) {
window.clearTimeout(this.timeout);
}
this.timeout = window.setTimeout(
() => this.setState({ copied: false }),
1000
);
};
handleResetCopied = () => {};
render () {
const { children, label, ...otherProps } = this.props;
const { copied } = this.state;
return (
<div data-tip='' onClick={this.handleCopy}>
{children}
<ReactTooltip
effect='solid'
event='mouseover'
eventOff='mouseout'
place='bottom'
getContent={[() => (copied ? 'Copied.' : label), 50]}
{...otherProps}
/>
</div>
);
}
}
export default ClickToCopy;
// Copyright 2015-2018 Parity Technologies (UK) Ltd.
// This file is part of Parity.
//
// SPDX-License-Identifier: BSD-3-Clause
import ClickToCopy from './ClickToCopy';
export default ClickToCopy;
......@@ -1224,12 +1224,6 @@ acorn@^5.0.0, acorn@^5.5.0, acorn@^5.6.2:
version "5.7.1"
resolved "https://registry.yarnpkg.com/acorn/-/acorn-5.7.1.tgz#f095829297706a7c9776958c0afc8930a9b9d9d8"
add-dom-event-listener@1.x:
version "1.0.2"
resolved "https://registry.yarnpkg.com/add-dom-event-listener/-/add-dom-event-listener-1.0.2.tgz#8faed2c41008721cf111da1d30d995b85be42bed"
dependencies:
object-assign "4.x"
add-stream@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/add-stream/-/add-stream-1.0.0.tgz#6a7990437ca736d5e1288db92bd3266d5f5cb2aa"
......@@ -2367,7 +2361,7 @@ babel-register@^6.26.0, babel-register@^6.9.0:
mkdirp "^0.5.1"
source-map-support "^0.4.15"
babel-runtime@6.26.0, babel-runtime@6.x, babel-runtime@^6.18.0, babel-runtime@^6.2.0, babel-runtime@^6.22.0, babel-runtime@^6.26.0:
babel-runtime@6.26.0, babel-runtime@^6.18.0, babel-runtime@^6.2.0, babel-runtime@^6.22.0, babel-runtime@^6.26.0:
version "6.26.0"
resolved "https://registry.yarnpkg.com/babel-runtime/-/babel-runtime-6.26.0.tgz#965c7058668e82b55d7bfe04ff2337bc8b5647fe"
dependencies:
......@@ -3014,7 +3008,7 @@ class-utils@^0.3.5:
isobject "^3.0.0"
static-extend "^0.1.1"
classnames@^2.2.5, classnames@^2.2.6:
classnames@^2.2.5:
version "2.2.6"
resolved "https://registry.yarnpkg.com/classnames/-/classnames-2.2.6.tgz#43935bffdd291f326dad0a205309b38d00f650ce"
......@@ -3257,20 +3251,10 @@ compare-versions@^3.1.0:
version "3.3.0"
resolved "https://registry.yarnpkg.com/compare-versions/-/compare-versions-3.3.0.tgz#af93ea705a96943f622ab309578b9b90586f39c3"
component-classes@^1.2.5:
version "1.2.6"
resolved "https://registry.yarnpkg.com/component-classes/-/component-classes-1.2.6.tgz#c642394c3618a4d8b0b8919efccbbd930e5cd691"
dependencies:
component-indexof "0.0.3"
component-emitter@^1.2.1:
version "1.2.1"
resolved "https://registry.yarnpkg.com/component-emitter/-/component-emitter-1.2.1.tgz#137918d6d78283f7df7a6b7c5a63e140e69425e6"
component-indexof@0.0.3:
version "0.0.3"
resolved "https://registry.yarnpkg.com/component-indexof/-/component-indexof-0.0.3.tgz#11d091312239eb8f32c8f25ae9cb002ffe8d3c24"
compressible@~2.0.13:
version "2.0.14"
resolved "https://registry.yarnpkg.com/compressible/-/compressible-2.0.14.tgz#326c5f507fbb055f54116782b969a81b67a29da7"
......@@ -3524,12 +3508,6 @@ copy-descriptor@^0.1.0:
version "0.1.1"
resolved "https://registry.yarnpkg.com/copy-descriptor/-/copy-descriptor-0.1.1.tgz#676f6eb3c39997c2ee1ac3a924fd6124748f578d"
copy-to-clipboard@^3:
version "3.0.8"
resolved "https://registry.yarnpkg.com/copy-to-clipboard/-/copy-to-clipboard-3.0.8.tgz#f4e82f4a8830dce4666b7eb8ded0c9bcc313aba9"
dependencies:
toggle-selection "^1.0.3"
copyfiles@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/copyfiles/-/copyfiles-2.0.0.tgz#bbd78bb78e8fd6db5c67adf54249317b24560f2a"
......@@ -3667,13 +3645,6 @@ crypto-random-string@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/crypto-random-string/-/crypto-random-string-1.0.0.tgz#a230f64f568310e1498009940790ec99545bca7e"
css-animation@^1.3.2:
version "1.4.1"
resolved "https://registry.yarnpkg.com/css-animation/-/css-animation-1.4.1.tgz#5b8813125de0fbbbb0bbe1b472ae84221469b7a8"
dependencies:
babel-runtime "6.x"
component-classes "^1.2.5"
css-color-names@0.0.4:
version "0.0.4"
resolved "https://registry.yarnpkg.com/css-color-names/-/css-color-names-0.0.4.tgz#808adc2e79cf84738069b646cb20ec27beb629e0"
......@@ -4139,10 +4110,6 @@ doctrine@^2.0.0, doctrine@^2.0.2, doctrine@^2.1.0:
dependencies:
esutils "^2.0.2"
dom-align@^1.7.0:
version "1.8.0"
resolved "https://registry.yarnpkg.com/dom-align/-/dom-align-1.8.0.tgz#c0e89b5b674c6e836cd248c52c2992135f093654"
dom-converter@~0.1:
version "0.1.4"
resolved "https://registry.yarnpkg.com/dom-converter/-/dom-converter-0.1.4.tgz#a45ef5727b890c9bffe6d7c876e7b19cb0e17f3b"
......@@ -7535,10 +7502,6 @@ lodash-es@^4.2.1:
version "4.17.10"
resolved "https://registry.yarnpkg.com/lodash-es/-/lodash-es-4.17.10.tgz#62cd7104cdf5dd87f235a837f0ede0e8e5117e05"
lodash._getnative@^3.0.0:
version "3.9.1"
resolved "https://registry.yarnpkg.com/lodash._getnative/-/lodash._getnative-3.9.1.tgz#570bc7dede46d61cdcde687d65d3eecbaa3aaff5"
lodash._reinterpolate@~3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/lodash._reinterpolate/-/lodash._reinterpolate-3.0.0.tgz#0ccf2d89166af03b3663c796538b75ac6e114d9d"
......@@ -7567,22 +7530,6 @@ lodash.defaults@^4.2.0:
version "4.2.0"
resolved "https://registry.yarnpkg.com/lodash.defaults/-/lodash.defaults-4.2.0.tgz#d09178716ffea4dde9e5fb7b37f6f0802274580c"
lodash.isarguments@^3.0.0:
version "3.1.0"
resolved "https://registry.yarnpkg.com/lodash.isarguments/-/lodash.isarguments-3.1.0.tgz#2f573d85c6a24289ff00663b491c1d338ff3458a"
lodash.isarray@^3.0.0:
version "3.0.4"
resolved "https://registry.yarnpkg.com/lodash.isarray/-/lodash.isarray-3.0.4.tgz#79e4eb88c36a8122af86f844aa9bcd851b5fbb55"
lodash.keys@^3.1.2:
version "3.1.2"
resolved "https://registry.yarnpkg.com/lodash.keys/-/lodash.keys-3.1.2.tgz#4dbc0472b156be50a0b286855d1bd0b0c656098a"
dependencies:
lodash._getnative "^3.0.0"
lodash.isarguments "^3.0.0"
lodash.isarray "^3.0.0"
lodash.memoize@^4.1.2:
version "4.1.2"
resolved "https://registry.yarnpkg.com/lodash.memoize/-/lodash.memoize-4.1.2.tgz#bcc6c49a42a2840ed997f323eada5ecd182e0bfe"
......@@ -8414,7 +8361,7 @@ oauth-sign@~0.8.1, oauth-sign@~0.8.2:
version "0.8.2"
resolved "https://registry.yarnpkg.com/oauth-sign/-/oauth-sign-0.8.2.tgz#46a6ab7f0aead8deae9ec0565780b7d4efeb9d43"
object-assign@4.1.1, object-assign@4.x, object-assign@^4.0.1, object-assign@^4.1.0, object-assign@^4.1.1:
object-assign@4.1.1, object-assign@^4.0.1, object-assign@^4.1.0, object-assign@^4.1.1:
version "4.1.1"
resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863"
......@@ -9351,7 +9298,7 @@ promise@^7.1.1:
dependencies:
asap "~2.0.3"
prop-types@15.x, prop-types@^15.5.10, prop-types@^15.5.8, prop-types@^15.6.0, prop-types@^15.6.1:
prop-types@^15.5.10, prop-types@^15.6.0, prop-types@^15.6.1:
version "15.6.2"
resolved "https://registry.yarnpkg.com/prop-types/-/prop-types-15.6.2.tgz#05d5ca77b4453e985d60fc7ff8c859094a497102"
dependencies:
......@@ -9532,51 +9479,6 @@ raw-body@2.3.2:
iconv-lite "0.4.19"
unpipe "1.0.0"
rc-align@^2.4.0:
version "2.4.3"
resolved "https://registry.yarnpkg.com/rc-align/-/rc-align-2.4.3.tgz#b9b3c2a6d68adae71a8e1d041cd5e3b2a655f99a"
dependencies:
babel-runtime "^6.26.0"
dom-align "^1.7.0"
prop-types "^15.5.8"
rc-util "^4.0.4"
rc-animate@2.x:
version "2.4.4"
resolved "https://registry.yarnpkg.com/rc-animate/-/rc-animate-2.4.4.tgz#a05a784c747beef140d99ff52b6117711bef4b1e"
dependencies:
babel-runtime "6.x"
css-animation "^1.3.2"
prop-types "15.x"
rc-tooltip@^3.7.2:
version "3.7.2"
resolved "https://registry.yarnpkg.com/rc-tooltip/-/rc-tooltip-3.7.2.tgz#3698656d4bacd51b72d9e327bed15d1d5a9f1b27"
dependencies:
babel-runtime "6.x"
prop-types "^15.5.8"
rc-trigger "^2.2.2"
rc-trigger@^2.2.2:
version "2.5.3"
resolved "https://registry.yarnpkg.com/rc-trigger/-/rc-trigger-2.5.3.tgz#aa3d9a9b20c51d05f6f35d36fa41074f70f6cd64"
dependencies:
babel-runtime "6.x"
classnames "^2.2.6"
prop-types "15.x"
rc-align "^2.4.0"
rc-animate "2.x"
rc-util "^4.4.0"
rc-util@^4.0.4, rc-util@^4.4.0:
version "4.5.1"
resolved "https://registry.yarnpkg.com/rc-util/-/rc-util-4.5.1.tgz#0e435057174c024901c7600ba8903dd03da3ab39"
dependencies:
add-dom-event-listener "1.x"
babel-runtime "6.x"
prop-types "^15.5.10"
shallowequal "^0.2.2"
rc@^1.0.1, rc@^1.1.2, rc@^1.1.6, rc@^1.2.1, rc@^1.2.7:
version "1.2.8"
resolved "https://registry.yarnpkg.com/rc/-/rc-1.2.8.tgz#cd924bf5200a075b83c188cd6b9e211b7fc0d3ed"
......@@ -9603,13 +9505,6 @@ react-content-loader@^3.1.2:
version "3.1.2"
resolved "https://registry.yarnpkg.com/react-content-loader/-/react-content-loader-3.1.2.tgz#98230b4604b4b744eaa2d3fc88917dd988df6766"
react-copy-to-clipboard@^5.0.1:
version "5.0.1"
resolved "https://registry.yarnpkg.com/react-copy-to-clipboard/-/react-copy-to-clipboard-5.0.1.tgz#8eae107bb400be73132ed3b6a7b4fb156090208e"
dependencies:
copy-to-clipboard "^3"
prop-types "^15.5.8"
react-dev-utils@^5.0.1:
version "5.0.1"
resolved "https://registry.yarnpkg.com/react-dev-utils/-/react-dev-utils-5.0.1.tgz#1f396e161fe44b595db1b186a40067289bf06613"
......@@ -10568,12 +10463,6 @@ sha.js@^2.4.0, sha.js@^2.4.8:
inherits "^2.0.1"
safe-buffer "^5.0.1"
shallowequal@^0.2.2:
version "0.2.2"
resolved "https://registry.yarnpkg.com/shallowequal/-/shallowequal-0.2.2.tgz#1e32fd5bcab6ad688a4812cb0cc04efc75c7014e"
dependencies:
lodash.keys "^3.1.2"
shebang-command@^1.2.0:
version "1.2.0"
resolved "https://registry.yarnpkg.com/shebang-command/-/shebang-command-1.2.0.tgz#44aac65b695b03398968c39f363fee5deafdf1ea"
......@@ -11401,10 +11290,6 @@ to-regex@^3.0.1, to-regex@^3.0.2:
regex-not "^1.0.2"
safe-regex "^1.1.0"
toggle-selection@^1.0.3:
version "1.0.6"
resolved "https://registry.yarnpkg.com/toggle-selection/-/toggle-selection-1.0.6.tgz#6e45b1263f2017fa0acc7d89d78b15b8bf77da32"
toposort@^1.0.0:
version "1.0.7"
resolved "https://registry.yarnpkg.com/toposort/-/toposort-1.0.7.tgz#2e68442d9f64ec720b8cc89e6443ac6caa950029"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment