This repository was archived by the owner on Sep 17, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path2997.2474b216.chunk.js
2 lines (2 loc) · 15.8 KB
/
2997.2474b216.chunk.js
1
2
/*! For license information please see 2997.2474b216.chunk.js.LICENSE.txt */
"use strict";(self.webpackChunkacellus=self.webpackChunkacellus||[]).push([[2997],{82367:function(e,t,r){r.d(t,{r:function(){return s}});var n,o=r(47313),i=["title","titleId"];function a(){return a=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},a.apply(this,arguments)}function u(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},i=Object.keys(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}function c(e,t){var r=e.title,c=e.titleId,s=u(e,i);return o.createElement("svg",a({fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:"w-6 h-6",ref:t,"aria-labelledby":c},s),r?o.createElement("title",{id:c},r):null,n||(n=o.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M20.25 7.5l-.625 10.632a2.25 2.25 0 01-2.247 2.118H6.622a2.25 2.25 0 01-2.247-2.118L3.75 7.5M10 11.25h4M3.375 7.5h17.25c.621 0 1.125-.504 1.125-1.125v-1.5c0-.621-.504-1.125-1.125-1.125H3.375c-.621 0-1.125.504-1.125 1.125v1.5c0 .621.504 1.125 1.125 1.125z"})))}var s=o.forwardRef(c);r.p},29684:function(e,t,r){r.r(t),r.d(t,{ActionLogRow:function(){return O},ActionLogTable:function(){return T},default:function(){return I}});var n=r(74165),o=r(93433),i=r(15861),a=r(1413),u=r(29439),c=r(43681),s=r(48351),l=r(47313),d=r(58467),f=r(60199),p=r(12264),h=r(67134),m=r(35667),v=r(79250),g=r(41543),w=r(20388),x=r(46959),y=r(13797),D=r(66355),b=r(67773),Z=r(81517),j=r(11360),S=r(58229),k=r(46417);function I(){var e=(0,l.useMemo)((function(){var e=new Date,t=new Date(e.getTime()+j.u3),r=[{value:{startDate:new Date(e.getTime()-j.u3),endDate:t},name:"Last 24 Hours"},{value:{startDate:new Date(e.getTime()-2*j.u3),endDate:t},name:"Last 48 Hours"},{value:{startDate:new Date(e.getTime()-j.un),endDate:t},name:"Last 7 Days"},{value:{startDate:new Date(e.getTime()-j.vS),endDate:t},name:"Last 30 Days"},{value:{startDate:new Date(e.getTime()-j.eV/4),endDate:t},name:"Last 3 Months"},{value:{startDate:new Date(e.getTime()-j.eV/2),endDate:t},name:"Last 6 Months"},{value:{startDate:new Date(0),endDate:t},name:"All Time"}];return(0,S.L1)()&&!(0,S.yv)()&&r.unshift({value:{startDate:"mock",endDate:"mock"},name:"Mock Data (Localhost Only)"},{value:{startDate:"mock2",endDate:"mock2"},name:"Mock Data 2 (Localhost Only)"}),r}),[]),t=(0,l.useState)(),r=(0,u.Z)(t,2),n=r[0],o=r[1],i=(0,l.useState)(),a=(0,u.Z)(i,2),c=a[0],s=a[1],p=(0,l.useState)(),h=(0,u.Z)(p,2),m=h[0],x=h[1],D=(0,l.useState)(e[0].value),Z=(0,u.Z)(D,2),I=Z[0],O=Z[1],C=(0,l.useState)(),E=(0,u.Z)(C,2),M=E[0],z=E[1],F=(0,l.useState)(),N=(0,u.Z)(F,2),B=N[0],H=N[1],R=(0,l.useState)(null),V=(0,u.Z)(R,2),X=V[0],Y=V[1],_=(0,l.useState)(),q=(0,u.Z)(_,2),G=q[0],U=q[1],$=(0,l.useState)(null),J=(0,u.Z)($,2),K=J[0],ee=J[1];(0,l.useEffect)((function(){var e=new AbortController;return z(Q(I,n,c,m,void 0,e.signal)),function(){return e.abort()}}),[m,c,n,I]);return(0,k.jsxs)(A,{children:[(0,k.jsx)("h2",{children:"Action Log"}),(0,k.jsx)("p",{children:"Adjust the filters to find the actions you are looking for."}),(0,k.jsxs)(L,{children:[(0,k.jsxs)(P,{children:[(0,k.jsxs)(W,{children:[(0,k.jsx)(w.Z,{data:e,onChange:function(e){return O(e.value||void 0)}}),(0,k.jsx)(w.Z,{data:b.MF,onChange:function(e){return x(e.value||void 0)}})]}),(0,k.jsxs)(W,{children:[(0,k.jsx)(y.ZP,{format:"user",placeholder:"Search Teacher",autocomplete:!0,query:B,setQuery:H,onSearch:function(e){var t;if(null===e||void 0===e||null===(t=e.trim)||void 0===t||!t.call(e))return Y(null);f.Z.getSearch(e,{role:"teacher"}).then((function(e){return Y(e.result||[])})).catch((function(){return Y([])}))},onSelection:function(e){Y(null),o((null===e||void 0===e?void 0:e.acellusID)||void 0)},results:X}),(0,k.jsx)(y.ZP,{format:"user",placeholder:"Search Student",autocomplete:!0,query:G,setQuery:U,onSearch:function(e){var t;if(null===e||void 0===e||null===(t=e.trim)||void 0===t||!t.call(e))return ee(null);f.Z.getSearch(e,{role:"student"}).then((function(e){return ee(e.result||[])})).catch((function(){return ee([])}))},onSelection:function(e){ee(null),s((null===e||void 0===e?void 0:e.acellusID)||void 0)},results:K})]})]}),(0,k.jsx)("div",{children:M&&(0,k.jsx)(l.Suspense,{fallback:(0,k.jsx)(v.Z,{}),children:(0,k.jsx)(d.KP,{errorElement:(0,k.jsx)(g.Z,{}),resolve:M,children:(0,k.jsx)(T,{timeFrame:I,actionType:m,studentID:c,teacherID:n})})})})]})]})}function T(e){var t=e.teacherID,r=e.studentID,n=e.actionType,o=e.timeFrame,i=(0,d.qv)(),c=(0,l.useState)(i),s=(0,u.Z)(c,2),f=s[0],p=s[1],h=(0,l.useState)(!1),v=(0,u.Z)(h,2),g=v[0],w=v[1],y=(0,l.useRef)(!1),D=(0,l.useState)(),b=(0,u.Z)(D,2),j=b[0],I=b[1];(0,l.useEffect)((function(){return p(i)}),[i]);var T=(0,l.useCallback)((function(){w(!0),y.current=!0,Q(o,t,r,n,f).then((function(e){p(e),I(!1)})).catch((function(e){toast.error("Failed to load more."),console.error(e),I(e)})).finally((function(){w(!1),y.current=!1}))}),[n,f,r,t,o]);(0,l.useEffect)((function(){document.documentElement.scrollHeight!==document.documentElement.clientHeight||y.current||!f.page||j||T()}),[T,f.page,j]),(0,l.useEffect)((function(){if(f.page)return(0,S.Oo)("scroll",(function(){!(document.documentElement.scrollHeight-document.documentElement.scrollTop<=document.documentElement.clientHeight+100)||y.current||g||j||T()}))}),[T,g,j,f.page]);var A=(0,Z.Av)().teacher.acellusID,L=function(e){return 10===e||0===e};return 0===f.actions.length?(0,k.jsx)(m.Z,{title:"No Actions.",subtext:"Looks like we couldn't find any actions for the given scope."}):(0,k.jsx)(C,{children:(0,k.jsxs)(E,{children:[(0,k.jsxs)(F,{children:[(0,k.jsx)(N,{children:"Teacher"}),(0,k.jsx)(N,{children:"Action"}),(0,k.jsx)(N,{children:"Date / Time"})]}),f.actions.map((function(e){return(L(A)||!L(e.teacherID))&&(0,k.jsx)(O,(0,a.Z)((0,a.Z)({},e),{},{profiles:f.profiles}),e.id)})),f.page&&j&&(0,k.jsx)(z,{children:(0,k.jsx)(x.Z,{customStyles:{gridColumn:"span 3 / span 3",width:"100%"},onClick:T,isSubmitting:g,error:j,children:"Load More"})})]})})}function O(e){var t=e.actionType,r=e.teacherID,n=e.details,o=e.timeStamp,i=e.profiles,c=e.children,d=(0,j.zL)(o),f=b.MF.find((function(e){return e.value===t})),p=i[r],h=(0,l.useMemo)((function(){return(0,a.Z)((0,a.Z)({},n),{},{teacher:(null===n||void 0===n?void 0:n.teacherID)&&i[n.teacherID],student:(null===n||void 0===n?void 0:n.studentID)&&i[n.studentID],fromStudent:(null===n||void 0===n?void 0:n.fromAcellusID)&&i[n.fromAcellusID],toStudent:(null===n||void 0===n?void 0:n.toAcellusID)&&i[n.toAcellusID],students:null===c||void 0===c?void 0:c.reduce((function(e,t){var r,n=(null===(r=t.details)||void 0===r?void 0:r.studentID)&&i[t.details.studentID];return n&&!e.includes(n)&&e.push(n),e}),[]),courseNames:null===c||void 0===c?void 0:c.reduce((function(e,t){var r;return null!==(r=t.details)&&void 0!==r&&r.courseName&&!e.includes(t.details.courseName)&&e.push(t.details.courseName),e}),[]),sourceSchoolNames:null===c||void 0===c?void 0:c.reduce((function(e,t){var r;return null!==(r=t.details)&&void 0!==r&&r.sourceSchoolName&&!e.includes(t.details.sourceSchoolName)&&e.push(t.details.sourceSchoolName),e}),[]),teachers:null===c||void 0===c?void 0:c.reduce((function(e,t){var r,n=(null===(r=t.details)||void 0===r?void 0:r.teacherID)&&i[t.details.teacherID];return n&&!e.includes(n)&&e.push(n),e}),[])})}),[c,n,i]),m=(0,l.useState)(!1),v=(0,u.Z)(m,2),g=v[0],w=v[1];return(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(s.u,{as:l.Fragment,appear:!0,show:!0,enter:"transition-opacity duration-500",enterFrom:"opacity-0",enterTo:"opacity-100",children:(0,k.jsxs)(M,{isGroup:!!c,onClick:function(){return w((function(e){return!e}))},children:[(0,k.jsx)(Y,{children:p&&(0,k.jsx)(D.Z,{teacher:p})}),(0,k.jsx)(X,{text:"left",children:(0,k.jsx)(V,{children:(c?f.groupMessage&&f.groupMessage(h):f.message&&f.message(h))||"[".concat(t,"] ").concat(f.type,": ").concat(JSON.stringify(h))})}),(0,k.jsx)(X,{children:(0,k.jsxs)(B,{children:[(0,k.jsx)("p",{children:c?(0,j._z)(d):r?"".concat((0,j._z)(d)," - ").concat(null===d||void 0===d?void 0:d.toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit"})):null===d||void 0===d?void 0:d.toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit"})}),(0,k.jsx)(H,{onClick:function(e){e.stopPropagation(),w((function(e){return!e}))},children:(0,k.jsx)(R,{"data-testid":"chevron",hide:!c,current:g})})]})})]})}),c&&(0,k.jsx)(_,{open:g,children:(0,k.jsx)(q,{children:c.map((function(e){return(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(O,(0,a.Z)((0,a.Z)({},e),{},{profiles:i}),e.id),(0,k.jsx)(G,{})]})}))})})]})}var A=c.Z.div({display:"flex",flexDirection:"column"}),L=c.Z.div({marginTop:"2rem",display:"flex",flexDirection:"column",gap:"1rem"}),C=c.Z.div({maxWidth:"100%",overflowX:"auto",overflowY:"hidden",borderRadius:"1rem","--tw-shadow":"0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1)","--tw-shadow-colored":"0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color)",boxShadow:"var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)"}),E=c.Z.div({width:"fit-content",minWidth:"100%"}),M=c.Z.div((function(e){return[{gridColumn:"span 3 / span 3",display:"grid",width:"100%",gridTemplateColumns:"24rem 1fr 30rem",alignItems:"center",whiteSpace:"nowrap",borderTopWidth:"1px",borderBottomWidth:"1px","--tw-border-opacity":"1",borderColor:"rgb(229 231 235 / var(--tw-border-opacity))",":first-child":{borderTopWidth:"0px"},":last-child":{borderBottomWidth:"0px"}},e.isGroup&&{cursor:"pointer"}]})),z=(0,c.Z)(M)({padding:"1rem"}),F=(0,c.Z)(M)({borderBottomWidth:"2px","--tw-border-opacity":"1",borderColor:"rgb(199 215 245 / var(--tw-border-opacity))","--tw-bg-opacity":"1",backgroundColor:"rgb(223 232 249 / var(--tw-bg-opacity))"}),N=c.Z.span({padding:"1.5rem",fontSize:"1.4rem",fontWeight:"700","--tw-text-opacity":"1",color:"rgb(107 114 128 / var(--tw-text-opacity))"}),P=c.Z.div({display:"flex",flexDirection:"column",justifyContent:"space-between",gap:"1rem","@media (min-width: 768px)":{flexDirection:"row"}}),W=c.Z.div({display:"flex",width:"100%",flexDirection:"column",gap:"1rem","@media (min-width: 1280px)":{flexDirection:"row"}}),B=c.Z.div({display:"flex",flexDirection:"row",justifyContent:"space-between",fontSize:"1.6rem"}),H=c.Z.button({cursor:"auto"}),R=(0,c.Z)(h.r)((function(e){return[{marginTop:"auto",marginBottom:"auto",height:"1.5rem",width:"1.5rem",cursor:"pointer",strokeWidth:"0.4rem","--tw-text-opacity":"1",color:"rgb(75 85 99 / var(--tw-text-opacity))",transitionProperty:"all",transitionTimingFunction:"cubic-bezier(0.4, 0, 0.2, 1)",transitionDuration:"500ms",":hover":{"--tw-scale-x":"1.1","--tw-scale-y":"1.1",transform:"translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))"},"@media (min-width: 1024px)":{width:"2.5rem"}},e.current&&{"--tw-rotate":"90deg",transform:"translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))"},e.hide&&{cursor:"auto",opacity:"0"}]})),V=c.Z.p({display:"inline-flex",alignItems:"center",gap:"0.5rem"}),X=c.Z.span({paddingLeft:"1.5rem",paddingRight:"1.5rem",paddingTop:"0.75rem",paddingBottom:"0.75rem",fontSize:"1.4rem"}),Y=(0,c.Z)(X)({fontWeight:"700"}),_=c.Z.div((function(e){return[{gridColumn:"span 3 / span 3",display:"grid",gridTemplateRows:"0fr","--tw-bg-opacity":"1",backgroundColor:"rgb(243 244 246 / var(--tw-bg-opacity))",transitionProperty:"all",transitionTimingFunction:"cubic-bezier(0.4, 0, 0.2, 1)",transitionDuration:"500ms"},e.open&&{gridTemplateRows:"1fr"}]})),q=c.Z.div({overflow:"hidden"}),G=c.Z.div({marginLeft:"auto",marginRight:"auto",height:"1px",width:"95%","--tw-bg-opacity":"1",backgroundColor:"rgb(156 163 175 / var(--tw-bg-opacity))",opacity:"0.5",":last-child":{height:"0px"}});function Q(e,t,r,n,o,i){return U.apply(this,arguments)}function U(){return U=(0,i.Z)((0,n.Z)().mark((function e(t,r,u,c,s,l){var d,h,m,v,g,w,x,y,D;return(0,n.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return d={teacherID:r,studentID:u,actionType:c,page:null===s||void 0===s?void 0:s.page,limit:s&&100},e.next=3,p.Z.getLog(t.startDate,t.endDate,d,l);case 3:return h=e.sent,m=null!==s&&void 0!==s&&s.profiles?Object.keys(s.profiles):[],v=h.actions.reduce((function(e,t){var r=t.teacherID,n=t.details||{},o=n.studentID,i=n.fromAcellusID,a=n.toAcellusID,u=n.teacherID;return e.includes(r)||e.push(r),o&&!e.includes(o)&&e.push(o),i&&!e.includes(i)&&e.push(i),a&&!e.includes(a)&&e.push(a),u&&!e.includes(u)&&e.push(u),e}),(0,o.Z)(m)),g=v.map(function(){var e=(0,i.Z)((0,n.Z)().mark((function e(t){var r;return(0,n.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!m.includes(t)){e.next=2;break}return e.abrupt("return",[t,s.profiles[t]]);case 2:return e.next=4,f.Z.get(t,l).catch((function(){}));case 4:return r=e.sent,e.abrupt("return",[t,(0,a.Z)((0,a.Z)({},r),{},{acellusID:t})]);case 6:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()),e.next=9,Promise.all(g).then((function(e){return Object.fromEntries(e)}));case 9:return w=e.sent,x=null!==s&&void 0!==s&&s.actions?(0,o.Z)(s.actions):[],y=x.length-1,D=x[y],h.actions.forEach((function(e){var t,r=crypto.randomUUID(),n=b.MF.find((function(t){return t.value===e.actionType})),o=(null===(t=D)||void 0===t?void 0:t.timeStamp)&&new Date(1e3*D.timeStamp),i=new Date(1e3*e.timeStamp),u=(0,a.Z)((0,a.Z)({},e),{},{id:r});if(D&&null!==n&&void 0!==n&&n.groupMessage&&D.actionType===e.actionType&&D.teacherID===e.teacherID&&o.setHours(0,0,0,0)-i.setHours(0,0,0,0)===0)if(delete u.teacherID,x[y].children)x[y].children.push(u);else{var c=(0,a.Z)({},x[y]);delete c.teacherID,x[y].children=[c,u],delete x[y].details}else x[++y]=u;D=e})),e.abrupt("return",{actions:x,profiles:w,page:h.page});case 15:case"end":return e.stop()}}),e)}))),U.apply(this,arguments)}},73617:function(e,t,r){r.d(t,{Z:function(){return u}});var n="undefined"!==typeof Element,o="function"===typeof Map,i="function"===typeof Set,a="function"===typeof ArrayBuffer&&!!ArrayBuffer.isView;function u(e,t){try{return c(e,t)}catch(r){if((r.message||"").match(/stack|recursion/i))return logger.warn("isDeepEqual cannot handle circular refs"),!1;throw r}}function c(e,t){if(e===t)return!0;if("object"===typeof e&&"object"===typeof t){if(e.constructor!==t.constructor)return!1;var r,u,s,l;if(Array.isArray(e)&&Array.isArray(t)){if((u=e.length)!==t.length)return!1;for(s=u;0!==s--;)if(!c(e[s],t[s]))return!1;return!0}if(o&&e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(r=e.entries();!(s=r.next()).done;)if(!t.has(s.value[0]))return!1;for(r=e.entries();!(s=r.next()).done;)if(!c(s.value[1],t.get(s.value[0])))return!1;return!0}if(i&&e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(r=e.entries();!(s=r.next()).done;)if(!t.has(s.value[0]))return!1;return!0}if(a&&ArrayBuffer.isView(e)&&ArrayBuffer.isView(t)){if((u=e.length)!==t.length)return!1;for(s=u;0!==s--;)if(e[s]!==t[s])return!1;return!0}if(e.constructor===RegExp)return e.source===t.source&&e.flags===t.flags;if(e.valueOf!==Object.prototype.valueOf&&"function"===typeof e.valueOf&&"function"===typeof t.valueOf)return e.valueOf()===t.valueOf();if(e.toString!==Object.prototype.toString&&"function"===typeof e.toString&&"function"===typeof t.toString)return e.toString()===t.toString();if((u=(l=Object.keys(e)).length)!==Object.keys(t).length)return!1;for(s=u;0!==s--;)if(!Object.prototype.hasOwnProperty.call(t,l[s]))return!1;if(n&&e instanceof Element)return!1;for(s=u;0!==s--;)if(("_owner"!==l[s]&&"_v"!==l[s]&&"_o"!==l[s]||!e.$$tyepof)&&!c(e[l[s]],t[l[s]]))return!1;return!0}return e!==e&&t!==t}}}]);