3Dshock/client/build/static/js/main.4a4e0606.chunk.js
2021-03-10 19:17:23 -07:00

2 lines
10 KiB
JavaScript

(this.webpackJsonpclient=this.webpackJsonpclient||[]).push([[0],{208:function(e,t,n){},210:function(e,t,n){},388:function(e,t,n){"use strict";n.r(t);var r,a=n(0),c=n(24),s=n.n(c),i=(n(208),n(209),n(210),n(103)),u=n(29),o=n(19),l=n.n(o),p=n(31),j=n(56),b=n(200),d=n(393),h=n(390),f=n(395),x=n(397),O=n(83),m=n(44),v=n(127),g=n.n(v),w=n(112),y=n(63),k=n.n(y),C=function(){var e=Object(p.a)(l.a.mark((function e(t){var n;return l.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:e.next=2;break;case 2:return e.next=4,k.a.post("/api/clients",t);case 4:return n=e.sent,e.abrupt("return",n.data.client_id);case 6:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),S=function(){var e=Object(p.a)(l.a.mark((function e(t){var n;return l.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:e.next=2;break;case 2:return e.next=4,k.a.get("/api/clients/".concat(t));case 4:return n=e.sent,e.abrupt("return",n.data);case 6:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),I=function(){var e=Object(p.a)(l.a.mark((function e(t){var n;return l.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,k.a.post("/api/clients/".concat(t,"/session"));case 3:return n=e.sent,e.abrupt("return",n.data);case 7:return e.prev=7,e.t0=e.catch(0),b.b.error("Something went wrong, check connection with the machine"),e.abrupt("return",e.t0);case 11:case"end":return e.stop()}}),e,null,[[0,7]])})));return function(t){return e.apply(this,arguments)}}(),T=function(){var e=Object(p.a)(l.a.mark((function e(t){var n;return l.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,k.a.get("/api/clients/".concat(t,"/session"));case 2:return n=e.sent,e.abrupt("return",n.data);case 4:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),D=function(){var e=Object(p.a)(l.a.mark((function e(t){return l.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,k.a.delete("/api/clients/".concat(t,"/session"));case 2:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),N=function(){var e=Object(p.a)(l.a.mark((function e(t){return l.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,D(t);case 2:return e.next=4,I(t);case 4:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),P=function(){var e=Object(p.a)(l.a.mark((function e(){var t;return l.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,k.a.get("/api/status");case 2:return t=e.sent,e.abrupt("return",t.data.status);case 4:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),F=n(8),E=function(){var e=Object(u.f)(),t=Object(a.useState)(null),n=Object(j.a)(t,2),r=n[0],c=n[1],s=function(){var t=Object(p.a)(l.a.mark((function t(n){var r;return l.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!(n.phone.length<10)){t.next=4;break}return b.b.error("Check all fields!"),c("Phone number needs to be a length of at least 10"),t.abrupt("return");case 4:return t.next=6,C({name:n.name,email:n.email,phone:parseInt(n.phone.replace(/\D/g,""))});case 6:r=t.sent,e.push("/sessions/".concat(r));case 8:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}();return Object(F.jsxs)(w.Content,{children:[Object(F.jsx)(d.a,{title:"Dashboard",subTitle:"Enter the name, email and phone number of the subject"}),Object(F.jsx)(h.a,{}),Object(F.jsxs)(f.a,{className:"dashboard-form",onFinish:s,labelCol:{span:8},wrapperCol:{span:16},children:[Object(F.jsx)(g.a,{label:"name",name:"name",children:Object(F.jsx)(x.a,{minLength:3})}),Object(F.jsx)(g.a,{label:"email",name:"email",children:Object(F.jsx)(x.a,{type:"email"})}),Object(F.jsx)(g.a,{label:"phone",name:"phone",children:Object(F.jsx)(x.a,{type:"tel",minLength:10})}),Object(F.jsxs)(O.a,{justify:"space-between",children:[Object(F.jsx)(m.a,{danger:!0,onClick:function(){},children:"Reset"}),Object(F.jsx)(m.a,{htmlType:"submit",type:"primary",children:"Start Session"})]}),r&&Object(F.jsx)("p",{className:"error",children:r})]})]})},B=n(398),_=n(394),L=n(391),W=function(e){var t=e.clientId,n=Object(a.useState)(null),r=Object(j.a)(n,2),c=r[0],s=r[1],i=Object(a.useState)(null),u=Object(j.a)(i,2),o=u[0],b=u[1],h=Object(a.useState)(!0),f=Object(j.a)(h,2);f[0],f[1];Object(a.useEffect)((function(){var e=setInterval(function(){var e=Object(p.a)(l.a.mark((function e(){var n,r;return l.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(c&&c.length>=89)){e.next=2;break}return e.abrupt("return");case 2:return e.next=4,T(t);case 4:n=e.sent,(r=n.photos).length&&s(r);case 7:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),250);return function(){return clearInterval(e)}}),[t,c]);var x=function(){return b(null)};return(null===c||void 0===c?void 0:c.length)?Object(F.jsxs)(F.Fragment,{children:[Object(F.jsx)(B.a,{visible:!!o,onOk:x,cancelText:null,onCancel:x,width:"50%",children:Object(F.jsx)("img",{width:"100%",onClick:x,src:"".concat("","/output/").concat(t,"/").concat(o),alt:"large modal"})}),Object(F.jsx)(d.a,{title:"Session Pictures",subTitle:"".concat(c.length,"/").concat(89," loaded"),children:Object(F.jsx)("div",{className:"loading-bar-container",children:Object(F.jsx)("div",{className:"loading-bar"})})}),Object(F.jsx)("div",{className:"photo-wall",children:c?c.sort((function(e,t){return e.split("_")[0].localeCompare(t.split("_")[0])})).map((function(e){return Object(F.jsx)(_.a,{className:"photo",title:e.split("_")[0],children:Object(F.jsx)("img",{onClick:function(){return b(e)},src:"".concat("","/output/").concat(t,"/").concat(e),alt:"lol"})},e)})):Object(F.jsx)(L.a,{})})]}):null},G=n(399);!function(e){e[e["Standing By..."]=0]="Standing By...",e[e["Warming Up..."]=1]="Warming Up...",e[e["Capturing Photo"]=2]="Capturing Photo",e[e["Capturing Grid"]=3]="Capturing Grid",e[e["Writing To Disk"]=4]="Writing To Disk",e[e["Downloading!"]=5]="Downloading!"}(r||(r={}));var R=["lime","gold","volcano","magenta","geekblue"],q=function(e){var t=e.poll,n=Object(a.useState)(r["Standing By..."]),c=Object(j.a)(n,2),s=c[0],i=c[1];return Object(a.useEffect)((function(){var e=setInterval(function(){var e=Object(p.a)(l.a.mark((function e(){var n;return l.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t){e.next=2;break}return e.abrupt("return");case 2:return e.next=4,P();case 4:n=e.sent,i(n);case 6:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),250);return function(){return clearInterval(e)}}),[]),Object(F.jsx)(G.a,{color:R[s],style:{display:"flex"},children:Object(F.jsx)("span",{style:{margin:"auto"},children:r[s]})})},A=n(396),J=n(392),U=function(e){var t=Object(u.f)(),n=e.match.params.clientId,r=Object(a.useState)(null),c=Object(j.a)(r,2),s=c[0],i=c[1],o=Object(a.useState)(!1),d=Object(j.a)(o,2),f=d[0],x=d[1],v=function(){var e=Object(p.a)(l.a.mark((function e(){return l.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return b.b.loading("Photo sequence starting! Stand by..."),e.next=3,I(n);case 3:x(!0);case 4:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),g=function(){var e=Object(p.a)(l.a.mark((function e(){return l.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return x(!1),b.b.loading("Deleting photos & restarting capture sequence! Stand by..."),e.next=4,N(n);case 4:x(!0);case 5:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),y=function(){var e=Object(p.a)(l.a.mark((function e(){return l.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t.push("/");case 1:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),k=function(){var e=Object(p.a)(l.a.mark((function e(){return l.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,D(n);case 2:b.b.success("Photos Deleted! Going back to dashboard"),t.push("/");case 4:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();return Object(a.useEffect)((function(){(function(){var e=Object(p.a)(l.a.mark((function e(){var t;return l.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,S(n);case 2:t=e.sent,i(t),t.has_photos&&x(!0);case 5:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}})()()}),[n]),Object(F.jsxs)(w.Content,{children:[Object(F.jsx)(O.a,{justify:"center",children:Object(F.jsxs)(A.a.Title,{children:["Client: ",null===s||void 0===s?void 0:s.name]})}),Object(F.jsxs)(O.a,{justify:"space-around",style:{width:"60%",margin:"auto"},children:[Object(F.jsxs)(A.a.Text,{children:[Object(F.jsx)("strong",{children:"email:"})," ",null===s||void 0===s?void 0:s.email]}),Object(F.jsxs)(A.a.Text,{children:[Object(F.jsx)("strong",{children:"phone:"})," ",null===s||void 0===s?void 0:s.phone]})]}),Object(F.jsx)(h.a,{}),Object(F.jsxs)(O.a,{justify:"center",className:"session-header",children:[Object(F.jsx)(m.a,{disabled:f,type:"primary",onClick:v,children:"Capture"},"startsession"),Object(F.jsx)(J.a,{disabled:!f,title:"Re-capture set?",onConfirm:g,children:Object(F.jsx)(m.a,{type:"default",disabled:!f,children:"Retry Capture"})},"retry"),Object(F.jsx)(J.a,{disabled:!f,title:"Delete all photos and return to dashboard?",onConfirm:k,children:Object(F.jsx)(m.a,{danger:!0,disabled:!f,children:"Abort Session"})},"nuke"),Object(F.jsx)(m.a,{ghost:!0,type:"primary",disabled:!f,onClick:y,children:"Finish Session"},"finish"),Object(F.jsx)(q,{poll:!0})]}),Object(F.jsx)(h.a,{}),Object(F.jsx)(O.a,{className:"controls",children:f&&Object(F.jsx)(W,{clientId:n})})]})};console.log("ENV","production");var V=function(){return Object(F.jsx)(i.a,{children:Object(F.jsx)("div",{className:"App",children:Object(F.jsxs)(u.c,{children:[Object(F.jsx)(u.a,{path:"/sessions/:clientId",component:U}),Object(F.jsx)(u.a,{exact:!0,path:"/",component:E})]})})})},z=function(e){e&&e instanceof Function&&n.e(3).then(n.bind(null,400)).then((function(t){var n=t.getCLS,r=t.getFID,a=t.getFCP,c=t.getLCP,s=t.getTTFB;n(e),r(e),a(e),c(e),s(e)}))};s.a.render(Object(F.jsx)(V,{}),document.getElementById("root")),z()}},[[388,1,2]]]);
//# sourceMappingURL=main.4a4e0606.chunk.js.map