Skip to content
This repository has been archived by the owner on Nov 20, 2020. It is now read-only.

Bug fix #125

Merged
merged 6 commits into from
Apr 23, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
"description": "Conflux Blockchain Explorer",
"main": "index.js",
"scripts": {
"start": "NODE_ENV=development webpack-dev-server --config webpack.dev.config.js",
"build": "NODE_ENV=production webpack --config webpack.prod.config.js",
"start": "cross-env NODE_ENV=development webpack-dev-server --config webpack.dev.config.js",
"build": "cross-env NODE_ENV=production webpack --config webpack.prod.config.js",
"prettier": "pretty-quick --staged",
"lint:staged": "lint-staged",
"lintfix": "eslint . --fix",
"lint:eslint": "eslint --ignore-path .eslintignore --fix",
"eslint-check": "eslint --print-config . | eslint-config-prettier-check",
"serve:dev": "NODE_ENV=development API_HOST=http://testnet-jsonrpc.conflux-chain.org:18084/api SERVER_PORT=3000 SERVER_HOST=127.0.0.1 SERVER_PREFIX=/proxy node ./service/index.js"
"serve:dev": "cross-env NODE_ENV=development API_HOST=http://testnet-jsonrpc.conflux-chain.org:18084/api SERVER_PORT=3000 SERVER_HOST=127.0.0.1 SERVER_PREFIX=/proxy node ./service/index.js"
},
"keywords": [],
"author": "Angelia",
Expand All @@ -36,6 +36,7 @@
"antd": "^3.19.1",
"bignumber.js": "^9.0.0",
"classnames": "^2.2.6",
"cross-env": "^7.0.2",
"echarts": "^4.2.1",
"history": "^4.9.0",
"humanize-number": "^0.0.2",
Expand Down
2 changes: 1 addition & 1 deletion src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import GlobalStyle from './globalStyles';
import zhTranslationMessages from './lang/zh';
import enTranslationMessages from './lang/en';

Sentry.init({ dsn: 'https://2a65cc47c686438ebde60b1237a8a8ec@sentry.io/5168571' });
Sentry.init({ dsn: 'https://2a65cc47c686438ebde60b1237a8a8ec@sentry.io/5168571', environment: process.env.NODE_ENV });

require('./assets/iconfont/iconfont.js');

Expand Down
10 changes: 8 additions & 2 deletions src/pages/Account/accountHead.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@
import React, { Component, Fragment } from 'react';
import styled from 'styled-components';
import moment from 'moment';
import { Link } from 'react-router-dom';
import { Link, withRouter } from 'react-router-dom';
import PropTypes from 'prop-types';
import { injectIntl } from 'react-intl';
import compose from 'lodash/fp/compose';
import * as commonCss from '../../globalStyles/common';
import CopyButton from '../../components/CopyButton';
import QrcodeButton from '../../components/QrcodeButton';
Expand Down Expand Up @@ -522,4 +523,9 @@ AccountHead.propTypes = {
}).isRequired,
};

export default injectIntl(AccountHead);
const hoc = compose(
injectIntl,
withRouter
);

export default hoc(AccountHead);
26 changes: 14 additions & 12 deletions src/pages/Account/detail.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,18 +124,20 @@ class Detail extends Component {
reqTokenList({
address: accountid,
}).then((body) => {
const listSorted = (body.result.list || []).sort((a, b) => {
return b.balance - a.balance;
});
const tokenMap = {};
listSorted.forEach((v) => {
tokenMap[v.address] = v;
});
this.setState({
tokenTotal: body.result.list.length,
tokenList: listSorted,
tokenMap,
});
if (body.code === 0) {
const listSorted = (body.result.list || []).sort((a, b) => {
return b.balance - a.balance;
});
const tokenMap = {};
listSorted.forEach((v) => {
tokenMap[v.address] = v;
});
this.setState({
tokenTotal: body.result.list.length,
tokenList: listSorted,
tokenMap,
});
}
});
}

