text: (this.webpackJsonpjornalcripto=this.webpackJsonpjornalcripto||[]).push([[0],{31:function(t,e,n){},33:function(t,e,n){},34:function(t,e,n){},35:function(t,e,n){},36:function(t,e,n){"use strict";n.r(e);var a,r=n(0),i=n.n(r),s=n(14),c=n.n(s),o=n(6),l=n.n(o),h=n(7),u=n(2),d=n(3),p=n(5),b=n(4),f=n(15),m=n(16),j=Object(m.a)(a||(a=Object(f.a)(["\n* {\n  \n}\nbody, html {\n  min-height: 100%;\n  min-width: 100%;\n  margin 0px;  \n}\n\n#root, #root > div{\n  position:fixed;\n  background-color: #14143c;\n  height: 100%;\n  width: 100%;\n}\n\nheader {\n  display: inline-block;\n  background-color: #0000009e;\n  height: 60px;\n  min-width:100%;\n  margin: 0px;\n  flex: 0 0 100%;\n}\n\n.main-content{\npadding-top: 2em;\ndisplay: flex;\nflex-wrap: wrap;\njustify-content: flex-start;\nalign-items: flex-start;\n}\n"]))),y=n(20),v=n(11),O=n.n(v),g=n(21),x=n.n(g),C=(n(31),n(1)),k=function(t){Object(p.a)(n,t);var e=Object(b.a)(n);function n(t){var a;return Object(u.a)(this,n),(a=e.call(this,t)).styledColor="#fff",a.lineColor="#accfe0",a.fontFamily="monospace",a.handleChart=a.props.click,a.state={chartOptions:{title:{text:a.props.data.crypto,style:{fontFamily:a.fontFamily,color:a.styledColor}},chart:{legend:"none",width:"700",height:"350",zoomType:"xy",backgroundColor:"#14143c",borderColor:"#2e303c",borderWidth:1},xAxis:{type:"datetime",labels:{style:{fontFamily:a.fontFamily,color:a.styledColor}},title:{text:a.props.data.interval,style:{fontFamily:a.fontFamily,color:a.styledColor}}},yAxis:{tickInterval:.1,labels:{align:"left",reserveSpace:!0,style:{fontFamily:a.fontFamily,color:a.styledColor}},title:{text:"Pre\xe7o",style:{fontFamily:a.fontFamily,color:a.styledColor},labels:{style:{fontFamily:a.fontFamily,color:a.styledColor}}},style:{fontFamily:a.fontFamily,color:a.styledColor}},series:[{type:"line",threshold:a.threshould,negativeColor:a.negativeLineColor,color:a.lineColor,data:[],marker:{enabled:!1}}]}},a}return Object(d.a)(n,[{key:"updateChart",value:function(){var t,e=[],n=Object(y.a)(this.props.data.chartinfo);try{for(n.s();!(t=n.n()).done;){var a=t.value;e.push([parseInt(a[6])-10899999,parseFloat(a[4])])}}catch(r){n.e(r)}finally{n.f()}this.setState({chartOptions:{title:{text:this.props.data.crypto},xAxis:{title:{text:this.props.data.interval}},series:[{data:e}]}})}},{key:"componentDidMount",value:function(){this.updateChart()}},{key:"render",value:function(){var t=this.state.chartOptions;return Object(C.jsxs)("div",{className:"chart",children:[Object(C.jsx)("button",{onClick:this.handleChart.bind(this),className:"time-btn",value:"15m",name:"100",symbol:this.props.data.crypto,children:"15M"}),Object(C.jsx)("button",{onClick:this.handleChart.bind(this),className:"time-btn",value:"1h",name:"24",symbol:this.props.data.crypto,children:"1H"}),Object(C.jsx)("button",{onClick:this.handleChart.bind(this),className:"time-btn",value:"4h",name:"42",symbol:this.props.data.crypto,children:"4H"}),Object(C.jsx)("button",{onClick:this.handleChart.bind(this),className:"time-btn",value:"1d",name:"31",symbol:this.props.data.crypto,children:"1D"}),Object(C.jsx)(x.a,{highcharts:O.a,options:t})]})}}]),n}(r.Component),F=n(23),w=n(22);function P(){var t=i.a.useState(new Date),e=Object(F.a)(t,2),n=e[0],a=e[1];return i.a.useEffect((function(){var t=setInterval((function(){a(new Date)}),1e3);return function(){clearInterval(t)}})),Object(C.jsxs)("div",{className:"mini-clock-area",children:[Object(C.jsx)(w.a,{className:"mini-clock-icon"}),Object(C.jsx)("p",{className:"time",children:n.toLocaleTimeString()})]})}n(33);var N=function(t){Object(p.a)(n,t);var e=Object(b.a)(n);function n(t){var a;return Object(u.a)(this,n),(a=e.call(this,t)).handleChart=a.props.click,a.state={data:a.props.data.data,doneFilter:!1},a.higherCryptos=[],a.lowerCryptos=[],a}return Object(d.a)(n,[{key:"handleClick",value:function(t){var e=t.currentTarget;this.props.click(e.value,e.name)}},{key:"LowerPercentOnTop",value:function(t){var e=[];return t.forEach((function(t){e.push(t)})),e.sort((function(t,e){return parseFloat(t.priceChangePercent)-parseFloat(e.priceChangePercent)})),e}},{key:"HigherPercentOnTop",value:function(t){var e=[];return t.forEach((function(t){e.push(t)})),e.sort((function(t,e){var n=parseFloat(t.priceChangePercent);return parseFloat(e.priceChangePercent)-n})),e}},{key:"getFirstElements",value:function(t){for(var e=[],n=0;n<=5;n++)e.push(t[n]);return e}},{key:"componentDidMount",value:function(){this.higherCryptos=this.getFirstElements(this.HigherPercentOnTop(this.state.data)),this.lowerCryptos=this.getFirstElements(this.LowerPercentOnTop(this.state.data)),this.setState({doneFilter:!0})}},{key:"render",value:function(){var t=this;return Object(C.jsxs)(r.Fragment,{children:[Object(C.jsx)("ul",{className:"list",children:this.higherCryptos.map((function(e,n){return Object(C.jsx)("button",{className:"btn-positive",value:t.props.data.interval,name:t.props.data.limit,symbol:e.symbol,onClick:t.handleChart.bind(t),children:"".concat(e.symbol,": + ").concat(e.priceChangePercent)},n)}))}),Object(C.jsx)("ul",{className:"list",children:this.lowerCryptos.map((function(e,n){return Object(C.jsx)("button",{className:"btn-negative",value:t.props.data.interval,name:t.props.data.limit,symbol:e.symbol,onClick:t.handleChart.bind(t),children:"".concat(e.symbol,":  ").concat(e.priceChangePercent)},e.symbol)}))})]})}}]),n}(i.a.Component),T=function(){function t(){Object(u.a)(this,t),this._cryptos=[]}return Object(d.a)(t,[{key:"getData",value:function(){var t=this;return new Promise((function(e,n){fetch("https://api.binance.com/api/v3/ticker/24hr?").then((function(t){return t.json()})).then((function(n){return t._cryptos=t.symbolFilter(n),e(t._cryptos)})).catch((function(t){return console.log(t)}))}))}},{key:"symbolFilter",value:function(t){var e=[];return t.forEach((function(t,n){(t.symbol.endsWith("BRL")||t.symbol.endsWith("USDT")&&!t.symbol.match("DOWN")&&!t.symbol.match("UP")&&"0.00000000"!==t.askPrice&&"0.00"!==t.askPrice)&&e.push(t)})),e}}]),t}(),D=function(){function t(){Object(u.a)(this,t),this._chartinfo=[],this.data=[]}return Object(d.a)(t,[{key:"getData",value:function(t,e,n){var a=this;return new Promise((function(r,i){fetch("https://api.binance.com/api/v3/klines?"+new URLSearchParams({symbol:t,interval:e,limit:n})).then((function(t){return t.json()})).then((function(t){return a._chartinfo=t,r(a._chartinfo)})).catch((function(t){return console.log(t)}))}))}}]),t}(),E=(n(34),function(t){Object(p.a)(n,t);var e=Object(b.a)(n);function n(t){var a;return Object(u.a)(this,n),(a=e.call(this,t)).handleChart=a.props.click,a.unaltededData=a.props.data.data,a.state={data:a.props.data.data,selectedFilter:!1},a}return Object(d.a)(n,[{key:"HigherOnTop",value:function(t,e){var n=[];return t.forEach((function(t){n.push(t)})),n.sort((function(t,n){var a=parseFloat(t[e]);return parseFloat(n[e])-a})),n}},{key:"LowerOnTop",value:function(t,e){var n=[];return t.forEach((function(t){n.push(t)})),n.sort((function(t,n){return parseFloat(t[e])-parseFloat(n[e])})),n}},{key:"toggleButton",value:function(){var t=Object(h.a)(l.a.mark((function t(e){var n,a,r;return l.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:n=!1===this.state.selectedFilter?null:!this.state.selectedFilter,this.setState({selectedFilter:n}),!0===this.state.selectedFilter?(a=this.LowerOnTop(this.state.data,e.target.value),this.setState({data:a})):null===this.state.selectedFilter?(r=this.HigherOnTop(this.state.data,e.target.value),this.setState({data:r})):this.setState({data:this.unaltededData});case 3:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}()},{key:"render",value:function(){var t=this;return Object(C.jsxs)("div",{className:"main-table",children:[Object(C.jsxs)("li",{className:"title-container",children:[Object(C.jsx)("button",{className:"title-btn",children:"PAR"}),Object(C.jsx)("button",{className:"title-btn",onClick:this.toggleButton.bind(this),value:"priceChangePercent",children:"VARIA\xc7\xc3O 24Hrs"}),Object(C.jsx)("button",{className:"title-btn",onClick:this.toggleButton.bind(this),value:"lastPrice",children:"PRE\xc7O ATUAL"}),Object(C.jsx)("button",{className:"title-btn",onClick:this.toggleButton.bind(this),value:"highPrice",children:"MAIOR PRE\xc7O"}),Object(C.jsx)("button",{className:"title-btn",onClick:this.toggleButton.bind(this),value:"lowPrice",children:"MENOR PRE\xc7O"})]}),Object(C.jsx)("div",{className:"item-list",children:this.state.data.map((function(e,n){return Object(C.jsxs)("button",{className:"crypto-container",onClick:t.handleChart.bind(t),value:t.props.data.interval,name:t.props.data.limit,symbol:e.symbol,children:[Object(C.jsxs)("p",{children:[" ","".concat(e.symbol)]}),Object(C.jsxs)("p",{children:[" ","".concat(e.priceChangePercent.slice(0,-1),"%")]}),Object(C.jsxs)("p",{children:[" ","".concat(e.lastPrice.slice(0,-2))]}),Object(C.jsxs)("p",{children:[" ","".concat(e.highPrice.slice(0,-6))]}),Object(C.jsxs)("p",{children:[" ","".concat(e.lowPrice.slice(0,-6))]})]},e.symbol)}))})]})}}]),n}(r.Component)),S=(n(35),function(t){Object(p.a)(n,t);var e=Object(b.a)(n);function n(){return Object(u.a)(this,n),e.apply(this,arguments)}return Object(d.a)(n,[{key:"render",value:function(){return Object(C.jsx)("div",{class:"loader"})}}]),n}(i.a.Component)),I=function(t){Object(p.a)(n,t);var e=Object(b.a)(n);function n(t){var a;return Object(u.a)(this,n),(a=e.call(this,t)).child=i.a.createRef(),a.Ticker24Hr=new T,a.ChartInfo=new D,a._refreshTime=null,a.state={data:null,chartinfo:null,crypto:"ETHBRL",interval:"1h",limit:"24"},a}return Object(d.a)(n,[{key:"handleChart",value:function(){var t=Object(h.a)(l.a.mark((function t(e){var n=this;return l.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(e.target.interval===this.state.interval){t.next=3;break}return t.next=3,this.setState({interval:e.target.value,limit:e.target.name,crypto:e.target.attributes.symbol.value});case 3:return t.next=5,this.ChartInfo.getData(this.state.crypto,this.state.interval,this.state.limit).then((function(t){n.setState({chartinfo:t}),n.child.current.updateChart()})).catch((function(t){return console.log(t)}));case 5:clearInterval(this._refreshTime);case 6:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}()},{key:"componentDidMount",value:function(){var t=Object(h.a)(l.a.mark((function t(){var e=this;return l.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.Ticker24Hr.getData().then((function(t){e.setState({data:t})})).catch((function(t){return console.log(t)}));case 2:return t.next=4,this.ChartInfo.getData(this.state.crypto,this.state.interval,this.state.limit).then((function(t){e.setState({chartinfo:t})})).catch((function(t){return console.log(t)}));case 4:this._refreshTime=setInterval((function(){e.Ticker24Hr.getData(),e.ChartInfo.getData(e.state.crypto,e.state.interval,e.state.limit)}),3e4);case 5:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}()},{key:"render",value:function(){var t=this;return this.state.data&&this.state.chartinfo?Object(C.jsxs)(r.Fragment,{children:[Object(C.jsxs)("header",{children:[Object(C.jsx)(N,{data:this.state,click:function(e){return t.handleChart(e)}}),Object(C.jsx)(P,{})]}),Object(C.jsxs)("div",{className:"main-content",children:[Object(C.jsx)(k,{data:this.state,click:function(e){return t.handleChart(e)},ref:this.child}),Object(C.jsx)(E,{data:this.state,click:function(e){return t.handleChart(e)}})]}),Object(C.jsx)(j,{})]}):Object(C.jsx)(S,{})}}]),n}(r.Component);c.a.render(Object(C.jsx)(I,{}),document.getElementById("root"))}},[[36,1,2]]]);
  //# sourceMappingURL=main.080b8588.chunk.js.map