-
Notifications
You must be signed in to change notification settings - Fork 13
/
block.52e5781a049e4339545d.js
1 lines (1 loc) · 5.23 KB
/
block.52e5781a049e4339545d.js
1
"use strict";(this.webpackChunkBitShares2_light=this.webpackChunkBitShares2_light||[]).push([[366],{14116:(e,t,n)=>{n.r(t),n.d(t,{default:()=>_});var s=n(96540),o=n(77157),l=n(57127),r=n(5556),a=n.n(r),c=n(31267),i=n(9404),p=n.n(i),h=n(6882),m=n(45218),u=n(80849),d=n.n(u),b=n(12569),g=n(72342),k=n(44068),E=n(56848);class x extends s.Component{shouldComponentUpdate(e){return e.block.id!==this.props.block.id}render(){let{block:e}=this.props,t=null;return t=[],e.transactions.length>0&&(t=[],e.transactions.forEach(((n,o)=>{t.push(s.createElement(E.Hg,{key:o,id:`tx_${o}`,name:`tx_${o}`},s.createElement(m.A,{block:e,key:o,trx:n,index:o})))}))),s.createElement("div",null,t)}}class y extends s.Component{static propTypes={dynGlobalObject:b.A.ChainObject.isRequired,blocks:a().object.isRequired,height:a().number.isRequired};static defaultProps={dynGlobalObject:"2.1.0",blocks:{},height:1};constructor(e){super(e),this.state={showInput:!1},this.scrollToTop=this.scrollToTop.bind(this)}componentDidMount(){this._getBlock(this.props.height),E.sV.scrollEvent.register("begin",(()=>{})),E.sV.scrollEvent.register("end",(()=>{this.setState({scrollEnded:!0})}))}UNSAFE_componentWillReceiveProps(e){e.height!==this.props.height&&this._getBlock(e.height)}shouldComponentUpdate(e,t){return!p().is(e.blocks,this.props.blocks)||e.height!==this.props.height||e.dynGlobalObject!==this.props.dynGlobalObject||t.showInput!==this.state.showInput}scrollToTop(){E.Nk.scrollToTop({duration:1500,delay:100,smooth:!0,containerId:"blockContainer"})}_getBlock(e){e&&(e=parseInt(e,10),this.props.blocks.get(e)||h.A.getBlock(e))}_nextBlock(){let e=this.props.match.params.height,t=Math.min(this.props.dynGlobalObject.get("head_block_number"),parseInt(e,10)+1);this.props.history.push(`/block/${t}`)}_previousBlock(){let e=this.props.match.params.height,t=Math.max(1,parseInt(e,10)-1);this.props.history.push(`/block/${t}`)}toggleInput(e){e.preventDefault(),this.setState({showInput:!0})}_onKeyDown(e){e&&13===e.keyCode&&(this.props.history.push(`/block/${e.target.value}`),this.setState({showInput:!1}))}_onSubmit(){const e=this.refs.blockInput.value;e&&this._onKeyDown({keyCode:13,target:{value:e}})}componentDidUpdate(){let{blocks:e}=this.props,t=parseInt(this.props.height,10),n=e.get(t);this.props.scrollToIndex&&!this.state.scrollEnded&&n&&E.XG.scrollTo(`tx_${this.props.scrollToIndex}`,{duration:1500,delay:100,smooth:!0,offset:-100,containerId:"blockContainer"})}render(){const{showInput:e}=this.state;let{blocks:t}=this.props,n=parseInt(this.props.height,10),o=t.get(n),l=e?s.createElement("span",{className:"inline-label"},s.createElement("input",{ref:"blockInput",type:"number",onKeyDown:this._onKeyDown.bind(this)}),s.createElement("button",{onClick:this._onSubmit.bind(this),className:"button"},s.createElement(d(),{content:"explorer.block.go_to"}))):s.createElement("span",null,s.createElement(d(),{style:{textTransform:"uppercase"},component:"span",content:"explorer.block.title"}),s.createElement("a",{onClick:this.toggleInput.bind(this)}," #",n));return s.createElement("div",{className:"grid-block page-layout"},s.createElement("div",{className:"grid-block main-content"},s.createElement("div",{className:"grid-content",id:"blockContainer"},s.createElement("div",{className:"grid-content no-overflow medium-offset-2 medium-8 large-offset-3 large-6 small-12"},s.createElement("h4",{className:"text-center"},l),s.createElement("ul",null,s.createElement("li",null,s.createElement(d(),{component:"span",content:"explorer.block.date"}),":"," ",o?s.createElement(c.XU,{value:o.timestamp,format:"full"}):null),s.createElement("li",null,s.createElement(d(),{component:"span",content:"explorer.block.witness"}),":"," ",o?s.createElement(k.A,{witness:o.witness}):null),s.createElement("li",null,s.createElement(d(),{component:"span",content:"explorer.block.previous"}),": ",o?o.previous:null),s.createElement("li",null,s.createElement(d(),{component:"span",content:"explorer.block.transactions"}),": ",o?o.transactions.length:null)),s.createElement("div",{className:"clearfix",style:{marginBottom:"1rem"}},s.createElement("div",{className:"button float-left outline",onClick:this._previousBlock.bind(this)},"←"),s.createElement("div",{className:"button float-right outline",onClick:this._nextBlock.bind(this)},"→")),o?s.createElement(x,{block:o}):null,s.createElement("div",{style:{textAlign:"center",marginBottom:20}},s.createElement("a",{onClick:this.scrollToTop},s.createElement(d(),{content:"global.return_to_top"})))))))}}const v=(0,g.A)(y);function f(){return f=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e},f.apply(this,arguments)}class I extends s.Component{render(){let e=parseInt(this.props.match.params.height,10),t=this.props.match.params.txIndex?parseInt(this.props.match.params.txIndex):0;return s.createElement(l.A,{stores:[o.A],inject:{blocks:()=>o.A.getState().blocks}},s.createElement(v,f({},this.props,{height:e,scrollToIndex:t})))}}const _=I},44068:(e,t,n)=>{n.d(t,{A:()=>c});var s=n(96540),o=n(12569),l=n(72342),r=n(63024);class a extends s.Component{static propTypes={witness:o.A.ChainObject.isRequired};render(){let e=this.props.witness.get("witness_account");return s.createElement(r.A,{account:e})}}const c=a=(0,l.A)(a)}}]);