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

Commit c1bfff0

Browse files
author
wenzhe
committed
add system maintaining tips
1 parent ae1db54 commit c1bfff0

File tree

4 files changed

+71
-29
lines changed

4 files changed

+71
-29
lines changed

src/globalStyles/base.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,5 +96,19 @@ const BaseStyle = css`
9696
padding: 5px 10px;
9797
z-index: 99999;
9898
}
99+
100+
.message {
101+
padding: 12px;
102+
font-size: 16px;
103+
line-height: 16px;
104+
border-radius: 4px;
105+
color: #fff;
106+
position: relative;
107+
z-index: 9999;
108+
}
109+
.message-important-light {
110+
background: #ffebd4;
111+
color: #e76a25;
112+
}
99113
`;
100114
export default BaseStyle;

src/lang/zh.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,4 +137,5 @@ export default {
137137
'app.directory.topholders.desc': '保证社区的公开与透明',
138138
'app.directory.community.title': '社区',
139139
'app.directory.community.desc': '成为下一代去中心化社区的一员',
140+
'system maintaining, please visit later': '系统维护中,请稍后访问',
140141
};

src/pages/Account/detail.js

Lines changed: 41 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -403,6 +403,7 @@ class Detail extends Component {
403403
},
404404
minedTotalCount: 0,
405405
curMinedPage: 1,
406+
showMaintaining: false,
406407
};
407408
}
408409

@@ -417,33 +418,40 @@ class Detail extends Component {
417418
async fetchAccountDetail(accountid, queries) {
418419
const { history } = this.props;
419420
this.setState({ isLoading: true, accountid });
420-
const { code, result } = (await superagent.get(`/proxy/fetchAccountDetail/${accountid}`).query(queries)).body;
421-
if (!code) {
422-
this.setState(
423-
{
424-
accountDetail: result.find((item) => Object.keys(item)[0] === `account/${accountid}`)[`account/${accountid}`],
425-
// TxList: result.find((item) => Object.keys(item)[0] === `account/${accountid}/transactionList`)[
426-
// `account/${accountid}/transactionList`
427-
// ],
428-
TxList: get(
429-
result.find((item) => Object.keys(item)[0] === `account/${accountid}/transactionList`),
430-
`account/${accountid}/transactionList`,
431-
[]
432-
),
433-
TxTotalCount: get(
434-
result.find((item) => Object.keys(item)[0] === `account/${accountid}/transactionList`),
435-
`total_account/${accountid}/transactionList`,
436-
[]
437-
),
438-
minedTotalCount:
439-
get(result.find((item) => Object.keys(item)[0] === `account/${accountid}`), [`account/${accountid}`, 'minedBlocks']) || 0,
440-
},
441-
() => {
442-
this.setState({ isLoading: false, queries });
443-
}
444-
);
445-
} else if (code === 1) {
446-
history.push(`/search-notfound?searchId=${accountid}`);
421+
422+
try {
423+
const { code, result } = (await superagent.get(`/proxy/fetchAccountDetail/${accountid}`).query(queries)).body;
424+
if (!code) {
425+
this.setState(
426+
{
427+
accountDetail: result.find((item) => Object.keys(item)[0] === `account/${accountid}`)[`account/${accountid}`],
428+
// TxList: result.find((item) => Object.keys(item)[0] === `account/${accountid}/transactionList`)[
429+
// `account/${accountid}/transactionList`
430+
// ],
431+
TxList: get(
432+
result.find((item) => Object.keys(item)[0] === `account/${accountid}/transactionList`),
433+
`account/${accountid}/transactionList`,
434+
[]
435+
),
436+
TxTotalCount: get(
437+
result.find((item) => Object.keys(item)[0] === `account/${accountid}/transactionList`),
438+
`total_account/${accountid}/transactionList`,
439+
[]
440+
),
441+
minedTotalCount:
442+
get(result.find((item) => Object.keys(item)[0] === `account/${accountid}`), [`account/${accountid}`, 'minedBlocks']) || 0,
443+
},
444+
() => {
445+
this.setState({ isLoading: false, queries });
446+
}
447+
);
448+
} else if (code === 1) {
449+
history.push(`/search-notfound?searchId=${accountid}`);
450+
}
451+
} catch (e) {
452+
this.setState({
453+
showMaintaining: true,
454+
});
447455
}
448456
return {};
449457
}
@@ -482,6 +490,7 @@ class Detail extends Component {
482490
accountid,
483491
minedTotalCount,
484492
curMinedPage,
493+
showMaintaining,
485494
} = this.state;
486495
const {
487496
intl,
@@ -568,6 +577,11 @@ class Detail extends Component {
568577

569578
return (
570579
<div className="page-address-detail">
580+
{showMaintaining && (
581+
<div className="message message-important-light">
582+
<span>{intl.formatMessage({ id: 'system maintaining, please visit after 9/9' })}</span>
583+
</div>
584+
)}
571585
<Wrapper>
572586
<HeadBar>
573587
<h1>{i18n('Account')}</h1>

src/pages/Home/index.js

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,12 +145,19 @@ class Home extends Component {
145145
hashRate: 'day',
146146
}),
147147
summary: Immutable.fromJS({}),
148+
showMaintaining: false,
148149
};
149150
}
150151

151152
componentDidMount() {
152153
this.fetchStatistic();
153-
this.fetchLineData('tps', 'day');
154+
this.fetchLineData('tps', 'day').then((result) => {
155+
if (result.data.length === 0) {
156+
this.setState({
157+
showMaintaining: true,
158+
});
159+
}
160+
});
154161
this.fetchLineData('difficulty', 'day');
155162
this.fetchLineData('blockTime', 'day');
156163
this.fetchLineData('hashRate', 'day');
@@ -183,6 +190,7 @@ class Home extends Component {
183190
data,
184191
});
185192
}
193+
return result;
186194
}
187195

188196
formatTrend(value) {
@@ -196,10 +204,15 @@ class Home extends Component {
196204
}
197205

198206
render() {
199-
const { data, duration, summary } = this.state;
207+
const { data, duration, summary, showMaintaining } = this.state;
200208
const { intl } = this.props;
201209
return (
202210
<Container>
211+
{showMaintaining && (
212+
<div className="message message-important-light">
213+
<span>{intl.formatMessage({ id: 'system maintaining, please visit later' })}</span>
214+
</div>
215+
)}
203216
<BlockContainer>
204217
<Block key="tps" width="216px" height="44px" url={dashboard1}>
205218
<span className="block-title">

0 commit comments

Comments
 (0)