Dependencies bump, fix babel configuration, use connected-react-router instead of react-redux-router

This commit is contained in:
mmv 2019-03-05 17:46:49 +04:00
parent 3e305d3267
commit 5b2fb5f87f
21 changed files with 30034 additions and 177 deletions

View File

@ -7,19 +7,41 @@
{ {
"forceAllTransforms": true "forceAllTransforms": true
} }
], ]
["@babel/preset-stage-0", { "decoratorsLegacy": true }]
], ],
"plugins": [ "plugins": [
"@babel/plugin-syntax-dynamic-import", "@babel/plugin-syntax-dynamic-import",
"transform-es3-member-expression-literals", "@babel/plugin-transform-member-expression-literals",
"transform-es3-property-literals" "@babel/plugin-transform-property-literals",
"@babel/plugin-syntax-import-meta",
"@babel/plugin-proposal-class-properties",
"@babel/plugin-proposal-json-strings",
[
"@babel/plugin-proposal-decorators",
{
"legacy": true
}
],
"@babel/plugin-proposal-function-sent",
"@babel/plugin-proposal-export-namespace-from",
"@babel/plugin-proposal-numeric-separator",
"@babel/plugin-proposal-throw-expressions",
"@babel/plugin-proposal-export-default-from",
"@babel/plugin-proposal-logical-assignment-operators",
"@babel/plugin-proposal-optional-chaining",
[
"@babel/plugin-proposal-pipeline-operator",
{
"proposal": "minimal"
}
],
"@babel/plugin-proposal-nullish-coalescing-operator",
"@babel/plugin-proposal-do-expressions",
"@babel/plugin-proposal-function-bind"
], ],
"env": { "env": {
"test": { "test": {
"plugins": [ "plugins": ["dynamic-import-node"]
"dynamic-import-node"
]
} }
} }
} }

View File

@ -2,13 +2,13 @@ if (typeof Promise === 'undefined') {
// Rejection tracking prevents a common issue where React gets into an // Rejection tracking prevents a common issue where React gets into an
// inconsistent state due to an error, but it gets swallowed by a Promise, // inconsistent state due to an error, but it gets swallowed by a Promise,
// and the user has no idea what causes React's erratic future behavior. // and the user has no idea what causes React's erratic future behavior.
require('promise/lib/rejection-tracking').enable(); require('promise/lib/rejection-tracking').enable()
window.Promise = require('promise/lib/es6-extensions.js'); window.Promise = require('promise/lib/es6-extensions.js')
} }
// fetch() polyfill for making API calls. // fetch() polyfill for making API calls.
require('whatwg-fetch'); require('whatwg-fetch')
// Object.assign() is commonly used with React. // Object.assign() is commonly used with React.
// It will use the native implementation if it's present and isn't buggy. // It will use the native implementation if it's present and isn't buggy.
Object.assign = require('object-assign'); Object.assign = require('object-assign')

View File

