github.com/shyftnetwork/go-empyrean@v1.8.3-0.20191127201940-fbfca9338f04/shyftBlockExplorerUI/src/components/table/blocks/blocksMined.js (about) 1 import React, { Component } from 'react'; 2 import MinedBlockTable from './blocksMinedTable'; 3 import classes from './table.css'; 4 import ErrorMessage from './errorMessage'; 5 6 class BlocksMinedTable extends Component { 7 constructor(props) { 8 super(props); 9 this.state = { 10 data: [] 11 }; 12 } 13 14 render() { 15 const table = this.props.data.map((data, i) => { 16 const conversion = data.Rewards / 10000000000000000000; 17 return <MinedBlockTable 18 key={`${data.Hash}${i}`} 19 Hash={data.Hash} 20 Number={data.Number} 21 Coinbase={data.Coinbase} 22 AgeGet={data.AgeGet} 23 GasUsed={data.GasUsed} 24 GasLimit={data.GasLimit} 25 UncleCount={data.UncleCount} 26 TxCount={data.TxCount} 27 Reward={conversion} 28 detailBlockHandler={this.props.detailBlockHandler} 29 getBlocksMined={this.props.getBlocksMined} 30 /> 31 }); 32 33 let combinedClasses = ['responsive-table', classes.table]; 34 return ( 35 <div> 36 { 37 this.props.data.length > 0 ? 38 <table className={combinedClasses.join(' ')}> 39 <thead> 40 <tr> 41 <th scope="col" className={classes.thItem}> Height </th> 42 <th scope="col" className={classes.thItem}> Block Hash </th> 43 <th scope="col" className={classes.thItem}> Age </th> 44 <th scope="col" className={classes.thItem}> Txn </th> 45 <th scope="col" className={classes.thItem}> Uncles </th> 46 <th scope="col" className={classes.thItem}> Coinbase </th> 47 <th scope="col" className={classes.thItem}> GasUsed </th> 48 <th scope="col" className={classes.thItem}> GasLimit </th> 49 <th scope="col" className={classes.thItem}> Avg.GasPrice </th> 50 <th scope="col" className={classes.thItem}> Reward </th> 51 </tr> 52 </thead> 53 {table} 54 </table> 55 : <ErrorMessage /> 56 } 57 </div> 58 ); 59 } 60 } 61 export default BlocksMinedTable;