dappros/ethora

View on GitHub
client-web/build-prod/static/js/526.44a2029e.chunk.js

Summary

Maintainability
A
0 mins
Test Coverage
"use strict";(self.webpackChunkweb_app=self.webpackChunkweb_app||[]).push([[526],{97526:function(e,t,n){n.r(t),n.d(t,{default:function(){return W}});var r=n(74165),a=n(15861),s=n(70885),i=n(72791),c=n(20803),l=n(47409),o=n(20601),d=n(85847),p=n(82839),h=n(90466),u=n(12891),x=n(35667),f=n(53628),m=n(74142),j=n(96580),g=n(24177),v=n(80184);function y(e){var t=e.apps,n=e.currentAppIndex,c=(0,i.useState)(0),y=(0,s.Z)(c,2),Z=y[0],k=y[1],b=(0,m.Z)(),w=(0,i.useState)([]),C=(0,s.Z)(w,2),I=C[0],D=C[1],z=(0,i.useState)(!1),N=(0,s.Z)(z,2),T=N[0],K=N[1],S=function(){var e=(0,a.Z)((0,r.Z)().mark((function e(){var a,s;return(0,r.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return K(!0),e.prev=1,e.next=4,l.IW(t[n].appToken).get("users/count");case 4:return a=e.sent,k(a.data.count),e.next=8,l.IW(t[n].appToken).get("users/graph");case 8:s=e.sent,D((0,g.F7)(s.data)),e.next=15;break;case 12:e.prev=12,e.t0=e.catch(1),console.log(e.t0);case 15:K(!1);case 16:case"end":return e.stop()}}),e,null,[[1,12]])})));return function(){return e.apply(this,arguments)}}();return(0,i.useEffect)((function(){S()}),[t,n]),T?(0,v.jsx)("div",{className:"dashboard-graph",style:{marginRight:"10px",justifyContent:"center",alignItems:"center"},children:(0,v.jsx)(j.Z,{})}):(0,v.jsxs)("div",{className:"dashboard-graph",style:{marginRight:"10px"},children:[(0,v.jsxs)("a",{className:"title",onClick:function(e){return e.preventDefault()},href:"/",children:["Users ",Z]}),(0,v.jsx)(o.h,{height:"100%",children:(0,v.jsxs)(d.w,{width:500,height:300,data:I,margin:{top:5,right:30,left:20,bottom:5},children:[(0,v.jsx)(p.q,{strokeDasharray:"3 3"}),(0,v.jsx)(h.K,{dataKey:"date"}),(0,v.jsx)(u.B,{dataKey:"y"}),(0,v.jsx)(x.u,{}),(0,v.jsx)(f.x,{type:"monotone",name:"Users",dataKey:"y",stroke:b.palette.primary.main,activeDot:{r:8}})]})})]})}var Z=n(50228),k=n(40508),b=n(70324),w=n(81898),C=n(63381);function I(e){return(0,v.jsx)(Z.Z,{sx:{width:150,marginBottom:"20px"},children:(0,v.jsxs)(w.Z,{fullWidth:!0,children:[(0,v.jsx)(k.Z,{id:"demo-simple-select-label",children:"App"}),(0,v.jsx)(C.Z,{labelId:"demo-simple-select-label",id:"demo-simple-select",value:e.currentAppIndex,label:"App",onChange:function(t){e.setCurrentAppIndex(t.target.value)},children:e.apps.map((function(e,t){return(0,v.jsx)(b.Z,{value:t,children:e.appName},e._id)}))})]})})}var D=n(11210),z=n(36459);function N(e){(0,z.Z)(e);var t=(0,m.Z)();return(0,v.jsxs)("div",{className:"dashboard-graph",style:{marginRight:"10px"},children:[(0,v.jsx)("a",{className:"title",onClick:function(e){return e.preventDefault()},href:"/",children:"Tokens"}),(0,v.jsx)(o.h,{height:"100%",children:(0,v.jsxs)(d.w,{width:500,height:300,data:[],margin:{top:5,right:30,left:20,bottom:5},children:[(0,v.jsx)(p.q,{strokeDasharray:"3 3"}),(0,v.jsx)(h.K,{dataKey:"date"}),(0,v.jsx)(u.B,{dataKey:"y"}),(0,v.jsx)(x.u,{}),(0,v.jsx)(f.x,{type:"monotone",name:"Transactions",dataKey:"y",stroke:t.palette.primary.main,activeDot:{r:8}})]})})]})}function T(e){var t=e.apps,n=e.currentAppIndex,c=(0,i.useState)([]),y=(0,s.Z)(c,2),Z=y[0],k=y[1],b=(0,i.useState)(!1),w=(0,s.Z)(b,2),C=w[0],I=w[1],D=(0,m.Z)(),z=function(){var e=(0,a.Z)((0,r.Z)().mark((function e(){var a;return(0,r.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return I(!0),e.prev=1,e.next=4,l.IW(t[n].appToken).get("explorer/graph");case 4:a=e.sent,k((0,g.F7)(a.data)),e.next=11;break;case 8:e.prev=8,e.t0=e.catch(1),console.log(e.t0);case 11:I(!1);case 12:case"end":return e.stop()}}),e,null,[[1,8]])})));return function(){return e.apply(this,arguments)}}();return(0,i.useEffect)((function(){z()}),[t,n]),C?(0,v.jsx)("div",{className:"dashboard-graph",style:{marginRight:"10px",justifyContent:"center",alignItems:"center"},children:(0,v.jsx)(j.Z,{})}):(0,v.jsxs)("div",{className:"dashboard-graph",style:{marginRight:"10px"},children:[(0,v.jsx)("a",{className:"title",onClick:function(e){return e.preventDefault()},href:"/",children:"Transactions"}),(0,v.jsx)(o.h,{height:"100%",children:(0,v.jsxs)(d.w,{width:500,height:300,data:Z,margin:{top:5,right:30,left:20,bottom:5},children:[(0,v.jsx)(p.q,{strokeDasharray:"3 3"}),(0,v.jsx)(h.K,{dataKey:"date"}),(0,v.jsx)(u.B,{dataKey:"y"}),(0,v.jsx)(x.u,{}),(0,v.jsx)(f.x,{type:"monotone",name:"Transactions",dataKey:"y",stroke:D.palette.primary.main,activeDot:{r:8}})]})})]})}var K=n(8549);function S(e){var t=e.apps,n=e.currentAppIndex,r=(0,i.useState)(0),a=(0,s.Z)(r,2),c=a[0],o=a[1];return(0,i.useEffect)((function(){l.IW(t[n].appToken).get("/explorer/count/contract").then((function(e){o(e.data.count)}))}),[t,n]),(0,v.jsx)("div",{className:"dashboard-graph",style:{marginRight:"10px",display:"flex",flexDirection:"column",justifyContent:"flex-end",width:"100%"},children:(0,v.jsxs)(Z.Z,{sx:{display:"flex",justifyContent:"center",flexDirection:"column",alignItems:"center",height:"100%"},children:[(0,v.jsx)(K.Z,{style:{fontSize:"90px",color:"#604020"},color:"inherit"}),(0,v.jsxs)("div",{style:{display:"flex",flexDirection:"column",alignItems:"center"},children:[(0,v.jsx)("span",{children:c}),(0,v.jsx)("span",{children:"Contracts"})]})]})})}var A=n(1039),H=n(25512);function B(e){var t=e.blockchain;return(0,v.jsx)("div",{className:"dashboard-graph",style:{marginRight:"10px",width:"100%"},children:(0,v.jsxs)(Z.Z,{sx:{display:"flex",justifyContent:"center",flexDirection:"column",alignItems:"center",height:"100%"},children:[!(null===t||void 0===t||!t.latestBlockNumber)&&(0,v.jsx)(A.Z,{style:{fontSize:"90px",color:"green"}}),!(null!==t&&void 0!==t&&t.latestBlockNumber)&&(0,v.jsx)(H.Z,{style:{fontSize:"90px",color:"red"}}),(0,v.jsx)("div",{style:{display:"flex",flexDirection:"column",alignItems:"center"},children:(0,v.jsx)("span",{children:"Network Health"})})]})})}function R(e){var t=e.width,n=e.color;return(0,v.jsx)("svg",{fill:n,xmlns:"http://www.w3.org/2000/svg",width:t,viewBox:"0 0 640 512",children:(0,v.jsx)("path",{d:"M296 136V88h48v48H296zM288 32c-26.5 0-48 21.5-48 48v4H121.6C111.2 62.7 89.3 48 64 48C28.7 48 0 76.7 0 112s28.7 64 64 64c25.3 0 47.2-14.7 57.6-36h66.9c-58.9 39.6-98.9 105-104 180H80c-26.5 0-48 21.5-48 48v64c0 26.5 21.5 48 48 48h64c26.5 0 48-21.5 48-48V368c0-26.5-21.5-48-48-48h-3.3c5.9-67 48.5-123.4 107.5-149.1c8.6 12.7 23.2 21.1 39.8 21.1h64c16.6 0 31.1-8.4 39.8-21.1c59 25.7 101.6 82.1 107.5 149.1H496c-26.5 0-48 21.5-48 48v64c0 26.5 21.5 48 48 48h64c26.5 0 48-21.5 48-48V368c0-26.5-21.5-48-48-48h-4.5c-5-75-45.1-140.4-104-180h66.9c10.4 21.3 32.3 36 57.6 36c35.3 0 64-28.7 64-64s-28.7-64-64-64c-25.3 0-47.2 14.7-57.6 36H400V80c0-26.5-21.5-48-48-48H288zM88 376h48v48H88V376zm416 48V376h48v48H504z"})})}function M(e){var t=e.blockchain;return(0,v.jsx)("div",{className:"dashboard-graph",style:{marginRight:"10px",display:"flex",flexDirection:"column",justifyContent:"flex-end",width:"100%"},children:(0,v.jsxs)(Z.Z,{sx:{display:"flex",justifyContent:"center",flexDirection:"column",alignItems:"center",height:"100%"},children:[(0,v.jsx)(R,{color:"#0071e6",width:"100px"}),(0,v.jsxs)("div",{style:{display:"flex",flexDirection:"column",alignItems:"center"},children:[(0,v.jsx)("span",{children:t.peerCount}),(0,v.jsx)("span",{children:"Peers"})]})]})})}var W=function(){var e=(0,D.K)((function(e){return e.apps})),t=(0,i.useState)(0),n=(0,s.Z)(t,2),o=n[0],d=n[1],p=(0,i.useState)({blockTimestamp:"",latestBlockHash:"",latestBlockNumber:0,noOfTransactions:0,peerCount:0,pendingTransactions:0,transactionDifficulty:0}),h=(0,s.Z)(p,2),u=h[0],x=h[1],f=function(){var t=(0,a.Z)((0,r.Z)().mark((function t(){var n;return(0,r.Z)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,l.IW(e[o].appToken).get("/explorer/blockchain");case 3:n=t.sent,x(n.data),t.next=10;break;case 7:t.prev=7,t.t0=t.catch(0),console.log(t.t0);case 10:case"end":return t.stop()}}),t,null,[[0,7]])})));return function(){return t.apply(this,arguments)}}();return(0,i.useEffect)((function(){e.length&&d(0)}),[e]),(0,i.useEffect)((function(){f()}),[]),(0,v.jsx)("div",{style:{backgroundColor:"#edf0f4",padding:"20px"},children:(0,v.jsxs)(c.Z,{maxWidth:"xl",style:{width:"100%"},children:[(0,v.jsx)(I,{apps:e,currentAppIndex:o,setCurrentAppIndex:d}),(0,v.jsxs)(Z.Z,{sx:{display:"grid",gridTemplateColumns:{xs:"1fr",sm:"1fr 1fr"},gridTemplateRows:"250px 250px"},children:[(0,v.jsx)(y,{apps:e,currentAppIndex:o}),(0,v.jsx)(N,{}),(0,v.jsx)(T,{apps:e,currentAppIndex:o}),(0,v.jsxs)(Z.Z,{sx:{display:"flex",width:"100%"},children:[(0,v.jsx)(S,{apps:e,currentAppIndex:o}),(0,v.jsx)(B,{blockchain:u}),(0,v.jsx)(M,{blockchain:u})]})]})]})})}},1039:function(e,t,n){var r=n(64836);t.Z=void 0;var a=r(n(45649)),s=n(80184),i=(0,a.default)((0,s.jsx)("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8zm4.59-12.42L10 14.17l-2.59-2.58L6 13l4 4 8-8z"}),"CheckCircleOutlined");t.Z=i},8549:function(e,t,n){var r=n(64836);t.Z=void 0;var a=r(n(45649)),s=n(80184),i=(0,a.default)((0,s.jsx)("path",{d:"m5.2494 8.0688 2.83-2.8269 14.1343 14.15-2.83 2.8269zm4.2363-4.2415 2.828-2.8289 5.6577 5.656-2.828 2.8289zM.9989 12.3147l2.8284-2.8285 5.6569 5.6569-2.8285 2.8284zM1 21h12v2H1z"}),"Gavel");t.Z=i},25512:function(e,t,n){var r=n(64836);t.Z=void 0;var a=r(n(45649)),s=n(80184),i=(0,a.default)((0,s.jsx)("path",{d:"M14.59 8 12 10.59 9.41 8 8 9.41 10.59 12 8 14.59 9.41 16 12 13.41 14.59 16 16 14.59 13.41 12 16 9.41 14.59 8zM12 2C6.47 2 2 6.47 2 12s4.47 10 10 10 10-4.47 10-10S17.53 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8z"}),"HighlightOffOutlined");t.Z=i}}]);
//# sourceMappingURL=526.44a2029e.chunk.js.map