Expand Down
19 changes: 10 additions & 9 deletions src/pages/Transaction/detail.js
Original file line number Diff line number Diff line change
Expand Up @@ -296,16 +296,7 @@ class Detail extends Component {
{ showError: false }
).then((body) => {
switch (body.code) {
case errorCodes.ParameterError:
history.push(`/search-notfound?searchId=${txnhash}`);
break;
case errorCodes.TxNotFoundError:
this.setState({
isPacking: true,
});
break;
case 0:
default:
const transactionDetails = body.result;
this.setState({ result: transactionDetails });
let toAddress = transactionDetails.to;
Expand Down Expand Up @@ -392,6 +383,16 @@ class Detail extends Component {
});
}
break;
case errorCodes.ParameterError:
history.push(`/search-notfound?searchId=${txnhash}`);
break;
case errorCodes.TxNotFoundError:
this.setState({
isPacking: true,
});
break;
default:
break;
}
});
}
Expand Down
2 changes: 2 additions & 0 deletions src/utils/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import superagent from 'superagent';
import querystring from 'querystring';
import huNum from 'humanize-number';
import { injectIntl, FormattedMessage, FormattedHTMLMessage } from 'react-intl';
import * as Sentry from '@sentry/browser';
import { toast } from '../components/Toast';
import { notice } from '../components/Message/notice';
import { errorCodes, addressTypeContract, addressTypeCommon } from '../constants';
Expand Down Expand Up @@ -214,6 +215,7 @@ export const sendRequest = (config) => {
});
reqPromise.catch((error) => {
if (config && config.url.match(/dashboard\/dag$/)) return;
Sentry.captureException(error);
console.log(error);
if (config.showNetWorkError !== false) {
toast.error({
Expand Down
40 changes: 40 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2489,6 +2489,13 @@ create-react-context@^0.3.0:
gud "^1.0.0"
warning "^4.0.3"

cross-env@^7.0.2:
version "7.0.2"
resolved "https://registry.yarnpkg.com/cross-env/-/cross-env-7.0.2.tgz#bd5ed31339a93a3418ac4f3ca9ca3403082ae5f9"
integrity sha512-KZP/bMEOJEDCkDQAyRhu3RL2ZO/SUVrxQVI0G3YEQ+OLbRA3c6zgixe8Mq8a/z7+HKlNEjo8oiLUs8iRijY2Rw==
dependencies:
cross-spawn "^7.0.1"

cross-spawn@6.0.5, cross-spawn@^6.0.0, cross-spawn@^6.0.5:
version "6.0.5"
resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-6.0.5.tgz#4a5ec7c64dfae22c3a14124dbacdee846d80cbc4"
Expand All @@ -2509,6 +2516,15 @@ cross-spawn@^5.0.1:
shebang-command "^1.2.0"
which "^1.2.9"

cross-spawn@^7.0.1:
version "7.0.2"
resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-7.0.2.tgz#d0d7dcfa74e89115c7619f4f721a94e1fdb716d6"
integrity sha512-PD6G8QG3S4FK/XCGFbEQrDqO2AnMMsy0meR7lerlIOHAAbkuavGU/pOqprrlvfTNjvowivTeBsjebAL0NSoMxw==
dependencies:
path-key "^3.1.0"
shebang-command "^2.0.0"
which "^2.0.1"

crypto-browserify@^3.11.0:
version "3.12.0"
resolved "https://registry.yarnpkg.com/crypto-browserify/-/crypto-browserify-3.12.0.tgz#396cf9f3137f03e4b8e532c58f698254e00f80ec"
Expand Down Expand Up @@ -6694,6 +6710,11 @@ path-key@^2.0.0, path-key@^2.0.1:
resolved "https://registry.yarnpkg.com/path-key/-/path-key-2.0.1.tgz#411cadb574c5a140d3a4b1910d40d80cc9f40b40"
integrity sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A=

path-key@^3.1.0:
version "3.1.1"
resolved "https://registry.yarnpkg.com/path-key/-/path-key-3.1.1.tgz#581f6ade658cbba65a0d3380de7753295054f375"
integrity sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==

path-parse@^1.0.6:
version "1.0.6"
resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.6.tgz#d62dbb5679405d72c4737ec58600e9ddcf06d24c"
Expand Down Expand Up @@ -8657,11 +8678,23 @@ shebang-command@^1.2.0:
dependencies:
shebang-regex "^1.0.0"

shebang-command@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/shebang-command/-/shebang-command-2.0.0.tgz#ccd0af4f8835fbdc265b82461aaf0c36663f34ea"
integrity sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==
dependencies:
shebang-regex "^3.0.0"

shebang-regex@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-1.0.0.tgz#da42f49740c0b42db2ca9728571cb190c98efea3"
integrity sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM=

shebang-regex@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-3.0.0.tgz#ae16f1644d873ecad843b0307b143362d4c42172"
integrity sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==

signal-exit@^3.0.0, signal-exit@^3.0.2:
version "3.0.2"
resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.2.tgz#b5fdc08f1287ea1178628e415e25132b73646c6d"
Expand Down Expand Up @@ -10092,6 +10125,13 @@ which@1, which@^1.2.10, which@^1.2.14, which@^1.2.9, which@^1.3.1:
dependencies:
isexe "^2.0.0"

which@^2.0.1:
version "2.0.2"
resolved "https://registry.yarnpkg.com/which/-/which-2.0.2.tgz#7c6a8dd0a636a0327e10b59c9286eee93f3f51b1"
integrity sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==
dependencies:
isexe "^2.0.0"

wide-align@^1.1.0:
version "1.1.3"
resolved "https://registry.yarnpkg.com/wide-align/-/wide-align-1.1.3.tgz#ae074e6bdc0c14a431e804e624549c633b000457"
Expand Down