Fix dappIcon & Fix Signer Pending (#7338)

* Move signerPending inside this repo

* Use latest version of dappIcon

* Tell babel to ignore node_modules in tests
This commit is contained in:
Amaury Martiny 2017-12-19 17:54:09 +01:00 committed by Jaco Greeff
parent 6bc88664ce
commit 3fa7d09b5e
7 changed files with 144 additions and 53 deletions

90
js/package-lock.json generated
View File

@ -1127,6 +1127,54 @@
"u2f-api-polyfill": "0.4.3" "u2f-api-polyfill": "0.4.3"
} }
}, },
"@parity/mobx": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/@parity/mobx/-/mobx-1.0.3.tgz",
"integrity": "sha512-pVzsYjnVM1BN04kT0kcGyPQ8XvEQwz5xtFrEfnR06ezah5M4Vz3xpkLsc7oRjkMpdO6QoEZ1RU9hCSNDoPA0Ww==",
"requires": {
"@parity/ledger": "2.1.2",
"babel-preset-env": "1.6.1"
},
"dependencies": {
"babel-preset-env": {
"version": "1.6.1",
"resolved": "https://registry.npmjs.org/babel-preset-env/-/babel-preset-env-1.6.1.tgz",
"integrity": "sha512-W6VIyA6Ch9ePMI7VptNn2wBM6dbG0eSz25HEiL40nQXCsXGTGZSTZu1Iap+cj3Q0S5a7T9+529l/5Bkvd+afNA==",
"requires": {
"babel-plugin-check-es2015-constants": "6.22.0",
"babel-plugin-syntax-trailing-function-commas": "6.22.0",
"babel-plugin-transform-async-to-generator": "6.24.1",
"babel-plugin-transform-es2015-arrow-functions": "6.22.0",
"babel-plugin-transform-es2015-block-scoped-functions": "6.22.0",
"babel-plugin-transform-es2015-block-scoping": "6.26.0",
"babel-plugin-transform-es2015-classes": "6.24.1",
"babel-plugin-transform-es2015-computed-properties": "6.24.1",
"babel-plugin-transform-es2015-destructuring": "6.23.0",
"babel-plugin-transform-es2015-duplicate-keys": "6.24.1",
"babel-plugin-transform-es2015-for-of": "6.23.0",
"babel-plugin-transform-es2015-function-name": "6.24.1",
"babel-plugin-transform-es2015-literals": "6.22.0",
"babel-plugin-transform-es2015-modules-amd": "6.24.1",
"babel-plugin-transform-es2015-modules-commonjs": "6.24.1",
"babel-plugin-transform-es2015-modules-systemjs": "6.24.1",
"babel-plugin-transform-es2015-modules-umd": "6.24.1",
"babel-plugin-transform-es2015-object-super": "6.24.1",
"babel-plugin-transform-es2015-parameters": "6.24.1",
"babel-plugin-transform-es2015-shorthand-properties": "6.24.1",
"babel-plugin-transform-es2015-spread": "6.22.0",
"babel-plugin-transform-es2015-sticky-regex": "6.24.1",
"babel-plugin-transform-es2015-template-literals": "6.22.0",
"babel-plugin-transform-es2015-typeof-symbol": "6.23.0",
"babel-plugin-transform-es2015-unicode-regex": "6.24.1",
"babel-plugin-transform-exponentiation-operator": "6.24.1",
"babel-plugin-transform-regenerator": "6.26.0",
"browserslist": "2.10.0",
"invariant": "2.2.2",
"semver": "5.4.1"
}
}
}
},
"@parity/plugin-signer-account": { "@parity/plugin-signer-account": {
"version": "github:paritytech/plugin-signer-account#e151e3ca4e0d51aec93219df3661212cc15aa4cc" "version": "github:paritytech/plugin-signer-account#e151e3ca4e0d51aec93219df3661212cc15aa4cc"
}, },
@ -1198,12 +1246,13 @@
} }
}, },
"@parity/ui": { "@parity/ui": {
"version": "3.0.17", "version": "3.0.20",
"resolved": "https://registry.npmjs.org/@parity/ui/-/ui-3.0.17.tgz", "resolved": "https://registry.npmjs.org/@parity/ui/-/ui-3.0.20.tgz",
"integrity": "sha512-X3F8CmgL6qWaCKQg5AD69n8kidoZyhQpkYdbK6rBeUqNErkKKAOH/SJXsl2TdCsjlghsErl7wYRFWGEt2S86Xg==", "integrity": "sha512-YAbuHCQOVO/eJGH53Dm8cO3NnMBpJCu+JSRrDAEzSGQ8+pHyEbepxFWzwVVERhd6KDC3dUbuDTwa2CwpYFDUJw==",
"requires": { "requires": {
"@parity/api": "2.1.14", "@parity/api": "2.1.14",
"@parity/etherscan": "2.1.3", "@parity/etherscan": "2.1.3",
"@parity/mobx": "1.0.3",
"@parity/shared": "2.2.14", "@parity/shared": "2.2.14",
"babel-runtime": "6.26.0", "babel-runtime": "6.26.0",
"bignumber.js": "4.1.0", "bignumber.js": "4.1.0",
@ -1842,7 +1891,6 @@
"version": "6.24.1", "version": "6.24.1",
"resolved": "https://registry.npmjs.org/babel-helper-builder-binary-assignment-operator-visitor/-/babel-helper-builder-binary-assignment-operator-visitor-6.24.1.tgz", "resolved": "https://registry.npmjs.org/babel-helper-builder-binary-assignment-operator-visitor/-/babel-helper-builder-binary-assignment-operator-visitor-6.24.1.tgz",
"integrity": "sha1-zORReto1b0IgvK6KAsKzRvmlZmQ=", "integrity": "sha1-zORReto1b0IgvK6KAsKzRvmlZmQ=",
"dev": true,
"requires": { "requires": {
"babel-helper-explode-assignable-expression": "6.24.1", "babel-helper-explode-assignable-expression": "6.24.1",
"babel-runtime": "6.26.0", "babel-runtime": "6.26.0",
@ -1886,7 +1934,6 @@
"version": "6.24.1", "version": "6.24.1",
"resolved": "https://registry.npmjs.org/babel-helper-explode-assignable-expression/-/babel-helper-explode-assignable-expression-6.24.1.tgz", "resolved": "https://registry.npmjs.org/babel-helper-explode-assignable-expression/-/babel-helper-explode-assignable-expression-6.24.1.tgz",
"integrity": "sha1-8luCz33BBDPFX3BZLVdGQArCLKo=", "integrity": "sha1-8luCz33BBDPFX3BZLVdGQArCLKo=",
"dev": true,
"requires": { "requires": {
"babel-runtime": "6.26.0", "babel-runtime": "6.26.0",
"babel-traverse": "6.26.0", "babel-traverse": "6.26.0",
@ -1958,7 +2005,6 @@
"version": "6.24.1", "version": "6.24.1",
"resolved": "https://registry.npmjs.org/babel-helper-remap-async-to-generator/-/babel-helper-remap-async-to-generator-6.24.1.tgz", "resolved": "https://registry.npmjs.org/babel-helper-remap-async-to-generator/-/babel-helper-remap-async-to-generator-6.24.1.tgz",
"integrity": "sha1-XsWBgnrXI/7N04HxySg5BnbkVRs=", "integrity": "sha1-XsWBgnrXI/7N04HxySg5BnbkVRs=",
"dev": true,
"requires": { "requires": {
"babel-helper-function-name": "6.24.1", "babel-helper-function-name": "6.24.1",
"babel-runtime": "6.26.0", "babel-runtime": "6.26.0",
@ -2080,8 +2126,7 @@
"babel-plugin-syntax-async-functions": { "babel-plugin-syntax-async-functions": {
"version": "6.13.0", "version": "6.13.0",
"resolved": "https://registry.npmjs.org/babel-plugin-syntax-async-functions/-/babel-plugin-syntax-async-functions-6.13.0.tgz", "resolved": "https://registry.npmjs.org/babel-plugin-syntax-async-functions/-/babel-plugin-syntax-async-functions-6.13.0.tgz",
"integrity": "sha1-ytnK0RkbWtY0vzCuCHI5HgZHvpU=", "integrity": "sha1-ytnK0RkbWtY0vzCuCHI5HgZHvpU="
"dev": true
}, },
"babel-plugin-syntax-async-generators": { "babel-plugin-syntax-async-generators": {
"version": "6.13.0", "version": "6.13.0",
@ -2122,8 +2167,7 @@
"babel-plugin-syntax-exponentiation-operator": { "babel-plugin-syntax-exponentiation-operator": {
"version": "6.13.0", "version": "6.13.0",
"resolved": "https://registry.npmjs.org/babel-plugin-syntax-exponentiation-operator/-/babel-plugin-syntax-exponentiation-operator-6.13.0.tgz", "resolved": "https://registry.npmjs.org/babel-plugin-syntax-exponentiation-operator/-/babel-plugin-syntax-exponentiation-operator-6.13.0.tgz",
"integrity": "sha1-nufoM3KQ2pUoggGmpX9BcDF4MN4=", "integrity": "sha1-nufoM3KQ2pUoggGmpX9BcDF4MN4="
"dev": true
}, },
"babel-plugin-syntax-export-extensions": { "babel-plugin-syntax-export-extensions": {
"version": "6.13.0", "version": "6.13.0",
@ -2158,8 +2202,7 @@
"babel-plugin-syntax-trailing-function-commas": { "babel-plugin-syntax-trailing-function-commas": {
"version": "6.22.0", "version": "6.22.0",
"resolved": "https://registry.npmjs.org/babel-plugin-syntax-trailing-function-commas/-/babel-plugin-syntax-trailing-function-commas-6.22.0.tgz", "resolved": "https://registry.npmjs.org/babel-plugin-syntax-trailing-function-commas/-/babel-plugin-syntax-trailing-function-commas-6.22.0.tgz",
"integrity": "sha1-ugNgk3+NBuQBgKQ/4NVhb/9TLPM=", "integrity": "sha1-ugNgk3+NBuQBgKQ/4NVhb/9TLPM="
"dev": true
}, },
"babel-plugin-transform-async-generator-functions": { "babel-plugin-transform-async-generator-functions": {
"version": "6.24.1", "version": "6.24.1",
@ -2176,7 +2219,6 @@
"version": "6.24.1", "version": "6.24.1",
"resolved": "https://registry.npmjs.org/babel-plugin-transform-async-to-generator/-/babel-plugin-transform-async-to-generator-6.24.1.tgz", "resolved": "https://registry.npmjs.org/babel-plugin-transform-async-to-generator/-/babel-plugin-transform-async-to-generator-6.24.1.tgz",
"integrity": "sha1-ZTbjeK/2yx1VF6wOQOs+n8jQh2E=", "integrity": "sha1-ZTbjeK/2yx1VF6wOQOs+n8jQh2E=",
"dev": true,
"requires": { "requires": {
"babel-helper-remap-async-to-generator": "6.24.1", "babel-helper-remap-async-to-generator": "6.24.1",
"babel-plugin-syntax-async-functions": "6.13.0", "babel-plugin-syntax-async-functions": "6.13.0",
@ -2469,7 +2511,6 @@
"version": "6.24.1", "version": "6.24.1",
"resolved": "https://registry.npmjs.org/babel-plugin-transform-exponentiation-operator/-/babel-plugin-transform-exponentiation-operator-6.24.1.tgz", "resolved": "https://registry.npmjs.org/babel-plugin-transform-exponentiation-operator/-/babel-plugin-transform-exponentiation-operator-6.24.1.tgz",
"integrity": "sha1-KrDJx/MJj6SJB3cruBP+QejeOg4=", "integrity": "sha1-KrDJx/MJj6SJB3cruBP+QejeOg4=",
"dev": true,
"requires": { "requires": {
"babel-helper-builder-binary-assignment-operator-visitor": "6.24.1", "babel-helper-builder-binary-assignment-operator-visitor": "6.24.1",
"babel-plugin-syntax-exponentiation-operator": "6.13.0", "babel-plugin-syntax-exponentiation-operator": "6.13.0",
@ -2646,9 +2687,9 @@
} }
}, },
"babel-preset-env": { "babel-preset-env": {
"version": "1.6.0", "version": "1.6.1",
"resolved": "https://registry.npmjs.org/babel-preset-env/-/babel-preset-env-1.6.0.tgz", "resolved": "https://registry.npmjs.org/babel-preset-env/-/babel-preset-env-1.6.1.tgz",
"integrity": "sha512-OVgtQRuOZKckrILgMA5rvctvFZPv72Gua9Rt006AiPoB0DJKGN07UmaQA+qRrYgK71MVct8fFhT0EyNWYorVew==", "integrity": "sha512-W6VIyA6Ch9ePMI7VptNn2wBM6dbG0eSz25HEiL40nQXCsXGTGZSTZu1Iap+cj3Q0S5a7T9+529l/5Bkvd+afNA==",
"dev": true, "dev": true,
"requires": { "requires": {
"babel-plugin-check-es2015-constants": "6.22.0", "babel-plugin-check-es2015-constants": "6.22.0",
@ -3310,7 +3351,6 @@
"version": "2.10.0", "version": "2.10.0",
"resolved": "https://registry.npmjs.org/browserslist/-/browserslist-2.10.0.tgz", "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-2.10.0.tgz",
"integrity": "sha512-WyvzSLsuAVPOjbljXnyeWl14Ae+ukAT8MUuagKVzIDvwBxl4UAwD1xqtyQs2eWYPGUKMeC3Ol62goqYuKqTTcw==", "integrity": "sha512-WyvzSLsuAVPOjbljXnyeWl14Ae+ukAT8MUuagKVzIDvwBxl4UAwD1xqtyQs2eWYPGUKMeC3Ol62goqYuKqTTcw==",
"dev": true,
"requires": { "requires": {
"caniuse-lite": "1.0.30000780", "caniuse-lite": "1.0.30000780",
"electron-to-chromium": "1.3.28" "electron-to-chromium": "1.3.28"
@ -3455,8 +3495,7 @@
"caniuse-lite": { "caniuse-lite": {
"version": "1.0.30000780", "version": "1.0.30000780",
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30000780.tgz", "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30000780.tgz",
"integrity": "sha1-H5CV8u/UlA4LpsWZKreptkzDW6Q=", "integrity": "sha1-H5CV8u/UlA4LpsWZKreptkzDW6Q="
"dev": true
}, },
"capture-stack-trace": { "capture-stack-trace": {
"version": "1.0.0", "version": "1.0.0",
@ -5625,8 +5664,7 @@
"electron-to-chromium": { "electron-to-chromium": {
"version": "1.3.28", "version": "1.3.28",
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.28.tgz", "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.28.tgz",
"integrity": "sha1-jdTmRYCGZE6fnwoc8y4qH53/2e4=", "integrity": "sha1-jdTmRYCGZE6fnwoc8y4qH53/2e4="
"dev": true
}, },
"element-resize-detector": { "element-resize-detector": {
"version": "1.1.12", "version": "1.1.12",
@ -10178,6 +10216,9 @@
"verror": "1.10.0" "verror": "1.10.0"
} }
}, },
"jsqr": {
"version": "git+https://github.com/cozmo/jsQR.git#397a6eb8f90752cf640cb4bb67ba6f86e3bb5d1f"
},
"jsx-ast-utils": { "jsx-ast-utils": {
"version": "1.4.1", "version": "1.4.1",
"resolved": "https://registry.npmjs.org/jsx-ast-utils/-/jsx-ast-utils-1.4.1.tgz", "resolved": "https://registry.npmjs.org/jsx-ast-utils/-/jsx-ast-utils-1.4.1.tgz",
@ -14140,11 +14181,6 @@
"jsqr": "git+https://github.com/cozmo/jsQR.git#397a6eb8f90752cf640cb4bb67ba6f86e3bb5d1f", "jsqr": "git+https://github.com/cozmo/jsQR.git#397a6eb8f90752cf640cb4bb67ba6f86e3bb5d1f",
"prop-types": "15.5.10", "prop-types": "15.5.10",
"webrtc-adapter": "5.0.6" "webrtc-adapter": "5.0.6"
},
"dependencies": {
"jsqr": {
"version": "git+https://github.com/cozmo/jsQR.git#397a6eb8f90752cf640cb4bb67ba6f86e3bb5d1f"
}
} }
}, },
"react-redux": { "react-redux": {

View File

@ -68,7 +68,7 @@
"babel-plugin-transform-runtime": "6.23.0", "babel-plugin-transform-runtime": "6.23.0",
"babel-plugin-webpack-alias": "2.1.2", "babel-plugin-webpack-alias": "2.1.2",
"babel-polyfill": "6.26.0", "babel-polyfill": "6.26.0",
"babel-preset-env": "1.6.0", "babel-preset-env": "1.6.1",
"babel-preset-react": "6.24.1", "babel-preset-react": "6.24.1",
"babel-preset-stage-0": "6.24.1", "babel-preset-stage-0": "6.24.1",
"babel-register": "6.26.0", "babel-register": "6.26.0",
@ -146,7 +146,7 @@
"@parity/plugin-signer-hardware": "paritytech/plugin-signer-hardware", "@parity/plugin-signer-hardware": "paritytech/plugin-signer-hardware",
"@parity/plugin-signer-qr": "paritytech/plugin-signer-qr", "@parity/plugin-signer-qr": "paritytech/plugin-signer-qr",
"@parity/shared": "2.2.14", "@parity/shared": "2.2.14",
"@parity/ui": "^3.0.17", "@parity/ui": "3.0.20",
"keythereum": "1.0.2", "keythereum": "1.0.2",
"lodash.flatten": "4.4.0", "lodash.flatten": "4.4.0",
"lodash.omitby": "4.6.0", "lodash.omitby": "4.6.0",

View File

@ -47,14 +47,8 @@
} }
.image { .image {
box-shadow: 0 0 8px 0 rgba(0, 0, 0, 0.15);
border-radius: 0.125em;
display: block;
width: 2em;
height: 2em;
margin-left: auto; margin-left: auto;
margin-right: auto; margin-right: auto;
padding: 0.125em;
} }
} }
} }

View File

@ -0,0 +1,17 @@
// Copyright 2015-2017 Parity Technologies (UK) Ltd.
// This file is part of Parity.
// Parity is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// Parity is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
export default from './signerPending';

View File

@ -0,0 +1,52 @@
// Copyright 2015-2017 Parity Technologies (UK) Ltd.
// This file is part of Parity.
// Parity is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// Parity is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
import React from 'react';
import PropTypes from 'prop-types';
import { observer } from 'mobx-react';
import Badge from '@parity/ui/lib/Badge';
import Store from '../../Signer/pendingStore';
function SignerPending ({ className, onClick }, { api }) {
const store = Store.get(api);
const pendingCount = store.pending.length;
if (!pendingCount) {
return null;
}
return (
<Badge
color='red'
className={ className }
onClick={ onClick }
value={ pendingCount }
/>
);
}
SignerPending.contextTypes = {
api: PropTypes.object.isRequired
};
SignerPending.propTypes = {
className: PropTypes.string,
onClick: PropTypes.func
};
export default observer(SignerPending);

View File

@ -30,11 +30,11 @@ import ContainerTitle from '@parity/ui/lib/Container/Title';
import IdentityIcon from '@parity/ui/lib/IdentityIcon'; import IdentityIcon from '@parity/ui/lib/IdentityIcon';
import GradientBg from '@parity/ui/lib/GradientBg'; import GradientBg from '@parity/ui/lib/GradientBg';
import SelectionList from '@parity/ui/lib/SelectionList'; import SelectionList from '@parity/ui/lib/SelectionList';
import SignerPending from '@parity/ui/lib/SignerPending';
import { CancelIcon } from '@parity/ui/lib/Icons'; import { CancelIcon } from '@parity/ui/lib/Icons';
import DappsStore from '@parity/shared/lib/mobx/dappsStore'; import DappsStore from '@parity/shared/lib/mobx/dappsStore';
import Signer from '../Signer/Embedded'; import Signer from '../Signer/Embedded';
import SignerPending from './SignerPending';
import AccountStore from './accountStore'; import AccountStore from './accountStore';
import Store, { DISPLAY_ACCOUNTS, DISPLAY_SIGNER } from './store'; import Store, { DISPLAY_ACCOUNTS, DISPLAY_SIGNER } from './store';
@ -151,8 +151,8 @@ class ParityBar extends Component {
const { moving, position } = this.state; const { moving, position } = this.state;
const containerClassNames = this.store.isOpen const containerClassNames = this.store.isOpen
? [ styles.overlay ] ? [styles.overlay]
: [ styles.bar ]; : [styles.bar];
if (!this.store.isOpen && moving) { if (!this.store.isOpen && moving) {
containerClassNames.push(styles.moving); containerClassNames.push(styles.moving);
@ -255,13 +255,13 @@ class ParityBar extends Component {
label={ this.renderSignerLabel() } label={ this.renderSignerLabel() }
onClick={ this.toggleSignerDisplay } onClick={ this.toggleSignerDisplay }
/> />
{ this.renderDrag() } {this.renderDrag()}
</GradientBg> </GradientBg>
); );
} }
renderDrag () { renderDrag () {
const dragButtonClasses = [ styles.dragButton ]; const dragButtonClasses = [styles.dragButton];
if (this.state.moving) { if (this.state.moving) {
dragButtonClasses.push(styles.moving); dragButtonClasses.push(styles.moving);
@ -286,7 +286,7 @@ class ParityBar extends Component {
if (!externalLink) { if (!externalLink) {
return ( return (
<Link to='/'> <Link to='/'>
{ button } {button}
</Link> </Link>
); );
} }
@ -296,7 +296,7 @@ class ParityBar extends Component {
href={ externalLink } href={ externalLink }
target='_parent' target='_parent'
> >
{ button } {button}
</a> </a>
); );
} }
@ -380,9 +380,9 @@ class ParityBar extends Component {
return ( return (
<div className={ styles.label }> <div className={ styles.label }>
<div className={ styles.labelText }> <div className={ styles.labelText }>
{ name } {name}
</div> </div>
{ bubble } {bubble}
</div> </div>
); );
} }

View File

@ -14,13 +14,5 @@
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with Parity. If not, see <http://www.gnu.org/licenses/>. // along with Parity. If not, see <http://www.gnu.org/licenses/>.
require('babel-register')({ require('babel-register')();
ignore: function (filename) {
if (filename.indexOf('node_modules') !== -1) {
return filename.indexOf('@parity') === -1;
}
return false;
}
});
require('babel-polyfill'); require('babel-polyfill');