@ -1,23 +1,23 @@
/*eslint-disable*/ /*eslint-disable*/
const autoprefixer = require('autoprefixer'); const autoprefixer = require('autoprefixer')
const cssmixins = require('postcss-mixins'); const cssmixins = require('postcss-mixins')
const cssvars = require('postcss-simple-vars'); const cssvars = require('postcss-simple-vars')
const webpack = require('webpack'); const webpack = require('webpack')
const HtmlWebPackPlugin = require("html-webpack-plugin"); const HtmlWebPackPlugin = require('html-webpack-plugin')
const paths = require('./paths'); const paths = require('./paths')
const getClientEnvironment = require('./env'); const getClientEnvironment = require('./env')
const publicPath = '/'; const publicPath = '/'
// `publicUrl` we will provide it to our app // `publicUrl` we will provide it to our app
// as %PUBLIC_URL% in `index.html` and `process.env.PUBLIC_URL` in JavaScript. // as %PUBLIC_URL% in `index.html` and `process.env.PUBLIC_URL` in JavaScript.
// Omit trailing slash as %PUBLIC_PATH%/xyz looks better than %PUBLIC_PATH%xyz. // Omit trailing slash as %PUBLIC_PATH%/xyz looks better than %PUBLIC_PATH%xyz.
var publicUrl = ''; var publicUrl = ''
// Get environment variables to inject into our app. // Get environment variables to inject into our app.
var env = getClientEnvironment(publicUrl); var env = getClientEnvironment(publicUrl)
const cssvariables = require(paths.appSrc + '/theme/variables'); const cssvariables = require(paths.appSrc + '/theme/variables')
const postcssPlugins = [ const postcssPlugins = [
autoprefixer({ autoprefixer({
@ -26,22 +26,22 @@ const postcssPlugins = [
'last 4 versions', 'last 4 versions',
'Firefox ESR', 'Firefox ESR',
'not ie < 9', // React doesn't support IE8 anyway 'not ie < 9', // React doesn't support IE8 anyway
] ],
}), }),
cssmixins, cssmixins,
cssvars({ cssvars({
variables: function() { variables: function() {
return Object.assign({}, cssvariables); return Object.assign({}, cssvariables)
}, },
silent: false silent: false,
}), }),
]; ]
module.exports = { module.exports = {
devtool: 'eval-source-map', devtool: 'eval-source-map',
mode: 'development', mode: 'development',
entry: [ entry: [
"babel-polyfill", 'babel-polyfill',
// Include an alternative client for WebpackDevServer. A client's job is to // Include an alternative client for WebpackDevServer. A client's job is to
// connect to WebpackDevServer by a socket and get notified about changes. // connect to WebpackDevServer by a socket and get notified about changes.
// When you save a file, the client will either apply hot updates (in case // When you save a file, the client will either apply hot updates (in case
@ -56,17 +56,13 @@ module.exports = {
// We ship a few polyfills by default: // We ship a few polyfills by default:
require.resolve('./polyfills'), require.resolve('./polyfills'),
// Finally, this is your app's code: // Finally, this is your app's code:
paths.appIndexJs paths.appIndexJs,
// We include the app code last so that if there is a runtime error during // We include the app code last so that if there is a runtime error during
// initialization, it doesn't blow up the WebpackDevServer client, and // initialization, it doesn't blow up the WebpackDevServer client, and
// changing JS code would still trigger a refresh. // changing JS code would still trigger a refresh.
], ],
resolve: { resolve: {
modules: [ modules: [paths.appSrc, 'node_modules', paths.appContracts],
paths.appSrc,
'node_modules',
paths.appContracts,
],
// These are the reasonable defaults supported by the Node ecosystem. // These are the reasonable defaults supported by the Node ecosystem.
// We also include JSX as a common component filename extension to support // We also include JSX as a common component filename extension to support
// some tools, although we do not recommend using it, see: // some tools, although we do not recommend using it, see:
@ -75,7 +71,7 @@ module.exports = {
alias: { alias: {
'~': paths.appSrc, '~': paths.appSrc,
'#': paths.appContracts, '#': paths.appContracts,
} },
}, },
output: { output: {
// Next line is not used in dev but WebpackDevServer crashes without it: // Next line is not used in dev but WebpackDevServer crashes without it:
@ -87,7 +83,7 @@ module.exports = {
// containing code from all our entry points, and the Webpack runtime. // containing code from all our entry points, and the Webpack runtime.
filename: 'static/js/bundle.js', filename: 'static/js/bundle.js',
// This is the URL that app is served from. We use "/" in development. // This is the URL that app is served from. We use "/" in development.
publicPath: publicPath publicPath: publicPath,
}, },
module: { module: {
rules: [ rules: [
@ -95,20 +91,20 @@ module.exports = {
test: /\.(js|jsx)$/, test: /\.(js|jsx)$/,
exclude: /node_modules/, exclude: /node_modules/,
use: { use: {
loader: "babel-loader" loader: 'babel-loader',
} },
}, },
{ {
test: /\.(scss|css)$/, test: /\.(scss|css)$/,
use: [ use: [
'style-loader', 'style-loader',
{ loader: 'css-loader', {
loader: 'css-loader',
options: { options: {
importLoaders: 1, importLoaders: 1,
modules: true, modules: true,
minimize: false,
localIdentName: '[name]__[local]___[hash:base64:5]', localIdentName: '[name]__[local]___[hash:base64:5]',
} },
}, },
{ {
loader: 'postcss-loader', loader: 'postcss-loader',
@ -123,22 +119,24 @@ module.exports = {
test: /\.html$/, test: /\.html$/,
use: [ use: [
{ {
loader: "html-loader", loader: 'html-loader',
options: { minimize: false } options: { minimize: false },
} },
] ],
}, },
{ {
test: /\.(jpe?g|png|svg)$/i, test: /\.(jpe?g|png|svg)$/i,
exclude: /node_modules/, exclude: /node_modules/,
use: [{ use: [
loader: "file-loader", {
loader: 'file-loader',
options: { options: {
name: 'img/[hash].[ext]' name: 'img/[hash].[ext]',
}
}]
}, },
] },
],
},
],
}, },
plugins: [ plugins: [
new HtmlWebPackPlugin({ new HtmlWebPackPlugin({
@ -152,6 +150,6 @@ module.exports = {
node: { node: {
fs: 'empty', fs: 'empty',
net: 'empty', net: 'empty',
tls: 'empty' tls: 'empty',
},
} }
};

29807
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@ -31,86 +31,102 @@
"devDependencies": { "devDependencies": {
"@babel/cli": "^7.0.0-beta.40", "@babel/cli": "^7.0.0-beta.40",
"@babel/core": "^7.0.0-beta.40", "@babel/core": "^7.0.0-beta.40",
"@babel/plugin-syntax-dynamic-import": "^7.0.0-beta.40", "@babel/plugin-proposal-class-properties": "^7.0.0",
"@babel/plugin-proposal-decorators": "^7.0.0",
"@babel/plugin-proposal-do-expressions": "^7.0.0",
"@babel/plugin-proposal-export-default-from": "^7.0.0",
"@babel/plugin-proposal-export-namespace-from": "^7.0.0",
"@babel/plugin-proposal-function-bind": "^7.0.0",
"@babel/plugin-proposal-function-sent": "^7.0.0",
"@babel/plugin-proposal-json-strings": "^7.0.0",
"@babel/plugin-proposal-logical-assignment-operators": "^7.0.0",
"@babel/plugin-proposal-nullish-coalescing-operator": "^7.0.0",
"@babel/plugin-proposal-numeric-separator": "^7.0.0",
"@babel/plugin-proposal-optional-chaining": "^7.0.0",
"@babel/plugin-proposal-pipeline-operator": "^7.0.0",
"@babel/plugin-proposal-throw-expressions": "^7.0.0",
"@babel/plugin-syntax-dynamic-import": "^7.0.0",
"@babel/plugin-syntax-import-meta": "^7.0.0",
"@babel/plugin-transform-member-expression-literals": "^7.2.0",
"@babel/plugin-transform-property-literals": "^7.2.0",
"@babel/polyfill": "^7.0.0-beta.40", "@babel/polyfill": "^7.0.0-beta.40",
"@babel/preset-env": "^7.0.0-beta.40", "@babel/preset-env": "^7.0.0-beta.40",
"@babel/preset-flow": "^7.0.0-beta.40", "@babel/preset-flow": "^7.0.0-beta.40",
"@babel/preset-react": "^7.0.0-beta.40", "@babel/preset-react": "^7.0.0-beta.40",
"@babel/preset-stage-0": "^7.0.0-beta.40",
"@sambego/storybook-state": "^1.0.7", "@sambego/storybook-state": "^1.0.7",
"@storybook/addon-actions": "^3.3.15", "@storybook/addon-actions": "^5.0.0",
"@storybook/addon-knobs": "^3.3.15", "@storybook/addon-knobs": "^5.0.0",
"@storybook/addon-links": "^3.3.15", "@storybook/addon-links": "^5.0.0",
"@storybook/react": "^3.3.15", "@storybook/react": "^5.0.0",
"autoprefixer": "^8.1.0", "autoprefixer": "^9.4.10",
"babel-core": "^7.0.0-bridge.0", "babel-core": "^7.0.0-bridge.0",
"babel-eslint": "8", "babel-eslint": "^10.0.1",
"babel-jest": "^22.4.1", "babel-jest": "^24.1.0",
"babel-loader": "^8.0.0-beta.0", "babel-loader": "^8.0.0-beta.0",
"babel-plugin-dynamic-import-node": "^1.2.0", "babel-plugin-dynamic-import-node": "^2.2.0",
"babel-plugin-transform-es3-member-expression-literals": "^6.22.0", "babel-plugin-transform-es3-member-expression-literals": "^6.22.0",
"babel-plugin-transform-es3-property-literals": "^6.22.0", "babel-plugin-transform-es3-property-literals": "^6.22.0",
"bignumber.js": "^7.2.1", "bignumber.js": "^8.1.1",
"classnames": "^2.2.5", "classnames": "^2.2.5",
"css-loader": "^0.28.10", "css-loader": "^2.1.0",
"detect-port": "^1.2.2", "detect-port": "^1.2.2",
"dotenv": "^5.0.1", "dotenv": "^6.2.0",
"eslint": "^4.18.2", "eslint": "^5.15.1",
"eslint-config-airbnb": "^16.1.0", "eslint-config-airbnb": "^17.1.0",
"eslint-plugin-flowtype": "^2.46.1", "eslint-plugin-flowtype": "^3.4.2",
"eslint-plugin-import": "^2.9.0", "eslint-plugin-import": "^2.9.0",
"eslint-plugin-jest": "^21.13.0", "eslint-plugin-jest": "^22.3.0",
"eslint-plugin-jsx-a11y": "^6.0.3", "eslint-plugin-jsx-a11y": "^6.0.3",
"eslint-plugin-react": "^7.7.0", "eslint-plugin-react": "^7.7.0",
"ethereumjs-abi": "^0.6.5", "ethereumjs-abi": "^0.6.5",
"extract-text-webpack-plugin": "^4.0.0-beta.0", "extract-text-webpack-plugin": "^4.0.0-beta.0",
"file-loader": "^1.1.11", "file-loader": "^3.0.1",
"flow-bin": "^0.79.1", "flow-bin": "^0.94.0",
"fs-extra": "^5.0.0", "fs-extra": "^7.0.1",
"html-loader": "^0.5.5", "html-loader": "^0.5.5",
"html-webpack-plugin": "^3.0.4", "html-webpack-plugin": "^3.0.4",
"immutable": "^4.0.0-rc.9", "immutable": "^4.0.0-rc.9",
"jest": "^22.4.2", "jest": "^24.1.0",
"json-loader": "^0.5.7", "json-loader": "^0.5.7",
"material-ui-search-bar": "^1.0.0-beta.13", "material-ui-search-bar": "^1.0.0-beta.13",
"postcss-loader": "^2.1.1", "postcss-loader": "^3.0.0",
"postcss-mixins": "^6.2.0", "postcss-mixins": "^6.2.0",
"postcss-simple-vars": "^4.1.0", "postcss-simple-vars": "^5.0.2",
"pre-commit": "^1.2.2", "pre-commit": "^1.2.2",
"react": "^16.4.0", "react": "^16.4.0",
"react-dev-utils": "^5.0.1", "react-dev-utils": "^7.0.3",
"react-dom": "^16.4.0", "react-dom": "^16.4.0",
"react-redux": "^5.0.7", "react-redux": "^6.0.1",
"react-router-redux": "^5.0.0-alpha.9", "redux": "^4.0.1",
"redux": "^3.7.2",
"redux-actions": "^2.3.0", "redux-actions": "^2.3.0",
"redux-thunk": "^2.2.0", "redux-thunk": "^2.2.0",
"reselect": "^3.0.1", "reselect": "^4.0.0",
"run-with-testrpc": "^0.3.0", "run-with-testrpc": "^0.3.0",
"storybook-host": "^4.1.5", "storybook-host": "^5.0.3",
"storybook-router": "^0.3.3", "storybook-router": "^0.3.3",
"style-loader": "^0.20.2", "style-loader": "^0.23.1",
"truffle": "^4.1.11", "truffle": "^5.0.6",
"truffle-contract": "^1.1.8", "truffle-contract": "^4.0.7",
"truffle-solidity-loader": "0.0.8", "truffle-solidity-loader": "^0.1.6",
"uglifyjs-webpack-plugin": "^1.2.2", "uglifyjs-webpack-plugin": "^2.1.2",
"web3": "0.18.4", "web3": "^0.20.7",
"webpack": "^4.1.1", "webpack": "^4.1.1",
"webpack-bundle-analyzer": "^2.11.1", "webpack-bundle-analyzer": "^3.1.0",
"webpack-cli": "^2.0.8", "webpack-cli": "^3.2.3",
"webpack-dev-server": "^3.1.0", "webpack-dev-server": "^3.1.0",
"webpack-manifest-plugin": "^2.0.0-rc.2" "webpack-manifest-plugin": "^2.0.0-rc.2"
}, },
"dependencies": { "dependencies": {
"@gnosis.pm/util-contracts": "^0.2.14", "@gnosis.pm/util-contracts": "^2.0.0",
"@material-ui/core": "^3.0.1", "@material-ui/core": "^3.0.1",
"@material-ui/icons": "^3.0.1", "@material-ui/icons": "^3.0.1",
"connected-react-router": "^6.3.1",
"final-form": "^4.2.1", "final-form": "^4.2.1",
"history": "^4.7.2", "history": "^4.7.2",
"react-final-form": "^3.1.2", "react-final-form": "^4.1.0",
"react-loadable": "^5.3.1", "react-loadable": "^5.3.1",
"react-router-dom": "^4.2.2", "react-router-dom": "^4.2.2",
"recompose": "^0.27.1" "recompose": "^0.30.0"
}, },
"jest": { "jest": {
"verbose": true, "verbose": true,

View File

@ -39,21 +39,19 @@ const ConnectDetails = ({ classes, onConnect }: Props) => (
<React.Fragment> <React.Fragment>
<div className={classes.container}> <div className={classes.container}>
<Row margin="lg" align="center"> <Row margin="lg" align="center">
<Paragraph className={classes.text} size="lg" noMargin weight="bolder">Connect a Wallet</Paragraph> <Paragraph className={classes.text} size="lg" noMargin weight="bolder">
Connect a Wallet
</Paragraph>
</Row> </Row>
</div> </div>
<Row className={classes.logo} margin="lg"> <Row className={classes.logo} margin="lg">
<CircleDot keySize={32} circleSize={75} dotSize={25} dotTop={50} dotRight={25} center mode="error" /> <CircleDot keySize={32} circleSize={75} dotSize={25} dotTop={50} dotRight={25} center mode="error" />
</Row> </Row>
<Row className={classes.connect}> <Row className={classes.connect}>
<Button <Button onClick={onConnect} size="medium" variant="contained" color="primary" fullWidth>
onClick={onConnect} <Paragraph className={classes.connectText} size="sm" weight="regular" color="white" noMargin>
size="medium" CONNECT
variant="raised" </Paragraph>
color="primary"
fullWidth
>
<Paragraph className={classes.connectText} size="sm" weight="regular" color="white" noMargin>CONNECT</Paragraph>
</Button> </Button>
</Row> </Row>
</React.Fragment> </React.Fragment>

View File

@ -96,9 +96,7 @@ const styles = () => ({
}, },
}) })
const UserDetails = ({ const UserDetails = ({ provider, connected, network, userAddress, classes, onDisconnect }: Props) => {
provider, connected, network, userAddress, classes, onDisconnect,
}: Props) => {
const status = connected ? 'Connected' : 'Connection error' const status = connected ? 'Connected' : 'Connection error'
const address = userAddress ? shortVersionOf(userAddress, 6) : 'Address not available' const address = userAddress ? shortVersionOf(userAddress, 6) : 'Address not available'
const identiconAddress = userAddress || 'random' const identiconAddress = userAddress || 'random'
@ -108,25 +106,30 @@ const UserDetails = ({
<React.Fragment> <React.Fragment>
<Block className={classes.container}> <Block className={classes.container}>
<Row className={classes.identicon} margin="md" align="center"> <Row className={classes.identicon} margin="md" align="center">
{ connected {connected ? (
? <Identicon address={identiconAddress} diameter={60} /> <Identicon address={identiconAddress} diameter={60} />
: <CircleDot keySize={30} circleSize={75} dotSize={25} dotTop={50} dotRight={25} mode="warning" hideDot /> ) : (
} <CircleDot keySize={30} circleSize={75} dotSize={25} dotTop={50} dotRight={25} mode="warning" hideDot />
)}
</Row> </Row>
<Block align="center" className={classes.user}> <Block align="center" className={classes.user}>
<Paragraph className={classes.address} size="sm" noMargin>{address}</Paragraph> <Paragraph className={classes.address} size="sm" noMargin>
{ userAddress && {address}
</Paragraph>
{userAddress && (
<OpenInNew <OpenInNew
className={classes.open} className={classes.open}
style={openIconStyle} style={openIconStyle}
onClick={openAddressInEtherScan(userAddress, network)} onClick={openAddressInEtherScan(userAddress, network)}
/> />
} )}
</Block> </Block>
</Block> </Block>
<Hairline margin="xs" /> <Hairline margin="xs" />
<Row className={classes.details}> <Row className={classes.details}>
<Paragraph noMargin align="right" className={classes.labels}>Status </Paragraph> <Paragraph noMargin align="right" className={classes.labels}>
Status{' '}
</Paragraph>
<Spacer /> <Spacer />
<Dot className={classNames(classes.dot, connected ? classes.connected : classes.warning)} /> <Dot className={classNames(classes.dot, connected ? classes.connected : classes.warning)} />
<Paragraph noMargin align="right" color={color} weight="bolder" className={classes.labels}> <Paragraph noMargin align="right" color={color} weight="bolder" className={classes.labels}>
@ -135,7 +138,9 @@ const UserDetails = ({
</Row> </Row>
<Hairline margin="xs" /> <Hairline margin="xs" />
<Row className={classes.details}> <Row className={classes.details}>
<Paragraph noMargin align="right" className={classes.labels}>Client </Paragraph> <Paragraph noMargin align="right" className={classes.labels}>
Client{' '}
</Paragraph>
<Spacer /> <Spacer />
<Img className={classes.logo} src={metamask} height={14} alt="Metamask client" /> <Img className={classes.logo} src={metamask} height={14} alt="Metamask client" />
<Paragraph noMargin align="right" weight="bolder" className={classes.labels}> <Paragraph noMargin align="right" weight="bolder" className={classes.labels}>
@ -144,7 +149,9 @@ const UserDetails = ({
</Row> </Row>
<Hairline margin="xs" /> <Hairline margin="xs" />
<Row className={classes.details}> <Row className={classes.details}>
<Paragraph noMargin align="right" className={classes.labels}>Network </Paragraph> <Paragraph noMargin align="right" className={classes.labels}>
Network{' '}
</Paragraph>
<Spacer /> <Spacer />
<Img className={classes.logo} src={dot} height={14} alt="Network" /> <Img className={classes.logo} src={dot} height={14} alt="Network" />
<Paragraph noMargin align="right" weight="bolder" className={classes.labels}> <Paragraph noMargin align="right" weight="bolder" className={classes.labels}>
@ -153,14 +160,10 @@ const UserDetails = ({
</Row> </Row>
<Hairline margin="xs" /> <Hairline margin="xs" />
<Row className={classes.disconnect}> <Row className={classes.disconnect}>
<Button <Button onClick={onDisconnect} size="medium" variant="contained" color="primary" fullWidth>
onClick={onDisconnect} <Paragraph className={classes.disconnectText} size="sm" weight="bold" color="white" noMargin>
size="medium" DISCONNECT
variant="raised" </Paragraph>
color="primary"
fullWidth
>
<Paragraph className={classes.disconnectText} size="sm" weight="bold" color="white" noMargin>DISCONNECT</Paragraph>
</Button> </Button>
</Row> </Row>
</React.Fragment> </React.Fragment>

View File

@ -48,7 +48,7 @@ const Controls = ({
<Button <Button
style={secondButtonStyle} style={secondButtonStyle}
size="small" size="small"
variant="raised" variant="contained"
color="primary" color="primary"
type="submit" type="submit"
disabled={disabled} disabled={disabled}

View File

@ -46,7 +46,7 @@ class GnoStepper extends React.PureComponent<Props, State> {
static FinishButton = ({ static FinishButton = ({
component, to, title, ...props component, to, title, ...props
}) => ( }) => (
<Button component={component} to={to} variant="raised" color="primary" {...props}> <Button component={component} to={to} variant="contained" color="primary" {...props}>
{title} {title}
</Button> </Button>
) )

View File

@ -5,7 +5,7 @@ import { MuiThemeProvider } from '@material-ui/core/styles'
import React from 'react' import React from 'react'
import ReactDOM from 'react-dom' import ReactDOM from 'react-dom'
import { Provider } from 'react-redux' import { Provider } from 'react-redux'
import { ConnectedRouter } from 'react-router-redux' import { ConnectedRouter } from 'connected-react-router'
import PageFrame from '~/components/layout/PageFrame' import PageFrame from '~/components/layout/PageFrame'
import { history, store } from '~/store' import { history, store } from '~/store'
import theme from '~/theme/mui' import theme from '~/theme/mui'
@ -25,7 +25,4 @@ const Root = () => (
</Provider> </Provider>
) )
ReactDOM.render( ReactDOM.render(<Root />, document.getElementById('root'))
<Root />,
document.getElementById('root'),
)

View File

@ -19,7 +19,7 @@ const NoRights = () => (
<Button <Button
component={Link} component={Link}
to={SAFELIST_ADDRESS} to={SAFELIST_ADDRESS}
variant="raised" variant="contained"
color="primary" color="primary"
> >
Safe List Safe List

View File

@ -75,7 +75,7 @@ const BalanceComponent = openHoc(({
<Img src={token.get('logoUrl')} height={30} alt={name} /> <Img src={token.get('logoUrl')} height={30} alt={name} />
</ListItemIcon> </ListItemIcon>
<ListItemText primary={name} secondary={`${token.get('funds')} ${symbol}`} /> <ListItemText primary={name} secondary={`${token.get('funds')} ${symbol}`} />
<Button variant="raised" color="primary" onClick={onMoveFundsClick} disabled={disabled}> <Button variant="contained" color="primary" onClick={onMoveFundsClick} disabled={disabled}>
{MOVE_FUNDS_BUTTON_TEXT} {MOVE_FUNDS_BUTTON_TEXT}
</Button> </Button>
</ListItem> </ListItem>

View File

@ -24,7 +24,7 @@ const Confirmations = ({ confirmations, onEditThreshold }: Props) => (
cut cut
/> />
<Button <Button
variant="raised" variant="contained"
color="primary" color="primary"
onClick={onEditThreshold} onClick={onEditThreshold}
> >

View File

@ -22,7 +22,7 @@ const MultisigTransactionsComponent = ({ onSeeTxs }: Props) => {
</Avatar> </Avatar>
<ListItemText primary="Safe's Multisig Transaction" secondary={text} /> <ListItemText primary="Safe's Multisig Transaction" secondary={text} />
<Button <Button
variant="raised" variant="contained"
color="primary" color="primary"
onClick={onSeeTxs} onClick={onSeeTxs}
> >

View File

@ -51,7 +51,7 @@ const Owners = openHoc(({
} }
</ListItemIcon> </ListItemIcon>
<Button <Button
variant="raised" variant="contained"
color="primary" color="primary"
onClick={onAddOwner} onClick={onAddOwner}
> >

View File

@ -86,7 +86,7 @@ class GnoTransaction extends React.PureComponent<Props> {
} }
{ !executionHash && !userConfirmed && { !executionHash && !userConfirmed &&
<Button <Button
variant="raised" variant="contained"
color="primary" color="primary"
onClick={this.onProccesClick} onClick={this.onProccesClick}
> >

View File

@ -26,7 +26,7 @@ const SafeTable = ({ safes }: Props) => (
<TableRow key={safe.address}> <TableRow key={safe.address}>
<TableCell> <TableCell>
<Link to={`${SAFELIST_ADDRESS}/${safe.address}`}> <Link to={`${SAFELIST_ADDRESS}/${safe.address}`}>
<Button variant="raised" size="small" color="primary">Open</Button> <Button variant="contained" size="small" color="primary">Open</Button>
</Link> </Link>
</TableCell> </TableCell>
<TableCell padding="none">{safe.get('name')}</TableCell> <TableCell padding="none">{safe.get('name')}</TableCell>

View File

@ -2,7 +2,7 @@
import { List, Map } from 'immutable' import { List, Map } from 'immutable'
import contract from 'truffle-contract' import contract from 'truffle-contract'
import type { Dispatch as ReduxDispatch } from 'redux' import type { Dispatch as ReduxDispatch } from 'redux'
import StandardToken from '@gnosis.pm/util-contracts/build/contracts/StandardToken.json' import StandardToken from '@gnosis.pm/util-contracts/build/contracts/GnosisStandardToken.json'
import HumanFriendlyToken from '@gnosis.pm/util-contracts/build/contracts/HumanFriendlyToken.json' import HumanFriendlyToken from '@gnosis.pm/util-contracts/build/contracts/HumanFriendlyToken.json'
import { getWeb3 } from '~/logic/wallets/getWeb3' import { getWeb3 } from '~/logic/wallets/getWeb3'
import { type GlobalState } from '~/store/index' import { type GlobalState } from '~/store/index'
@ -35,7 +35,8 @@ export const getStandardTokenContract = ensureOnce(createStandardTokenContract)
export const calculateBalanceOf = async (tokenAddress: string, address: string, decimals: number) => { export const calculateBalanceOf = async (tokenAddress: string, address: string, decimals: number) => {
const erc20Token = await getStandardTokenContract() const erc20Token = await getStandardTokenContract()
return erc20Token.at(tokenAddress) return erc20Token
.at(tokenAddress)
.then(instance => instance.balanceOf(address).then(funds => funds.div(10 ** decimals).toString())) .then(instance => instance.balanceOf(address).then(funds => funds.div(10 ** decimals).toString()))
.catch(() => '0') .catch(() => '0')
} }
@ -46,29 +47,32 @@ export const fetchTokensData = async () => {
return enhancedFetch(url, errMsg) return enhancedFetch(url, errMsg)
} }
export const fetchTokens = (safeAddress: string) => export const fetchTokens = (safeAddress: string) => async (dispatch: ReduxDispatch<GlobalState>) => {
async (dispatch: ReduxDispatch<GlobalState>) => {
const tokens: List<string> = getActiveTokenAddresses(safeAddress) const tokens: List<string> = getActiveTokenAddresses(safeAddress)
const ethBalance = await getSafeEthToken(safeAddress) const ethBalance = await getSafeEthToken(safeAddress)
const customTokens = getTokens(safeAddress) const customTokens = getTokens(safeAddress)
const json = await exports.fetchTokensData() const json = await exports.fetchTokensData()
try { try {
const balancesRecords = await Promise.all(json.map(async (item: TokenProps) => { const balancesRecords = await Promise.all(
json.map(async (item: TokenProps) => {
const status = tokens.includes(item.address) const status = tokens.includes(item.address)
const funds = status ? await calculateBalanceOf(item.address, safeAddress, item.decimals) : '0' const funds = status ? await calculateBalanceOf(item.address, safeAddress, item.decimals) : '0'
return makeToken({ ...item, status, funds }) return makeToken({ ...item, status, funds })
})) }),
)
const customTokenRecords = await Promise.all(customTokens.map(async (item: TokenProps) => { const customTokenRecords = await Promise.all(
customTokens.map(async (item: TokenProps) => {
const status = tokens.includes(item.address) const status = tokens.includes(item.address)
const funds = status ? await calculateBalanceOf(item.address, safeAddress, item.decimals) : '0' const funds = status ? await calculateBalanceOf(item.address, safeAddress, item.decimals) : '0'
return makeToken({ ...item, status, funds }) return makeToken({ ...item, status, funds })
})) }),
)
const balances: Map<string, Token> = Map().withMutations((map) => { const balances: Map<string, Token> = Map().withMutations(map => {
balancesRecords.forEach(record => map.set(record.get('address'), record)) balancesRecords.forEach(record => map.set(record.get('address'), record))
customTokenRecords.forEach(record => map.set(record.get('address'), record)) customTokenRecords.forEach(record => map.set(record.get('address'), record))
@ -78,7 +82,7 @@ export const fetchTokens = (safeAddress: string) =>
return dispatch(addTokens(safeAddress, balances)) return dispatch(addTokens(safeAddress, balances))
} catch (err) { } catch (err) {
// eslint-disable-next-line // eslint-disable-next-line
console.log("Error fetching token balances... " + err) console.log('Error fetching token balances... ' + err)
return Promise.resolve() return Promise.resolve()
} }

View File

@ -29,7 +29,7 @@ export const CreateSafe = ({ size, provider }: SafeProps) => (
<Button <Button
component={Link} component={Link}
to={OPEN_ADDRESS} to={OPEN_ADDRESS}
variant="raised" variant="contained"
size={size || 'medium'} size={size || 'medium'}
color="primary" color="primary"
disabled={!provider} disabled={!provider}

View File

@ -1,21 +1,21 @@
// @flow // @flow
import { createBrowserHistory } from 'history' import createBrowserHistory from 'history/createBrowserHistory'
import { routerMiddleware, routerReducer } from 'react-router-redux' import { connectRouter, routerMiddleware } from 'connected-react-router'
import { combineReducers, createStore, applyMiddleware, compose, type Reducer, type Store } from 'redux' import { combineReducers, createStore, applyMiddleware, compose, type Reducer, type Store } from 'redux'
import thunk from 'redux-thunk' import thunk from 'redux-thunk'
import provider, { PROVIDER_REDUCER_ID, type State as ProviderState } from '~/logic/wallets/store/reducer/provider' import provider, { PROVIDER_REDUCER_ID, type State as ProviderState } from '~/logic/wallets/store/reducer/provider'
import safe, { SAFE_REDUCER_ID, type State as SafeState, safesInitialState } from '~/routes/safe/store/reducer/safe' import safe, { SAFE_REDUCER_ID, type State as SafeState, safesInitialState } from '~/routes/safe/store/reducer/safe'
import tokens, { TOKEN_REDUCER_ID, type State as TokensState } from '~/routes/tokens/store/reducer/tokens' import tokens, { TOKEN_REDUCER_ID, type State as TokensState } from '~/routes/tokens/store/reducer/tokens'
import transactions, { type State as TransactionsState, TRANSACTIONS_REDUCER_ID } from '~/routes/safe/store/reducer/transactions' import transactions, {
type State as TransactionsState,
TRANSACTIONS_REDUCER_ID,
} from '~/routes/safe/store/reducer/transactions'
export const history = createBrowserHistory() export const history = createBrowserHistory()
// eslint-disable-next-line // eslint-disable-next-line
const composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose const composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose
const finalCreateStore = composeEnhancers(applyMiddleware( const finalCreateStore = composeEnhancers(applyMiddleware(thunk, routerMiddleware(history)))
thunk,
routerMiddleware(history),
))
export type GlobalState = { export type GlobalState = {
providers: ProviderState, providers: ProviderState,
@ -27,7 +27,7 @@ export type GlobalState = {
export type GetState = () => GlobalState export type GetState = () => GlobalState
const reducers: Reducer<GlobalState> = combineReducers({ const reducers: Reducer<GlobalState> = combineReducers({
routing: routerReducer, router: connectRouter(history),
[PROVIDER_REDUCER_ID]: provider, [PROVIDER_REDUCER_ID]: provider,
[SAFE_REDUCER_ID]: safe, [SAFE_REDUCER_ID]: safe,
[TOKEN_REDUCER_ID]: tokens, [TOKEN_REDUCER_ID]: tokens,

View File

@ -1,6 +1,18 @@
// @flow // @flow
import { createMuiTheme } from '@material-ui/core/styles' import { createMuiTheme } from '@material-ui/core/styles'
import { largeFontSize, mediumFontSize, smallFontSize, disabled, primary, secondary, md, lg, bolderFont, boldFont, buttonLargeFontSize } from './variables' import {
largeFontSize,
mediumFontSize,
smallFontSize,
disabled,
primary,
secondary,
md,
lg,
bolderFont,
boldFont,
buttonLargeFontSize,
} from './variables'
export type WithStyles = { export type WithStyles = {
classes: Object, classes: Object,
@ -31,12 +43,12 @@ export default createMuiTheme({
root: { root: {
fontFamily: 'Roboto Mono, monospace', fontFamily: 'Roboto Mono, monospace',
letterSpacing: '0.9px', letterSpacing: '0.9px',
'&:disabled': { '&$disabled': {
color: disabled, color: disabled,
}, },
color: disabled, color: disabled,
}, },
disabled: { '&$disabled': {
cursor: 'pointer', cursor: 'pointer',
}, },
contained: { contained: {
@ -160,7 +172,7 @@ export default createMuiTheme({
fontFamily: 'Roboto Mono, monospace', fontFamily: 'Roboto Mono, monospace',
fontWeight: 'normal', fontWeight: 'normal',
}, },
selected: { '&$selected': {
fontWeight: bolderFont, fontWeight: bolderFont,
}, },
}, },