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

Commit

Permalink
Merge pull request #8 from Conflux-Dev/bugfix
Browse files Browse the repository at this point in the history
add system maintaining tips
  • Loading branch information
Angelia authored Sep 6, 2019
2 parents ae1db54 + c1bfff0 commit f35f611
Show file tree
Hide file tree
Showing 4 changed files with 71 additions and 29 deletions.
14 changes: 14 additions & 0 deletions src/globalStyles/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,5 +96,19 @@ const BaseStyle = css`
padding: 5px 10px;
z-index: 99999;
}
.message {
padding: 12px;
font-size: 16px;
line-height: 16px;
border-radius: 4px;
color: #fff;
position: relative;
z-index: 9999;
}
.message-important-light {
background: #ffebd4;
color: #e76a25;
}
`;
export default BaseStyle;
1 change: 1 addition & 0 deletions src/lang/zh.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,4 +137,5 @@ export default {
'app.directory.topholders.desc': '保证社区的公开与透明',
'app.directory.community.title': '社区',
'app.directory.community.desc': '成为下一代去中心化社区的一员',
'system maintaining, please visit later': '系统维护中,请稍后访问',
};
68 changes: 41 additions & 27 deletions src/pages/Account/detail.js
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,7 @@ class Detail extends Component {
},
minedTotalCount: 0,
curMinedPage: 1,
showMaintaining: false,
};
}

Expand All @@ -417,33 +418,40 @@ class Detail extends Component {
async fetchAccountDetail(accountid, queries) {
const { history } = this.props;
this.setState({ isLoading: true, accountid });
const { code, result } = (await superagent.get(`/proxy/fetchAccountDetail/${accountid}`).query(queries)).body;
if (!code) {
this.setState(
{
accountDetail: result.find((item) => Object.keys(item)[0] === `account/${accountid}`)[`account/${accountid}`],
// TxList: result.find((item) => Object.keys(item)[0] === `account/${accountid}/transactionList`)[
// `account/${accountid}/transactionList`
// ],
TxList: get(
result.find((item) => Object.keys(item)[0] === `account/${accountid}/transactionList`),
`account/${accountid}/transactionList`,
[]
),
TxTotalCount: get(
result.find((item) => Object.keys(item)[0] === `account/${accountid}/transactionList`),
`total_account/${accountid}/transactionList`,
[]
),
minedTotalCount:
get(result.find((item) => Object.keys(item)[0] === `account/${accountid}`), [`account/${accountid}`, 'minedBlocks']) || 0,
},
() => {
this.setState({ isLoading: false, queries });
}
);
} else if (code === 1) {
history.push(`/search-notfound?searchId=${accountid}`);

try {
const { code, result } = (await superagent.get(`/proxy/fetchAccountDetail/${accountid}`).query(queries)).body;
if (!code) {
this.setState(
{
accountDetail: result.find((item) => Object.keys(item)[0] === `account/${accountid}`)[`account/${accountid}`],
// TxList: result.find((item) => Object.keys(item)[0] === `account/${accountid}/transactionList`)[
// `account/${accountid}/transactionList`
// ],
TxList: get(
result.find((item) => Object.keys(item)[0] === `account/${accountid}/transactionList`),
`account/${accountid}/transactionList`,
[]
),
TxTotalCount: get(
result.find((item) => Object.keys(item)[0] === `account/${accountid}/transactionList`),
`total_account/${accountid}/transactionList`,
[]
),
minedTotalCount:
get(result.find((item) => Object.keys(item)[0] === `account/${accountid}`), [`account/${accountid}`, 'minedBlocks']) || 0,
},
() => {
this.setState({ isLoading: false, queries });
}
);
} else if (code === 1) {
history.push(`/search-notfound?searchId=${accountid}`);
}
} catch (e) {
this.setState({
showMaintaining: true,
});
}
return {};
}
Expand Down Expand Up @@ -482,6 +490,7 @@ class Detail extends Component {
accountid,
minedTotalCount,
curMinedPage,
showMaintaining,
} = this.state;
const {
intl,
Expand Down Expand Up @@ -568,6 +577,11 @@ class Detail extends Component {

return (
<div className="page-address-detail">
{showMaintaining && (
<div className="message message-important-light">
<span>{intl.formatMessage({ id: 'system maintaining, please visit after 9/9' })}</span>
</div>
)}
<Wrapper>
<HeadBar>
<h1>{i18n('Account')}</h1>
Expand Down
17 changes: 15 additions & 2 deletions src/pages/Home/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,12 +145,19 @@ class Home extends Component {
hashRate: 'day',
}),
summary: Immutable.fromJS({}),
showMaintaining: false,
};
}

componentDidMount() {
this.fetchStatistic();
this.fetchLineData('tps', 'day');
this.fetchLineData('tps', 'day').then((result) => {
if (result.data.length === 0) {
this.setState({
showMaintaining: true,
});
}
});
this.fetchLineData('difficulty', 'day');
this.fetchLineData('blockTime', 'day');
this.fetchLineData('hashRate', 'day');
Expand Down Expand Up @@ -183,6 +190,7 @@ class Home extends Component {
data,
});
}
return result;
}

formatTrend(value) {
Expand All @@ -196,10 +204,15 @@ class Home extends Component {
}

render() {
const { data, duration, summary } = this.state;
const { data, duration, summary, showMaintaining } = this.state;
const { intl } = this.props;
return (
<Container>
{showMaintaining && (
<div className="message message-important-light">
<span>{intl.formatMessage({ id: 'system maintaining, please visit later' })}</span>
</div>
)}
<BlockContainer>
<Block key="tps" width="216px" height="44px" url={dashboard1}>
<span className="block-title">
Expand Down

0 comments on commit f35f611

Please sign in to comment.