3Dshock/client/build/static/js/main.333f1baa.chunk.js
2021-03-07 22:48:48 -07:00

2 lines
8.5 KiB
JavaScript

(this.webpackJsonpclient=this.webpackJsonpclient||[]).push([[0],{161:function(t,e,n){},163:function(t,e,n){},261:function(t,e,n){"use strict";n.r(e);var r=n(0),a=n(24),c=n.n(a),s=(n(161),n(162),n(163),n(81)),u=n(25),i=n(15),o=n.n(i),l=n(27),p=n(41),j=n(152),b=n(266),f=n(263),h=n(40),d=n(90),O=n(55),x=n.n(O),m="prod";if("jank"===m){x.a.defaults.baseURL="http://192.168.1.107:5000"}var v=function(){var t=Object(l.a)(o.a.mark((function t(e){var n;return o.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,x.a.post("/api/clients",e);case 2:return n=t.sent,t.abrupt("return",n.data.client_id);case 4:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),g=function(){var t=Object(l.a)(o.a.mark((function t(e){var n;return o.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,x.a.get("/api/clients/".concat(e));case 2:return n=t.sent,t.abrupt("return",n.data);case 4:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),w=function(){var t=Object(l.a)(o.a.mark((function t(e){var n;return o.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,x.a.post("/api/clients/".concat(e,"/session"));case 2:return n=t.sent,t.abrupt("return",n.data);case 4:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),k=function(){var t=Object(l.a)(o.a.mark((function t(e){var n;return o.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,x.a.get("/api/clients/".concat(e,"/session"));case 2:return n=t.sent,t.abrupt("return",n.data);case 4:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),y=function(){var t=Object(l.a)(o.a.mark((function t(e){return o.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,x.a.delete("/api/clients/".concat(e,"/session"));case 2:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),C=function(){var t=Object(l.a)(o.a.mark((function t(e){return o.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,y(e);case 2:return t.next=4,w(e);case 4:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),S=n(8),I=function(){var t=Object(u.f)(),e=Object(r.useState)(null),n=Object(p.a)(e,2),a=n[0],c=n[1],s=Object(r.useState)(""),i=Object(p.a)(s,2),O=i[0],x=i[1],m=Object(r.useState)(""),g=Object(p.a)(m,2),w=g[0],k=g[1],y=Object(r.useState)(""),C=Object(p.a)(y,2),I=C[0],F=C[1],P=function(){var e=Object(l.a)(o.a.mark((function e(n){var r;return o.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n.preventDefault(),!(I.length<10)){e.next=5;break}return j.b.error("Check all fields!"),c("Phone number needs to be a length of at least 10"),e.abrupt("return");case 5:return e.next=7,v({name:O,email:w,phone:parseInt(I)});case 7:r=e.sent,t.push("/sessions/".concat(r));case 9:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}();return Object(S.jsxs)(d.Content,{children:[Object(S.jsx)(b.a,{title:"Dashboard",subTitle:"Enter the name, email and phone number of the subject"}),Object(S.jsx)(f.a,{}),Object(S.jsxs)("form",{onSubmit:P,children:[Object(S.jsxs)("label",{htmlFor:"name",children:["Name:",Object(S.jsx)("input",{minLength:3,value:O,onChange:function(t){return x(t.target.value)},name:"name"})]}),Object(S.jsxs)("label",{htmlFor:"email",children:["Email:",Object(S.jsx)("input",{value:w,onChange:function(t){return k(t.target.value)},type:"email",name:"email"})]}),Object(S.jsxs)("label",{htmlFor:"phone",children:["Phone:",Object(S.jsx)("input",{value:I,onChange:function(t){return F(t.target.value)},type:"tel",name:"phone"})]}),Object(S.jsx)(h.a,{danger:!0,onClick:function(){x(""),k(""),F("")},children:"Reset"}),Object(S.jsx)(h.a,{htmlType:"submit",type:"primary",children:"Start Session"}),a&&Object(S.jsx)("p",{className:"error",children:a})]})]})},F=n(268),P=n(267),T=n(264),D=function(t){var e=t.clientId,n=Object(r.useState)(null),a=Object(p.a)(n,2),c=a[0],s=a[1],u=Object(r.useState)(null),i=Object(p.a)(u,2),j=i[0],f=i[1],h=Object(r.useState)(!0),d=Object(p.a)(h,2),O=(d[0],d[1]);Object(r.useEffect)((function(){var t=setInterval(function(){var t=Object(l.a)(o.a.mark((function t(){var n,r;return o.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!(c&&c.length>=178)){t.next=3;break}return O(!1),t.abrupt("return");case 3:return t.next=5,k(e);case 5:n=t.sent,(r=n.photos).length&&s(r);case 8:case"end":return t.stop()}}),t)})));return function(){return t.apply(this,arguments)}}(),250);return function(){return clearInterval(t)}}),[e,c]);var x=function(){return f(null)},v="jank"===m?"http://192.168.1.107:5000":"";return(null===c||void 0===c?void 0:c.length)?Object(S.jsxs)(S.Fragment,{children:[Object(S.jsx)(F.a,{visible:!!j,onOk:x,cancelText:null,onCancel:x,width:"50%",children:Object(S.jsx)("img",{width:"100%",onClick:x,src:"".concat(v,"/output/").concat(e,"/").concat(j),alt:"large image"})}),Object(S.jsx)(b.a,{title:"Session Pictures",subTitle:"".concat(c.length,"/").concat(178," loaded")}),Object(S.jsx)("div",{className:"photo-wall",children:c?c.sort((function(t,e){return t.split("_")[0].localeCompare(e.split("_")[0])})).map((function(t){return Object(S.jsx)(P.a,{className:"photo",title:t.split("_")[0],children:Object(S.jsx)("img",{onClick:function(){return f(t)},id:t,src:"".concat(v,"/output/").concat(e,"/").concat(t),alt:"lol"},t)})})):Object(S.jsx)(T.a,{})})]}):null},N=n(269),E=n(265),_=n(71),B=function(t){var e=Object(u.f)(),n=t.match.params.clientId,a=Object(r.useState)(null),c=Object(p.a)(a,2),s=(c[0],c[1]),i=Object(r.useState)(!1),O=Object(p.a)(i,2),x=O[0],m=O[1],v=function(){var t=Object(l.a)(o.a.mark((function t(){return o.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return j.b.loading("Photo sequence starting! Stand by..."),t.next=3,w(n);case 3:m(!0);case 4:case"end":return t.stop()}}),t)})));return function(){return t.apply(this,arguments)}}(),k=function(){var t=Object(l.a)(o.a.mark((function t(){return o.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return m(!1),j.b.loading("Deleting photos & restarting capture sequence! Stand by..."),t.next=4,C(n);case 4:m(!0);case 5:case"end":return t.stop()}}),t)})));return function(){return t.apply(this,arguments)}}(),I=function(){var t=Object(l.a)(o.a.mark((function t(){return o.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e.push("/");case 1:case"end":return t.stop()}}),t)})));return function(){return t.apply(this,arguments)}}(),F=function(){var t=Object(l.a)(o.a.mark((function t(){return o.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,y(n);case 2:j.b.success("Photos Deleted! Going back to dashboard"),e.push("/");case 4:case"end":return t.stop()}}),t)})));return function(){return t.apply(this,arguments)}}();return Object(r.useEffect)((function(){(function(){var t=Object(l.a)(o.a.mark((function t(){var e;return o.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,g(n);case 2:e=t.sent,s(e),e.has_photos&&m(!0);case 5:case"end":return t.stop()}}),t)})));return function(){return t.apply(this,arguments)}})()()}),[n]),Object(S.jsxs)(d.Content,{children:[Object(S.jsx)(b.a,{ghost:!1,onBack:function(){return e.goBack()},title:"Session for ".concat(n),tags:x?Object(S.jsx)(N.a,{color:"lime",children:"Active"}):Object(S.jsx)(N.a,{children:"Inactive"}),subTitle:"session has ".concat(x?"started":"not started"),extra:[Object(S.jsx)(h.a,{disabled:x,type:"primary",onClick:v,children:"Capture"},"startsession"),Object(S.jsx)(E.a,{title:"Re-capture set?",onConfirm:k,children:Object(S.jsx)(h.a,{type:"default",disabled:!x,children:"Retry Capture"})},"retry"),Object(S.jsx)(E.a,{title:"Delete all photos and return to dashboard?",onConfirm:F,children:Object(S.jsx)(h.a,{danger:!0,disabled:!x,children:"Abort Session"})},"nuke"),Object(S.jsx)(h.a,{ghost:!0,type:"primary",disabled:!x,onClick:I,children:"Finish Session"},"finish")]}),Object(S.jsx)(f.a,{}),Object(S.jsx)(_.a,{className:"controls",children:x&&Object(S.jsx)(D,{clientId:n})})]})};var L=function(){return Object(S.jsx)(s.a,{children:Object(S.jsx)("div",{className:"App",children:Object(S.jsxs)(u.c,{children:[Object(S.jsx)(u.a,{path:"/sessions/:clientId",component:B}),Object(S.jsx)(u.a,{exact:!0,path:"/",component:I})]})})})},R=function(t){t&&t instanceof Function&&n.e(3).then(n.bind(null,270)).then((function(e){var n=e.getCLS,r=e.getFID,a=e.getFCP,c=e.getLCP,s=e.getTTFB;n(t),r(t),a(t),c(t),s(t)}))};c.a.render(Object(S.jsx)(L,{}),document.getElementById("root")),R()}},[[261,1,2]]]);
//# sourceMappingURL=main.333f1baa.chunk.js.map