Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import React, { Component } from 'react'
- import logo from '../kepeng.png';
- import ListTransaction from '../API/ListTransaction'
- import DetailTransaction from '../API/DetailTransaction'
- const navDashboard = {
- 'textAlign': 'left'
- }
- const imageResponsive = {
- 'minWidth': '95px',
- 'float': 'none',
- 'margin': 'auto',
- 'position': 'relative',
- 'top': '-10px'
- }
- const h2xLarge = {
- 'fontSize': 'x-large'
- }
- const tileItem = {
- 'height': '165px',
- 'textAlign': '-webkit-right',
- 'textAlign': 'right'
- }
- const tileInfo = {
- 'color': '#ffffff'
- }
- const tdAlign = {
- 'margin': 'auto'
- }
- const contentHeader = {
- 'top': '-15px',
- 'padding': '0'
- }
- const widgetUser = {
- 'height': '100%',
- 'maxHeight': '55px'
- }
- const contentWrapper = {
- 'marginLeft': '0'
- }
- const aHref = {
- 'cursor': 'pointer'
- }
- const tdStyle = {
- 'color': 'rgb(128, 128, 128)',
- 'fontSize': 'small'
- }
- export default class SocialWidget extends Component {
- constructor(props) {
- super(props)
- this.state = {
- ListTransaction: ''
- }
- }
- componentDidMount() {
- setInterval(() => {
- ListTransaction()
- .then((response) => response.json())
- .then((responseJson) => {
- var result = responseJson.result
- this.setState({ ListTransaction: result })
- })
- }, 1000)
- }
- DetailTransaction (e) {
- console.log('Clicked', e)
- }
- duration(minDateTimes, maxDateTimes) {
- var mintime = new Date((parseInt(minDateTimes)))
- var maxtime = new Date()
- // console.log(maxtime)
- let date1 = mintime.toISOString()
- let date2 = maxtime.toISOString()
- date1 = new Date(date1.toString())
- date2 = new Date(date2.toString())
- var e1 = Math.round(date1 / 1000)
- var e2 = Math.round(date2 / 1000)
- var diff = e2 - e1
- // console.log(diff)
- var str = ''
- if (diff < 0) {
- diff = (diff + 86400)
- str += (Math.floor(diff / 3600)) + 'j '
- diff = diff % 3600
- str += (Math.floor(diff / 60)) + 'm'
- } else {
- str += (Math.floor(diff / 86400)) + '[D] '
- diff = diff % 86400
- str += (Math.floor(diff / 3600)) + '[H] '
- diff = diff % 3600
- str += (Math.floor(diff / 60)) + '[M] '
- diff = diff % 60
- str += (Math.floor(diff / 1)) + '[S] '
- }
- // diff = diff / 1000
- return str
- }
- ellipsis(str) {
- str = str.substring(0, 26) + '...'
- return str
- }
- countGas(gasLim, gasUsed) {
- const gasValue = gasLim * gasUsed
- return gasValue
- }
- render() {
- return (
- // start root
- <div>
- {/* start warpper */}
- <div className="content-wrapper" style={contentWrapper}>
- {/* start content */}
- <section className="content">
- {/* start nav-tabs-custom */}
- <div className="nav-tabs-custom">
- <ul className="nav nav-tabs">
- <li className="active"><a href="#tab_1" data-toggle="tab">Dashboard</a></li>
- <li><a href="#tab_2" data-toggle="tab">Chart</a></li>
- </ul>
- {/* start tab-content */}
- <div className="tab-content">
- <div className="tab-pane active fade-in" id="tab_1">
- {/* start row */}
- <div className="row">
- {/* start col */}
- <div className="col-md-3">
- {/* start box box-widget */}
- <div className="box box-widget widget-user-2">
- {/* Add the bg color to the header using any of the bg-* classes */}
- <div className="widget-user-header bg-aqua-active">
- {/* start widget-user-image */}
- <div className="widget-user-image" style={widgetUser}>
- <img className="img-responsive" src={logo} alt="User Avatar" style={imageResponsive} />
- </div><br />
- {/* end widget-user-image */}
- {/* <h3 className="widget-user-username" style={textAlignLeft}><b>Kepeng (K)</b></h3>
- <h4 className="widget-user-desc" style={widgetUserDesc}>
- <b>1,242.</b>79624002 IDR
- </h4>
- <h4 className="widget-user-desc" style={widgetUserDesc}><b>0.</b>00002477 BTC</h4> */}
- </div>
- {/* start box-footer no-padding */}
- <div className="box-footer no-padding">
- <ul className="nav nav-stacked">
- <li style={navDashboard}><a href="#">Coin Name: <span className="pull-right badge bg-blue"><b>Kepeng (K)</b></span></a></li>
- <li style={navDashboard}><a href="#">Sale per coin: <span className="pull-right badge bg-blue"><b>1,242.</b>79624002 IDR</span></a></li>
- <li style={navDashboard}><a href="#">Purchase per coin: <span className="pull-right badge bg-blue"><b>0.</b>00002477 BTC</span></a></li>
- <li style={navDashboard}><a href="#">Market Cap: <span className="pull-right badge bg-blue"><b>5,717,386,802</b> IDR</span></a></li>
- <li style={navDashboard}><a href="#">Volume (24h): <span className="pull-right badge bg-aqua"><b>717,607</b> IDR</span></a></li>
- <li style={navDashboard}><a href="#">Change (24h): <span className="pull-right badge bg-green">+<b>3.</b><small>34%</small></span></a></li>
- </ul>
- </div>
- {/* end box-footer no-padding */}
- </div>
- {/* end box box-widget */}
- </div>
- {/* end col */}
- <div className="col-md-2">
- <div className="tile-item tile-primary" style={tileItem}>
- <div className="tile-bubbles"></div>
- <h1 className="tile-title">Last Block Found</h1>
- <h6 className="tile-info"><a style={tileInfo}><b>1540501</b></a></h6>
- </div>
- </div>
- <div className="col-md-2">
- <div className="tile-item tile-primary" style={tileItem}>
- <div className="tile-bubbles"></div>
- <h1 className="tile-title">Circulation Supply</h1>
- <h6 className="tile-info"><b>4,600,422 D</b></h6>
- </div>
- </div>
- <div className="col-md-2">
- <div className="tile-item tile-primary" style={tileItem}>
- <div className="tile-bubbles"></div>
- <h1 className="tile-title">Masternodes</h1>
- <h6 className="tile-info"><a style={tileInfo}>119</a></h6>
- </div>
- </div>
- <div className="col-md-3">
- <div className="tile-item tile-primary" style={tileItem}>
- <div className="tile-bubbles"></div>
- <h1 className="tile-title">Masternodes Cost</h1>
- <h6 className="tile-info"><b>6,213,981.2</b>0 <b>IDR</b></h6><br />
- <span>5,000 D</span>
- </div>
- </div>
- <div className="col-md-2">
- <div className="tile-item tile-primary" style={tileItem}>
- <div className="tile-bubbles"></div>
- <h1 className="tile-title">Coins Locked</h1>
- <h6 className="tile-info"><b>595,000 D</b></h6><br />
- <span><b>12</b>.93 % of the supply</span>
- </div>
- </div>
- <div className="col-md-2">
- <div className="tile-item tile-primary" style={tileItem}>
- <div className="tile-bubbles"></div>
- <h1 className="tile-title">PoW Difficulty</h1>
- <h6 className="tile-info"><b>4,920.</b> 44254063</h6>
- </div>
- </div>
- <div className="col-md-2">
- <div className="tile-item tile-primary" style={tileItem}>
- <div className="tile-bubbles"></div>
- <h1 className="tile-title">PoS Difficulty</h1>
- <h6 className="tile-info"><b>0.</b> 00024414</h6>
- </div>
- </div>
- <div className="col-md-3">
- <div className="tile-item tile-primary" style={tileItem}>
- <div className="tile-bubbles"></div>
- <h1 className="tile-title">Stake Weight Spent</h1>
- <h6 className="tile-info"><b>99</b></h6>
- <span>Last 100 PoS blocks AVG</span>
- </div>
- </div>
- <div className="col-md-12">
- <div className="tile-item tile-primary" style={tileItem}>
- <div className="tile-bubbles"></div>
- <h1 className="tile-title">Peers Info</h1>
- <span>22 active Connections</span>
- </div>
- </div>
- </div>
- {/* end row */}
- {/* start row */}
- <div className="row">
- {/* start col */}
- <div className="col-xs-12 col-sm-12 col-md-12">
- {/* start content-header */}
- <section className="content-header" style={contentHeader}>
- {/* start box */}
- <div className="box">
- {/* start box-header */}
- <div className="box-header">
- <h3 className="box-title pull pull-left" style={h2xLarge}><b>Blocks</b></h3>
- </div>
- {/* end box-header */}
- {/* start box-body */}
- <div className="box-body">
- {/* start table-responsive */}
- <div className="table-responsive">
- <table id="example2" className="table table-bordered">
- <thead>
- <tr>
- <th>Height</th>
- <th>Age</th>
- <th>Txs</th>
- <th>Difficult</th>
- <th>Proof-Type</th>
- <th>Block Size</th>
- <th>Extracted by</th>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td><a>1540501</a></td>
- <td>1 week</td>
- <td>2</td>
- <td><b>4,920.</b>44254063</td>
- <td><span className="btn btn-default" style={tdAlign}>PoW</span></td>
- <td><b>435</b>B</td>
- <td><a>DRN58D1XeKFZpxCVDfpxy6AGdGjHhQfnDC</a></td>
- </tr>
- <tr>
- <td><a>1540500</a></td>
- <td>1 week</td>
- <td>6</td>
- <td><b>4,920.</b>44254063</td>
- <td><span className="btn btn-primary" style={tdAlign}>PoS</span></td>
- <td><b>123</b>kB</td>
- <td><a>DJRMtgTF7PDX3nCSRDDuLxYSbuzw8JEHpu</a></td>
- </tr>
- <tr>
- <td><a>1540499</a></td>
- <td>1 week</td>
- <td>2</td>
- <td><b>2,733.</b>57779737</td>
- <td><span className="btn btn-default" style={tdAlign}>PoW</span></td>
- <td><b>434</b>B</td>
- <td><a>DRN58D1XeKFZpxCVDfpxy6AGdGjHhQfnDC</a></td>
- </tr>
- <tr>
- <td><a>1540498</a></td>
- <td>1 week</td>
- <td>2</td>
- <td><b>2,915.</b>81470881</td>
- <td><span className="btn btn-default" style={tdAlign}>PoW</span></td>
- <td><b>434</b>B</td>
- <td><a>DRN58D1XeKFZpxCVDfpxy6AGdGjHhQfnDC</a></td>
- </tr>
- <tr>
- <td><a>1540497</a></td>
- <td>1 week</td>
- <td>2</td>
- <td><b>1,555.</b>10061496</td>
- <td><span className="btn btn-default" style={tdAlign}>PoW</span></td>
- <td><b>435</b>B</td>
- <td><a>DRN58D1XeKFZpxCVDfpxy6AGdGjHhQfnDC</a></td>
- </tr>
- </tbody>
- </table>
- </div>
- {/* end table-responsive */}
- </div>
- {/* end box-body */}
- </div>
- {/* end box */}
- </section>
- {/* end content-header */}
- </div>
- {/* end col */}
- {/* start col */}
- <div className="col-xs-12 col-sm-12 col-md-12">
- {/* start content-header */}
- <section className="content-header" style={contentHeader}>
- {/* start box */}
- <div className="box">
- {/* start box-header */}
- <div className="box-header">
- <h3 className="box-title pull pull-left" style={h2xLarge}><b>Transactions</b></h3>
- </div>
- {/* end box-header */}
- {/* start box-body */}
- <div className="box-body">
- {/* start table-responsive */}
- <div className="table-responsive">
- <table id="example2" className="table table-bordered">
- <thead>
- <tr>
- <th>TxHash</th>
- <th>Block</th>
- <th>Age</th>
- <th>From</th>
- <th>To</th>
- <th>Value</th>
- <th><small>[TxFree]</small></th>
- </tr>
- </thead>
- <tbody>
- {this.state.ListTransaction ?
- this.state.ListTransaction.map((list, i) => {
- return (
- <tr>
- <td><a onClick={this.DetailTransaction.bind(this)} style={aHref}>{this.ellipsis(list.hash)}</a></td>
- <td>{list.blockNumber}</td>
- <td>{this.duration(list.timeStamp)}</td>
- <td><a style={aHref}>{this.ellipsis(list.from)}</a></td>
- <td><a style={aHref}>{this.ellipsis(list.to)}</a></td>
- <td>{list.value} Ether</td>
- <td style={tdStyle}><small>{this.countGas(list.gas, list.gasUsed)}</small></td>
- </tr>
- )
- })
- : null
- }
- </tbody>
- </table>
- </div>
- {/* end table-responsive */}
- </div>
- {/* end box-body */}
- </div>
- {/* end box */}
- </section>
- {/* end content-header */}
- </div>
- {/* end col */}
- </div>
- {/* end row */}
- </div>
- <div className="tab-pane fade-in" id="tab_2">
- The European languages are members of the same family. Their separate existence is a myth.
- For science, music, sport, etc, Europe uses the same vocabulary. The languages only differ
- in their grammar, their pronunciation and their most common words. Everyone realizes why a
- new common language would be desirable: one could refuse to pay expensive translators. To
- achieve this, it would be necessary to have uniform grammar, pronunciation and more common
- words. If several languages coalesce, the grammar of the resulting language is more simple
- and regular than that of the individual languages.
- </div>
- </div>
- </div>
- {/* end nav-tabs-custom */}
- </section>
- {/* <!-- end content --> */}
- </div>
- {/* end content-wrapper */}
- </div>
- // end root
- )
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment