2 lines
5.7 KiB
JavaScript
2 lines
5.7 KiB
JavaScript
(this.webpackJsonpclient=this.webpackJsonpclient||[]).push([[0],{33:function(e,t,n){},34:function(e,t,n){},63:function(e,t,n){"use strict";n.r(t);var r=n(0),c=n.n(r),a=n(27),s=n.n(a),i=(n(33),n(34),n(14)),u=n(3),o=n(2),p=n.n(o),j=n(5),l=n(10),f=n(12),b=n.n(f),h=[{name:"Elijah",email:"elijah@elijah.com",phone:4039876543},{name:"Tanner",email:"tanner@tanner.com",phone:4031234567,activeSession:!0}],O=h[0],x=["/images/1.jpg","/images/2.jpg","/images/3.jpg","/images/4.jpg"],d="prod",m="/api",v=function(){var e=Object(j.a)(p.a.mark((function e(t){return p.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,b.a.post("".concat(m,"/clients"),t);case 2:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),g=function(){var e=Object(j.a)(p.a.mark((function e(t){var n;return p.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("jank"!==d){e.next=2;break}return e.abrupt("return",O);case 2:return e.next=4,b.a.post("".concat(m,"/client/").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)}}(),k=function(){var e=Object(j.a)(p.a.mark((function e(t){var n;return p.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("jank"!==d){e.next=2;break}return e.abrupt("return",x);case 2:return e.next=4,b.a.get("".concat(m,"/clients/").concat(t,"/session"));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)}}(),w=function(){var e=Object(j.a)(p.a.mark((function e(t){return p.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,b.a.delete("".concat(m,"/clients/").concat(t,"/session"));case 2:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),S=n(1),y=function(){var e=Object(u.f)(),t=Object(r.useState)(""),n=Object(l.a)(t,2),c=n[0],a=n[1],s=Object(r.useState)(""),i=Object(l.a)(s,2),o=i[0],f=i[1],b=Object(r.useState)(""),h=Object(l.a)(b,2),O=h[0],x=h[1],m=function(){var t=Object(j.a)(p.a.mark((function t(n){return p.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n.preventDefault(),"jank"!==d){t.next=4;break}return e.push("/sessions/".concat(O)),t.abrupt("return");case 4:return t.next=6,v({name:c,email:o,phone:parseInt(O)});case 6:e.push("/sessions/".concat(O));case 7:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}();return Object(S.jsxs)("div",{children:[Object(S.jsx)("h1",{children:"Dashboard"}),Object(S.jsxs)("form",{onSubmit:m,children:[Object(S.jsxs)("label",{htmlFor:"name",children:["Name:",Object(S.jsx)("input",{value:c,onChange:function(e){return a(e.target.value)},name:"name"})]}),Object(S.jsxs)("label",{htmlFor:"email",children:["Email:",Object(S.jsx)("input",{value:o,onChange:function(e){return f(e.target.value)},type:"email",name:"email"})]}),Object(S.jsxs)("label",{htmlFor:"phone",children:["Phone:",Object(S.jsx)("input",{value:O,onChange:function(e){return x(e.target.value)},type:"tel",name:"phone"})]}),Object(S.jsx)("button",{type:"submit",children:"Start Session"}),Object(S.jsx)("button",{type:"button",onClick:function(){a(""),f(""),x("")},children:"Reset"})]}),Object(S.jsx)("div",{children:"TODO: List of past sessions for review?"})]})},C=function(e){var t=e.clientId,n=Object(r.useState)(null),c=Object(l.a)(n,2),a=c[0],s=c[1];return Object(r.useEffect)((function(){var e=setInterval(function(){var e=Object(j.a)(p.a.mark((function e(){var n;return p.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!a){e.next=2;break}return e.abrupt("return");case 2:return e.next=4,k(t);case 4:(n=e.sent)&&s(n);case 6:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),300);return function(){return clearInterval(e)}}),[t,a]),Object(S.jsxs)("div",{children:[Object(S.jsx)("h3",{children:"Session Pictures"}),a&&a.map((function(e){return Object(S.jsx)("img",{id:e,src:e})}))]})},I=function(e){var t=Object(u.f)(),n=e.match.params.clientId,c=Object(r.useState)(!1),a=Object(l.a)(c,2),s=a[0],i=a[1],o=function(){var e=Object(j.a)(p.a.mark((function e(){return p.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)}}(),f=function(){var e=Object(j.a)(p.a.mark((function e(){return p.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,w(n);case 2:t.push("/");case 3:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();return Object(r.useEffect)((function(){(function(){var e=Object(j.a)(p.a.mark((function e(){var t;return p.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,g(n);case 2:t=e.sent,t.activeSession&&i(!0);case 5:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}})()()})),Object(S.jsxs)("div",{children:[Object(S.jsxs)("h1",{children:["Session for ",n]}),Object(S.jsx)("button",{children:"Capture"}),s&&Object(S.jsx)(C,{clientId:n}),Object(S.jsxs)("div",{className:"controls",children:[Object(S.jsx)("button",{onClick:f,children:"Nuke Session"}),Object(S.jsx)("button",{onClick:o,children:"Exit Session"})]})]})};var F=function(){return Object(S.jsx)(i.a,{children:Object(S.jsx)("div",{className:"App",children:Object(S.jsxs)(u.c,{children:[Object(S.jsx)(u.a,{path:"/sessions/:clientId",component:I}),Object(S.jsx)(u.a,{exact:!0,path:"/",component:y})]})})})},E=function(e){e&&e instanceof Function&&n.e(3).then(n.bind(null,64)).then((function(t){var n=t.getCLS,r=t.getFID,c=t.getFCP,a=t.getLCP,s=t.getTTFB;n(e),r(e),c(e),a(e),s(e)}))};s.a.render(Object(S.jsx)(c.a.StrictMode,{children:Object(S.jsx)(F,{})}),document.getElementById("root")),E()}},[[63,1,2]]]);
|
|
//# sourceMappingURL=main.3f5ea67c.chunk.js.map
|