Skip to content

Commit

Permalink
update table
Browse files Browse the repository at this point in the history
  • Loading branch information
syslink committed Jul 27, 2020
1 parent e7a59f3 commit 33b10cc
Show file tree
Hide file tree
Showing 8 changed files with 45 additions and 27 deletions.
Binary file added build/assets/175eb3da8b94fc1b25591a3248489bf5.ttf
Binary file not shown.
Binary file not shown.
Binary file not shown.
2 changes: 1 addition & 1 deletion build/css/index.css

Large diffs are not rendered by default.

22 changes: 11 additions & 11 deletions build/js/index.js

Large diffs are not rendered by default.

16 changes: 12 additions & 4 deletions src/TransactionList/TransactionList.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint no-mixed-operators:0 */
import React, { Component } from 'react';
import { Table, Feedback, Dialog, Button } from '@icedesign/base';
import { Tag, Balloon } from '@alifd/next';
import { Feedback, Dialog } from '@icedesign/base';
import { Table, Tag, Balloon, Button } from '@alifd/next';
import IceContainer from '@icedesign/container';
import copy from 'copy-to-clipboard';
import * as oexchain from 'oex-web3';
Expand Down Expand Up @@ -140,7 +140,7 @@ export default class TransactionList extends Component {
transactions = transactions.slice(0, this.state.maxTxNum);
}

_this.setState({ transactions });
this.state.transactions = transactions;
//});
}
}
Expand Down Expand Up @@ -353,13 +353,13 @@ export default class TransactionList extends Component {
}

render() {
console.log('displayed tx num = ' + this.state.transactions.length);
return (
<div className="progress-table">
{
this.state.homePage ?
<IceContainer title={T("交易")}>
<Table primaryKey="txHash" isZebra={false} hasBorder={false}
//rowProps={{style: {height:'50px'}}}
language={T('zh-cn')} hasHeader={false}
dataSource={this.state.transactions}
>
Expand All @@ -368,6 +368,14 @@ export default class TransactionList extends Component {
<Table.Column title={T("交易详情")} dataIndex="parsedActions" width={180} cell={this.renderDetailInfo2.bind(this)}/>
<Table.Column title={T("结果")} dataIndex="parsedActions" width={80} cell={this.renderResult2.bind(this)} />
</Table>

<Button type='primary'
style={{width: '100%', height: '40px', background: 'rgb(239,240,255)', color: '#5c67f2'}}
onClick={() => {
history.push('/Transaction');
}}>
{T('查询交易')}
</Button>
</IceContainer>
:
<IceContainer className="tab-card" title={T("交易")}>
Expand Down
13 changes: 9 additions & 4 deletions src/pages/Dashboard/components/BlocksTable/BlocksTable.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export default class BlocksTable extends Component {
super(props);

this.state = {
maxBlockNum: 17,
blockList: [],
intervalId: 0,
blockListVisible: false,
Expand Down Expand Up @@ -53,7 +54,7 @@ export default class BlocksTable extends Component {
let nextBlockNum = block.number - 1;
let count = 1;
const len = this.state.blockList.length;
for (let i = 0; count < 18; i++, nextBlockNum--, count++) {
for (let i = 0; count < this.state.maxBlockNum; i++, nextBlockNum--, count++) {
if (i < len && this.state.blockList[i].number == nextBlockNum) {
blockList.push(this.state.blockList[i]);
continue;
Expand Down Expand Up @@ -101,10 +102,13 @@ export default class BlocksTable extends Component {
const localTime = utils.getValidTime(record.timestamp);
return (<div>
<div>
{T('矿工') + ' '}<font style={{color: '#5c67f2'}}>{record.miner}</font>
{T('出块时间 ')}{localTime}
</div>
<div>
<font style={{color: '#5c67f2'}}>{record.txn}{T('条交易')}</font>{T('发生于')}{localTime}
{T('矿工 ') + ' '}<font style={{color: '#5c67f2'}}>{record.miner}</font>
</div>
<div>
{T('交易量 ') + ' '}<font style={{color: '#5c67f2'}}>{record.txn}{T('条')}</font>
</div>
</div>);
}
Expand Down Expand Up @@ -137,8 +141,9 @@ export default class BlocksTable extends Component {
<Table.Column title={T("区块大小(B)")} dataIndex="size" width={100}/>
<Table.Column title={T("生产者")} dataIndex="miner" width={100} /> */}
</Table>

<Button type='primary'
style={{width: '100%', height: '40px', background: 'rgb(239,240,255)', color: '#5c67f2'}}
style={{width: '100%', height: '40px', marginTop: '5px', background: 'rgb(239,240,255)', color: '#5c67f2'}}
onClick={() => {
this.setState({blockListVisible: true});
}}>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
/* eslint no-mixed-operators:0 */
import React, { Component } from 'react';
import * as oexchain from 'oex-web3';

import TransactionList from '../../../../TransactionList';
import eventProxy from '../../../../utils/eventProxy';
Expand All @@ -12,26 +11,32 @@ export default class TransactionsTable extends Component {
super(props);

this.state = {
blockHashSet: {},
txHashSet: {},
maxTxNum: 13,
txHashArr: [],
current: 1,
assetInfos: {},
txFrom: { txHashArr: [], maxTxNum: 0, fromHomePage: true },
intervalId: 0,
transactions: [],
};
}

componentDidMount() {
eventProxy.on('updateBlocks', (blocks) => {
const maxTxNum = 13;
let txHashArr = [];
for (let i = 0; i < blocks.length; i++) {
txHashArr.push(...blocks[i].transactions);
if (txHashArr.length > maxTxNum) {
txHashArr = txHashArr.slice(0, maxTxNum);
break;
if (this.state.blockHashSet[blocks[i].number] == null) {
txHashArr.push(...blocks[i].transactions);
this.state.blockHashSet[blocks[i].number] = 1;
if (txHashArr.length > this.state.maxTxNum) {
txHashArr = txHashArr.slice(0, this.state.maxTxNum);
break;
}
}
}
this.setState({txFrom: { txHashArr, maxTxNum, fromHomePage: true }});
this.setState({txFrom: { txHashArr, maxTxNum: this.state.maxTxNum, fromHomePage: true }});
});
}

Expand Down

0 comments on commit 33b10cc

Please sign in to comment.