@local-civics/mgmt-ui 0.1.46 → 0.1.47

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.es.js CHANGED
@@ -1 +1 @@
1
- import{NotificationsProvider as e}from"@mantine/notifications";export{showNotification,updateNotification}from"@mantine/notifications";import{jsxs as n,jsx as i,Fragment as t}from"react/jsx-runtime";import{IconArrowLeft as r,IconCategory2 as l,IconCheck as o,IconTrash as a,IconPlaylistAdd as c,IconDownload as s,IconX as d,IconCloudUpload as h,IconInfoCircle as m,IconColorSwatch as u,IconSwitchHorizontal as g,IconLogout as p,IconHome2 as f,IconGauge as v,IconAlbum as b,IconLambda as C,IconBrandInstagram as y,IconBrandLinkedin as k,IconBrandFacebook as x}from"@tabler/icons";import*as N from"react";import{useState as S}from"react";import{createStyles as z,Text as w,Tabs as O,Title as T,Image as L,UnstyledButton as A,Group as B,Avatar as I,Badge as W,ScrollArea as E,Table as P,Container as D,Stack as H,Grid as j,ActionIcon as R,Button as M,LoadingOverlay as F,Select as q,Autocomplete as V,Drawer as G,Divider as U,TextInput as _,Tooltip as Y,Paper as $,ThemeIcon as J,Card as Q,Overlay as K,createEmotionCache as X,MantineProvider as Z,Modal as ee,Navbar as ne,Center as ie,AppShell as te,Loader as re}from"@mantine/core";import{Dropzone as le,MIME_TYPES as oe}from"@mantine/dropzone";import{useForm as ae}from"@mantine/form";import*as ce from"papaparse";import{openConfirmModal as se,ModalsProvider as de}from"@mantine/modals";import{Chart as he}from"react-charts";var me=function(){return me=Object.assign||function(e){for(var n,i=1,t=arguments.length;i<t;i++)for(var r in n=arguments[i])Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r]);return e},me.apply(this,arguments)};var ue=z((function(e){var n,i;return{root:(n={display:"flex",backgroundImage:"linear-gradient(-60deg, ".concat(e.colors[e.primaryColor][4]," 0%, ").concat(e.colors[e.primaryColor][7]," 100%)"),padding:1.5*e.spacing.xl,borderRadius:e.radius.md},n[e.fn.smallerThan("sm")]={flexDirection:"column"},n),title:{color:e.white,textTransform:"uppercase",fontWeight:700,fontSize:e.fontSizes.sm},count:{color:e.white,fontSize:32,lineHeight:1,fontWeight:700,marginBottom:e.spacing.md,fontFamily:"Greycliff CF, ".concat(e.fontFamily)},description:{color:e.colors[e.primaryColor][0],fontSize:e.fontSizes.sm,marginTop:5},stat:{flex:1,"& + &":(i={paddingLeft:e.spacing.xl,marginLeft:e.spacing.xl,borderLeft:"1px solid ".concat(e.colors[e.primaryColor][3])},i[e.fn.smallerThan("sm")]={paddingLeft:0,marginLeft:0,borderLeft:0,paddingTop:e.spacing.xl,marginTop:e.spacing.xl,borderTop:"1px solid ".concat(e.colors[e.primaryColor][3])},i)}}})),ge=function(e){var t=e.data,r=ue().classes,l=t.map((function(e){var t="%"===e.unit?Math.round(100*(e.value+Number.EPSILON)):e.value;return n("div",me({className:r.stat},{children:[n(w,me({className:r.count},{children:[t.toLocaleString(),e.unit]})),i(w,me({className:r.title},{children:e.title}))]}),e.title)}));return i("div",me({className:r.root},{children:l}))},pe=function(e){var n,t=null===(n=e.data)||void 0===n?void 0:n.map((function(e){return i(O.Tab,me({value:e.value},{children:e.label||e.value}),e.value)}));return i(O,me({value:e.value,onTabChange:e.onChange},{children:i(O.List,{children:t})}))},fe=z((function(e){var n,i,t;return{wrapper:(n={display:"flex",alignItems:"center",padding:2*e.spacing.xl,borderRadius:e.radius.md,backgroundColor:"dark"===e.colorScheme?e.colors.dark[8]:e.white,border:"1px solid ".concat("dark"===e.colorScheme?e.colors.dark[8]:e.colors.gray[3])},n["@media (max-width: ".concat(e.breakpoints.sm,"px)")]={flexDirection:"column-reverse",padding:e.spacing.xl},n),image:(i={maxWidth:"40%"},i["@media (max-width: ".concat(e.breakpoints.sm,"px)")]={maxWidth:"100%"},i),body:(t={paddingRight:4*e.spacing.xl},t["@media (max-width: ".concat(e.breakpoints.sm,"px)")]={paddingRight:0,marginTop:e.spacing.xl},t),title:{color:"dark"===e.colorScheme?e.white:e.black,fontFamily:"Greycliff CF, ".concat(e.fontFamily),lineHeight:1,marginBottom:e.spacing.md},controls:{display:"flex",marginTop:e.spacing.xl},inputWrapper:{width:"100%",flex:"1"},input:{borderTopRightRadius:0,borderBottomRightRadius:0,borderRight:0},control:{borderTopLeftRadius:0,borderBottomLeftRadius:0}}})),ve=function(e){var t=fe().classes,r=e.title||"Nothing to display",l=e.description||"We don't have anything to show you here just yet. Add data, check back later, or adjust your search.";return n("div",me({className:t.wrapper},{children:[n("div",me({className:t.body},{children:[i(T,me({className:t.title},{children:e.loading?"Loading...":r})),i(w,me({size:"sm",color:"dimmed"},{children:e.loading?"Hold on, we're loading your data.":l}))]})),i(L,{src:"https://cdn.localcivics.io/illustrations/".concat(e.icon,".svg"),className:t.image})]}))};function be(e){if(0===e.items.length)return i(ve,{title:"No badges to display",description:"There has not been any badge progress just yet.",loading:e.loading,icon:"badges"});var t=e.items.map((function(t){return n("tr",{children:[i("td",{children:i(A,me({onClick:function(){return e.onClick&&e.onClick(t)}},{children:n(B,me({spacing:"sm"},{children:[i(I,{size:40,src:t.avatar,radius:40}),n("div",{children:[i(w,me({size:"sm",weight:500},{children:t.name})),i(w,me({size:"xs",color:"dimmed"},{children:t.email}))]})]}))}))}),n("td",{children:[!!t.isComplete&&i(W,me({variant:"filled"},{children:"Complete"})),!t.isComplete&&i(W,me({color:"red",variant:"filled"},{children:"Incomplete"}))]})]},t.name)}));return i(E.Autosize,me({maxHeight:500},{children:n(P,me({verticalSpacing:"sm",sx:{minWidth:700},highlightOnHover:!0,striped:!0},{children:[i("thead",{children:n("tr",{children:[i("th",{children:"Student Name"}),i("th",{children:"Badge Status"})]})}),i("tbody",{children:t})]}))}))}function Ce(e){if(0===e.items.length)return i(ve,{title:"No lessons to display",description:"There are not lessons in badge.",loading:e.loading,icon:"badges"});var t=e.items.map((function(t){var r=Math.round(100*(t.percentageCompletion+Number.EPSILON));return n("tr",{children:[i("td",{children:i(A,me({onClick:function(){return e.onClick&&e.onClick(t)}},{children:t.lessonName}))}),n("td",{children:[r,"%"]})]},t.lessonName)}));return i(E.Autosize,me({maxHeight:500},{children:n(P,me({verticalSpacing:"sm",sx:{minWidth:700},highlightOnHover:!0,striped:!0},{children:[i("thead",{children:n("tr",{children:[i("th",{children:"Lesson Name"}),i("th",{children:"Lesson Completion"})]})}),i("tbody",{children:t})]}))}))}var ye=z((function(e){var n;return{title:(n={fontSize:34,fontWeight:900},n[e.fn.smallerThan("sm")]={fontSize:24},n),description:{maxWidth:600}}})),ke=function(e){var t=ye().classes,o=S("lessons"),a=o[0],c=o[1],s=e.students.length,d=s>0?e.students.filter((function(e){return e.isComplete})).length/s:0;return i(D,me({size:"lg",py:"xl"},{children:n(H,me({spacing:"md"},{children:[i(j,{children:n(j.Col,me({sm:"auto"},{children:[i(W,me({variant:"filled",leftSection:i(R,me({onClick:e.onBackClick,color:"blue",size:"xs",radius:"xl",variant:"filled"},{children:i(r,{size:14})})),size:"lg"},{children:"Badges"})),n(B,{children:[n(H,me({spacing:0},{children:[i(T,me({order:2,className:t.title,mt:"md"},{children:e.displayName||"Badge"})),i(w,me({color:"dimmed",className:t.description,mt:"sm"},{children:e.description||"No description"}))]})),i(H,me({ml:"auto"},{children:i(M,me({variant:"gradient",onClick:e.onPreviewClick},{children:"Preview"}))}))]})]}))}),i("div",{children:n("div",me({style:{position:"relative"}},{children:[i(F,{visible:e.loading,overlayBlur:2}),n(H,{children:[i(ge,{data:[{title:"BADGE COMPLETION",value:d,unit:"%"}]}),i(q,{clearable:!0,clearButtonLabel:"Clear class selection",size:"sm",placeholder:"Select a class",nothingFound:"No options",value:e.classId,onChange:e.onClassChange,icon:i(l,{}),data:e.classes.map((function(e){return{value:e.classId,label:e.name}}))}),n(H,me({spacing:0},{children:[i(pe,{value:a,data:[{label:"By lesson",value:"lessons"},{label:"By student",value:"students"}],onChange:c}),"lessons"===a&&i(Ce,{loading:e.loading,items:e.lessons,onClick:e.onLessonClick}),"students"===a&&i(be,{loading:e.loading,items:e.students,onClick:e.onUserClick})]}))]})]}))})]}))}))};function xe(e){if(0===e.items.length)return i(ve,{title:"No badges to display",description:"We don't have any badges to show you just yet.",loading:e.loading,icon:"badges"});var t=e.items.map((function(t){return i("tr",{children:i("td",{children:i(A,me({sx:function(e){return{display:"block",width:"100%",padding:e.spacing.md,color:"dark"===e.colorScheme?e.colors.dark[0]:e.black,"&:hover":{backgroundColor:"dark"===e.colorScheme?e.colors.dark[8]:e.colors.gray[1]}}},onClick:function(){return e.onClick&&e.onClick(t)}},{children:i(B,{children:n("div",{children:[i(w,me({size:"sm",weight:500},{children:t.name})),i(w,me({size:"xs",color:"dimmed"},{children:t.description}))]})})}))})},t.badgeId)}));return i(E.Autosize,me({maxHeight:500},{children:i(P,me({horizontalSpacing:0,verticalSpacing:0,sx:{minWidth:700}},{children:i("tbody",{children:t})}))}))}var Ne=z((function(e){var n;return{title:(n={fontSize:34,fontWeight:900},n[e.fn.smallerThan("sm")]={fontSize:24},n),description:{maxWidth:600}}})),Se=function(e){var t=Ne().classes;return i(D,me({size:"lg",py:"xl"},{children:n(H,me({spacing:"md"},{children:[i(j,{children:n(j.Col,me({sm:"auto"},{children:[i(W,me({variant:"filled",size:"lg"},{children:"Badges"})),i(T,me({order:2,className:t.title,mt:"md"},{children:"Badges and micro-credentials"})),i(w,me({color:"dimmed",className:t.description,mt:"sm"},{children:"Project-sized skills acquisition and standards alignment."}))]}))}),i(V,{placeholder:"Search for a badge that fits your needs",data:e.badges.map((function(e){return e.name})),onChange:e.onAutocompleteChange}),n("div",me({style:{position:"relative"}},{children:[i(F,{visible:e.loading,overlayBlur:2}),i(xe,{loading:e.loading,items:e.badges,onClick:e.onBadgeClick})]}))]}))}))};function ze(e){if(0===e.items.length)return i(ve,{title:"No students to display",description:"You don't have any students yet, add them and revisit.",loading:e.loading,icon:"groups"});var t=e.items.map((function(t){return n("tr",{children:[i("td",{children:i(A,me({onClick:function(){return e.onViewProfile(t)}},{children:t.studentName}))}),i("td",{children:t.className})]},t.studentName)}));return i(E.Autosize,me({maxHeight:500},{children:n(P,me({verticalSpacing:"sm",sx:{minWidth:700},highlightOnHover:!0,striped:!0},{children:[i("thead",{children:n("tr",{children:[i("th",{children:"Student Name"}),i("th",{children:"Class Name"})]})}),i("tbody",{children:t})]}))}))}var we=[{unit:"year",ms:31536e6},{unit:"month",ms:2628e6},{unit:"day",ms:864e5},{unit:"hour",ms:36e5},{unit:"minute",ms:6e4},{unit:"second",ms:1e3}],Oe=new Intl.RelativeTimeFormat("en",{numeric:"auto"});function Te(e,n){return void 0===n&&(n=new Date),e?function(e){for(var n=0,i=we;n<i.length;n++){var t=i[n],r=t.unit,l=t.ms;if(Math.abs(e)>=l||"second"===r)return Oe.format(Math.round(e/l),r)}return""}(e.getTime()-n.getTime()):""}function Le(e){if(0===e.items.length)return i(ve,{title:"No reflections to display",description:"There has not been any lesson progress just yet.",loading:e.loading,icon:"lessons"});var t=e.items.map((function(e){return n("tr",{children:[i("td",{children:e.studentName}),i("td",{children:e.lessonName}),i("td",{children:e.reflection}),i("td",{children:Te(new Date(e.updatedAt))})]},e.studentName+e.lessonName)}));return i(E.Autosize,me({maxHeight:500},{children:n(P,me({verticalSpacing:"sm",sx:{minWidth:700},highlightOnHover:!0,striped:!0},{children:[i("thead",{children:n("tr",{children:[i("th",{children:"Student Name"}),i("th",{children:"Lesson Name"}),i("th",{children:"Reflection"}),i("th",{children:"Updated At"})]})}),i("tbody",{children:t})]}))}))}function Ae(e){if(0===e.items.length)return i(ve,{title:"No impact statements to display",description:"There are no students with impact statements yet.",loading:e.loading,icon:"kindergarten"});var t=e.items.map((function(e){return n("tr",{children:[i("td",{children:e.studentName}),i("td",{children:e.impactStatement})]},e.studentName)}));return i(E.Autosize,me({maxHeight:500},{children:n(P,me({verticalSpacing:"sm",sx:{minWidth:700},highlightOnHover:!0,striped:!0},{children:[i("thead",{children:n("tr",{children:[i("th",{children:"Student Name"}),i("th",{children:"Impact Statement"})]})}),i("tbody",{children:t})]}))}))}function Be(e){if(0===e.items.length)return i(ve,{title:"No badges to display",description:"We don't have any badges to show you just yet.",loading:e.loading,icon:"badges"});var t=e.items.map((function(t){return n("tr",{children:[i("td",{children:i(A,me({onClick:function(){return e.onClick&&e.onClick(t)}},{children:t.name}))}),i("td",{children:t.description}),n("td",{children:[Math.round(100*(t.percentageCompletion+Number.EPSILON)),"%"]})]},t.badgeId)}));return i(E.Autosize,me({maxHeight:500},{children:n(P,me({verticalSpacing:"sm",sx:{minWidth:700},highlightOnHover:!0,striped:!0},{children:[i("thead",{children:n("tr",{children:[i("th",{children:"Badge Name"}),i("th",{children:"Description"}),i("th",{children:"Completion"})]})}),i("tbody",{children:t})]}))}))}function Ie(e){if(0===e.items.length)return i(ve,{title:"No lessons to display",description:"We don't have any lessons to show you just yet.",loading:e.loading,icon:"lessons"});var t=e.items.map((function(t){return n("tr",{children:[i("td",{children:i(A,me({onClick:function(){return e.onClick&&e.onClick(t)}},{children:t.name}))}),i("td",{children:t.description}),n("td",{children:[Math.round(100*(t.percentageCompletion+Number.EPSILON)),"%"]})]},t.lessonId)}));return i(E.Autosize,me({maxHeight:500},{children:n(P,me({verticalSpacing:"sm",sx:{minWidth:700},highlightOnHover:!0,striped:!0},{children:[i("thead",{children:n("tr",{children:[i("th",{children:"Lesson Name"}),i("th",{children:"Description"}),i("th",{children:"Completion"})]})}),i("tbody",{children:t})]}))}))}var We=function(e){var t=S("students"),r=t[0],o=t[1];return i(D,me({size:"lg",py:"xl"},{children:n(H,{children:[n(H,me({spacing:0},{children:[i(T,me({size:"h3"},{children:"Dashboard"})),i(w,me({color:"dimmed",size:"sm",mt:"md"},{children:"Fast-track learning for your students."}))]})),i(H,{children:n("div",me({style:{position:"relative"}},{children:[i(F,{visible:e.loading,overlayBlur:2}),n(H,me({spacing:"sm"},{children:[i(ge,{data:[{title:"# OF STUDENTS",value:e.students.length},{title:"ACCOUNT CREATION",value:e.percentageOfAccountsCreated,unit:"%"},{title:"BADGE COMPLETION",value:e.percentageOfBadgesEarned,unit:"%"},{title:"LESSON COMPLETION",value:e.percentageOfLessonsCompleted,unit:"%"}]}),i(q,{clearable:!0,clearButtonLabel:"Clear class selection",size:"sm",placeholder:"Select a class",nothingFound:"No options",value:e.classId,onChange:e.onClassChange,icon:i(l,{}),data:e.classes.map((function(e){return{value:e.classId,label:e.name}}))}),n(H,me({spacing:0},{children:[i(pe,{value:r,data:[{label:"My students",value:"students"},{label:"Impact statements",value:"impact"},{label:"Reflections",value:"reflections"},{label:"Badges",value:"badges"},{label:"Lessons",value:"lessons"}],onChange:o}),"impact"===r&&i(Ae,{loading:e.loading,items:e.impacts}),"reflections"===r&&i(Le,{loading:e.loading,items:e.reflections}),"badges"===r&&i(Be,{loading:e.loading,items:e.badges,onClick:e.onBadgeClick}),"lessons"===r&&i(Ie,{loading:e.loading,items:e.lessons,onClick:e.onLessonClick}),"students"===r&&i(ze,{loading:e.loading,items:e.students,onViewProfile:e.onViewStudentProfile})]}))]}))]}))})]})}))};function Ee(e){if(0===e.items.length)return i(ve,{title:"No students to display",description:"You have not rostered any students yet.",loading:e.loading,icon:"groups"});var t=e.items.map((function(t){return n("tr",{children:[i("td",{children:i(A,me({onClick:function(){return e.onViewProfile&&e.onViewProfile(t)}},{children:n(B,me({spacing:"sm"},{children:[i(I,{size:40,src:t.avatar,radius:40}),n("div",{children:[i(w,me({size:"sm",weight:500},{children:t.givenName&&t.familyName?"".concat(t.givenName," ").concat(t.familyName):t.email})),i(w,me({size:"xs",color:"dimmed"},{children:t.email}))]})]}))}))}),i("td",{children:t.badgesEarned}),i("td",{children:t.lessonsCompleted}),i("td",{children:t.hasAccount&&i(o,{color:"green"})}),i("td",{children:t.lastActivity?Te(t.lastActivity):""}),i("td",{children:i(B,me({noWrap:!0,spacing:0,position:"right"},{children:!t.readonly&&!!e.onDelete&&i(R,me({color:"red"},{children:i(a,{onClick:function(){return se({title:'Delete "'.concat((n=t).givenName&&n.familyName?"".concat(n.givenName," ").concat(n.familyName):n.email,'"?'),centered:!0,children:i(w,me({size:"sm"},{children:"Are you sure you want to delete this person? This action is destructive and you will have to contact support to restore your data."})),labels:{confirm:"Delete",cancel:"No don't delete them"},confirmProps:{color:"red"},onConfirm:function(){return e.onDelete&&e.onDelete(n)}});var n},size:16,stroke:1.5})}))}))})]},t.email)}));return i(E,{children:n(P,me({verticalSpacing:20,sx:{minWidth:700},highlightOnHover:!0,striped:!0},{children:[i("thead",{children:n("tr",{children:[i("th",{children:"Student Name"}),i("th",{children:"Badges Earned"}),i("th",{children:"Lessons Completed"}),i("th",{children:"Account Created?"}),i("th",{children:"Last Active"}),i("th",{})]})}),i("tbody",{children:t})]}))})}var Pe=z((function(e){var n;return{title:(n={fontSize:34,fontWeight:900},n[e.fn.smallerThan("sm")]={fontSize:24},n),description:{maxWidth:600},wrapper:{position:"relative",marginBottom:30},dropzone:{borderWidth:1,paddingBottom:50},icon:{color:"dark"===e.colorScheme?e.colors.dark[3]:e.colors.gray[4]},control:{position:"absolute",width:250,left:"calc(50% - 125px)",bottom:-20}}})),De=function(e){var l=Pe().classes,o=ae({initialValues:{classId:"",studentId:"",email:"",givenName:"",familyName:"",avatar:"",role:"",readonly:!1,lastActivity:null,hasAccount:!1,lessonsCompleted:0,badgesEarned:0},validate:{email:function(n){return/^\S+@\S+$/.test(n)&&0===e.students.filter((function(e){return e.email===n})).length?null:"Invalid email"}}}),a=S(!1),s=a[0],d=a[1];return n(t,{children:[i(G,me({opened:s,onClose:function(){return d(!1)},title:i(T,me({size:"h5"},{children:"Add students"})),padding:"xl",size:"xl"},{children:n(H,me({spacing:"md"},{children:[i(He,me({},e,{close:function(){return d(!1)}})),i(U,{label:"or",labelPosition:"center",my:"md",variant:"dashed"}),i("form",me({onSubmit:o.onSubmit((function(){var n=o.values;o.reset(),d(!1),e.onCreateStudents&&e.onCreateStudents([n])}))},{children:n(H,{children:[i(_,me({withAsterisk:!0,label:"Email",placeholder:"Email"},o.getInputProps("email"))),n(B,me({grow:!0},{children:[i(_,me({label:"Given name",placeholder:"Given name"},o.getInputProps("givenName"))),i(_,me({label:"Family name",placeholder:"Family name"},o.getInputProps("familyName")))]})),i(M,me({type:"submit",fullWidth:!0,mt:"md"},{children:"Submit"}))]})}))]}))})),i(D,me({size:"lg",py:"xl"},{children:n(H,me({spacing:"md"},{children:[n(j,{children:[n(j.Col,me({sm:"auto"},{children:[i(W,me({variant:"filled",leftSection:i(R,me({onClick:e.onBackClick,color:"blue",size:"xs",radius:"xl",variant:"filled"},{children:i(r,{size:14})})),size:"lg"},{children:"Classes"})),i(T,me({order:2,className:l.title,mt:"md"},{children:e.displayName||"Class"})),i(w,me({color:"dimmed",className:l.description,mt:"sm"},{children:e.description||"No description"}))]})),i(j.Col,me({sm:"content"},{children:!e.loading&&i(M,me({onClick:function(){return d(!0)},leftIcon:i(c,{size:14})},{children:"Add students"}))}))]}),n("div",me({style:{position:"relative"}},{children:[i(F,{visible:e.loading,overlayBlur:2}),n(H,me({spacing:"sm"},{children:[i(ge,{data:[{title:"# OF STUDENTS",value:e.students.length},{title:"ACCOUNT CREATION",value:e.percentageOfAccountsCreated,unit:"%"},{title:"BADGE COMPLETION",value:e.percentageOfBadgesEarned,unit:"%"},{title:"LESSON COMPLETION",value:e.percentageOfLessonsCompleted,unit:"%"}]}),i(Ee,{loading:e.loading,items:e.students,onDelete:e.onDeleteStudent,onViewProfile:function(n){return e.onStudentClick(n)}})]}))]}))]}))}))]})},He=function(e){var t=Pe(),r=t.classes,l=t.theme,o=N.useRef(null),a=N.useState(!1),c=a[0],m=a[1],u=N.useCallback((function(n){m(!0),n.forEach((function(n){ce.parse(n,{download:!0,header:!0,dynamicTyping:!0,skipEmptyLines:!0,worker:!0,complete:function(n){var i=n.data.filter((function(n){return/^\S+@\S+$/.test(n.email)&&0===e.students.filter((function(e){return e.email===n.email})).length}));i.length>0&&e.onCreateStudents&&e.onCreateStudents(i),m(!1),e.close()}})}))}),[]);return n("div",me({className:r.wrapper},{children:[i(le,me({loading:c,openRef:o,onDrop:u,className:r.dropzone,radius:"md",accept:[oe.csv],maxSize:5*Math.pow(1024,2)},{children:n("div",me({style:{pointerEvents:"none"}},{children:[n(B,me({position:"center"},{children:[i(le.Accept,{children:i(s,{size:50,color:l.colors[l.primaryColor][6],stroke:1.5})}),i(le.Reject,{children:i(d,{size:50,color:l.colors.red[6],stroke:1.5})}),i(le.Idle,{children:i(h,{size:50,color:"dark"===l.colorScheme?l.colors.dark[0]:l.black,stroke:1.5})})]})),n(w,me({align:"center",weight:700,size:"lg",mt:"xl"},{children:[i(le.Accept,{children:"Drop files here"}),i(le.Reject,{children:"Csv file less than 5mb"}),i(le.Idle,{children:"Upload multiple"})]})),n(w,me({align:"center",size:"sm",mt:"xs",color:"dimmed"},{children:["Drag'n'drop files here to upload. We can accept only ",i("i",{children:".csv"})," files that are less than 5mb in size."]}))]}))})),i(M,me({className:r.control,size:"md",radius:"xl",onClick:function(){var e;return null===(e=o.current)||void 0===e?void 0:e.call(o)}},{children:"Select file"}))]}))};function je(e){if(0===e.items.length)return i(ve,{title:"No classes to display",description:"You don't have any classes yet. Try creating one first...",loading:e.loading,icon:"groups"});var t=e.items.map((function(t){return n("tr",{children:[i("td",{children:i(A,me({onClick:function(){return e.onClick(t)}},{children:i(w,me({size:14},{children:t.name}))}))}),i("td",{children:i(w,me({size:14},{children:t.description}))}),i("td",{children:i(B,me({noWrap:!0,spacing:0,position:"right"},{children:i(R,me({color:"red"},{children:i(a,{onClick:function(){return se({title:'Delete "'.concat((n=t).name,'"?'),centered:!0,children:i(w,me({size:"sm"},{children:"Are you sure you want to delete this class? This action is destructive and you will have to contact support to restore your data."})),labels:{confirm:"Delete class",cancel:"No don't delete it"},confirmProps:{color:"red"},onConfirm:function(){return e.onDeleteClass(n)}});var n},size:16,stroke:1.5})}))}))})]},t.classId)}));return i(E.Autosize,me({maxHeight:300},{children:n(P,me({verticalSpacing:20,sx:{minWidth:700},highlightOnHover:!0,striped:!0},{children:[i("thead",{children:n("tr",{children:[i("th",{children:"Class Name"}),i("th",{children:"Description"}),i("th",{})]})}),i("tbody",{children:t})]}))}))}var Re=z((function(e){var n;return{title:(n={fontSize:34,fontWeight:900},n[e.fn.smallerThan("sm")]={fontSize:24},n),description:{maxWidth:600}}})),Me=function(e){var r=Re().classes,l=ae({initialValues:{classId:"",name:"",description:""},validate:{name:function(e){return e.length<=6?"Name should include at least 6 characters":null}}}),o=S(!1),a=o[0],s=o[1];return n(t,{children:[i(G,me({opened:a,onClose:function(){return s(!1)},title:n(B,me({spacing:0},{children:[i(T,me({size:"h5"},{children:"Create a class"})),i(Y,me({label:"Classes settings cannot be modified once created"},{children:i(R,{children:i(m,{color:"#3b82f6",size:14})})}))]})),padding:"xl",size:"xl"},{children:n("form",me({onSubmit:l.onSubmit((function(){var n=l.values;l.reset(),s(!1),e.onCreateClass&&e.onCreateClass(n)}))},{children:[n(H,{children:[i(_,me({withAsterisk:!0,label:"Name",placeholder:"Class name"},l.getInputProps("name"))),i(_,me({label:"Description",placeholder:"A class for my first period English students"},l.getInputProps("description")))]}),i(M,me({type:"submit",fullWidth:!0,mt:"md"},{children:"Submit"}))]}))})),i(D,me({size:"lg",py:"xl"},{children:n(H,me({spacing:"md"},{children:[n(j,{children:[n(j.Col,me({sm:"auto"},{children:[i(W,me({variant:"filled",size:"lg"},{children:"Classes"})),i(T,me({order:2,className:r.title,mt:"md"},{children:"Organize students into classes"})),i(w,me({color:"dimmed",className:r.description,mt:"sm"},{children:"A class can be for a specific period of time, grade, team, or other cohorts."}))]})),i(j.Col,me({sm:"content"},{children:!e.loading&&i(M,me({onClick:function(){return s(!0)},leftIcon:i(c,{size:14})},{children:"Create class"}))}))]}),n("div",me({style:{position:"relative"}},{children:[i(F,{visible:e.loading,overlayBlur:2}),n(H,me({spacing:"sm"},{children:[i(ge,{data:[{title:"# OF CLASSES",value:e.classes.length}]}),i(je,{loading:e.loading,items:e.classes,onDeleteClass:e.onDeleteClass,onClick:e.onClassClick})]}))]}))]}))}))]})},Fe=z((function(e){var n;return{title:(n={fontSize:34,fontWeight:900,marginTop:16},n[e.fn.smallerThan("sm")]={fontSize:24},n),description:{maxWidth:600}}})),qe=function(e){var r=Fe().classes;return n(t,{children:[i(T,me({className:r.title},{children:e.name})),i(w,me({color:"dimmed",className:r.description,mt:"xs"},{children:e.impactStatement}))]})};function Ve(e){if(0===e.items.length)return i(ve,{title:"No badges to display",description:"There has not been any badge progress just yet.",loading:e.loading,icon:"badges"});var t=e.items.map((function(t){return n("tr",{children:[i("td",{children:i(A,me({onClick:function(){return e.onClick(t)}},{children:t.badgeName}))}),n("td",{children:[!!t.isComplete&&i(W,me({variant:"filled"},{children:"Complete"})),!t.isComplete&&i(W,me({color:"red",variant:"filled"},{children:"Incomplete"}))]})]},t.badgeName)}));return i(E.Autosize,me({maxHeight:500},{children:n(P,me({verticalSpacing:"sm",sx:{minWidth:700},highlightOnHover:!0,striped:!0},{children:[i("thead",{children:n("tr",{children:[i("th",{children:"Badge Name"}),i("th",{children:"Status"})]})}),i("tbody",{children:t})]}))}))}function Ge(e){if(0===e.items.length)return i(ve,{title:"No answers to display",description:"There has not been any lesson progress just yet.",loading:e.loading,icon:"lessons"});var t=e.items.map((function(t){return n("tr",{children:[i("td",{children:i(A,me({onClick:function(){return e.onClick(t)}},{children:t.lessonName}))}),i("td",{children:t.questionName}),i("td",{children:t.answer.join(",")})]},t.questionName)}));return i(E.Autosize,me({maxHeight:500},{children:n(P,me({verticalSpacing:"sm",sx:{minWidth:700},highlightOnHover:!0,striped:!0},{children:[i("thead",{children:n("tr",{children:[i("th",{children:"Lesson Name"}),i("th",{children:"Question"}),i("th",{children:"Answer"})]})}),i("tbody",{children:t})]}))}))}function Ue(e){if(0===e.items.length)return i(ve,{title:"No reflections to display",description:"There has not been any lesson progress just yet.",loading:e.loading,icon:"lessons"});var t=e.items.map((function(t){return n("tr",{children:[i("td",{children:i(A,me({onClick:function(){return e.onClick(t)}},{children:t.lessonName}))}),i("td",{children:t.reflection}),i("td",{children:t.rating.toLocaleString()})]},t.lessonName)}));return i(E.Autosize,me({maxHeight:500},{children:n(P,me({verticalSpacing:"sm",sx:{minWidth:700},highlightOnHover:!0,striped:!0},{children:[i("thead",{children:n("tr",{children:[i("th",{children:"Lesson Name"}),i("th",{children:"Reflection"}),i("th",{children:"Rating"})]})}),i("tbody",{children:t})]}))}))}var _e=function(e){var t=S("badges"),l=t[0],o=t[1],a=e.badges.length,c=a>0?e.badges.filter((function(e){return e.isComplete})).length/a:0;return i(D,me({size:"lg",py:"xl"},{children:n(H,me({spacing:"md"},{children:[i(j,me({gutter:"md"},{children:n(j.Col,me({sm:"auto"},{children:[i(W,me({variant:"filled",leftSection:i(R,me({onClick:e.onBackClick,color:"blue",size:"xs",radius:"xl",variant:"filled"},{children:i(r,{size:14})})),size:"lg"},{children:"Students"})),i(qe,{variant:"compact",name:e.name,impactStatement:e.impactStatement})]}))})),n("div",me({style:{position:"relative"}},{children:[i(F,{visible:e.loading,overlayBlur:2}),n(H,me({spacing:"lg"},{children:[i(ge,{data:[{title:"PROBLEMS SOLVED",value:e.numberOfProblemsSolved},{title:"LESSON COMPLETION",value:e.percentageOfLessonsCompleted,unit:"%"},{title:"BADGE COMPLETION",value:c,unit:"%"}]}),n(H,me({spacing:0},{children:[i(pe,{value:l,data:[{label:"My badges",value:"badges"},{label:"My answers",value:"answers"},{label:"My reflections",value:"reflections"}],onChange:o}),"badges"===l&&i(Ve,{loading:e.loading,items:e.badges,onClick:e.onBadgeClick}),"answers"===l&&i(Ge,{loading:e.loading,items:e.answers,onClick:e.onAnswerClick}),"reflections"===l&&i(Ue,{loading:e.loading,items:e.reflections,onClick:e.onReflectionClick})]}))]}))]}))]}))}))},Ye=z((function(e,n){var i=n.from||"blue",t=n.to||"green";return{card:{position:"relative",cursor:"pointer",overflow:"hidden",transition:"transform 150ms ease, box-shadow 100ms ease",padding:e.spacing.xl,paddingLeft:2*e.spacing.xl,"&:hover":{boxShadow:e.shadows.md,transform:"scale(1.02)"},"&::before":{content:'""',position:"absolute",top:0,bottom:0,left:0,width:6,backgroundImage:e.fn.linearGradient(0,e.colors[i][6],e.colors[t][6])}}}}));function $e(e){var t=Ye(e).classes,r=e.from||"blue",l=e.to||"green",o=e.icon||i(u,{size:28,stroke:1.5});return n($,me({withBorder:!0,radius:"md",className:t.card,onClick:e.onClick},{children:[i(J,me({size:"xl",radius:"md",variant:"gradient",gradient:{deg:0,from:r,to:l}},{children:o})),i(w,me({size:"xl",weight:500,mt:"md"},{children:e.title})),i(w,me({size:"sm",mt:"sm",color:"dimmed"},{children:e.description}))]}))}var Je=z((function(e){return{card:{height:240,backgroundSize:"cover",backgroundPosition:"center"},content:{position:"absolute",padding:e.spacing.xl,zIndex:1,top:0,bottom:0,right:0,left:0},action:{position:"absolute",bottom:e.spacing.xl,right:e.spacing.xl},title:{color:e.white,marginBottom:e.spacing.xs/2},description:{color:e.white,maxWidth:220}}})),Qe=function(e){var t=e.title,r=e.description,l=e.image,o=e.action,a=e.style,c=e.className,s=function(e,n){var i={};for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&n.indexOf(t)<0&&(i[t]=e[t]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(t=Object.getOwnPropertySymbols(e);r<t.length;r++)n.indexOf(t[r])<0&&Object.prototype.propertyIsEnumerable.call(e,t[r])&&(i[t[r]]=e[t[r]])}return i}(e,["title","description","image","action","style","className"]),d=Je(),h=d.classes,m=d.cx,u=d.theme;return n(Q,me({radius:"md",style:me({backgroundImage:"url(".concat(l,")")},a),className:m(h.card,c)},s,{children:[i(K,{gradient:"linear-gradient(105deg, ".concat(u.black," 20%, #312f2f 50%, ").concat(u.colors.gray[4]," 100%)"),opacity:.55,zIndex:0}),n("div",me({className:h.content},{children:[i(w,me({size:"lg",weight:700,className:h.title},{children:t})),i(w,me({size:"sm",className:h.description},{children:r})),i(M,me({className:h.action,variant:"white",color:"dark",component:"a",size:"xs",href:o.link,target:"_blank"},{children:o.label}))]}))]}))},Ke=function(e){return i(D,me({size:"lg"},{children:n(H,me({spacing:"lg"},{children:[n(j,me({gutter:"md"},{children:[i(j.Col,me({md:6},{children:i(qe,{variant:"compact",name:e.name,impactStatement:e.impactStatement})})),i(j.Col,me({md:6},{children:i(Qe,{title:e.organization.name,description:e.organization.description,image:e.organization.image,action:{label:"Visit website",link:e.organization.website}})}))]})),n(j,me({gutter:"md"},{children:[i(j.Col,{children:i($e,{title:"Dashboard",description:"Track class performance across core areas of focus.",onClick:e.onDashboardClick})}),i(j.Col,{children:i($e,{title:"Classes",description:"Organize students into classes.",onClick:e.onClassesClick})}),i(j.Col,{children:i($e,{title:"Lessons",description:"Explore units of instruction and/or see corresponding class progress.",onClick:e.onLessonsClick})}),i(j.Col,{children:i($e,{title:"Badges",description:"Project-sized skills acquisition and standards alignment.",onClick:e.onBadgesClick})})]}))]}))}))};function Xe(e){if(0===e.items.length)return i(ve,{title:"No reflections to display",description:"There has not been any lesson progress just yet.",loading:e.loading,icon:"lessons"});var t=e.items.map((function(e){return n("tr",{children:[i("td",{children:e.studentName}),i("td",{children:e.reflection}),i("td",{children:e.rating.toLocaleString()})]},e.studentName)}));return i(E.Autosize,me({maxHeight:500},{children:n(P,me({verticalSpacing:"sm",sx:{minWidth:700},highlightOnHover:!0,striped:!0},{children:[i("thead",{children:n("tr",{children:[i("th",{children:"Student Name"}),i("th",{children:"Reflection"}),i("th",{children:"Rating"})]})}),i("tbody",{children:t})]}))}))}function Ze(e){if(0===e.items.length)return i(ve,{title:"No students to display",description:"You don't have any student data yet for this lesson",loading:e.loading,icon:"lessons"});var t=e.items.map((function(t){return n("tr",{children:[i("td",{children:i(A,me({onClick:function(){return e.onClick&&e.onClick(t)}},{children:n(B,me({spacing:"sm"},{children:[i(I,{size:40,src:t.avatar,radius:40}),n("div",{children:[i(w,me({size:"sm",weight:500},{children:t.name})),i(w,me({size:"xs",color:"dimmed"},{children:t.email}))]})]}))}))}),n("td",{children:[!!t.isComplete&&i(W,me({variant:"filled"},{children:"Complete"})),!t.isComplete&&!t.isStarted&&i(W,me({color:"red",variant:"filled"},{children:"Not started"})),!t.isComplete&&!!t.isStarted&&i(W,me({color:"violet",variant:"filled"},{children:"In progress"}))]})]},t.name)}));return i(E.Autosize,me({maxHeight:500},{children:n(P,me({verticalSpacing:"sm",sx:{minWidth:700},highlightOnHover:!0,striped:!0},{children:[i("thead",{children:n("tr",{children:[i("th",{children:"Lesson Name"}),i("th",{children:"Status"})]})}),i("tbody",{children:t})]}))}))}function en(e){var t=N.useMemo((function(){return{position:"left",getValue:function(e){return e.primary}}}),[]),r=N.useMemo((function(){return[{position:"bottom",getValue:function(e){return e.secondary}}]}),[]);if(0===e.items.length)return i(ve,{title:"No questions to display",description:"There are no questions in this lesson.",loading:e.loading,icon:"lessons"});var l=e.items.map((function(e){if(e.chart){var l={},o=e.choices||[];return o.forEach((function(e){l[e]=0})),e.answers.forEach((function(e){return e.forEach((function(e){e in l&&(l[e]=l[e]?l[e]+1:1)}))})),i(Q,me({withBorder:!0,p:"xl",radius:"md"},{children:n(H,me({spacing:4},{children:[i(T,me({size:"lg"},{children:e.question})),n(w,me({size:"sm"},{children:[e.answers.length," answers"]})),i("div",me({style:{background:"white",height:"300px",width:"100%",position:"relative"}},{children:i(he,{options:{data:[{label:"",data:o.map((function(e){return{primary:e,secondary:l[e]}}))}],primaryAxis:t,secondaryAxes:r}})}))]}))}),e.question)}return i(Q,me({withBorder:!0,p:"xl",radius:"md"},{children:n(H,me({spacing:4},{children:[i(T,me({size:"lg"},{children:e.question})),n(w,me({size:"sm"},{children:[e.answers.length," answers"]})),i(E.Autosize,me({maxHeight:500},{children:i(H,me({spacing:4},{children:e.answers.map((function(e){var n=e.join("\n");return i(Q,me({p:5,radius:0,bg:"gray.0"},{children:i(w,{children:n})}),n)}))}))}))]}))}),e.question)}));return i(H,me({py:4,spacing:10,sx:{minWidth:700}},{children:l}))}var nn=z((function(e){var n;return{title:(n={fontSize:34,fontWeight:900},n[e.fn.smallerThan("sm")]={fontSize:24},n),description:{maxWidth:600}}})),tn=function(e){var t=nn().classes,o=S("question"),a=o[0],c=o[1],s=e.students.length,d=s>0?e.students.filter((function(e){return e.isComplete})).length/s:0;return i(D,me({size:"lg",py:"xl"},{children:n(H,me({spacing:"md"},{children:[i(j,{children:n(j.Col,me({sm:"auto"},{children:[i(W,me({variant:"filled",leftSection:i(R,me({onClick:e.onBackClick,color:"blue",size:"xs",radius:"xl",variant:"filled"},{children:i(r,{size:14})})),size:"lg"},{children:"Lessons"})),n(B,{children:[n(H,me({spacing:0},{children:[i(T,me({order:2,className:t.title,mt:"md"},{children:e.displayName||"Lesson"})),i(w,me({color:"dimmed",className:t.description,mt:"sm"},{children:e.description||"No description"}))]})),i(H,me({ml:"auto"},{children:i(M,me({variant:"gradient",onClick:e.onPreviewClick},{children:"Preview"}))}))]})]}))}),i("div",{children:n("div",me({style:{position:"relative"}},{children:[i(F,{visible:e.loading,overlayBlur:2}),n(H,{children:[i(ge,{data:[{title:"LESSON COMPLETION",value:d,unit:"%"}]}),i(q,{clearable:!0,clearButtonLabel:"Clear class selection",size:"sm",placeholder:"Select a class",nothingFound:"No options",value:e.classId,onChange:e.onClassChange,icon:i(l,{}),data:e.classes.map((function(e){return{value:e.classId,label:e.name}}))}),n(H,me({spacing:0},{children:[i(pe,{value:a,data:[{label:"By question",value:"question"},{label:"By reflection",value:"reflections"},{label:"By student",value:"students"}],onChange:c}),"question"===a&&i(en,{loading:e.loading,items:e.questions}),"reflections"===a&&i(Xe,{loading:e.loading,items:e.reflections}),"students"===a&&i(Ze,{loading:e.loading,items:e.students,onClick:e.onUserClick})]}))]})]}))})]}))}))};function rn(e){if(0===e.items.length)return i(ve,{title:"No lessons to display",description:"We don't have any lessons to show you just yet.",loading:e.loading,icon:"lessons"});var t=e.items.map((function(t){return i("tr",{children:i("td",{children:i(A,me({sx:function(e){return{display:"block",width:"100%",padding:e.spacing.md,color:"dark"===e.colorScheme?e.colors.dark[0]:e.black,"&:hover":{backgroundColor:"dark"===e.colorScheme?e.colors.dark[8]:e.colors.gray[1]}}},onClick:function(){return e.onClick&&e.onClick(t)}},{children:i(B,{children:n("div",{children:[i(w,me({size:"sm",weight:500},{children:t.name})),i(w,me({size:"xs",color:"dimmed"},{children:t.description}))]})})}))})},t.lessonId)}));return i(E.Autosize,me({maxHeight:500},{children:i(P,me({horizontalSpacing:0,verticalSpacing:0,sx:{minWidth:700}},{children:i("tbody",{children:t})}))}))}var ln=z((function(e){var n;return{title:(n={fontSize:34,fontWeight:900},n[e.fn.smallerThan("sm")]={fontSize:24},n),description:{maxWidth:600}}})),on=function(e){var t=ln().classes;return i(D,me({size:"lg",py:"xl"},{children:n(H,me({spacing:"md"},{children:[i(j,{children:n(j.Col,me({sm:"auto"},{children:[i(W,me({variant:"filled",size:"lg"},{children:"Lessons"})),i(T,me({order:2,className:t.title,mt:"md"},{children:"Lessons"})),i(w,me({color:"dimmed",className:t.description,mt:"sm"},{children:"Explore units of instruction and/or see corresponding class progress."}))]}))}),i(V,{placeholder:"Search for a lesson that fits your needs",data:e.lessons.map((function(e){return e.name})),onChange:e.onAutocompleteChange}),n("div",me({style:{position:"relative"}},{children:[i(F,{visible:e.loading,overlayBlur:2}),i(rn,{loading:e.loading,items:e.lessons,onClick:e.onLessonClick})]}))]}))}))},an=X({key:"mantine",prepend:!1}),cn=function(n){return i(Z,me({withNormalizeCSS:!0,withGlobalStyles:!0,emotionCache:an,theme:{loader:"bars"}},{children:i(e,me({limit:n.notificationLimit||5},{children:i(de,{children:n.children})}))}))},sn=function(e){var t=ae({initialValues:{active:e.account}});return i(ee,me({centered:!0,opened:e.opened,onClose:function(){return e.onClose&&e.onClose()},size:"sm",title:i(T,me({size:"h5"},{children:"Accounts"}))},{children:n("form",me({onSubmit:t.onSubmit((function(){e.onChange&&e.onChange(t.values.active)}))},{children:[i(q,me({required:!0,placeholder:"Select an account",defaultValue:e.account,data:e.accounts.map((function(e){return{value:e.accountId,label:e.name}}))},t.getInputProps("active"))),i(M,me({type:"submit",fullWidth:!0,mt:"xl"},{children:"Switch"}))]}))}))},dn=z((function(e){return{link:{width:50,height:50,borderRadius:e.radius.md,display:"flex",alignItems:"center",justifyContent:"center",color:"dark"===e.colorScheme?e.colors.dark[0]:e.colors.gray[7],"&:hover":{backgroundColor:"dark"===e.colorScheme?e.colors.dark[5]:e.colors.gray[0]}},active:{"&, &:hover":{backgroundColor:e.fn.variant({variant:"light",color:e.primaryColor}).background,color:e.fn.variant({variant:"light",color:e.primaryColor}).color}}}})),hn=[{icon:f,label:"Home",href:"/home"},{icon:v,label:"Dashboard",href:"/dashboard"},{icon:l,label:"Classes",href:"/classes"},{icon:b,label:"Badges",href:"/badges"},{icon:C,label:"Lessons",href:"/lessons"}],mn=function(e){var n,t=e.icon,r=e.label,l=e.active,o=e.onClick,a=dn(),c=a.classes,s=a.cx;return i(Y,me({label:r,position:"right",transitionDuration:0},{children:i(A,me({onClick:o,className:s(c.link,(n={},n[c.active]=l,n))},{children:i(t,{stroke:1.5})}))}))},un=function(e){var t=hn.map((function(n){return i(mn,{label:n.label,icon:n.icon,active:n.label===e.active,onClick:function(){return e.navigate(n.href)}},n.label)}));return n(ne,me({width:{base:80},p:"md"},{children:[i(ie,{children:i(I,me({color:"blue",radius:"sm"},{children:i("div",me({style:{width:15,marginLeft:"auto",marginRight:"auto"}},{children:i(L,{fit:"contain",src:"https://cdn.localcivics.io/brand/l.png"})}))}))}),i(ne.Section,me({grow:!0,mt:50},{children:i(H,me({justify:"center",spacing:0},{children:t}))})),i(ne.Section,{children:n(H,me({justify:"center",spacing:0},{children:[i(mn,{icon:g,label:"Switch accounts",onClick:e.onSwitchAccounts}),i(mn,{icon:p,label:"Logout",onClick:e.onLogout})]}))})]}))},gn=z((function(e){var n,i,t,r,l,o;return{footer:{paddingTop:2*e.spacing.xl,paddingBottom:2*e.spacing.xl,paddingLeft:3*e.spacing.xl,backgroundColor:"dark"===e.colorScheme?e.colors.dark[6]:e.colors.gray[0],borderTop:"1px solid ".concat("dark"===e.colorScheme?e.colors.dark[5]:e.colors.gray[2])},logo:(n={maxWidth:200},n[e.fn.smallerThan("sm")]={display:"flex",flexDirection:"column",alignItems:"center"},n),description:(i={marginTop:5},i[e.fn.smallerThan("sm")]={marginTop:e.spacing.xs,textAlign:"center"},i),inner:(t={display:"flex",justifyContent:"space-between"},t[e.fn.smallerThan("sm")]={flexDirection:"column",alignItems:"center"},t),groups:(r={display:"flex",flexWrap:"wrap"},r[e.fn.smallerThan("sm")]={display:"none"},r),wrapper:{width:160},link:{display:"block",color:"dark"===e.colorScheme?e.colors.dark[1]:e.colors.gray[6],fontSize:e.fontSizes.sm,paddingTop:3,paddingBottom:3,"&:hover":{textDecoration:"underline"}},title:{fontSize:e.fontSizes.md,fontWeight:700,fontFamily:"Greycliff CF, ".concat(e.fontFamily),marginBottom:e.spacing.xs/2,color:"dark"===e.colorScheme?e.white:e.black},afterFooter:(l={display:"flex",justifyContent:"space-between",alignItems:"center",marginTop:e.spacing.xl,paddingTop:e.spacing.xl,paddingBottom:e.spacing.xl,borderTop:"1px solid ".concat("dark"===e.colorScheme?e.colors.dark[4]:e.colors.gray[2])},l[e.fn.smallerThan("sm")]={flexDirection:"column"},l),social:(o={},o[e.fn.smallerThan("sm")]={marginTop:e.spacing.xs},o)}})),pn=function(e){var r=gn().classes,l=fn(e.account,e.accounts,e.onAccountChange);return n(te,me({padding:"xs",navbar:i(un,{active:e.navbar.props.active,navigate:e.navbar.props.navigate,onLogout:e.navbar.props.onLogout,onSwitchAccounts:function(){return l.setChangeModalOpen(!0)}}),footer:i(t,{children:!l.opened&&n("footer",me({className:r.footer},{children:[n(D,me({className:r.inner},{children:[n("div",me({className:r.logo},{children:[n(B,me({spacing:"xs"},{children:[i("div",me({style:{width:15}},{children:i(L,{fit:"contain",src:"https://cdn.localcivics.io/brand/l.png"})})),i(T,me({color:"dimmed",size:"h5"},{children:"Local Civics"}))]})),i(w,me({size:"xs",color:"dimmed",className:r.description},{children:"We connect students to powerful civic learning experiences."}))]})),i("div",me({className:r.groups},{children:n("div",me({className:r.wrapper},{children:[i(w,me({className:r.link,component:"a",href:"https://www.localcivics.io",target:"_blank"},{children:"About"})),i(w,me({className:r.link,component:"a",href:"https://www.localcivics.io/terms-of-service",target:"_blank"},{children:"Terms"})),i(w,me({className:r.link,component:"a",href:"https://www.localcivics.io/privacy-policy",target:"_blank"},{children:"Privacy"})),i(w,me({className:r.link,component:"a",href:"https://localcivics.notion.site/Help-Center-b52300f587b64fc0a61f512686e7626d",target:"_blank"},{children:"Help Center"}))]}))}))]})),n(D,me({className:r.afterFooter},{children:[n(w,me({color:"dimmed",size:"sm"},{children:["© ",(new Date).getFullYear()," Local Civics. All rights reserved."]})),n(B,me({spacing:0,className:r.social,position:"right",noWrap:!0},{children:[i(R,me({component:"a",target:"_blank",href:"https://www.instagram.com/localcivics/",size:"lg"},{children:i(y,{size:18,stroke:1.5})})),i(R,me({component:"a",target:"_blank",href:"https://www.linkedin.com/company/localcivics",size:"lg"},{children:i(k,{size:18,stroke:1.5})})),i(R,me({component:"a",target:"_blank",href:"https://www.facebook.com/localcivics/",size:"lg"},{children:i(x,{size:18,stroke:1.5})}))]}))]}))]}))}),styles:function(e){return{main:{backgroundColor:"dark"===e.colorScheme?e.colors.dark[8]:e.colors.gray[0]}}}},{children:[n("div",me({style:{position:"relative"}},{children:[(e.loading||l.opened)&&i(ie,me({style:{height:400}},{children:i(re,{})})),!e.loading&&!l.opened&&e.page]})),i(sn,{opened:l.opened,account:l.account,accounts:l.accounts,onChange:l.onAccountChange,onClose:function(){return l.setChangeModalOpen(!1)}})]}))},fn=function(e,n,i){var t=JSON.stringify(n),r=S(!1),l=r[0],o=r[1],a=S(e),c=a[0],s=a[1];return N.useEffect((function(){s(e)}),[e,t]),{opened:l,account:c,accounts:n,setChangeModalOpen:o,onAccountChange:function(e){s(e),o(!1),i(e)}}};export{cn as AdminProvider,pn as App,ke as Badge,Se as Badges,De as Class,Me as Classes,We as Dashboard,Ke as Home,tn as Lesson,on as Lessons,un as Navbar,_e as Student,sn as SwitchAccount};
1
+ import{NotificationsProvider as e}from"@mantine/notifications";export{showNotification,updateNotification}from"@mantine/notifications";import{jsxs as n,jsx as i,Fragment as t}from"react/jsx-runtime";import{IconArrowLeft as r,IconCategory2 as l,IconCheck as o,IconTrash as a,IconPlaylistAdd as s,IconDownload as c,IconX as d,IconCloudUpload as h,IconInfoCircle as m,IconColorSwatch as u,IconSwitchHorizontal as g,IconLogout as p,IconHome2 as f,IconGauge as v,IconAlbum as b,IconLambda as C,IconBrandInstagram as y,IconBrandLinkedin as k,IconBrandFacebook as x}from"@tabler/icons";import*as N from"react";import{useState as S}from"react";import{createStyles as z,Text as w,Tabs as O,Title as T,Image as L,UnstyledButton as A,Group as B,Avatar as I,Badge as W,ScrollArea as E,Table as P,Container as D,Stack as H,Grid as j,ActionIcon as R,Button as M,LoadingOverlay as F,Select as q,Autocomplete as V,Drawer as G,Divider as U,TextInput as _,Tooltip as Y,Paper as $,ThemeIcon as J,Card as Q,Overlay as K,createEmotionCache as X,MantineProvider as Z,Modal as ee,Navbar as ne,Center as ie,AppShell as te,Loader as re}from"@mantine/core";import{Dropzone as le,MIME_TYPES as oe}from"@mantine/dropzone";import{useForm as ae}from"@mantine/form";import*as se from"papaparse";import{openConfirmModal as ce,ModalsProvider as de}from"@mantine/modals";import{Chart as he}from"react-charts";var me=function(){return me=Object.assign||function(e){for(var n,i=1,t=arguments.length;i<t;i++)for(var r in n=arguments[i])Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r]);return e},me.apply(this,arguments)};var ue=z((function(e){var n,i;return{root:(n={display:"flex",backgroundImage:"linear-gradient(-60deg, ".concat(e.colors[e.primaryColor][4]," 0%, ").concat(e.colors[e.primaryColor][7]," 100%)"),padding:1.5*e.spacing.xl,borderRadius:e.radius.md},n[e.fn.smallerThan("sm")]={flexDirection:"column"},n),title:{color:e.white,textTransform:"uppercase",fontWeight:700,fontSize:e.fontSizes.sm},count:{color:e.white,fontSize:32,lineHeight:1,fontWeight:700,marginBottom:e.spacing.md,fontFamily:"Greycliff CF, ".concat(e.fontFamily)},description:{color:e.colors[e.primaryColor][0],fontSize:e.fontSizes.sm,marginTop:5},stat:{flex:1,"& + &":(i={paddingLeft:e.spacing.xl,marginLeft:e.spacing.xl,borderLeft:"1px solid ".concat(e.colors[e.primaryColor][3])},i[e.fn.smallerThan("sm")]={paddingLeft:0,marginLeft:0,borderLeft:0,paddingTop:e.spacing.xl,marginTop:e.spacing.xl,borderTop:"1px solid ".concat(e.colors[e.primaryColor][3])},i)}}})),ge=function(e){var t=e.data,r=ue().classes,l=t.map((function(e){var t="%"===e.unit?Math.round(100*(e.value+Number.EPSILON)):e.value;return n("div",me({className:r.stat},{children:[n(w,me({className:r.count},{children:[t.toLocaleString(),e.unit]})),i(w,me({className:r.title},{children:e.title}))]}),e.title)}));return i("div",me({className:r.root},{children:l}))},pe=function(e){var n,t=null===(n=e.data)||void 0===n?void 0:n.map((function(e){return i(O.Tab,me({value:e.value},{children:e.label||e.value}),e.value)}));return i(O,me({value:e.value,onTabChange:e.onChange},{children:i(O.List,{children:t})}))},fe=z((function(e){var n,i,t;return{wrapper:(n={display:"flex",alignItems:"center",padding:2*e.spacing.xl,borderRadius:e.radius.md,backgroundColor:"dark"===e.colorScheme?e.colors.dark[8]:e.white,border:"1px solid ".concat("dark"===e.colorScheme?e.colors.dark[8]:e.colors.gray[3])},n["@media (max-width: ".concat(e.breakpoints.sm,"px)")]={flexDirection:"column-reverse",padding:e.spacing.xl},n),image:(i={maxWidth:"40%"},i["@media (max-width: ".concat(e.breakpoints.sm,"px)")]={maxWidth:"100%"},i),body:(t={paddingRight:4*e.spacing.xl},t["@media (max-width: ".concat(e.breakpoints.sm,"px)")]={paddingRight:0,marginTop:e.spacing.xl},t),title:{color:"dark"===e.colorScheme?e.white:e.black,fontFamily:"Greycliff CF, ".concat(e.fontFamily),lineHeight:1,marginBottom:e.spacing.md},controls:{display:"flex",marginTop:e.spacing.xl},inputWrapper:{width:"100%",flex:"1"},input:{borderTopRightRadius:0,borderBottomRightRadius:0,borderRight:0},control:{borderTopLeftRadius:0,borderBottomLeftRadius:0}}})),ve=function(e){var t=fe().classes,r=e.title||"Nothing to display",l=e.description||"We don't have anything to show you here just yet. Add data, check back later, or adjust your search.";return n("div",me({className:t.wrapper},{children:[n("div",me({className:t.body},{children:[i(T,me({className:t.title},{children:e.loading?"Loading...":r})),i(w,me({size:"sm",color:"dimmed"},{children:e.loading?"Hold on, we're loading your data.":l}))]})),i(L,{src:"https://cdn.localcivics.io/illustrations/".concat(e.icon,".svg"),className:t.image})]}))};function be(e){if(0===e.items.length)return i(ve,{title:"No badges to display",description:"There has not been any badge progress just yet.",loading:e.loading,icon:"badges"});var t=e.items.map((function(t){return n("tr",{children:[i("td",{children:i(A,me({onClick:function(){return e.onClick&&e.onClick(t)}},{children:n(B,me({spacing:"sm"},{children:[i(I,{size:40,src:t.avatar,radius:40}),n("div",{children:[i(w,me({size:"sm",weight:500},{children:t.name})),i(w,me({size:"xs",color:"dimmed"},{children:t.email}))]})]}))}))}),n("td",{children:[!!t.isComplete&&i(W,me({variant:"filled"},{children:"Complete"})),!t.isComplete&&i(W,me({color:"red",variant:"filled"},{children:"Incomplete"}))]})]},t.name)}));return i(E.Autosize,me({maxHeight:500},{children:n(P,me({verticalSpacing:"sm",sx:{minWidth:700},highlightOnHover:!0,striped:!0},{children:[i("thead",{children:n("tr",{children:[i("th",{children:"Student Name"}),i("th",{children:"Badge Status"})]})}),i("tbody",{children:t})]}))}))}function Ce(e){if(0===e.items.length)return i(ve,{title:"No lessons to display",description:"There are not lessons in badge.",loading:e.loading,icon:"badges"});var t=e.items.map((function(t){var r=Math.round(100*(t.percentageCompletion+Number.EPSILON));return n("tr",{children:[i("td",{children:i(A,me({onClick:function(){return e.onClick&&e.onClick(t)}},{children:t.lessonName}))}),n("td",{children:[r,"%"]})]},t.lessonName)}));return i(E.Autosize,me({maxHeight:500},{children:n(P,me({verticalSpacing:"sm",sx:{minWidth:700},highlightOnHover:!0,striped:!0},{children:[i("thead",{children:n("tr",{children:[i("th",{children:"Lesson Name"}),i("th",{children:"Lesson Completion"})]})}),i("tbody",{children:t})]}))}))}var ye=z((function(e){var n;return{title:(n={fontSize:34,fontWeight:900},n[e.fn.smallerThan("sm")]={fontSize:24},n),description:{maxWidth:600}}})),ke=function(e){var t=ye().classes,o=S("lessons"),a=o[0],s=o[1],c=e.students.length,d=c>0?e.students.filter((function(e){return e.isComplete})).length/c:0;return i(D,me({size:"lg",py:"xl"},{children:n(H,me({spacing:"md"},{children:[i(j,{children:n(j.Col,me({sm:"auto"},{children:[i(W,me({variant:"filled",leftSection:i(R,me({onClick:e.onBackClick,color:"blue",size:"xs",radius:"xl",variant:"filled"},{children:i(r,{size:14})})),size:"lg"},{children:"Badges"})),n(B,{children:[n(H,me({spacing:0},{children:[i(T,me({order:2,className:t.title,mt:"md"},{children:e.displayName||"Badge"})),i(w,me({color:"dimmed",className:t.description,mt:"sm"},{children:e.description||"No description"}))]})),i(H,me({ml:"auto"},{children:i(M,me({variant:"gradient",onClick:e.onPreviewClick},{children:"Preview"}))}))]})]}))}),i("div",{children:n("div",me({style:{position:"relative"}},{children:[i(F,{visible:e.loading,overlayBlur:2}),n(H,{children:[i(ge,{data:[{title:"BADGE COMPLETION",value:d,unit:"%"}]}),i(q,{clearable:!0,clearButtonLabel:"Clear class selection",size:"sm",placeholder:"Select a class",nothingFound:"No options",value:e.classId,onChange:e.onClassChange,icon:i(l,{}),data:e.classes.map((function(e){return{value:e.classId,label:e.name}}))}),n(H,me({spacing:0},{children:[i(pe,{value:a,data:[{label:"By lesson",value:"lessons"},{label:"By student",value:"students"}],onChange:s}),"lessons"===a&&i(Ce,{loading:e.loading,items:e.lessons,onClick:e.onLessonClick}),"students"===a&&i(be,{loading:e.loading,items:e.students,onClick:e.onUserClick})]}))]})]}))})]}))}))};function xe(e){if(0===e.items.length)return i(ve,{title:"No badges to display",description:"We don't have any badges to show you just yet.",loading:e.loading,icon:"badges"});var t=e.items.map((function(t){return i("tr",{children:i("td",{children:i(A,me({sx:function(e){return{display:"block",width:"100%",padding:e.spacing.md,color:"dark"===e.colorScheme?e.colors.dark[0]:e.black,"&:hover":{backgroundColor:"dark"===e.colorScheme?e.colors.dark[8]:e.colors.gray[1]}}},onClick:function(){return e.onClick&&e.onClick(t)}},{children:i(B,{children:n("div",{children:[i(w,me({size:"sm",weight:500},{children:t.name})),i(w,me({size:"xs",color:"dimmed"},{children:t.description}))]})})}))})},t.badgeId)}));return i(E.Autosize,me({maxHeight:500},{children:i(P,me({horizontalSpacing:0,verticalSpacing:0,sx:{minWidth:700}},{children:i("tbody",{children:t})}))}))}var Ne=z((function(e){var n;return{title:(n={fontSize:34,fontWeight:900},n[e.fn.smallerThan("sm")]={fontSize:24},n),description:{maxWidth:600}}})),Se=function(e){var t=Ne().classes;return i(D,me({size:"lg",py:"xl"},{children:n(H,me({spacing:"md"},{children:[i(j,{children:n(j.Col,me({sm:"auto"},{children:[i(W,me({variant:"filled",size:"lg"},{children:"Badges"})),i(T,me({order:2,className:t.title,mt:"md"},{children:"Badges and micro-credentials"})),i(w,me({color:"dimmed",className:t.description,mt:"sm"},{children:"Project-sized skills acquisition and standards alignment."}))]}))}),i(V,{placeholder:"Search for a badge that fits your needs",data:e.badges.map((function(e){return e.name})),onChange:e.onAutocompleteChange}),n("div",me({style:{position:"relative"}},{children:[i(F,{visible:e.loading,overlayBlur:2}),i(xe,{loading:e.loading,items:e.badges,onClick:e.onBadgeClick})]}))]}))}))};function ze(e){if(0===e.items.length)return i(ve,{title:"No students to display",description:"You don't have any students yet, add them and revisit.",loading:e.loading,icon:"groups"});var t=e.items.map((function(t){return n("tr",{children:[i("td",{children:i(A,me({onClick:function(){return e.onViewProfile(t)}},{children:t.studentName}))}),i("td",{children:t.className})]},t.studentName)}));return i(E.Autosize,me({maxHeight:500},{children:n(P,me({verticalSpacing:"sm",sx:{minWidth:700},highlightOnHover:!0,striped:!0},{children:[i("thead",{children:n("tr",{children:[i("th",{children:"Student Name"}),i("th",{children:"Class Name"})]})}),i("tbody",{children:t})]}))}))}var we=[{unit:"year",ms:31536e6},{unit:"month",ms:2628e6},{unit:"day",ms:864e5},{unit:"hour",ms:36e5},{unit:"minute",ms:6e4},{unit:"second",ms:1e3}],Oe=new Intl.RelativeTimeFormat("en",{numeric:"auto"});function Te(e,n){return void 0===n&&(n=new Date),e?function(e){for(var n=0,i=we;n<i.length;n++){var t=i[n],r=t.unit,l=t.ms;if(Math.abs(e)>=l||"second"===r)return Oe.format(Math.round(e/l),r)}return""}(e.getTime()-n.getTime()):""}function Le(e){if(0===e.items.length)return i(ve,{title:"No reflections to display",description:"There has not been any lesson progress just yet.",loading:e.loading,icon:"lessons"});var t=e.items.map((function(e){return n("tr",{children:[i("td",{children:e.studentName}),i("td",{children:e.lessonName}),i("td",{children:e.reflection}),i("td",{children:Te(new Date(e.updatedAt))})]},e.studentName+e.lessonName)}));return i(E.Autosize,me({maxHeight:500},{children:n(P,me({verticalSpacing:"sm",sx:{minWidth:700},highlightOnHover:!0,striped:!0},{children:[i("thead",{children:n("tr",{children:[i("th",{children:"Student Name"}),i("th",{children:"Lesson Name"}),i("th",{children:"Reflection"}),i("th",{children:"Updated At"})]})}),i("tbody",{children:t})]}))}))}function Ae(e){if(0===e.items.length)return i(ve,{title:"No impact statements to display",description:"There are no students with impact statements yet.",loading:e.loading,icon:"kindergarten"});var t=e.items.map((function(e){return n("tr",{children:[i("td",{children:e.studentName}),i("td",{children:e.impactStatement})]},e.studentName)}));return i(E.Autosize,me({maxHeight:500},{children:n(P,me({verticalSpacing:"sm",sx:{minWidth:700},highlightOnHover:!0,striped:!0},{children:[i("thead",{children:n("tr",{children:[i("th",{children:"Student Name"}),i("th",{children:"Impact Statement"})]})}),i("tbody",{children:t})]}))}))}function Be(e){if(0===e.items.length)return i(ve,{title:"No badges to display",description:"We don't have any badges to show you just yet.",loading:e.loading,icon:"badges"});var t=e.items.map((function(t){return n("tr",{children:[i("td",{children:i(A,me({onClick:function(){return e.onClick&&e.onClick(t)}},{children:t.name}))}),i("td",{children:t.description}),n("td",{children:[Math.round(100*(t.percentageCompletion+Number.EPSILON)),"%"]})]},t.badgeId)}));return i(E.Autosize,me({maxHeight:500},{children:n(P,me({verticalSpacing:"sm",sx:{minWidth:700},highlightOnHover:!0,striped:!0},{children:[i("thead",{children:n("tr",{children:[i("th",{children:"Badge Name"}),i("th",{children:"Description"}),i("th",{children:"Completion"})]})}),i("tbody",{children:t})]}))}))}function Ie(e){if(0===e.items.length)return i(ve,{title:"No lessons to display",description:"We don't have any lessons to show you just yet.",loading:e.loading,icon:"lessons"});var t=e.items.map((function(t){return n("tr",{children:[i("td",{children:i(A,me({onClick:function(){return e.onClick&&e.onClick(t)}},{children:t.name}))}),i("td",{children:t.description}),n("td",{children:[Math.round(100*(t.percentageCompletion+Number.EPSILON)),"%"]})]},t.lessonId)}));return i(E.Autosize,me({maxHeight:500},{children:n(P,me({verticalSpacing:"sm",sx:{minWidth:700},highlightOnHover:!0,striped:!0},{children:[i("thead",{children:n("tr",{children:[i("th",{children:"Lesson Name"}),i("th",{children:"Description"}),i("th",{children:"Completion"})]})}),i("tbody",{children:t})]}))}))}var We=function(e){var t=S("students"),r=t[0],o=t[1];return i(D,me({size:"lg",py:"xl"},{children:n(H,{children:[n(H,me({spacing:0},{children:[i(T,me({size:"h3"},{children:"Dashboard"})),i(w,me({color:"dimmed",size:"sm",mt:"md"},{children:"Fast-track learning for your students."}))]})),i(H,{children:n("div",me({style:{position:"relative"}},{children:[i(F,{visible:e.loading,overlayBlur:2}),n(H,me({spacing:"sm"},{children:[i(ge,{data:[{title:"# OF STUDENTS",value:e.students.length},{title:"ACCOUNT CREATION",value:e.percentageOfAccountsCreated,unit:"%"},{title:"BADGE COMPLETION",value:e.percentageOfBadgesEarned,unit:"%"},{title:"LESSON COMPLETION",value:e.percentageOfLessonsCompleted,unit:"%"}]}),i(q,{clearable:!0,clearButtonLabel:"Clear class selection",size:"sm",placeholder:"Select a class",nothingFound:"No options",value:e.classId,onChange:e.onClassChange,icon:i(l,{}),data:e.classes.map((function(e){return{value:e.classId,label:e.name}}))}),n(H,me({spacing:0},{children:[i(pe,{value:r,data:[{label:"My students",value:"students"},{label:"Impact statements",value:"impact"},{label:"Reflections",value:"reflections"},{label:"Badges",value:"badges"},{label:"Lessons",value:"lessons"}],onChange:o}),"impact"===r&&i(Ae,{loading:e.loading,items:e.impacts}),"reflections"===r&&i(Le,{loading:e.loading,items:e.reflections}),"badges"===r&&i(Be,{loading:e.loading,items:e.badges,onClick:e.onBadgeClick}),"lessons"===r&&i(Ie,{loading:e.loading,items:e.lessons,onClick:e.onLessonClick}),"students"===r&&i(ze,{loading:e.loading,items:e.students,onViewProfile:e.onViewStudentProfile})]}))]}))]}))})]})}))};function Ee(e){if(0===e.items.length)return i(ve,{title:"No students to display",description:"You have not rostered any students yet.",loading:e.loading,icon:"groups"});var t=e.items.map((function(t){return n("tr",{children:[i("td",{children:i(A,me({onClick:function(){return e.onViewProfile&&e.onViewProfile(t)}},{children:n(B,me({spacing:"sm"},{children:[i(I,{size:40,src:t.avatar,radius:40}),n("div",{children:[i(w,me({size:"sm",weight:500},{children:t.givenName&&t.familyName?"".concat(t.givenName," ").concat(t.familyName):t.email})),i(w,me({size:"xs",color:"dimmed"},{children:t.email}))]})]}))}))}),i("td",{children:t.badgesEarned}),i("td",{children:t.lessonsCompleted}),i("td",{children:t.hasAccount&&i(o,{color:"green"})}),i("td",{children:t.lastActivity?Te(t.lastActivity):""}),i("td",{children:i(B,me({noWrap:!0,spacing:0,position:"right"},{children:!t.readonly&&!!e.onDelete&&i(R,me({color:"red"},{children:i(a,{onClick:function(){return ce({title:'Delete "'.concat((n=t).givenName&&n.familyName?"".concat(n.givenName," ").concat(n.familyName):n.email,'"?'),centered:!0,children:i(w,me({size:"sm"},{children:"Are you sure you want to delete this person? This action is destructive and you will have to contact support to restore your data."})),labels:{confirm:"Delete",cancel:"No don't delete them"},confirmProps:{color:"red"},onConfirm:function(){return e.onDelete&&e.onDelete(n)}});var n},size:16,stroke:1.5})}))}))})]},t.email)}));return i(E,{children:n(P,me({verticalSpacing:20,sx:{minWidth:700},highlightOnHover:!0,striped:!0},{children:[i("thead",{children:n("tr",{children:[i("th",{children:"Student Name"}),i("th",{children:"Badges Earned"}),i("th",{children:"Lessons Completed"}),i("th",{children:"Account Created?"}),i("th",{children:"Last Active"}),i("th",{})]})}),i("tbody",{children:t})]}))})}var Pe=z((function(e){var n;return{title:(n={fontSize:34,fontWeight:900},n[e.fn.smallerThan("sm")]={fontSize:24},n),description:{maxWidth:600},wrapper:{position:"relative",marginBottom:30},dropzone:{borderWidth:1,paddingBottom:50},icon:{color:"dark"===e.colorScheme?e.colors.dark[3]:e.colors.gray[4]},control:{position:"absolute",width:250,left:"calc(50% - 125px)",bottom:-20}}})),De=function(e){var l=Pe().classes,o=ae({initialValues:{classId:"",studentId:"",email:"",givenName:"",familyName:"",avatar:"",role:"",readonly:!1,lastActivity:null,hasAccount:!1,lessonsCompleted:0,badgesEarned:0},validate:{email:function(n){return/^\S+@\S+$/.test(n)&&0===e.students.filter((function(e){return e.email===n})).length?null:"Invalid email"}}}),a=S(!1),c=a[0],d=a[1];return n(t,{children:[i(G,me({opened:c,onClose:function(){return d(!1)},title:i(T,me({size:"h5"},{children:"Add students"})),padding:"xl",size:"xl"},{children:n(H,me({spacing:"md"},{children:[i(He,me({},e,{close:function(){return d(!1)}})),i(U,{label:"or",labelPosition:"center",my:"md",variant:"dashed"}),i("form",me({onSubmit:o.onSubmit((function(){var n=o.values;o.reset(),d(!1),e.onCreateStudents&&e.onCreateStudents([n])}))},{children:n(H,{children:[i(_,me({withAsterisk:!0,label:"Email",placeholder:"Email"},o.getInputProps("email"))),n(B,me({grow:!0},{children:[i(_,me({label:"Given name",placeholder:"Given name"},o.getInputProps("givenName"))),i(_,me({label:"Family name",placeholder:"Family name"},o.getInputProps("familyName")))]})),i(M,me({type:"submit",fullWidth:!0,mt:"md"},{children:"Submit"}))]})}))]}))})),i(D,me({size:"lg",py:"xl"},{children:n(H,me({spacing:"md"},{children:[n(j,{children:[n(j.Col,me({sm:"auto"},{children:[i(W,me({variant:"filled",leftSection:i(R,me({onClick:e.onBackClick,color:"blue",size:"xs",radius:"xl",variant:"filled"},{children:i(r,{size:14})})),size:"lg"},{children:"Classes"})),i(T,me({order:2,className:l.title,mt:"md"},{children:e.displayName||"Class"})),i(w,me({color:"dimmed",className:l.description,mt:"sm"},{children:e.description||"No description"}))]})),i(j.Col,me({sm:"content"},{children:!e.loading&&i(M,me({onClick:function(){return d(!0)},leftIcon:i(s,{size:14})},{children:"Add students"}))}))]}),n("div",me({style:{position:"relative"}},{children:[i(F,{visible:e.loading,overlayBlur:2}),n(H,me({spacing:"sm"},{children:[i(ge,{data:[{title:"# OF STUDENTS",value:e.students.length},{title:"ACCOUNT CREATION",value:e.percentageOfAccountsCreated,unit:"%"},{title:"BADGE COMPLETION",value:e.percentageOfBadgesEarned,unit:"%"},{title:"LESSON COMPLETION",value:e.percentageOfLessonsCompleted,unit:"%"}]}),i(Ee,{loading:e.loading,items:e.students,onDelete:e.onDeleteStudent,onViewProfile:function(n){return e.onStudentClick(n)}})]}))]}))]}))}))]})},He=function(e){var t=Pe(),r=t.classes,l=t.theme,o=N.useRef(null),a=N.useState(!1),s=a[0],m=a[1],u=N.useCallback((function(n){m(!0),n.forEach((function(n){se.parse(n,{download:!0,header:!0,dynamicTyping:!0,skipEmptyLines:!0,worker:!0,complete:function(n){var i=n.data.filter((function(n){return/^\S+@\S+$/.test(n.email)&&0===e.students.filter((function(e){return e.email===n.email})).length}));i.length>0&&e.onCreateStudents&&e.onCreateStudents(i),m(!1),e.close()}})}))}),[]);return n("div",me({className:r.wrapper},{children:[i(le,me({loading:s,openRef:o,onDrop:u,className:r.dropzone,radius:"md",accept:[oe.csv],maxSize:5*Math.pow(1024,2)},{children:n("div",me({style:{pointerEvents:"none"}},{children:[n(B,me({position:"center"},{children:[i(le.Accept,{children:i(c,{size:50,color:l.colors[l.primaryColor][6],stroke:1.5})}),i(le.Reject,{children:i(d,{size:50,color:l.colors.red[6],stroke:1.5})}),i(le.Idle,{children:i(h,{size:50,color:"dark"===l.colorScheme?l.colors.dark[0]:l.black,stroke:1.5})})]})),n(w,me({align:"center",weight:700,size:"lg",mt:"xl"},{children:[i(le.Accept,{children:"Drop files here"}),i(le.Reject,{children:"Csv file less than 5mb"}),i(le.Idle,{children:"Upload multiple"})]})),n(w,me({align:"center",size:"sm",mt:"xs",color:"dimmed"},{children:["Drag'n'drop files here to upload. We can accept only ",i("i",{children:".csv"})," files that are less than 5mb in size."]}))]}))})),i(M,me({className:r.control,size:"md",radius:"xl",onClick:function(){var e;return null===(e=o.current)||void 0===e?void 0:e.call(o)}},{children:"Select file"}))]}))};function je(e){if(0===e.items.length)return i(ve,{title:"No classes to display",description:"You don't have any classes yet. Try creating one first...",loading:e.loading,icon:"groups"});var t=e.items.map((function(t){return n("tr",{children:[i("td",{children:i(A,me({onClick:function(){return e.onClick(t)}},{children:i(w,me({size:14},{children:t.name}))}))}),i("td",{children:i(w,me({size:14},{children:t.description}))}),i("td",{children:i(B,me({noWrap:!0,spacing:0,position:"right"},{children:i(R,me({color:"red"},{children:i(a,{onClick:function(){return ce({title:'Delete "'.concat((n=t).name,'"?'),centered:!0,children:i(w,me({size:"sm"},{children:"Are you sure you want to delete this class? This action is destructive and you will have to contact support to restore your data."})),labels:{confirm:"Delete class",cancel:"No don't delete it"},confirmProps:{color:"red"},onConfirm:function(){return e.onDeleteClass(n)}});var n},size:16,stroke:1.5})}))}))})]},t.classId)}));return i(E.Autosize,me({maxHeight:300},{children:n(P,me({verticalSpacing:20,sx:{minWidth:700},highlightOnHover:!0,striped:!0},{children:[i("thead",{children:n("tr",{children:[i("th",{children:"Class Name"}),i("th",{children:"Description"}),i("th",{})]})}),i("tbody",{children:t})]}))}))}var Re=z((function(e){var n;return{title:(n={fontSize:34,fontWeight:900},n[e.fn.smallerThan("sm")]={fontSize:24},n),description:{maxWidth:600}}})),Me=function(e){var r=Re().classes,l=ae({initialValues:{classId:"",name:"",description:""},validate:{name:function(e){return e.length<=6?"Name should include at least 6 characters":null}}}),o=S(!1),a=o[0],c=o[1];return n(t,{children:[i(G,me({opened:a,onClose:function(){return c(!1)},title:n(B,me({spacing:0},{children:[i(T,me({size:"h5"},{children:"Create a class"})),i(Y,me({label:"Classes settings cannot be modified once created"},{children:i(R,{children:i(m,{color:"#3b82f6",size:14})})}))]})),padding:"xl",size:"xl"},{children:n("form",me({onSubmit:l.onSubmit((function(){var n=l.values;l.reset(),c(!1),e.onCreateClass&&e.onCreateClass(n)}))},{children:[n(H,{children:[i(_,me({withAsterisk:!0,label:"Name",placeholder:"Class name"},l.getInputProps("name"))),i(_,me({label:"Description",placeholder:"A class for my first period English students"},l.getInputProps("description")))]}),i(M,me({type:"submit",fullWidth:!0,mt:"md"},{children:"Submit"}))]}))})),i(D,me({size:"lg",py:"xl"},{children:n(H,me({spacing:"md"},{children:[n(j,{children:[n(j.Col,me({sm:"auto"},{children:[i(W,me({variant:"filled",size:"lg"},{children:"Classes"})),i(T,me({order:2,className:r.title,mt:"md"},{children:"Organize students into classes"})),i(w,me({color:"dimmed",className:r.description,mt:"sm"},{children:"A class can be for a specific period of time, grade, team, or other cohorts."}))]})),i(j.Col,me({sm:"content"},{children:!e.loading&&i(M,me({onClick:function(){return c(!0)},leftIcon:i(s,{size:14})},{children:"Create class"}))}))]}),n("div",me({style:{position:"relative"}},{children:[i(F,{visible:e.loading,overlayBlur:2}),n(H,me({spacing:"sm"},{children:[i(ge,{data:[{title:"# OF CLASSES",value:e.classes.length}]}),i(je,{loading:e.loading,items:e.classes,onDeleteClass:e.onDeleteClass,onClick:e.onClassClick})]}))]}))]}))}))]})},Fe=z((function(e){var n;return{title:(n={fontSize:34,fontWeight:900,marginTop:16},n[e.fn.smallerThan("sm")]={fontSize:24},n),description:{maxWidth:600}}})),qe=function(e){var r=Fe().classes;return n(t,{children:[i(T,me({className:r.title},{children:e.name})),i(w,me({color:"dimmed",className:r.description,mt:"xs"},{children:e.impactStatement}))]})};function Ve(e){if(0===e.items.length)return i(ve,{title:"No badges to display",description:"There has not been any badge progress just yet.",loading:e.loading,icon:"badges"});var t=e.items.map((function(t){return n("tr",{children:[i("td",{children:i(A,me({onClick:function(){return e.onClick(t)}},{children:t.badgeName}))}),n("td",{children:[!!t.isComplete&&i(W,me({variant:"filled"},{children:"Complete"})),!t.isComplete&&i(W,me({color:"red",variant:"filled"},{children:"Incomplete"}))]})]},t.badgeName)}));return i(E.Autosize,me({maxHeight:500},{children:n(P,me({verticalSpacing:"sm",sx:{minWidth:700},highlightOnHover:!0,striped:!0},{children:[i("thead",{children:n("tr",{children:[i("th",{children:"Badge Name"}),i("th",{children:"Status"})]})}),i("tbody",{children:t})]}))}))}function Ge(e){if(0===e.items.length)return i(ve,{title:"No answers to display",description:"There has not been any lesson progress just yet.",loading:e.loading,icon:"lessons"});var t=e.items.map((function(t){return n("tr",{children:[i("td",{children:i(A,me({onClick:function(){return e.onClick(t)}},{children:t.lessonName}))}),i("td",{children:t.questionName}),i("td",{children:t.answer.join(",")})]},t.questionName)}));return i(E.Autosize,me({maxHeight:500},{children:n(P,me({verticalSpacing:"sm",sx:{minWidth:700},highlightOnHover:!0,striped:!0},{children:[i("thead",{children:n("tr",{children:[i("th",{children:"Lesson Name"}),i("th",{children:"Question"}),i("th",{children:"Answer"})]})}),i("tbody",{children:t})]}))}))}function Ue(e){if(0===e.items.length)return i(ve,{title:"No reflections to display",description:"There has not been any lesson progress just yet.",loading:e.loading,icon:"lessons"});var t=e.items.map((function(t){return n("tr",{children:[i("td",{children:i(A,me({onClick:function(){return e.onClick(t)}},{children:t.lessonName}))}),i("td",{children:t.reflection}),i("td",{children:t.rating.toLocaleString()})]},t.lessonName)}));return i(E.Autosize,me({maxHeight:500},{children:n(P,me({verticalSpacing:"sm",sx:{minWidth:700},highlightOnHover:!0,striped:!0},{children:[i("thead",{children:n("tr",{children:[i("th",{children:"Lesson Name"}),i("th",{children:"Reflection"}),i("th",{children:"Rating"})]})}),i("tbody",{children:t})]}))}))}var _e=function(e){var t=S("badges"),l=t[0],o=t[1],a=e.badges.length,s=a>0?e.badges.filter((function(e){return e.isComplete})).length/a:0;return i(D,me({size:"lg",py:"xl"},{children:n(H,me({spacing:"md"},{children:[i(j,me({gutter:"md"},{children:n(j.Col,me({sm:"auto"},{children:[i(W,me({variant:"filled",leftSection:i(R,me({onClick:e.onBackClick,color:"blue",size:"xs",radius:"xl",variant:"filled"},{children:i(r,{size:14})})),size:"lg"},{children:"Students"})),i(qe,{variant:"compact",name:e.name,impactStatement:e.impactStatement})]}))})),n("div",me({style:{position:"relative"}},{children:[i(F,{visible:e.loading,overlayBlur:2}),n(H,me({spacing:"lg"},{children:[i(ge,{data:[{title:"PROBLEMS SOLVED",value:e.numberOfProblemsSolved},{title:"LESSON COMPLETION",value:e.percentageOfLessonsCompleted,unit:"%"},{title:"BADGE COMPLETION",value:s,unit:"%"}]}),n(H,me({spacing:0},{children:[i(pe,{value:l,data:[{label:"My badges",value:"badges"},{label:"My answers",value:"answers"},{label:"My reflections",value:"reflections"}],onChange:o}),"badges"===l&&i(Ve,{loading:e.loading,items:e.badges,onClick:e.onBadgeClick}),"answers"===l&&i(Ge,{loading:e.loading,items:e.answers,onClick:e.onAnswerClick}),"reflections"===l&&i(Ue,{loading:e.loading,items:e.reflections,onClick:e.onReflectionClick})]}))]}))]}))]}))}))},Ye=z((function(e,n){var i=n.from||"blue",t=n.to||"green";return{card:{position:"relative",cursor:"pointer",overflow:"hidden",transition:"transform 150ms ease, box-shadow 100ms ease",padding:e.spacing.xl,paddingLeft:2*e.spacing.xl,"&:hover":{boxShadow:e.shadows.md,transform:"scale(1.02)"},"&::before":{content:'""',position:"absolute",top:0,bottom:0,left:0,width:6,backgroundImage:e.fn.linearGradient(0,e.colors[i][6],e.colors[t][6])}}}}));function $e(e){var t=Ye(e).classes,r=e.from||"blue",l=e.to||"green",o=e.icon||i(u,{size:28,stroke:1.5});return n($,me({withBorder:!0,radius:"md",className:t.card,onClick:e.onClick},{children:[i(J,me({size:"xl",radius:"md",variant:"gradient",gradient:{deg:0,from:r,to:l}},{children:o})),i(w,me({size:"xl",weight:500,mt:"md"},{children:e.title})),i(w,me({size:"sm",mt:"sm",color:"dimmed"},{children:e.description}))]}))}var Je=z((function(e){return{card:{height:240,backgroundSize:"cover",backgroundPosition:"center"},content:{position:"absolute",padding:e.spacing.xl,zIndex:1,top:0,bottom:0,right:0,left:0},action:{position:"absolute",bottom:e.spacing.xl,right:e.spacing.xl},title:{color:e.white,marginBottom:e.spacing.xs/2},description:{color:e.white,maxWidth:220}}})),Qe=function(e){var t=e.title,r=e.description,l=e.image,o=e.action,a=e.style,s=e.className,c=function(e,n){var i={};for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&n.indexOf(t)<0&&(i[t]=e[t]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(t=Object.getOwnPropertySymbols(e);r<t.length;r++)n.indexOf(t[r])<0&&Object.prototype.propertyIsEnumerable.call(e,t[r])&&(i[t[r]]=e[t[r]])}return i}(e,["title","description","image","action","style","className"]),d=Je(),h=d.classes,m=d.cx,u=d.theme;return n(Q,me({radius:"md",style:me({backgroundImage:"url(".concat(l,")")},a),className:m(h.card,s)},c,{children:[i(K,{gradient:"linear-gradient(105deg, ".concat(u.black," 20%, #312f2f 50%, ").concat(u.colors.gray[4]," 100%)"),opacity:.55,zIndex:0}),n("div",me({className:h.content},{children:[i(w,me({size:"lg",weight:700,className:h.title},{children:t})),i(w,me({size:"sm",className:h.description},{children:r})),i(M,me({className:h.action,variant:"white",color:"dark",component:"a",size:"xs",href:o.link,target:"_blank"},{children:o.label}))]}))]}))},Ke=function(e){return i(D,me({size:"lg"},{children:n(H,me({spacing:"lg"},{children:[n(j,me({gutter:"md"},{children:[i(j.Col,me({md:6},{children:i(qe,{variant:"compact",name:e.name,impactStatement:e.impactStatement})})),i(j.Col,me({md:6},{children:i(Qe,{title:e.organization.name,description:e.organization.description,image:e.organization.image,action:{label:"Visit website",link:e.organization.website}})}))]})),n(j,me({gutter:"md"},{children:[i(j.Col,{children:i($e,{title:"Dashboard",description:"Track class performance across core areas of focus.",onClick:e.onDashboardClick})}),i(j.Col,{children:i($e,{title:"Classes",description:"Organize students into classes.",onClick:e.onClassesClick})}),i(j.Col,{children:i($e,{title:"Lessons",description:"Explore units of instruction and/or see corresponding class progress.",onClick:e.onLessonsClick})}),i(j.Col,{children:i($e,{title:"Badges",description:"Project-sized skills acquisition and standards alignment.",onClick:e.onBadgesClick})})]}))]}))}))};function Xe(e){if(0===e.items.length)return i(ve,{title:"No reflections to display",description:"There has not been any lesson progress just yet.",loading:e.loading,icon:"lessons"});var t=e.items.map((function(e){return n("tr",{children:[i("td",{children:e.studentName}),i("td",{children:e.reflection}),i("td",{children:e.rating.toLocaleString()})]},e.studentName)}));return i(E.Autosize,me({maxHeight:500},{children:n(P,me({verticalSpacing:"sm",sx:{minWidth:700},highlightOnHover:!0,striped:!0},{children:[i("thead",{children:n("tr",{children:[i("th",{children:"Student Name"}),i("th",{children:"Reflection"}),i("th",{children:"Rating"})]})}),i("tbody",{children:t})]}))}))}function Ze(e){if(0===e.items.length)return i(ve,{title:"No students to display",description:"You don't have any student data yet for this lesson",loading:e.loading,icon:"lessons"});var t=e.items.map((function(t){return n("tr",{children:[i("td",{children:i(A,me({onClick:function(){return e.onClick&&e.onClick(t)}},{children:n(B,me({spacing:"sm"},{children:[i(I,{size:40,src:t.avatar,radius:40}),n("div",{children:[i(w,me({size:"sm",weight:500},{children:t.name})),i(w,me({size:"xs",color:"dimmed"},{children:t.email}))]})]}))}))}),n("td",{children:[!!t.isComplete&&i(W,me({variant:"filled"},{children:"Complete"})),!t.isComplete&&!t.isStarted&&i(W,me({color:"red",variant:"filled"},{children:"Not started"})),!t.isComplete&&!!t.isStarted&&i(W,me({color:"violet",variant:"filled"},{children:"In progress"}))]})]},t.name)}));return i(E.Autosize,me({maxHeight:500},{children:n(P,me({verticalSpacing:"sm",sx:{minWidth:700},highlightOnHover:!0,striped:!0},{children:[i("thead",{children:n("tr",{children:[i("th",{children:"Lesson Name"}),i("th",{children:"Status"})]})}),i("tbody",{children:t})]}))}))}function en(e){var t=N.useMemo((function(){return{position:"left",getValue:function(e){return e.primary}}}),[]),r=N.useMemo((function(){return[{position:"bottom",getValue:function(e){return e.secondary}}]}),[]);if(0===e.items.length)return i(ve,{title:"No questions to display",description:"There are no questions in this lesson.",loading:e.loading,icon:"lessons"});var l=e.items.map((function(e){if(e.chart){var l={},o=e.choices||[];return o.forEach((function(e){l[e]=0})),e.answers.forEach((function(e){return e.forEach((function(e){e in l&&(l[e]=l[e]?l[e]+1:1)}))})),i(Q,me({withBorder:!0,p:"xl",radius:"md"},{children:n(H,me({spacing:4},{children:[i(T,me({size:"lg"},{children:e.question})),n(w,me({size:"sm"},{children:[e.answers.length," answers"]})),i("div",me({style:{background:"white",height:"300px",width:"100%",position:"relative"}},{children:i(he,{options:{data:[{label:"",data:o.map((function(e){return{primary:nn(e,50),secondary:l[e]}}))}],primaryAxis:t,secondaryAxes:r}})}))]}))}),e.question)}return i(Q,me({withBorder:!0,p:"xl",radius:"md"},{children:n(H,me({spacing:4},{children:[i(T,me({size:"lg"},{children:e.question})),n(w,me({size:"sm"},{children:[e.answers.length," answers"]})),i(E.Autosize,me({maxHeight:500},{children:i(H,me({spacing:4},{children:e.answers.map((function(e){var n=e.join("\n");return i(Q,me({p:5,radius:0,bg:"gray.0"},{children:i(w,{children:n})}),n)}))}))}))]}))}),e.question)}));return i(H,me({py:4,spacing:10,sx:{minWidth:700}},{children:l}))}var nn=function(e,n){return e.substr(0,n-1)+(e.length>n?"&hellip;":"")},tn=z((function(e){var n;return{title:(n={fontSize:34,fontWeight:900},n[e.fn.smallerThan("sm")]={fontSize:24},n),description:{maxWidth:600}}})),rn=function(e){var t=tn().classes,o=S("question"),a=o[0],s=o[1],c=e.students.length,d=c>0?e.students.filter((function(e){return e.isComplete})).length/c:0;return i(D,me({size:"lg",py:"xl"},{children:n(H,me({spacing:"md"},{children:[i(j,{children:n(j.Col,me({sm:"auto"},{children:[i(W,me({variant:"filled",leftSection:i(R,me({onClick:e.onBackClick,color:"blue",size:"xs",radius:"xl",variant:"filled"},{children:i(r,{size:14})})),size:"lg"},{children:"Lessons"})),n(B,{children:[n(H,me({spacing:0},{children:[i(T,me({order:2,className:t.title,mt:"md"},{children:e.displayName||"Lesson"})),i(w,me({color:"dimmed",className:t.description,mt:"sm"},{children:e.description||"No description"}))]})),i(H,me({ml:"auto"},{children:i(M,me({variant:"gradient",onClick:e.onPreviewClick},{children:"Preview"}))}))]})]}))}),i("div",{children:n("div",me({style:{position:"relative"}},{children:[i(F,{visible:e.loading,overlayBlur:2}),n(H,{children:[i(ge,{data:[{title:"LESSON COMPLETION",value:d,unit:"%"}]}),i(q,{clearable:!0,clearButtonLabel:"Clear class selection",size:"sm",placeholder:"Select a class",nothingFound:"No options",value:e.classId,onChange:e.onClassChange,icon:i(l,{}),data:e.classes.map((function(e){return{value:e.classId,label:e.name}}))}),n(H,me({spacing:0},{children:[i(pe,{value:a,data:[{label:"By question",value:"question"},{label:"By reflection",value:"reflections"},{label:"By student",value:"students"}],onChange:s}),"question"===a&&i(en,{loading:e.loading,items:e.questions}),"reflections"===a&&i(Xe,{loading:e.loading,items:e.reflections}),"students"===a&&i(Ze,{loading:e.loading,items:e.students,onClick:e.onUserClick})]}))]})]}))})]}))}))};function ln(e){if(0===e.items.length)return i(ve,{title:"No lessons to display",description:"We don't have any lessons to show you just yet.",loading:e.loading,icon:"lessons"});var t=e.items.map((function(t){return i("tr",{children:i("td",{children:i(A,me({sx:function(e){return{display:"block",width:"100%",padding:e.spacing.md,color:"dark"===e.colorScheme?e.colors.dark[0]:e.black,"&:hover":{backgroundColor:"dark"===e.colorScheme?e.colors.dark[8]:e.colors.gray[1]}}},onClick:function(){return e.onClick&&e.onClick(t)}},{children:i(B,{children:n("div",{children:[i(w,me({size:"sm",weight:500},{children:t.name})),i(w,me({size:"xs",color:"dimmed"},{children:t.description}))]})})}))})},t.lessonId)}));return i(E.Autosize,me({maxHeight:500},{children:i(P,me({horizontalSpacing:0,verticalSpacing:0,sx:{minWidth:700}},{children:i("tbody",{children:t})}))}))}var on=z((function(e){var n;return{title:(n={fontSize:34,fontWeight:900},n[e.fn.smallerThan("sm")]={fontSize:24},n),description:{maxWidth:600}}})),an=function(e){var t=on().classes;return i(D,me({size:"lg",py:"xl"},{children:n(H,me({spacing:"md"},{children:[i(j,{children:n(j.Col,me({sm:"auto"},{children:[i(W,me({variant:"filled",size:"lg"},{children:"Lessons"})),i(T,me({order:2,className:t.title,mt:"md"},{children:"Lessons"})),i(w,me({color:"dimmed",className:t.description,mt:"sm"},{children:"Explore units of instruction and/or see corresponding class progress."}))]}))}),i(V,{placeholder:"Search for a lesson that fits your needs",data:e.lessons.map((function(e){return e.name})),onChange:e.onAutocompleteChange}),n("div",me({style:{position:"relative"}},{children:[i(F,{visible:e.loading,overlayBlur:2}),i(ln,{loading:e.loading,items:e.lessons,onClick:e.onLessonClick})]}))]}))}))},sn=X({key:"mantine",prepend:!1}),cn=function(n){return i(Z,me({withNormalizeCSS:!0,withGlobalStyles:!0,emotionCache:sn,theme:{loader:"bars"}},{children:i(e,me({limit:n.notificationLimit||5},{children:i(de,{children:n.children})}))}))},dn=function(e){var t=ae({initialValues:{active:e.account}});return i(ee,me({centered:!0,opened:e.opened,onClose:function(){return e.onClose&&e.onClose()},size:"sm",title:i(T,me({size:"h5"},{children:"Accounts"}))},{children:n("form",me({onSubmit:t.onSubmit((function(){e.onChange&&e.onChange(t.values.active)}))},{children:[i(q,me({required:!0,placeholder:"Select an account",defaultValue:e.account,data:e.accounts.map((function(e){return{value:e.accountId,label:e.name}}))},t.getInputProps("active"))),i(M,me({type:"submit",fullWidth:!0,mt:"xl"},{children:"Switch"}))]}))}))},hn=z((function(e){return{link:{width:50,height:50,borderRadius:e.radius.md,display:"flex",alignItems:"center",justifyContent:"center",color:"dark"===e.colorScheme?e.colors.dark[0]:e.colors.gray[7],"&:hover":{backgroundColor:"dark"===e.colorScheme?e.colors.dark[5]:e.colors.gray[0]}},active:{"&, &:hover":{backgroundColor:e.fn.variant({variant:"light",color:e.primaryColor}).background,color:e.fn.variant({variant:"light",color:e.primaryColor}).color}}}})),mn=[{icon:f,label:"Home",href:"/home"},{icon:v,label:"Dashboard",href:"/dashboard"},{icon:l,label:"Classes",href:"/classes"},{icon:b,label:"Badges",href:"/badges"},{icon:C,label:"Lessons",href:"/lessons"}],un=function(e){var n,t=e.icon,r=e.label,l=e.active,o=e.onClick,a=hn(),s=a.classes,c=a.cx;return i(Y,me({label:r,position:"right",transitionDuration:0},{children:i(A,me({onClick:o,className:c(s.link,(n={},n[s.active]=l,n))},{children:i(t,{stroke:1.5})}))}))},gn=function(e){var t=mn.map((function(n){return i(un,{label:n.label,icon:n.icon,active:n.label===e.active,onClick:function(){return e.navigate(n.href)}},n.label)}));return n(ne,me({width:{base:80},p:"md"},{children:[i(ie,{children:i(I,me({color:"blue",radius:"sm"},{children:i("div",me({style:{width:15,marginLeft:"auto",marginRight:"auto"}},{children:i(L,{fit:"contain",src:"https://cdn.localcivics.io/brand/l.png"})}))}))}),i(ne.Section,me({grow:!0,mt:50},{children:i(H,me({justify:"center",spacing:0},{children:t}))})),i(ne.Section,{children:n(H,me({justify:"center",spacing:0},{children:[i(un,{icon:g,label:"Switch accounts",onClick:e.onSwitchAccounts}),i(un,{icon:p,label:"Logout",onClick:e.onLogout})]}))})]}))},pn=z((function(e){var n,i,t,r,l,o;return{footer:{paddingTop:2*e.spacing.xl,paddingBottom:2*e.spacing.xl,paddingLeft:3*e.spacing.xl,backgroundColor:"dark"===e.colorScheme?e.colors.dark[6]:e.colors.gray[0],borderTop:"1px solid ".concat("dark"===e.colorScheme?e.colors.dark[5]:e.colors.gray[2])},logo:(n={maxWidth:200},n[e.fn.smallerThan("sm")]={display:"flex",flexDirection:"column",alignItems:"center"},n),description:(i={marginTop:5},i[e.fn.smallerThan("sm")]={marginTop:e.spacing.xs,textAlign:"center"},i),inner:(t={display:"flex",justifyContent:"space-between"},t[e.fn.smallerThan("sm")]={flexDirection:"column",alignItems:"center"},t),groups:(r={display:"flex",flexWrap:"wrap"},r[e.fn.smallerThan("sm")]={display:"none"},r),wrapper:{width:160},link:{display:"block",color:"dark"===e.colorScheme?e.colors.dark[1]:e.colors.gray[6],fontSize:e.fontSizes.sm,paddingTop:3,paddingBottom:3,"&:hover":{textDecoration:"underline"}},title:{fontSize:e.fontSizes.md,fontWeight:700,fontFamily:"Greycliff CF, ".concat(e.fontFamily),marginBottom:e.spacing.xs/2,color:"dark"===e.colorScheme?e.white:e.black},afterFooter:(l={display:"flex",justifyContent:"space-between",alignItems:"center",marginTop:e.spacing.xl,paddingTop:e.spacing.xl,paddingBottom:e.spacing.xl,borderTop:"1px solid ".concat("dark"===e.colorScheme?e.colors.dark[4]:e.colors.gray[2])},l[e.fn.smallerThan("sm")]={flexDirection:"column"},l),social:(o={},o[e.fn.smallerThan("sm")]={marginTop:e.spacing.xs},o)}})),fn=function(e){var r=pn().classes,l=vn(e.account,e.accounts,e.onAccountChange);return n(te,me({padding:"xs",navbar:i(gn,{active:e.navbar.props.active,navigate:e.navbar.props.navigate,onLogout:e.navbar.props.onLogout,onSwitchAccounts:function(){return l.setChangeModalOpen(!0)}}),footer:i(t,{children:!l.opened&&n("footer",me({className:r.footer},{children:[n(D,me({className:r.inner},{children:[n("div",me({className:r.logo},{children:[n(B,me({spacing:"xs"},{children:[i("div",me({style:{width:15}},{children:i(L,{fit:"contain",src:"https://cdn.localcivics.io/brand/l.png"})})),i(T,me({color:"dimmed",size:"h5"},{children:"Local Civics"}))]})),i(w,me({size:"xs",color:"dimmed",className:r.description},{children:"We connect students to powerful civic learning experiences."}))]})),i("div",me({className:r.groups},{children:n("div",me({className:r.wrapper},{children:[i(w,me({className:r.link,component:"a",href:"https://www.localcivics.io",target:"_blank"},{children:"About"})),i(w,me({className:r.link,component:"a",href:"https://www.localcivics.io/terms-of-service",target:"_blank"},{children:"Terms"})),i(w,me({className:r.link,component:"a",href:"https://www.localcivics.io/privacy-policy",target:"_blank"},{children:"Privacy"})),i(w,me({className:r.link,component:"a",href:"https://localcivics.notion.site/Help-Center-b52300f587b64fc0a61f512686e7626d",target:"_blank"},{children:"Help Center"}))]}))}))]})),n(D,me({className:r.afterFooter},{children:[n(w,me({color:"dimmed",size:"sm"},{children:["© ",(new Date).getFullYear()," Local Civics. All rights reserved."]})),n(B,me({spacing:0,className:r.social,position:"right",noWrap:!0},{children:[i(R,me({component:"a",target:"_blank",href:"https://www.instagram.com/localcivics/",size:"lg"},{children:i(y,{size:18,stroke:1.5})})),i(R,me({component:"a",target:"_blank",href:"https://www.linkedin.com/company/localcivics",size:"lg"},{children:i(k,{size:18,stroke:1.5})})),i(R,me({component:"a",target:"_blank",href:"https://www.facebook.com/localcivics/",size:"lg"},{children:i(x,{size:18,stroke:1.5})}))]}))]}))]}))}),styles:function(e){return{main:{backgroundColor:"dark"===e.colorScheme?e.colors.dark[8]:e.colors.gray[0]}}}},{children:[n("div",me({style:{position:"relative"}},{children:[(e.loading||l.opened)&&i(ie,me({style:{height:400}},{children:i(re,{})})),!e.loading&&!l.opened&&e.page]})),i(dn,{opened:l.opened,account:l.account,accounts:l.accounts,onChange:l.onAccountChange,onClose:function(){return l.setChangeModalOpen(!1)}})]}))},vn=function(e,n,i){var t=JSON.stringify(n),r=S(!1),l=r[0],o=r[1],a=S(e),s=a[0],c=a[1];return N.useEffect((function(){c(e)}),[e,t]),{opened:l,account:s,accounts:n,setChangeModalOpen:o,onAccountChange:function(e){c(e),o(!1),i(e)}}};export{cn as AdminProvider,fn as App,ke as Badge,Se as Badges,De as Class,Me as Classes,We as Dashboard,Ke as Home,rn as Lesson,an as Lessons,gn as Navbar,_e as Student,dn as SwitchAccount};
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- !function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("@mantine/notifications"),require("react/jsx-runtime"),require("@tabler/icons"),require("react"),require("@mantine/core"),require("@mantine/dropzone"),require("@mantine/form"),require("papaparse"),require("@mantine/modals"),require("react-charts")):"function"==typeof define&&define.amd?define(["exports","@mantine/notifications","react/jsx-runtime","@tabler/icons","react","@mantine/core","@mantine/dropzone","@mantine/form","papaparse","@mantine/modals","react-charts"],n):n((e="undefined"!=typeof globalThis?globalThis:e||self).components={},e.MantineNotifications,e.ReactJSXRuntime,e.TablerIcons,e.React,e.MantineCore,e.MantineDropzone,e.MantineForm,e.Papaparse,e.MantineModals,e.ReactCharts)}(this,(function(e,n,t,i,s,r,o,l,a,c,d){"use strict";function h(e){if(e&&e.__esModule)return e;var n=Object.create(null);return e&&Object.keys(e).forEach((function(t){if("default"!==t){var i=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(n,t,i.get?i:{enumerable:!0,get:function(){return e[t]}})}})),n.default=e,Object.freeze(n)}var u=h(s),m=h(a),x=function(){return x=Object.assign||function(e){for(var n,t=1,i=arguments.length;t<i;t++)for(var s in n=arguments[t])Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s]);return e},x.apply(this,arguments)};var g=r.createStyles((function(e){var n,t;return{root:(n={display:"flex",backgroundImage:"linear-gradient(-60deg, ".concat(e.colors[e.primaryColor][4]," 0%, ").concat(e.colors[e.primaryColor][7]," 100%)"),padding:1.5*e.spacing.xl,borderRadius:e.radius.md},n[e.fn.smallerThan("sm")]={flexDirection:"column"},n),title:{color:e.white,textTransform:"uppercase",fontWeight:700,fontSize:e.fontSizes.sm},count:{color:e.white,fontSize:32,lineHeight:1,fontWeight:700,marginBottom:e.spacing.md,fontFamily:"Greycliff CF, ".concat(e.fontFamily)},description:{color:e.colors[e.primaryColor][0],fontSize:e.fontSizes.sm,marginTop:5},stat:{flex:1,"& + &":(t={paddingLeft:e.spacing.xl,marginLeft:e.spacing.xl,borderLeft:"1px solid ".concat(e.colors[e.primaryColor][3])},t[e.fn.smallerThan("sm")]={paddingLeft:0,marginLeft:0,borderLeft:0,paddingTop:e.spacing.xl,marginTop:e.spacing.xl,borderTop:"1px solid ".concat(e.colors[e.primaryColor][3])},t)}}})),p=function(e){var n=e.data,i=g().classes,s=n.map((function(e){var n="%"===e.unit?Math.round(100*(e.value+Number.EPSILON)):e.value;return t.jsxs("div",x({className:i.stat},{children:[t.jsxs(r.Text,x({className:i.count},{children:[n.toLocaleString(),e.unit]})),t.jsx(r.Text,x({className:i.title},{children:e.title}))]}),e.title)}));return t.jsx("div",x({className:i.root},{children:s}))},j=function(e){var n,i=null===(n=e.data)||void 0===n?void 0:n.map((function(e){return t.jsx(r.Tabs.Tab,x({value:e.value},{children:e.label||e.value}),e.value)}));return t.jsx(r.Tabs,x({value:e.value,onTabChange:e.onChange},{children:t.jsx(r.Tabs.List,{children:i})}))},f=r.createStyles((function(e){var n,t,i;return{wrapper:(n={display:"flex",alignItems:"center",padding:2*e.spacing.xl,borderRadius:e.radius.md,backgroundColor:"dark"===e.colorScheme?e.colors.dark[8]:e.white,border:"1px solid ".concat("dark"===e.colorScheme?e.colors.dark[8]:e.colors.gray[3])},n["@media (max-width: ".concat(e.breakpoints.sm,"px)")]={flexDirection:"column-reverse",padding:e.spacing.xl},n),image:(t={maxWidth:"40%"},t["@media (max-width: ".concat(e.breakpoints.sm,"px)")]={maxWidth:"100%"},t),body:(i={paddingRight:4*e.spacing.xl},i["@media (max-width: ".concat(e.breakpoints.sm,"px)")]={paddingRight:0,marginTop:e.spacing.xl},i),title:{color:"dark"===e.colorScheme?e.white:e.black,fontFamily:"Greycliff CF, ".concat(e.fontFamily),lineHeight:1,marginBottom:e.spacing.md},controls:{display:"flex",marginTop:e.spacing.xl},inputWrapper:{width:"100%",flex:"1"},input:{borderTopRightRadius:0,borderBottomRightRadius:0,borderRight:0},control:{borderTopLeftRadius:0,borderBottomLeftRadius:0}}})),v=function(e){var n=f().classes,i=e.title||"Nothing to display",s=e.description||"We don't have anything to show you here just yet. Add data, check back later, or adjust your search.";return t.jsxs("div",x({className:n.wrapper},{children:[t.jsxs("div",x({className:n.body},{children:[t.jsx(r.Title,x({className:n.title},{children:e.loading?"Loading...":i})),t.jsx(r.Text,x({size:"sm",color:"dimmed"},{children:e.loading?"Hold on, we're loading your data.":s}))]})),t.jsx(r.Image,{src:"https://cdn.localcivics.io/illustrations/".concat(e.icon,".svg"),className:n.image})]}))};function b(e){if(0===e.items.length)return t.jsx(v,{title:"No badges to display",description:"There has not been any badge progress just yet.",loading:e.loading,icon:"badges"});var n=e.items.map((function(n){return t.jsxs("tr",{children:[t.jsx("td",{children:t.jsx(r.UnstyledButton,x({onClick:function(){return e.onClick&&e.onClick(n)}},{children:t.jsxs(r.Group,x({spacing:"sm"},{children:[t.jsx(r.Avatar,{size:40,src:n.avatar,radius:40}),t.jsxs("div",{children:[t.jsx(r.Text,x({size:"sm",weight:500},{children:n.name})),t.jsx(r.Text,x({size:"xs",color:"dimmed"},{children:n.email}))]})]}))}))}),t.jsxs("td",{children:[!!n.isComplete&&t.jsx(r.Badge,x({variant:"filled"},{children:"Complete"})),!n.isComplete&&t.jsx(r.Badge,x({color:"red",variant:"filled"},{children:"Incomplete"}))]})]},n.name)}));return t.jsx(r.ScrollArea.Autosize,x({maxHeight:500},{children:t.jsxs(r.Table,x({verticalSpacing:"sm",sx:{minWidth:700},highlightOnHover:!0,striped:!0},{children:[t.jsx("thead",{children:t.jsxs("tr",{children:[t.jsx("th",{children:"Student Name"}),t.jsx("th",{children:"Badge Status"})]})}),t.jsx("tbody",{children:n})]}))}))}function y(e){if(0===e.items.length)return t.jsx(v,{title:"No lessons to display",description:"There are not lessons in badge.",loading:e.loading,icon:"badges"});var n=e.items.map((function(n){var i=Math.round(100*(n.percentageCompletion+Number.EPSILON));return t.jsxs("tr",{children:[t.jsx("td",{children:t.jsx(r.UnstyledButton,x({onClick:function(){return e.onClick&&e.onClick(n)}},{children:n.lessonName}))}),t.jsxs("td",{children:[i,"%"]})]},n.lessonName)}));return t.jsx(r.ScrollArea.Autosize,x({maxHeight:500},{children:t.jsxs(r.Table,x({verticalSpacing:"sm",sx:{minWidth:700},highlightOnHover:!0,striped:!0},{children:[t.jsx("thead",{children:t.jsxs("tr",{children:[t.jsx("th",{children:"Lesson Name"}),t.jsx("th",{children:"Lesson Completion"})]})}),t.jsx("tbody",{children:n})]}))}))}var C=r.createStyles((function(e){var n;return{title:(n={fontSize:34,fontWeight:900},n[e.fn.smallerThan("sm")]={fontSize:24},n),description:{maxWidth:600}}}));function S(e){if(0===e.items.length)return t.jsx(v,{title:"No badges to display",description:"We don't have any badges to show you just yet.",loading:e.loading,icon:"badges"});var n=e.items.map((function(n){return t.jsx("tr",{children:t.jsx("td",{children:t.jsx(r.UnstyledButton,x({sx:function(e){return{display:"block",width:"100%",padding:e.spacing.md,color:"dark"===e.colorScheme?e.colors.dark[0]:e.black,"&:hover":{backgroundColor:"dark"===e.colorScheme?e.colors.dark[8]:e.colors.gray[1]}}},onClick:function(){return e.onClick&&e.onClick(n)}},{children:t.jsx(r.Group,{children:t.jsxs("div",{children:[t.jsx(r.Text,x({size:"sm",weight:500},{children:n.name})),t.jsx(r.Text,x({size:"xs",color:"dimmed"},{children:n.description}))]})})}))})},n.badgeId)}));return t.jsx(r.ScrollArea.Autosize,x({maxHeight:500},{children:t.jsx(r.Table,x({horizontalSpacing:0,verticalSpacing:0,sx:{minWidth:700}},{children:t.jsx("tbody",{children:n})}))}))}var k=r.createStyles((function(e){var n;return{title:(n={fontSize:34,fontWeight:900},n[e.fn.smallerThan("sm")]={fontSize:24},n),description:{maxWidth:600}}}));function N(e){if(0===e.items.length)return t.jsx(v,{title:"No students to display",description:"You don't have any students yet, add them and revisit.",loading:e.loading,icon:"groups"});var n=e.items.map((function(n){return t.jsxs("tr",{children:[t.jsx("td",{children:t.jsx(r.UnstyledButton,x({onClick:function(){return e.onViewProfile(n)}},{children:n.studentName}))}),t.jsx("td",{children:n.className})]},n.studentName)}));return t.jsx(r.ScrollArea.Autosize,x({maxHeight:500},{children:t.jsxs(r.Table,x({verticalSpacing:"sm",sx:{minWidth:700},highlightOnHover:!0,striped:!0},{children:[t.jsx("thead",{children:t.jsxs("tr",{children:[t.jsx("th",{children:"Student Name"}),t.jsx("th",{children:"Class Name"})]})}),t.jsx("tbody",{children:n})]}))}))}var T=[{unit:"year",ms:31536e6},{unit:"month",ms:2628e6},{unit:"day",ms:864e5},{unit:"hour",ms:36e5},{unit:"minute",ms:6e4},{unit:"second",ms:1e3}],z=new Intl.RelativeTimeFormat("en",{numeric:"auto"});function w(e,n){return void 0===n&&(n=new Date),e?function(e){for(var n=0,t=T;n<t.length;n++){var i=t[n],s=i.unit,r=i.ms;if(Math.abs(e)>=r||"second"===s)return z.format(Math.round(e/r),s)}return""}(e.getTime()-n.getTime()):""}function I(e){if(0===e.items.length)return t.jsx(v,{title:"No reflections to display",description:"There has not been any lesson progress just yet.",loading:e.loading,icon:"lessons"});var n=e.items.map((function(e){return t.jsxs("tr",{children:[t.jsx("td",{children:e.studentName}),t.jsx("td",{children:e.lessonName}),t.jsx("td",{children:e.reflection}),t.jsx("td",{children:w(new Date(e.updatedAt))})]},e.studentName+e.lessonName)}));return t.jsx(r.ScrollArea.Autosize,x({maxHeight:500},{children:t.jsxs(r.Table,x({verticalSpacing:"sm",sx:{minWidth:700},highlightOnHover:!0,striped:!0},{children:[t.jsx("thead",{children:t.jsxs("tr",{children:[t.jsx("th",{children:"Student Name"}),t.jsx("th",{children:"Lesson Name"}),t.jsx("th",{children:"Reflection"}),t.jsx("th",{children:"Updated At"})]})}),t.jsx("tbody",{children:n})]}))}))}function A(e){if(0===e.items.length)return t.jsx(v,{title:"No impact statements to display",description:"There are no students with impact statements yet.",loading:e.loading,icon:"kindergarten"});var n=e.items.map((function(e){return t.jsxs("tr",{children:[t.jsx("td",{children:e.studentName}),t.jsx("td",{children:e.impactStatement})]},e.studentName)}));return t.jsx(r.ScrollArea.Autosize,x({maxHeight:500},{children:t.jsxs(r.Table,x({verticalSpacing:"sm",sx:{minWidth:700},highlightOnHover:!0,striped:!0},{children:[t.jsx("thead",{children:t.jsxs("tr",{children:[t.jsx("th",{children:"Student Name"}),t.jsx("th",{children:"Impact Statement"})]})}),t.jsx("tbody",{children:n})]}))}))}function B(e){if(0===e.items.length)return t.jsx(v,{title:"No badges to display",description:"We don't have any badges to show you just yet.",loading:e.loading,icon:"badges"});var n=e.items.map((function(n){return t.jsxs("tr",{children:[t.jsx("td",{children:t.jsx(r.UnstyledButton,x({onClick:function(){return e.onClick&&e.onClick(n)}},{children:n.name}))}),t.jsx("td",{children:n.description}),t.jsxs("td",{children:[Math.round(100*(n.percentageCompletion+Number.EPSILON)),"%"]})]},n.badgeId)}));return t.jsx(r.ScrollArea.Autosize,x({maxHeight:500},{children:t.jsxs(r.Table,x({verticalSpacing:"sm",sx:{minWidth:700},highlightOnHover:!0,striped:!0},{children:[t.jsx("thead",{children:t.jsxs("tr",{children:[t.jsx("th",{children:"Badge Name"}),t.jsx("th",{children:"Description"}),t.jsx("th",{children:"Completion"})]})}),t.jsx("tbody",{children:n})]}))}))}function O(e){if(0===e.items.length)return t.jsx(v,{title:"No lessons to display",description:"We don't have any lessons to show you just yet.",loading:e.loading,icon:"lessons"});var n=e.items.map((function(n){return t.jsxs("tr",{children:[t.jsx("td",{children:t.jsx(r.UnstyledButton,x({onClick:function(){return e.onClick&&e.onClick(n)}},{children:n.name}))}),t.jsx("td",{children:n.description}),t.jsxs("td",{children:[Math.round(100*(n.percentageCompletion+Number.EPSILON)),"%"]})]},n.lessonId)}));return t.jsx(r.ScrollArea.Autosize,x({maxHeight:500},{children:t.jsxs(r.Table,x({verticalSpacing:"sm",sx:{minWidth:700},highlightOnHover:!0,striped:!0},{children:[t.jsx("thead",{children:t.jsxs("tr",{children:[t.jsx("th",{children:"Lesson Name"}),t.jsx("th",{children:"Description"}),t.jsx("th",{children:"Completion"})]})}),t.jsx("tbody",{children:n})]}))}))}function L(e){if(0===e.items.length)return t.jsx(v,{title:"No students to display",description:"You have not rostered any students yet.",loading:e.loading,icon:"groups"});var n=e.items.map((function(n){return t.jsxs("tr",{children:[t.jsx("td",{children:t.jsx(r.UnstyledButton,x({onClick:function(){return e.onViewProfile&&e.onViewProfile(n)}},{children:t.jsxs(r.Group,x({spacing:"sm"},{children:[t.jsx(r.Avatar,{size:40,src:n.avatar,radius:40}),t.jsxs("div",{children:[t.jsx(r.Text,x({size:"sm",weight:500},{children:n.givenName&&n.familyName?"".concat(n.givenName," ").concat(n.familyName):n.email})),t.jsx(r.Text,x({size:"xs",color:"dimmed"},{children:n.email}))]})]}))}))}),t.jsx("td",{children:n.badgesEarned}),t.jsx("td",{children:n.lessonsCompleted}),t.jsx("td",{children:n.hasAccount&&t.jsx(i.IconCheck,{color:"green"})}),t.jsx("td",{children:n.lastActivity?w(n.lastActivity):""}),t.jsx("td",{children:t.jsx(r.Group,x({noWrap:!0,spacing:0,position:"right"},{children:!n.readonly&&!!e.onDelete&&t.jsx(r.ActionIcon,x({color:"red"},{children:t.jsx(i.IconTrash,{onClick:function(){return i=n,c.openConfirmModal({title:'Delete "'.concat(i.givenName&&i.familyName?"".concat(i.givenName," ").concat(i.familyName):i.email,'"?'),centered:!0,children:t.jsx(r.Text,x({size:"sm"},{children:"Are you sure you want to delete this person? This action is destructive and you will have to contact support to restore your data."})),labels:{confirm:"Delete",cancel:"No don't delete them"},confirmProps:{color:"red"},onConfirm:function(){return e.onDelete&&e.onDelete(i)}});var i},size:16,stroke:1.5})}))}))})]},n.email)}));return t.jsx(r.ScrollArea,{children:t.jsxs(r.Table,x({verticalSpacing:20,sx:{minWidth:700},highlightOnHover:!0,striped:!0},{children:[t.jsx("thead",{children:t.jsxs("tr",{children:[t.jsx("th",{children:"Student Name"}),t.jsx("th",{children:"Badges Earned"}),t.jsx("th",{children:"Lessons Completed"}),t.jsx("th",{children:"Account Created?"}),t.jsx("th",{children:"Last Active"}),t.jsx("th",{})]})}),t.jsx("tbody",{children:n})]}))})}var P=r.createStyles((function(e){var n;return{title:(n={fontSize:34,fontWeight:900},n[e.fn.smallerThan("sm")]={fontSize:24},n),description:{maxWidth:600},wrapper:{position:"relative",marginBottom:30},dropzone:{borderWidth:1,paddingBottom:50},icon:{color:"dark"===e.colorScheme?e.colors.dark[3]:e.colors.gray[4]},control:{position:"absolute",width:250,left:"calc(50% - 125px)",bottom:-20}}})),D=function(e){var n=P(),s=n.classes,l=n.theme,a=u.useRef(null),c=u.useState(!1),d=c[0],h=c[1],g=u.useCallback((function(n){h(!0),n.forEach((function(n){m.parse(n,{download:!0,header:!0,dynamicTyping:!0,skipEmptyLines:!0,worker:!0,complete:function(n){var t=n.data.filter((function(n){return/^\S+@\S+$/.test(n.email)&&0===e.students.filter((function(e){return e.email===n.email})).length}));t.length>0&&e.onCreateStudents&&e.onCreateStudents(t),h(!1),e.close()}})}))}),[]);return t.jsxs("div",x({className:s.wrapper},{children:[t.jsx(o.Dropzone,x({loading:d,openRef:a,onDrop:g,className:s.dropzone,radius:"md",accept:[o.MIME_TYPES.csv],maxSize:5*Math.pow(1024,2)},{children:t.jsxs("div",x({style:{pointerEvents:"none"}},{children:[t.jsxs(r.Group,x({position:"center"},{children:[t.jsx(o.Dropzone.Accept,{children:t.jsx(i.IconDownload,{size:50,color:l.colors[l.primaryColor][6],stroke:1.5})}),t.jsx(o.Dropzone.Reject,{children:t.jsx(i.IconX,{size:50,color:l.colors.red[6],stroke:1.5})}),t.jsx(o.Dropzone.Idle,{children:t.jsx(i.IconCloudUpload,{size:50,color:"dark"===l.colorScheme?l.colors.dark[0]:l.black,stroke:1.5})})]})),t.jsxs(r.Text,x({align:"center",weight:700,size:"lg",mt:"xl"},{children:[t.jsx(o.Dropzone.Accept,{children:"Drop files here"}),t.jsx(o.Dropzone.Reject,{children:"Csv file less than 5mb"}),t.jsx(o.Dropzone.Idle,{children:"Upload multiple"})]})),t.jsxs(r.Text,x({align:"center",size:"sm",mt:"xs",color:"dimmed"},{children:["Drag'n'drop files here to upload. We can accept only ",t.jsx("i",{children:".csv"})," files that are less than 5mb in size."]}))]}))})),t.jsx(r.Button,x({className:s.control,size:"md",radius:"xl",onClick:function(){var e;return null===(e=a.current)||void 0===e?void 0:e.call(a)}},{children:"Select file"}))]}))};function W(e){if(0===e.items.length)return t.jsx(v,{title:"No classes to display",description:"You don't have any classes yet. Try creating one first...",loading:e.loading,icon:"groups"});var n=e.items.map((function(n){return t.jsxs("tr",{children:[t.jsx("td",{children:t.jsx(r.UnstyledButton,x({onClick:function(){return e.onClick(n)}},{children:t.jsx(r.Text,x({size:14},{children:n.name}))}))}),t.jsx("td",{children:t.jsx(r.Text,x({size:14},{children:n.description}))}),t.jsx("td",{children:t.jsx(r.Group,x({noWrap:!0,spacing:0,position:"right"},{children:t.jsx(r.ActionIcon,x({color:"red"},{children:t.jsx(i.IconTrash,{onClick:function(){return i=n,c.openConfirmModal({title:'Delete "'.concat(i.name,'"?'),centered:!0,children:t.jsx(r.Text,x({size:"sm"},{children:"Are you sure you want to delete this class? This action is destructive and you will have to contact support to restore your data."})),labels:{confirm:"Delete class",cancel:"No don't delete it"},confirmProps:{color:"red"},onConfirm:function(){return e.onDeleteClass(i)}});var i},size:16,stroke:1.5})}))}))})]},n.classId)}));return t.jsx(r.ScrollArea.Autosize,x({maxHeight:300},{children:t.jsxs(r.Table,x({verticalSpacing:20,sx:{minWidth:700},highlightOnHover:!0,striped:!0},{children:[t.jsx("thead",{children:t.jsxs("tr",{children:[t.jsx("th",{children:"Class Name"}),t.jsx("th",{children:"Description"}),t.jsx("th",{})]})}),t.jsx("tbody",{children:n})]}))}))}var G=r.createStyles((function(e){var n;return{title:(n={fontSize:34,fontWeight:900},n[e.fn.smallerThan("sm")]={fontSize:24},n),description:{maxWidth:600}}})),E=r.createStyles((function(e){var n;return{title:(n={fontSize:34,fontWeight:900,marginTop:16},n[e.fn.smallerThan("sm")]={fontSize:24},n),description:{maxWidth:600}}})),M=function(e){var n=E().classes;return t.jsxs(t.Fragment,{children:[t.jsx(r.Title,x({className:n.title},{children:e.name})),t.jsx(r.Text,x({color:"dimmed",className:n.description,mt:"xs"},{children:e.impactStatement}))]})};function H(e){if(0===e.items.length)return t.jsx(v,{title:"No badges to display",description:"There has not been any badge progress just yet.",loading:e.loading,icon:"badges"});var n=e.items.map((function(n){return t.jsxs("tr",{children:[t.jsx("td",{children:t.jsx(r.UnstyledButton,x({onClick:function(){return e.onClick(n)}},{children:n.badgeName}))}),t.jsxs("td",{children:[!!n.isComplete&&t.jsx(r.Badge,x({variant:"filled"},{children:"Complete"})),!n.isComplete&&t.jsx(r.Badge,x({color:"red",variant:"filled"},{children:"Incomplete"}))]})]},n.badgeName)}));return t.jsx(r.ScrollArea.Autosize,x({maxHeight:500},{children:t.jsxs(r.Table,x({verticalSpacing:"sm",sx:{minWidth:700},highlightOnHover:!0,striped:!0},{children:[t.jsx("thead",{children:t.jsxs("tr",{children:[t.jsx("th",{children:"Badge Name"}),t.jsx("th",{children:"Status"})]})}),t.jsx("tbody",{children:n})]}))}))}function R(e){if(0===e.items.length)return t.jsx(v,{title:"No answers to display",description:"There has not been any lesson progress just yet.",loading:e.loading,icon:"lessons"});var n=e.items.map((function(n){return t.jsxs("tr",{children:[t.jsx("td",{children:t.jsx(r.UnstyledButton,x({onClick:function(){return e.onClick(n)}},{children:n.lessonName}))}),t.jsx("td",{children:n.questionName}),t.jsx("td",{children:n.answer.join(",")})]},n.questionName)}));return t.jsx(r.ScrollArea.Autosize,x({maxHeight:500},{children:t.jsxs(r.Table,x({verticalSpacing:"sm",sx:{minWidth:700},highlightOnHover:!0,striped:!0},{children:[t.jsx("thead",{children:t.jsxs("tr",{children:[t.jsx("th",{children:"Lesson Name"}),t.jsx("th",{children:"Question"}),t.jsx("th",{children:"Answer"})]})}),t.jsx("tbody",{children:n})]}))}))}function F(e){if(0===e.items.length)return t.jsx(v,{title:"No reflections to display",description:"There has not been any lesson progress just yet.",loading:e.loading,icon:"lessons"});var n=e.items.map((function(n){return t.jsxs("tr",{children:[t.jsx("td",{children:t.jsx(r.UnstyledButton,x({onClick:function(){return e.onClick(n)}},{children:n.lessonName}))}),t.jsx("td",{children:n.reflection}),t.jsx("td",{children:n.rating.toLocaleString()})]},n.lessonName)}));return t.jsx(r.ScrollArea.Autosize,x({maxHeight:500},{children:t.jsxs(r.Table,x({verticalSpacing:"sm",sx:{minWidth:700},highlightOnHover:!0,striped:!0},{children:[t.jsx("thead",{children:t.jsxs("tr",{children:[t.jsx("th",{children:"Lesson Name"}),t.jsx("th",{children:"Reflection"}),t.jsx("th",{children:"Rating"})]})}),t.jsx("tbody",{children:n})]}))}))}var q=r.createStyles((function(e,n){var t=n.from||"blue",i=n.to||"green";return{card:{position:"relative",cursor:"pointer",overflow:"hidden",transition:"transform 150ms ease, box-shadow 100ms ease",padding:e.spacing.xl,paddingLeft:2*e.spacing.xl,"&:hover":{boxShadow:e.shadows.md,transform:"scale(1.02)"},"&::before":{content:'""',position:"absolute",top:0,bottom:0,left:0,width:6,backgroundImage:e.fn.linearGradient(0,e.colors[t][6],e.colors[i][6])}}}}));function U(e){var n=q(e).classes,s=e.from||"blue",o=e.to||"green",l=e.icon||t.jsx(i.IconColorSwatch,{size:28,stroke:1.5});return t.jsxs(r.Paper,x({withBorder:!0,radius:"md",className:n.card,onClick:e.onClick},{children:[t.jsx(r.ThemeIcon,x({size:"xl",radius:"md",variant:"gradient",gradient:{deg:0,from:s,to:o}},{children:l})),t.jsx(r.Text,x({size:"xl",weight:500,mt:"md"},{children:e.title})),t.jsx(r.Text,x({size:"sm",mt:"sm",color:"dimmed"},{children:e.description}))]}))}var V=r.createStyles((function(e){return{card:{height:240,backgroundSize:"cover",backgroundPosition:"center"},content:{position:"absolute",padding:e.spacing.xl,zIndex:1,top:0,bottom:0,right:0,left:0},action:{position:"absolute",bottom:e.spacing.xl,right:e.spacing.xl},title:{color:e.white,marginBottom:e.spacing.xs/2},description:{color:e.white,maxWidth:220}}})),_=function(e){var n=e.title,i=e.description,s=e.image,o=e.action,l=e.style,a=e.className,c=function(e,n){var t={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&n.indexOf(i)<0&&(t[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(i=Object.getOwnPropertySymbols(e);s<i.length;s++)n.indexOf(i[s])<0&&Object.prototype.propertyIsEnumerable.call(e,i[s])&&(t[i[s]]=e[i[s]])}return t}(e,["title","description","image","action","style","className"]),d=V(),h=d.classes,u=d.cx,m=d.theme;return t.jsxs(r.Card,x({radius:"md",style:x({backgroundImage:"url(".concat(s,")")},l),className:u(h.card,a)},c,{children:[t.jsx(r.Overlay,{gradient:"linear-gradient(105deg, ".concat(m.black," 20%, #312f2f 50%, ").concat(m.colors.gray[4]," 100%)"),opacity:.55,zIndex:0}),t.jsxs("div",x({className:h.content},{children:[t.jsx(r.Text,x({size:"lg",weight:700,className:h.title},{children:n})),t.jsx(r.Text,x({size:"sm",className:h.description},{children:i})),t.jsx(r.Button,x({className:h.action,variant:"white",color:"dark",component:"a",size:"xs",href:o.link,target:"_blank"},{children:o.label}))]}))]}))};function Y(e){if(0===e.items.length)return t.jsx(v,{title:"No reflections to display",description:"There has not been any lesson progress just yet.",loading:e.loading,icon:"lessons"});var n=e.items.map((function(e){return t.jsxs("tr",{children:[t.jsx("td",{children:e.studentName}),t.jsx("td",{children:e.reflection}),t.jsx("td",{children:e.rating.toLocaleString()})]},e.studentName)}));return t.jsx(r.ScrollArea.Autosize,x({maxHeight:500},{children:t.jsxs(r.Table,x({verticalSpacing:"sm",sx:{minWidth:700},highlightOnHover:!0,striped:!0},{children:[t.jsx("thead",{children:t.jsxs("tr",{children:[t.jsx("th",{children:"Student Name"}),t.jsx("th",{children:"Reflection"}),t.jsx("th",{children:"Rating"})]})}),t.jsx("tbody",{children:n})]}))}))}function J(e){if(0===e.items.length)return t.jsx(v,{title:"No students to display",description:"You don't have any student data yet for this lesson",loading:e.loading,icon:"lessons"});var n=e.items.map((function(n){return t.jsxs("tr",{children:[t.jsx("td",{children:t.jsx(r.UnstyledButton,x({onClick:function(){return e.onClick&&e.onClick(n)}},{children:t.jsxs(r.Group,x({spacing:"sm"},{children:[t.jsx(r.Avatar,{size:40,src:n.avatar,radius:40}),t.jsxs("div",{children:[t.jsx(r.Text,x({size:"sm",weight:500},{children:n.name})),t.jsx(r.Text,x({size:"xs",color:"dimmed"},{children:n.email}))]})]}))}))}),t.jsxs("td",{children:[!!n.isComplete&&t.jsx(r.Badge,x({variant:"filled"},{children:"Complete"})),!n.isComplete&&!n.isStarted&&t.jsx(r.Badge,x({color:"red",variant:"filled"},{children:"Not started"})),!n.isComplete&&!!n.isStarted&&t.jsx(r.Badge,x({color:"violet",variant:"filled"},{children:"In progress"}))]})]},n.name)}));return t.jsx(r.ScrollArea.Autosize,x({maxHeight:500},{children:t.jsxs(r.Table,x({verticalSpacing:"sm",sx:{minWidth:700},highlightOnHover:!0,striped:!0},{children:[t.jsx("thead",{children:t.jsxs("tr",{children:[t.jsx("th",{children:"Lesson Name"}),t.jsx("th",{children:"Status"})]})}),t.jsx("tbody",{children:n})]}))}))}function X(e){var n=u.useMemo((function(){return{position:"left",getValue:function(e){return e.primary}}}),[]),i=u.useMemo((function(){return[{position:"bottom",getValue:function(e){return e.secondary}}]}),[]);if(0===e.items.length)return t.jsx(v,{title:"No questions to display",description:"There are no questions in this lesson.",loading:e.loading,icon:"lessons"});var s=e.items.map((function(e){if(e.chart){var s={},o=e.choices||[];return o.forEach((function(e){s[e]=0})),e.answers.forEach((function(e){return e.forEach((function(e){e in s&&(s[e]=s[e]?s[e]+1:1)}))})),t.jsx(r.Card,x({withBorder:!0,p:"xl",radius:"md"},{children:t.jsxs(r.Stack,x({spacing:4},{children:[t.jsx(r.Title,x({size:"lg"},{children:e.question})),t.jsxs(r.Text,x({size:"sm"},{children:[e.answers.length," answers"]})),t.jsx("div",x({style:{background:"white",height:"300px",width:"100%",position:"relative"}},{children:t.jsx(d.Chart,{options:{data:[{label:"",data:o.map((function(e){return{primary:e,secondary:s[e]}}))}],primaryAxis:n,secondaryAxes:i}})}))]}))}),e.question)}return t.jsx(r.Card,x({withBorder:!0,p:"xl",radius:"md"},{children:t.jsxs(r.Stack,x({spacing:4},{children:[t.jsx(r.Title,x({size:"lg"},{children:e.question})),t.jsxs(r.Text,x({size:"sm"},{children:[e.answers.length," answers"]})),t.jsx(r.ScrollArea.Autosize,x({maxHeight:500},{children:t.jsx(r.Stack,x({spacing:4},{children:e.answers.map((function(e){var n=e.join("\n");return t.jsx(r.Card,x({p:5,radius:0,bg:"gray.0"},{children:t.jsx(r.Text,{children:n})}),n)}))}))}))]}))}),e.question)}));return t.jsx(r.Stack,x({py:4,spacing:10,sx:{minWidth:700}},{children:s}))}var $=r.createStyles((function(e){var n;return{title:(n={fontSize:34,fontWeight:900},n[e.fn.smallerThan("sm")]={fontSize:24},n),description:{maxWidth:600}}}));function Q(e){if(0===e.items.length)return t.jsx(v,{title:"No lessons to display",description:"We don't have any lessons to show you just yet.",loading:e.loading,icon:"lessons"});var n=e.items.map((function(n){return t.jsx("tr",{children:t.jsx("td",{children:t.jsx(r.UnstyledButton,x({sx:function(e){return{display:"block",width:"100%",padding:e.spacing.md,color:"dark"===e.colorScheme?e.colors.dark[0]:e.black,"&:hover":{backgroundColor:"dark"===e.colorScheme?e.colors.dark[8]:e.colors.gray[1]}}},onClick:function(){return e.onClick&&e.onClick(n)}},{children:t.jsx(r.Group,{children:t.jsxs("div",{children:[t.jsx(r.Text,x({size:"sm",weight:500},{children:n.name})),t.jsx(r.Text,x({size:"xs",color:"dimmed"},{children:n.description}))]})})}))})},n.lessonId)}));return t.jsx(r.ScrollArea.Autosize,x({maxHeight:500},{children:t.jsx(r.Table,x({horizontalSpacing:0,verticalSpacing:0,sx:{minWidth:700}},{children:t.jsx("tbody",{children:n})}))}))}var K=r.createStyles((function(e){var n;return{title:(n={fontSize:34,fontWeight:900},n[e.fn.smallerThan("sm")]={fontSize:24},n),description:{maxWidth:600}}})),Z=r.createEmotionCache({key:"mantine",prepend:!1}),ee=function(e){var n=l.useForm({initialValues:{active:e.account}});return t.jsx(r.Modal,x({centered:!0,opened:e.opened,onClose:function(){return e.onClose&&e.onClose()},size:"sm",title:t.jsx(r.Title,x({size:"h5"},{children:"Accounts"}))},{children:t.jsxs("form",x({onSubmit:n.onSubmit((function(){e.onChange&&e.onChange(n.values.active)}))},{children:[t.jsx(r.Select,x({required:!0,placeholder:"Select an account",defaultValue:e.account,data:e.accounts.map((function(e){return{value:e.accountId,label:e.name}}))},n.getInputProps("active"))),t.jsx(r.Button,x({type:"submit",fullWidth:!0,mt:"xl"},{children:"Switch"}))]}))}))},ne=r.createStyles((function(e){return{link:{width:50,height:50,borderRadius:e.radius.md,display:"flex",alignItems:"center",justifyContent:"center",color:"dark"===e.colorScheme?e.colors.dark[0]:e.colors.gray[7],"&:hover":{backgroundColor:"dark"===e.colorScheme?e.colors.dark[5]:e.colors.gray[0]}},active:{"&, &:hover":{backgroundColor:e.fn.variant({variant:"light",color:e.primaryColor}).background,color:e.fn.variant({variant:"light",color:e.primaryColor}).color}}}})),te=[{icon:i.IconHome2,label:"Home",href:"/home"},{icon:i.IconGauge,label:"Dashboard",href:"/dashboard"},{icon:i.IconCategory2,label:"Classes",href:"/classes"},{icon:i.IconAlbum,label:"Badges",href:"/badges"},{icon:i.IconLambda,label:"Lessons",href:"/lessons"}],ie=function(e){var n,i=e.icon,s=e.label,o=e.active,l=e.onClick,a=ne(),c=a.classes,d=a.cx;return t.jsx(r.Tooltip,x({label:s,position:"right",transitionDuration:0},{children:t.jsx(r.UnstyledButton,x({onClick:l,className:d(c.link,(n={},n[c.active]=o,n))},{children:t.jsx(i,{stroke:1.5})}))}))},se=function(e){var n=te.map((function(n){return t.jsx(ie,{label:n.label,icon:n.icon,active:n.label===e.active,onClick:function(){return e.navigate(n.href)}},n.label)}));return t.jsxs(r.Navbar,x({width:{base:80},p:"md"},{children:[t.jsx(r.Center,{children:t.jsx(r.Avatar,x({color:"blue",radius:"sm"},{children:t.jsx("div",x({style:{width:15,marginLeft:"auto",marginRight:"auto"}},{children:t.jsx(r.Image,{fit:"contain",src:"https://cdn.localcivics.io/brand/l.png"})}))}))}),t.jsx(r.Navbar.Section,x({grow:!0,mt:50},{children:t.jsx(r.Stack,x({justify:"center",spacing:0},{children:n}))})),t.jsx(r.Navbar.Section,{children:t.jsxs(r.Stack,x({justify:"center",spacing:0},{children:[t.jsx(ie,{icon:i.IconSwitchHorizontal,label:"Switch accounts",onClick:e.onSwitchAccounts}),t.jsx(ie,{icon:i.IconLogout,label:"Logout",onClick:e.onLogout})]}))})]}))},re=r.createStyles((function(e){var n,t,i,s,r,o;return{footer:{paddingTop:2*e.spacing.xl,paddingBottom:2*e.spacing.xl,paddingLeft:3*e.spacing.xl,backgroundColor:"dark"===e.colorScheme?e.colors.dark[6]:e.colors.gray[0],borderTop:"1px solid ".concat("dark"===e.colorScheme?e.colors.dark[5]:e.colors.gray[2])},logo:(n={maxWidth:200},n[e.fn.smallerThan("sm")]={display:"flex",flexDirection:"column",alignItems:"center"},n),description:(t={marginTop:5},t[e.fn.smallerThan("sm")]={marginTop:e.spacing.xs,textAlign:"center"},t),inner:(i={display:"flex",justifyContent:"space-between"},i[e.fn.smallerThan("sm")]={flexDirection:"column",alignItems:"center"},i),groups:(s={display:"flex",flexWrap:"wrap"},s[e.fn.smallerThan("sm")]={display:"none"},s),wrapper:{width:160},link:{display:"block",color:"dark"===e.colorScheme?e.colors.dark[1]:e.colors.gray[6],fontSize:e.fontSizes.sm,paddingTop:3,paddingBottom:3,"&:hover":{textDecoration:"underline"}},title:{fontSize:e.fontSizes.md,fontWeight:700,fontFamily:"Greycliff CF, ".concat(e.fontFamily),marginBottom:e.spacing.xs/2,color:"dark"===e.colorScheme?e.white:e.black},afterFooter:(r={display:"flex",justifyContent:"space-between",alignItems:"center",marginTop:e.spacing.xl,paddingTop:e.spacing.xl,paddingBottom:e.spacing.xl,borderTop:"1px solid ".concat("dark"===e.colorScheme?e.colors.dark[4]:e.colors.gray[2])},r[e.fn.smallerThan("sm")]={flexDirection:"column"},r),social:(o={},o[e.fn.smallerThan("sm")]={marginTop:e.spacing.xs},o)}})),oe=function(e,n,t){var i=JSON.stringify(n),r=s.useState(!1),o=r[0],l=r[1],a=s.useState(e),c=a[0],d=a[1];return u.useEffect((function(){d(e)}),[e,i]),{opened:o,account:c,accounts:n,setChangeModalOpen:l,onAccountChange:function(e){d(e),l(!1),t(e)}}};Object.defineProperty(e,"showNotification",{enumerable:!0,get:function(){return n.showNotification}}),Object.defineProperty(e,"updateNotification",{enumerable:!0,get:function(){return n.updateNotification}}),e.AdminProvider=function(e){return t.jsx(r.MantineProvider,x({withNormalizeCSS:!0,withGlobalStyles:!0,emotionCache:Z,theme:{loader:"bars"}},{children:t.jsx(n.NotificationsProvider,x({limit:e.notificationLimit||5},{children:t.jsx(c.ModalsProvider,{children:e.children})}))}))},e.App=function(e){var n=re().classes,s=oe(e.account,e.accounts,e.onAccountChange);return t.jsxs(r.AppShell,x({padding:"xs",navbar:t.jsx(se,{active:e.navbar.props.active,navigate:e.navbar.props.navigate,onLogout:e.navbar.props.onLogout,onSwitchAccounts:function(){return s.setChangeModalOpen(!0)}}),footer:t.jsx(t.Fragment,{children:!s.opened&&t.jsxs("footer",x({className:n.footer},{children:[t.jsxs(r.Container,x({className:n.inner},{children:[t.jsxs("div",x({className:n.logo},{children:[t.jsxs(r.Group,x({spacing:"xs"},{children:[t.jsx("div",x({style:{width:15}},{children:t.jsx(r.Image,{fit:"contain",src:"https://cdn.localcivics.io/brand/l.png"})})),t.jsx(r.Title,x({color:"dimmed",size:"h5"},{children:"Local Civics"}))]})),t.jsx(r.Text,x({size:"xs",color:"dimmed",className:n.description},{children:"We connect students to powerful civic learning experiences."}))]})),t.jsx("div",x({className:n.groups},{children:t.jsxs("div",x({className:n.wrapper},{children:[t.jsx(r.Text,x({className:n.link,component:"a",href:"https://www.localcivics.io",target:"_blank"},{children:"About"})),t.jsx(r.Text,x({className:n.link,component:"a",href:"https://www.localcivics.io/terms-of-service",target:"_blank"},{children:"Terms"})),t.jsx(r.Text,x({className:n.link,component:"a",href:"https://www.localcivics.io/privacy-policy",target:"_blank"},{children:"Privacy"})),t.jsx(r.Text,x({className:n.link,component:"a",href:"https://localcivics.notion.site/Help-Center-b52300f587b64fc0a61f512686e7626d",target:"_blank"},{children:"Help Center"}))]}))}))]})),t.jsxs(r.Container,x({className:n.afterFooter},{children:[t.jsxs(r.Text,x({color:"dimmed",size:"sm"},{children:["© ",(new Date).getFullYear()," Local Civics. All rights reserved."]})),t.jsxs(r.Group,x({spacing:0,className:n.social,position:"right",noWrap:!0},{children:[t.jsx(r.ActionIcon,x({component:"a",target:"_blank",href:"https://www.instagram.com/localcivics/",size:"lg"},{children:t.jsx(i.IconBrandInstagram,{size:18,stroke:1.5})})),t.jsx(r.ActionIcon,x({component:"a",target:"_blank",href:"https://www.linkedin.com/company/localcivics",size:"lg"},{children:t.jsx(i.IconBrandLinkedin,{size:18,stroke:1.5})})),t.jsx(r.ActionIcon,x({component:"a",target:"_blank",href:"https://www.facebook.com/localcivics/",size:"lg"},{children:t.jsx(i.IconBrandFacebook,{size:18,stroke:1.5})}))]}))]}))]}))}),styles:function(e){return{main:{backgroundColor:"dark"===e.colorScheme?e.colors.dark[8]:e.colors.gray[0]}}}},{children:[t.jsxs("div",x({style:{position:"relative"}},{children:[(e.loading||s.opened)&&t.jsx(r.Center,x({style:{height:400}},{children:t.jsx(r.Loader,{})})),!e.loading&&!s.opened&&e.page]})),t.jsx(ee,{opened:s.opened,account:s.account,accounts:s.accounts,onChange:s.onAccountChange,onClose:function(){return s.setChangeModalOpen(!1)}})]}))},e.Badge=function(e){var n=C().classes,o=s.useState("lessons"),l=o[0],a=o[1],c=e.students.length,d=c>0?e.students.filter((function(e){return e.isComplete})).length/c:0;return t.jsx(r.Container,x({size:"lg",py:"xl"},{children:t.jsxs(r.Stack,x({spacing:"md"},{children:[t.jsx(r.Grid,{children:t.jsxs(r.Grid.Col,x({sm:"auto"},{children:[t.jsx(r.Badge,x({variant:"filled",leftSection:t.jsx(r.ActionIcon,x({onClick:e.onBackClick,color:"blue",size:"xs",radius:"xl",variant:"filled"},{children:t.jsx(i.IconArrowLeft,{size:14})})),size:"lg"},{children:"Badges"})),t.jsxs(r.Group,{children:[t.jsxs(r.Stack,x({spacing:0},{children:[t.jsx(r.Title,x({order:2,className:n.title,mt:"md"},{children:e.displayName||"Badge"})),t.jsx(r.Text,x({color:"dimmed",className:n.description,mt:"sm"},{children:e.description||"No description"}))]})),t.jsx(r.Stack,x({ml:"auto"},{children:t.jsx(r.Button,x({variant:"gradient",onClick:e.onPreviewClick},{children:"Preview"}))}))]})]}))}),t.jsx("div",{children:t.jsxs("div",x({style:{position:"relative"}},{children:[t.jsx(r.LoadingOverlay,{visible:e.loading,overlayBlur:2}),t.jsxs(r.Stack,{children:[t.jsx(p,{data:[{title:"BADGE COMPLETION",value:d,unit:"%"}]}),t.jsx(r.Select,{clearable:!0,clearButtonLabel:"Clear class selection",size:"sm",placeholder:"Select a class",nothingFound:"No options",value:e.classId,onChange:e.onClassChange,icon:t.jsx(i.IconCategory2,{}),data:e.classes.map((function(e){return{value:e.classId,label:e.name}}))}),t.jsxs(r.Stack,x({spacing:0},{children:[t.jsx(j,{value:l,data:[{label:"By lesson",value:"lessons"},{label:"By student",value:"students"}],onChange:a}),"lessons"===l&&t.jsx(y,{loading:e.loading,items:e.lessons,onClick:e.onLessonClick}),"students"===l&&t.jsx(b,{loading:e.loading,items:e.students,onClick:e.onUserClick})]}))]})]}))})]}))}))},e.Badges=function(e){var n=k().classes;return t.jsx(r.Container,x({size:"lg",py:"xl"},{children:t.jsxs(r.Stack,x({spacing:"md"},{children:[t.jsx(r.Grid,{children:t.jsxs(r.Grid.Col,x({sm:"auto"},{children:[t.jsx(r.Badge,x({variant:"filled",size:"lg"},{children:"Badges"})),t.jsx(r.Title,x({order:2,className:n.title,mt:"md"},{children:"Badges and micro-credentials"})),t.jsx(r.Text,x({color:"dimmed",className:n.description,mt:"sm"},{children:"Project-sized skills acquisition and standards alignment."}))]}))}),t.jsx(r.Autocomplete,{placeholder:"Search for a badge that fits your needs",data:e.badges.map((function(e){return e.name})),onChange:e.onAutocompleteChange}),t.jsxs("div",x({style:{position:"relative"}},{children:[t.jsx(r.LoadingOverlay,{visible:e.loading,overlayBlur:2}),t.jsx(S,{loading:e.loading,items:e.badges,onClick:e.onBadgeClick})]}))]}))}))},e.Class=function(e){var n=P().classes,o=l.useForm({initialValues:{classId:"",studentId:"",email:"",givenName:"",familyName:"",avatar:"",role:"",readonly:!1,lastActivity:null,hasAccount:!1,lessonsCompleted:0,badgesEarned:0},validate:{email:function(n){return/^\S+@\S+$/.test(n)&&0===e.students.filter((function(e){return e.email===n})).length?null:"Invalid email"}}}),a=s.useState(!1),c=a[0],d=a[1];return t.jsxs(t.Fragment,{children:[t.jsx(r.Drawer,x({opened:c,onClose:function(){return d(!1)},title:t.jsx(r.Title,x({size:"h5"},{children:"Add students"})),padding:"xl",size:"xl"},{children:t.jsxs(r.Stack,x({spacing:"md"},{children:[t.jsx(D,x({},e,{close:function(){return d(!1)}})),t.jsx(r.Divider,{label:"or",labelPosition:"center",my:"md",variant:"dashed"}),t.jsx("form",x({onSubmit:o.onSubmit((function(){var n=o.values;o.reset(),d(!1),e.onCreateStudents&&e.onCreateStudents([n])}))},{children:t.jsxs(r.Stack,{children:[t.jsx(r.TextInput,x({withAsterisk:!0,label:"Email",placeholder:"Email"},o.getInputProps("email"))),t.jsxs(r.Group,x({grow:!0},{children:[t.jsx(r.TextInput,x({label:"Given name",placeholder:"Given name"},o.getInputProps("givenName"))),t.jsx(r.TextInput,x({label:"Family name",placeholder:"Family name"},o.getInputProps("familyName")))]})),t.jsx(r.Button,x({type:"submit",fullWidth:!0,mt:"md"},{children:"Submit"}))]})}))]}))})),t.jsx(r.Container,x({size:"lg",py:"xl"},{children:t.jsxs(r.Stack,x({spacing:"md"},{children:[t.jsxs(r.Grid,{children:[t.jsxs(r.Grid.Col,x({sm:"auto"},{children:[t.jsx(r.Badge,x({variant:"filled",leftSection:t.jsx(r.ActionIcon,x({onClick:e.onBackClick,color:"blue",size:"xs",radius:"xl",variant:"filled"},{children:t.jsx(i.IconArrowLeft,{size:14})})),size:"lg"},{children:"Classes"})),t.jsx(r.Title,x({order:2,className:n.title,mt:"md"},{children:e.displayName||"Class"})),t.jsx(r.Text,x({color:"dimmed",className:n.description,mt:"sm"},{children:e.description||"No description"}))]})),t.jsx(r.Grid.Col,x({sm:"content"},{children:!e.loading&&t.jsx(r.Button,x({onClick:function(){return d(!0)},leftIcon:t.jsx(i.IconPlaylistAdd,{size:14})},{children:"Add students"}))}))]}),t.jsxs("div",x({style:{position:"relative"}},{children:[t.jsx(r.LoadingOverlay,{visible:e.loading,overlayBlur:2}),t.jsxs(r.Stack,x({spacing:"sm"},{children:[t.jsx(p,{data:[{title:"# OF STUDENTS",value:e.students.length},{title:"ACCOUNT CREATION",value:e.percentageOfAccountsCreated,unit:"%"},{title:"BADGE COMPLETION",value:e.percentageOfBadgesEarned,unit:"%"},{title:"LESSON COMPLETION",value:e.percentageOfLessonsCompleted,unit:"%"}]}),t.jsx(L,{loading:e.loading,items:e.students,onDelete:e.onDeleteStudent,onViewProfile:function(n){return e.onStudentClick(n)}})]}))]}))]}))}))]})},e.Classes=function(e){var n=G().classes,o=l.useForm({initialValues:{classId:"",name:"",description:""},validate:{name:function(e){return e.length<=6?"Name should include at least 6 characters":null}}}),a=s.useState(!1),c=a[0],d=a[1];return t.jsxs(t.Fragment,{children:[t.jsx(r.Drawer,x({opened:c,onClose:function(){return d(!1)},title:t.jsxs(r.Group,x({spacing:0},{children:[t.jsx(r.Title,x({size:"h5"},{children:"Create a class"})),t.jsx(r.Tooltip,x({label:"Classes settings cannot be modified once created"},{children:t.jsx(r.ActionIcon,{children:t.jsx(i.IconInfoCircle,{color:"#3b82f6",size:14})})}))]})),padding:"xl",size:"xl"},{children:t.jsxs("form",x({onSubmit:o.onSubmit((function(){var n=o.values;o.reset(),d(!1),e.onCreateClass&&e.onCreateClass(n)}))},{children:[t.jsxs(r.Stack,{children:[t.jsx(r.TextInput,x({withAsterisk:!0,label:"Name",placeholder:"Class name"},o.getInputProps("name"))),t.jsx(r.TextInput,x({label:"Description",placeholder:"A class for my first period English students"},o.getInputProps("description")))]}),t.jsx(r.Button,x({type:"submit",fullWidth:!0,mt:"md"},{children:"Submit"}))]}))})),t.jsx(r.Container,x({size:"lg",py:"xl"},{children:t.jsxs(r.Stack,x({spacing:"md"},{children:[t.jsxs(r.Grid,{children:[t.jsxs(r.Grid.Col,x({sm:"auto"},{children:[t.jsx(r.Badge,x({variant:"filled",size:"lg"},{children:"Classes"})),t.jsx(r.Title,x({order:2,className:n.title,mt:"md"},{children:"Organize students into classes"})),t.jsx(r.Text,x({color:"dimmed",className:n.description,mt:"sm"},{children:"A class can be for a specific period of time, grade, team, or other cohorts."}))]})),t.jsx(r.Grid.Col,x({sm:"content"},{children:!e.loading&&t.jsx(r.Button,x({onClick:function(){return d(!0)},leftIcon:t.jsx(i.IconPlaylistAdd,{size:14})},{children:"Create class"}))}))]}),t.jsxs("div",x({style:{position:"relative"}},{children:[t.jsx(r.LoadingOverlay,{visible:e.loading,overlayBlur:2}),t.jsxs(r.Stack,x({spacing:"sm"},{children:[t.jsx(p,{data:[{title:"# OF CLASSES",value:e.classes.length}]}),t.jsx(W,{loading:e.loading,items:e.classes,onDeleteClass:e.onDeleteClass,onClick:e.onClassClick})]}))]}))]}))}))]})},e.Dashboard=function(e){var n=s.useState("students"),o=n[0],l=n[1];return t.jsx(r.Container,x({size:"lg",py:"xl"},{children:t.jsxs(r.Stack,{children:[t.jsxs(r.Stack,x({spacing:0},{children:[t.jsx(r.Title,x({size:"h3"},{children:"Dashboard"})),t.jsx(r.Text,x({color:"dimmed",size:"sm",mt:"md"},{children:"Fast-track learning for your students."}))]})),t.jsx(r.Stack,{children:t.jsxs("div",x({style:{position:"relative"}},{children:[t.jsx(r.LoadingOverlay,{visible:e.loading,overlayBlur:2}),t.jsxs(r.Stack,x({spacing:"sm"},{children:[t.jsx(p,{data:[{title:"# OF STUDENTS",value:e.students.length},{title:"ACCOUNT CREATION",value:e.percentageOfAccountsCreated,unit:"%"},{title:"BADGE COMPLETION",value:e.percentageOfBadgesEarned,unit:"%"},{title:"LESSON COMPLETION",value:e.percentageOfLessonsCompleted,unit:"%"}]}),t.jsx(r.Select,{clearable:!0,clearButtonLabel:"Clear class selection",size:"sm",placeholder:"Select a class",nothingFound:"No options",value:e.classId,onChange:e.onClassChange,icon:t.jsx(i.IconCategory2,{}),data:e.classes.map((function(e){return{value:e.classId,label:e.name}}))}),t.jsxs(r.Stack,x({spacing:0},{children:[t.jsx(j,{value:o,data:[{label:"My students",value:"students"},{label:"Impact statements",value:"impact"},{label:"Reflections",value:"reflections"},{label:"Badges",value:"badges"},{label:"Lessons",value:"lessons"}],onChange:l}),"impact"===o&&t.jsx(A,{loading:e.loading,items:e.impacts}),"reflections"===o&&t.jsx(I,{loading:e.loading,items:e.reflections}),"badges"===o&&t.jsx(B,{loading:e.loading,items:e.badges,onClick:e.onBadgeClick}),"lessons"===o&&t.jsx(O,{loading:e.loading,items:e.lessons,onClick:e.onLessonClick}),"students"===o&&t.jsx(N,{loading:e.loading,items:e.students,onViewProfile:e.onViewStudentProfile})]}))]}))]}))})]})}))},e.Home=function(e){return t.jsx(r.Container,x({size:"lg"},{children:t.jsxs(r.Stack,x({spacing:"lg"},{children:[t.jsxs(r.Grid,x({gutter:"md"},{children:[t.jsx(r.Grid.Col,x({md:6},{children:t.jsx(M,{variant:"compact",name:e.name,impactStatement:e.impactStatement})})),t.jsx(r.Grid.Col,x({md:6},{children:t.jsx(_,{title:e.organization.name,description:e.organization.description,image:e.organization.image,action:{label:"Visit website",link:e.organization.website}})}))]})),t.jsxs(r.Grid,x({gutter:"md"},{children:[t.jsx(r.Grid.Col,{children:t.jsx(U,{title:"Dashboard",description:"Track class performance across core areas of focus.",onClick:e.onDashboardClick})}),t.jsx(r.Grid.Col,{children:t.jsx(U,{title:"Classes",description:"Organize students into classes.",onClick:e.onClassesClick})}),t.jsx(r.Grid.Col,{children:t.jsx(U,{title:"Lessons",description:"Explore units of instruction and/or see corresponding class progress.",onClick:e.onLessonsClick})}),t.jsx(r.Grid.Col,{children:t.jsx(U,{title:"Badges",description:"Project-sized skills acquisition and standards alignment.",onClick:e.onBadgesClick})})]}))]}))}))},e.Lesson=function(e){var n=$().classes,o=s.useState("question"),l=o[0],a=o[1],c=e.students.length,d=c>0?e.students.filter((function(e){return e.isComplete})).length/c:0;return t.jsx(r.Container,x({size:"lg",py:"xl"},{children:t.jsxs(r.Stack,x({spacing:"md"},{children:[t.jsx(r.Grid,{children:t.jsxs(r.Grid.Col,x({sm:"auto"},{children:[t.jsx(r.Badge,x({variant:"filled",leftSection:t.jsx(r.ActionIcon,x({onClick:e.onBackClick,color:"blue",size:"xs",radius:"xl",variant:"filled"},{children:t.jsx(i.IconArrowLeft,{size:14})})),size:"lg"},{children:"Lessons"})),t.jsxs(r.Group,{children:[t.jsxs(r.Stack,x({spacing:0},{children:[t.jsx(r.Title,x({order:2,className:n.title,mt:"md"},{children:e.displayName||"Lesson"})),t.jsx(r.Text,x({color:"dimmed",className:n.description,mt:"sm"},{children:e.description||"No description"}))]})),t.jsx(r.Stack,x({ml:"auto"},{children:t.jsx(r.Button,x({variant:"gradient",onClick:e.onPreviewClick},{children:"Preview"}))}))]})]}))}),t.jsx("div",{children:t.jsxs("div",x({style:{position:"relative"}},{children:[t.jsx(r.LoadingOverlay,{visible:e.loading,overlayBlur:2}),t.jsxs(r.Stack,{children:[t.jsx(p,{data:[{title:"LESSON COMPLETION",value:d,unit:"%"}]}),t.jsx(r.Select,{clearable:!0,clearButtonLabel:"Clear class selection",size:"sm",placeholder:"Select a class",nothingFound:"No options",value:e.classId,onChange:e.onClassChange,icon:t.jsx(i.IconCategory2,{}),data:e.classes.map((function(e){return{value:e.classId,label:e.name}}))}),t.jsxs(r.Stack,x({spacing:0},{children:[t.jsx(j,{value:l,data:[{label:"By question",value:"question"},{label:"By reflection",value:"reflections"},{label:"By student",value:"students"}],onChange:a}),"question"===l&&t.jsx(X,{loading:e.loading,items:e.questions}),"reflections"===l&&t.jsx(Y,{loading:e.loading,items:e.reflections}),"students"===l&&t.jsx(J,{loading:e.loading,items:e.students,onClick:e.onUserClick})]}))]})]}))})]}))}))},e.Lessons=function(e){var n=K().classes;return t.jsx(r.Container,x({size:"lg",py:"xl"},{children:t.jsxs(r.Stack,x({spacing:"md"},{children:[t.jsx(r.Grid,{children:t.jsxs(r.Grid.Col,x({sm:"auto"},{children:[t.jsx(r.Badge,x({variant:"filled",size:"lg"},{children:"Lessons"})),t.jsx(r.Title,x({order:2,className:n.title,mt:"md"},{children:"Lessons"})),t.jsx(r.Text,x({color:"dimmed",className:n.description,mt:"sm"},{children:"Explore units of instruction and/or see corresponding class progress."}))]}))}),t.jsx(r.Autocomplete,{placeholder:"Search for a lesson that fits your needs",data:e.lessons.map((function(e){return e.name})),onChange:e.onAutocompleteChange}),t.jsxs("div",x({style:{position:"relative"}},{children:[t.jsx(r.LoadingOverlay,{visible:e.loading,overlayBlur:2}),t.jsx(Q,{loading:e.loading,items:e.lessons,onClick:e.onLessonClick})]}))]}))}))},e.Navbar=se,e.Student=function(e){var n=s.useState("badges"),o=n[0],l=n[1],a=e.badges.length,c=a>0?e.badges.filter((function(e){return e.isComplete})).length/a:0;return t.jsx(r.Container,x({size:"lg",py:"xl"},{children:t.jsxs(r.Stack,x({spacing:"md"},{children:[t.jsx(r.Grid,x({gutter:"md"},{children:t.jsxs(r.Grid.Col,x({sm:"auto"},{children:[t.jsx(r.Badge,x({variant:"filled",leftSection:t.jsx(r.ActionIcon,x({onClick:e.onBackClick,color:"blue",size:"xs",radius:"xl",variant:"filled"},{children:t.jsx(i.IconArrowLeft,{size:14})})),size:"lg"},{children:"Students"})),t.jsx(M,{variant:"compact",name:e.name,impactStatement:e.impactStatement})]}))})),t.jsxs("div",x({style:{position:"relative"}},{children:[t.jsx(r.LoadingOverlay,{visible:e.loading,overlayBlur:2}),t.jsxs(r.Stack,x({spacing:"lg"},{children:[t.jsx(p,{data:[{title:"PROBLEMS SOLVED",value:e.numberOfProblemsSolved},{title:"LESSON COMPLETION",value:e.percentageOfLessonsCompleted,unit:"%"},{title:"BADGE COMPLETION",value:c,unit:"%"}]}),t.jsxs(r.Stack,x({spacing:0},{children:[t.jsx(j,{value:o,data:[{label:"My badges",value:"badges"},{label:"My answers",value:"answers"},{label:"My reflections",value:"reflections"}],onChange:l}),"badges"===o&&t.jsx(H,{loading:e.loading,items:e.badges,onClick:e.onBadgeClick}),"answers"===o&&t.jsx(R,{loading:e.loading,items:e.answers,onClick:e.onAnswerClick}),"reflections"===o&&t.jsx(F,{loading:e.loading,items:e.reflections,onClick:e.onReflectionClick})]}))]}))]}))]}))}))},e.SwitchAccount=ee,Object.defineProperty(e,"__esModule",{value:!0})}));
1
+ !function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("@mantine/notifications"),require("react/jsx-runtime"),require("@tabler/icons"),require("react"),require("@mantine/core"),require("@mantine/dropzone"),require("@mantine/form"),require("papaparse"),require("@mantine/modals"),require("react-charts")):"function"==typeof define&&define.amd?define(["exports","@mantine/notifications","react/jsx-runtime","@tabler/icons","react","@mantine/core","@mantine/dropzone","@mantine/form","papaparse","@mantine/modals","react-charts"],n):n((e="undefined"!=typeof globalThis?globalThis:e||self).components={},e.MantineNotifications,e.ReactJSXRuntime,e.TablerIcons,e.React,e.MantineCore,e.MantineDropzone,e.MantineForm,e.Papaparse,e.MantineModals,e.ReactCharts)}(this,(function(e,n,t,i,s,r,o,l,a,c,d){"use strict";function h(e){if(e&&e.__esModule)return e;var n=Object.create(null);return e&&Object.keys(e).forEach((function(t){if("default"!==t){var i=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(n,t,i.get?i:{enumerable:!0,get:function(){return e[t]}})}})),n.default=e,Object.freeze(n)}var u=h(s),m=h(a),x=function(){return x=Object.assign||function(e){for(var n,t=1,i=arguments.length;t<i;t++)for(var s in n=arguments[t])Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s]);return e},x.apply(this,arguments)};var g=r.createStyles((function(e){var n,t;return{root:(n={display:"flex",backgroundImage:"linear-gradient(-60deg, ".concat(e.colors[e.primaryColor][4]," 0%, ").concat(e.colors[e.primaryColor][7]," 100%)"),padding:1.5*e.spacing.xl,borderRadius:e.radius.md},n[e.fn.smallerThan("sm")]={flexDirection:"column"},n),title:{color:e.white,textTransform:"uppercase",fontWeight:700,fontSize:e.fontSizes.sm},count:{color:e.white,fontSize:32,lineHeight:1,fontWeight:700,marginBottom:e.spacing.md,fontFamily:"Greycliff CF, ".concat(e.fontFamily)},description:{color:e.colors[e.primaryColor][0],fontSize:e.fontSizes.sm,marginTop:5},stat:{flex:1,"& + &":(t={paddingLeft:e.spacing.xl,marginLeft:e.spacing.xl,borderLeft:"1px solid ".concat(e.colors[e.primaryColor][3])},t[e.fn.smallerThan("sm")]={paddingLeft:0,marginLeft:0,borderLeft:0,paddingTop:e.spacing.xl,marginTop:e.spacing.xl,borderTop:"1px solid ".concat(e.colors[e.primaryColor][3])},t)}}})),p=function(e){var n=e.data,i=g().classes,s=n.map((function(e){var n="%"===e.unit?Math.round(100*(e.value+Number.EPSILON)):e.value;return t.jsxs("div",x({className:i.stat},{children:[t.jsxs(r.Text,x({className:i.count},{children:[n.toLocaleString(),e.unit]})),t.jsx(r.Text,x({className:i.title},{children:e.title}))]}),e.title)}));return t.jsx("div",x({className:i.root},{children:s}))},j=function(e){var n,i=null===(n=e.data)||void 0===n?void 0:n.map((function(e){return t.jsx(r.Tabs.Tab,x({value:e.value},{children:e.label||e.value}),e.value)}));return t.jsx(r.Tabs,x({value:e.value,onTabChange:e.onChange},{children:t.jsx(r.Tabs.List,{children:i})}))},f=r.createStyles((function(e){var n,t,i;return{wrapper:(n={display:"flex",alignItems:"center",padding:2*e.spacing.xl,borderRadius:e.radius.md,backgroundColor:"dark"===e.colorScheme?e.colors.dark[8]:e.white,border:"1px solid ".concat("dark"===e.colorScheme?e.colors.dark[8]:e.colors.gray[3])},n["@media (max-width: ".concat(e.breakpoints.sm,"px)")]={flexDirection:"column-reverse",padding:e.spacing.xl},n),image:(t={maxWidth:"40%"},t["@media (max-width: ".concat(e.breakpoints.sm,"px)")]={maxWidth:"100%"},t),body:(i={paddingRight:4*e.spacing.xl},i["@media (max-width: ".concat(e.breakpoints.sm,"px)")]={paddingRight:0,marginTop:e.spacing.xl},i),title:{color:"dark"===e.colorScheme?e.white:e.black,fontFamily:"Greycliff CF, ".concat(e.fontFamily),lineHeight:1,marginBottom:e.spacing.md},controls:{display:"flex",marginTop:e.spacing.xl},inputWrapper:{width:"100%",flex:"1"},input:{borderTopRightRadius:0,borderBottomRightRadius:0,borderRight:0},control:{borderTopLeftRadius:0,borderBottomLeftRadius:0}}})),v=function(e){var n=f().classes,i=e.title||"Nothing to display",s=e.description||"We don't have anything to show you here just yet. Add data, check back later, or adjust your search.";return t.jsxs("div",x({className:n.wrapper},{children:[t.jsxs("div",x({className:n.body},{children:[t.jsx(r.Title,x({className:n.title},{children:e.loading?"Loading...":i})),t.jsx(r.Text,x({size:"sm",color:"dimmed"},{children:e.loading?"Hold on, we're loading your data.":s}))]})),t.jsx(r.Image,{src:"https://cdn.localcivics.io/illustrations/".concat(e.icon,".svg"),className:n.image})]}))};function b(e){if(0===e.items.length)return t.jsx(v,{title:"No badges to display",description:"There has not been any badge progress just yet.",loading:e.loading,icon:"badges"});var n=e.items.map((function(n){return t.jsxs("tr",{children:[t.jsx("td",{children:t.jsx(r.UnstyledButton,x({onClick:function(){return e.onClick&&e.onClick(n)}},{children:t.jsxs(r.Group,x({spacing:"sm"},{children:[t.jsx(r.Avatar,{size:40,src:n.avatar,radius:40}),t.jsxs("div",{children:[t.jsx(r.Text,x({size:"sm",weight:500},{children:n.name})),t.jsx(r.Text,x({size:"xs",color:"dimmed"},{children:n.email}))]})]}))}))}),t.jsxs("td",{children:[!!n.isComplete&&t.jsx(r.Badge,x({variant:"filled"},{children:"Complete"})),!n.isComplete&&t.jsx(r.Badge,x({color:"red",variant:"filled"},{children:"Incomplete"}))]})]},n.name)}));return t.jsx(r.ScrollArea.Autosize,x({maxHeight:500},{children:t.jsxs(r.Table,x({verticalSpacing:"sm",sx:{minWidth:700},highlightOnHover:!0,striped:!0},{children:[t.jsx("thead",{children:t.jsxs("tr",{children:[t.jsx("th",{children:"Student Name"}),t.jsx("th",{children:"Badge Status"})]})}),t.jsx("tbody",{children:n})]}))}))}function y(e){if(0===e.items.length)return t.jsx(v,{title:"No lessons to display",description:"There are not lessons in badge.",loading:e.loading,icon:"badges"});var n=e.items.map((function(n){var i=Math.round(100*(n.percentageCompletion+Number.EPSILON));return t.jsxs("tr",{children:[t.jsx("td",{children:t.jsx(r.UnstyledButton,x({onClick:function(){return e.onClick&&e.onClick(n)}},{children:n.lessonName}))}),t.jsxs("td",{children:[i,"%"]})]},n.lessonName)}));return t.jsx(r.ScrollArea.Autosize,x({maxHeight:500},{children:t.jsxs(r.Table,x({verticalSpacing:"sm",sx:{minWidth:700},highlightOnHover:!0,striped:!0},{children:[t.jsx("thead",{children:t.jsxs("tr",{children:[t.jsx("th",{children:"Lesson Name"}),t.jsx("th",{children:"Lesson Completion"})]})}),t.jsx("tbody",{children:n})]}))}))}var C=r.createStyles((function(e){var n;return{title:(n={fontSize:34,fontWeight:900},n[e.fn.smallerThan("sm")]={fontSize:24},n),description:{maxWidth:600}}}));function S(e){if(0===e.items.length)return t.jsx(v,{title:"No badges to display",description:"We don't have any badges to show you just yet.",loading:e.loading,icon:"badges"});var n=e.items.map((function(n){return t.jsx("tr",{children:t.jsx("td",{children:t.jsx(r.UnstyledButton,x({sx:function(e){return{display:"block",width:"100%",padding:e.spacing.md,color:"dark"===e.colorScheme?e.colors.dark[0]:e.black,"&:hover":{backgroundColor:"dark"===e.colorScheme?e.colors.dark[8]:e.colors.gray[1]}}},onClick:function(){return e.onClick&&e.onClick(n)}},{children:t.jsx(r.Group,{children:t.jsxs("div",{children:[t.jsx(r.Text,x({size:"sm",weight:500},{children:n.name})),t.jsx(r.Text,x({size:"xs",color:"dimmed"},{children:n.description}))]})})}))})},n.badgeId)}));return t.jsx(r.ScrollArea.Autosize,x({maxHeight:500},{children:t.jsx(r.Table,x({horizontalSpacing:0,verticalSpacing:0,sx:{minWidth:700}},{children:t.jsx("tbody",{children:n})}))}))}var k=r.createStyles((function(e){var n;return{title:(n={fontSize:34,fontWeight:900},n[e.fn.smallerThan("sm")]={fontSize:24},n),description:{maxWidth:600}}}));function N(e){if(0===e.items.length)return t.jsx(v,{title:"No students to display",description:"You don't have any students yet, add them and revisit.",loading:e.loading,icon:"groups"});var n=e.items.map((function(n){return t.jsxs("tr",{children:[t.jsx("td",{children:t.jsx(r.UnstyledButton,x({onClick:function(){return e.onViewProfile(n)}},{children:n.studentName}))}),t.jsx("td",{children:n.className})]},n.studentName)}));return t.jsx(r.ScrollArea.Autosize,x({maxHeight:500},{children:t.jsxs(r.Table,x({verticalSpacing:"sm",sx:{minWidth:700},highlightOnHover:!0,striped:!0},{children:[t.jsx("thead",{children:t.jsxs("tr",{children:[t.jsx("th",{children:"Student Name"}),t.jsx("th",{children:"Class Name"})]})}),t.jsx("tbody",{children:n})]}))}))}var T=[{unit:"year",ms:31536e6},{unit:"month",ms:2628e6},{unit:"day",ms:864e5},{unit:"hour",ms:36e5},{unit:"minute",ms:6e4},{unit:"second",ms:1e3}],z=new Intl.RelativeTimeFormat("en",{numeric:"auto"});function w(e,n){return void 0===n&&(n=new Date),e?function(e){for(var n=0,t=T;n<t.length;n++){var i=t[n],s=i.unit,r=i.ms;if(Math.abs(e)>=r||"second"===s)return z.format(Math.round(e/r),s)}return""}(e.getTime()-n.getTime()):""}function I(e){if(0===e.items.length)return t.jsx(v,{title:"No reflections to display",description:"There has not been any lesson progress just yet.",loading:e.loading,icon:"lessons"});var n=e.items.map((function(e){return t.jsxs("tr",{children:[t.jsx("td",{children:e.studentName}),t.jsx("td",{children:e.lessonName}),t.jsx("td",{children:e.reflection}),t.jsx("td",{children:w(new Date(e.updatedAt))})]},e.studentName+e.lessonName)}));return t.jsx(r.ScrollArea.Autosize,x({maxHeight:500},{children:t.jsxs(r.Table,x({verticalSpacing:"sm",sx:{minWidth:700},highlightOnHover:!0,striped:!0},{children:[t.jsx("thead",{children:t.jsxs("tr",{children:[t.jsx("th",{children:"Student Name"}),t.jsx("th",{children:"Lesson Name"}),t.jsx("th",{children:"Reflection"}),t.jsx("th",{children:"Updated At"})]})}),t.jsx("tbody",{children:n})]}))}))}function A(e){if(0===e.items.length)return t.jsx(v,{title:"No impact statements to display",description:"There are no students with impact statements yet.",loading:e.loading,icon:"kindergarten"});var n=e.items.map((function(e){return t.jsxs("tr",{children:[t.jsx("td",{children:e.studentName}),t.jsx("td",{children:e.impactStatement})]},e.studentName)}));return t.jsx(r.ScrollArea.Autosize,x({maxHeight:500},{children:t.jsxs(r.Table,x({verticalSpacing:"sm",sx:{minWidth:700},highlightOnHover:!0,striped:!0},{children:[t.jsx("thead",{children:t.jsxs("tr",{children:[t.jsx("th",{children:"Student Name"}),t.jsx("th",{children:"Impact Statement"})]})}),t.jsx("tbody",{children:n})]}))}))}function B(e){if(0===e.items.length)return t.jsx(v,{title:"No badges to display",description:"We don't have any badges to show you just yet.",loading:e.loading,icon:"badges"});var n=e.items.map((function(n){return t.jsxs("tr",{children:[t.jsx("td",{children:t.jsx(r.UnstyledButton,x({onClick:function(){return e.onClick&&e.onClick(n)}},{children:n.name}))}),t.jsx("td",{children:n.description}),t.jsxs("td",{children:[Math.round(100*(n.percentageCompletion+Number.EPSILON)),"%"]})]},n.badgeId)}));return t.jsx(r.ScrollArea.Autosize,x({maxHeight:500},{children:t.jsxs(r.Table,x({verticalSpacing:"sm",sx:{minWidth:700},highlightOnHover:!0,striped:!0},{children:[t.jsx("thead",{children:t.jsxs("tr",{children:[t.jsx("th",{children:"Badge Name"}),t.jsx("th",{children:"Description"}),t.jsx("th",{children:"Completion"})]})}),t.jsx("tbody",{children:n})]}))}))}function O(e){if(0===e.items.length)return t.jsx(v,{title:"No lessons to display",description:"We don't have any lessons to show you just yet.",loading:e.loading,icon:"lessons"});var n=e.items.map((function(n){return t.jsxs("tr",{children:[t.jsx("td",{children:t.jsx(r.UnstyledButton,x({onClick:function(){return e.onClick&&e.onClick(n)}},{children:n.name}))}),t.jsx("td",{children:n.description}),t.jsxs("td",{children:[Math.round(100*(n.percentageCompletion+Number.EPSILON)),"%"]})]},n.lessonId)}));return t.jsx(r.ScrollArea.Autosize,x({maxHeight:500},{children:t.jsxs(r.Table,x({verticalSpacing:"sm",sx:{minWidth:700},highlightOnHover:!0,striped:!0},{children:[t.jsx("thead",{children:t.jsxs("tr",{children:[t.jsx("th",{children:"Lesson Name"}),t.jsx("th",{children:"Description"}),t.jsx("th",{children:"Completion"})]})}),t.jsx("tbody",{children:n})]}))}))}function L(e){if(0===e.items.length)return t.jsx(v,{title:"No students to display",description:"You have not rostered any students yet.",loading:e.loading,icon:"groups"});var n=e.items.map((function(n){return t.jsxs("tr",{children:[t.jsx("td",{children:t.jsx(r.UnstyledButton,x({onClick:function(){return e.onViewProfile&&e.onViewProfile(n)}},{children:t.jsxs(r.Group,x({spacing:"sm"},{children:[t.jsx(r.Avatar,{size:40,src:n.avatar,radius:40}),t.jsxs("div",{children:[t.jsx(r.Text,x({size:"sm",weight:500},{children:n.givenName&&n.familyName?"".concat(n.givenName," ").concat(n.familyName):n.email})),t.jsx(r.Text,x({size:"xs",color:"dimmed"},{children:n.email}))]})]}))}))}),t.jsx("td",{children:n.badgesEarned}),t.jsx("td",{children:n.lessonsCompleted}),t.jsx("td",{children:n.hasAccount&&t.jsx(i.IconCheck,{color:"green"})}),t.jsx("td",{children:n.lastActivity?w(n.lastActivity):""}),t.jsx("td",{children:t.jsx(r.Group,x({noWrap:!0,spacing:0,position:"right"},{children:!n.readonly&&!!e.onDelete&&t.jsx(r.ActionIcon,x({color:"red"},{children:t.jsx(i.IconTrash,{onClick:function(){return i=n,c.openConfirmModal({title:'Delete "'.concat(i.givenName&&i.familyName?"".concat(i.givenName," ").concat(i.familyName):i.email,'"?'),centered:!0,children:t.jsx(r.Text,x({size:"sm"},{children:"Are you sure you want to delete this person? This action is destructive and you will have to contact support to restore your data."})),labels:{confirm:"Delete",cancel:"No don't delete them"},confirmProps:{color:"red"},onConfirm:function(){return e.onDelete&&e.onDelete(i)}});var i},size:16,stroke:1.5})}))}))})]},n.email)}));return t.jsx(r.ScrollArea,{children:t.jsxs(r.Table,x({verticalSpacing:20,sx:{minWidth:700},highlightOnHover:!0,striped:!0},{children:[t.jsx("thead",{children:t.jsxs("tr",{children:[t.jsx("th",{children:"Student Name"}),t.jsx("th",{children:"Badges Earned"}),t.jsx("th",{children:"Lessons Completed"}),t.jsx("th",{children:"Account Created?"}),t.jsx("th",{children:"Last Active"}),t.jsx("th",{})]})}),t.jsx("tbody",{children:n})]}))})}var P=r.createStyles((function(e){var n;return{title:(n={fontSize:34,fontWeight:900},n[e.fn.smallerThan("sm")]={fontSize:24},n),description:{maxWidth:600},wrapper:{position:"relative",marginBottom:30},dropzone:{borderWidth:1,paddingBottom:50},icon:{color:"dark"===e.colorScheme?e.colors.dark[3]:e.colors.gray[4]},control:{position:"absolute",width:250,left:"calc(50% - 125px)",bottom:-20}}})),D=function(e){var n=P(),s=n.classes,l=n.theme,a=u.useRef(null),c=u.useState(!1),d=c[0],h=c[1],g=u.useCallback((function(n){h(!0),n.forEach((function(n){m.parse(n,{download:!0,header:!0,dynamicTyping:!0,skipEmptyLines:!0,worker:!0,complete:function(n){var t=n.data.filter((function(n){return/^\S+@\S+$/.test(n.email)&&0===e.students.filter((function(e){return e.email===n.email})).length}));t.length>0&&e.onCreateStudents&&e.onCreateStudents(t),h(!1),e.close()}})}))}),[]);return t.jsxs("div",x({className:s.wrapper},{children:[t.jsx(o.Dropzone,x({loading:d,openRef:a,onDrop:g,className:s.dropzone,radius:"md",accept:[o.MIME_TYPES.csv],maxSize:5*Math.pow(1024,2)},{children:t.jsxs("div",x({style:{pointerEvents:"none"}},{children:[t.jsxs(r.Group,x({position:"center"},{children:[t.jsx(o.Dropzone.Accept,{children:t.jsx(i.IconDownload,{size:50,color:l.colors[l.primaryColor][6],stroke:1.5})}),t.jsx(o.Dropzone.Reject,{children:t.jsx(i.IconX,{size:50,color:l.colors.red[6],stroke:1.5})}),t.jsx(o.Dropzone.Idle,{children:t.jsx(i.IconCloudUpload,{size:50,color:"dark"===l.colorScheme?l.colors.dark[0]:l.black,stroke:1.5})})]})),t.jsxs(r.Text,x({align:"center",weight:700,size:"lg",mt:"xl"},{children:[t.jsx(o.Dropzone.Accept,{children:"Drop files here"}),t.jsx(o.Dropzone.Reject,{children:"Csv file less than 5mb"}),t.jsx(o.Dropzone.Idle,{children:"Upload multiple"})]})),t.jsxs(r.Text,x({align:"center",size:"sm",mt:"xs",color:"dimmed"},{children:["Drag'n'drop files here to upload. We can accept only ",t.jsx("i",{children:".csv"})," files that are less than 5mb in size."]}))]}))})),t.jsx(r.Button,x({className:s.control,size:"md",radius:"xl",onClick:function(){var e;return null===(e=a.current)||void 0===e?void 0:e.call(a)}},{children:"Select file"}))]}))};function W(e){if(0===e.items.length)return t.jsx(v,{title:"No classes to display",description:"You don't have any classes yet. Try creating one first...",loading:e.loading,icon:"groups"});var n=e.items.map((function(n){return t.jsxs("tr",{children:[t.jsx("td",{children:t.jsx(r.UnstyledButton,x({onClick:function(){return e.onClick(n)}},{children:t.jsx(r.Text,x({size:14},{children:n.name}))}))}),t.jsx("td",{children:t.jsx(r.Text,x({size:14},{children:n.description}))}),t.jsx("td",{children:t.jsx(r.Group,x({noWrap:!0,spacing:0,position:"right"},{children:t.jsx(r.ActionIcon,x({color:"red"},{children:t.jsx(i.IconTrash,{onClick:function(){return i=n,c.openConfirmModal({title:'Delete "'.concat(i.name,'"?'),centered:!0,children:t.jsx(r.Text,x({size:"sm"},{children:"Are you sure you want to delete this class? This action is destructive and you will have to contact support to restore your data."})),labels:{confirm:"Delete class",cancel:"No don't delete it"},confirmProps:{color:"red"},onConfirm:function(){return e.onDeleteClass(i)}});var i},size:16,stroke:1.5})}))}))})]},n.classId)}));return t.jsx(r.ScrollArea.Autosize,x({maxHeight:300},{children:t.jsxs(r.Table,x({verticalSpacing:20,sx:{minWidth:700},highlightOnHover:!0,striped:!0},{children:[t.jsx("thead",{children:t.jsxs("tr",{children:[t.jsx("th",{children:"Class Name"}),t.jsx("th",{children:"Description"}),t.jsx("th",{})]})}),t.jsx("tbody",{children:n})]}))}))}var G=r.createStyles((function(e){var n;return{title:(n={fontSize:34,fontWeight:900},n[e.fn.smallerThan("sm")]={fontSize:24},n),description:{maxWidth:600}}})),E=r.createStyles((function(e){var n;return{title:(n={fontSize:34,fontWeight:900,marginTop:16},n[e.fn.smallerThan("sm")]={fontSize:24},n),description:{maxWidth:600}}})),M=function(e){var n=E().classes;return t.jsxs(t.Fragment,{children:[t.jsx(r.Title,x({className:n.title},{children:e.name})),t.jsx(r.Text,x({color:"dimmed",className:n.description,mt:"xs"},{children:e.impactStatement}))]})};function H(e){if(0===e.items.length)return t.jsx(v,{title:"No badges to display",description:"There has not been any badge progress just yet.",loading:e.loading,icon:"badges"});var n=e.items.map((function(n){return t.jsxs("tr",{children:[t.jsx("td",{children:t.jsx(r.UnstyledButton,x({onClick:function(){return e.onClick(n)}},{children:n.badgeName}))}),t.jsxs("td",{children:[!!n.isComplete&&t.jsx(r.Badge,x({variant:"filled"},{children:"Complete"})),!n.isComplete&&t.jsx(r.Badge,x({color:"red",variant:"filled"},{children:"Incomplete"}))]})]},n.badgeName)}));return t.jsx(r.ScrollArea.Autosize,x({maxHeight:500},{children:t.jsxs(r.Table,x({verticalSpacing:"sm",sx:{minWidth:700},highlightOnHover:!0,striped:!0},{children:[t.jsx("thead",{children:t.jsxs("tr",{children:[t.jsx("th",{children:"Badge Name"}),t.jsx("th",{children:"Status"})]})}),t.jsx("tbody",{children:n})]}))}))}function R(e){if(0===e.items.length)return t.jsx(v,{title:"No answers to display",description:"There has not been any lesson progress just yet.",loading:e.loading,icon:"lessons"});var n=e.items.map((function(n){return t.jsxs("tr",{children:[t.jsx("td",{children:t.jsx(r.UnstyledButton,x({onClick:function(){return e.onClick(n)}},{children:n.lessonName}))}),t.jsx("td",{children:n.questionName}),t.jsx("td",{children:n.answer.join(",")})]},n.questionName)}));return t.jsx(r.ScrollArea.Autosize,x({maxHeight:500},{children:t.jsxs(r.Table,x({verticalSpacing:"sm",sx:{minWidth:700},highlightOnHover:!0,striped:!0},{children:[t.jsx("thead",{children:t.jsxs("tr",{children:[t.jsx("th",{children:"Lesson Name"}),t.jsx("th",{children:"Question"}),t.jsx("th",{children:"Answer"})]})}),t.jsx("tbody",{children:n})]}))}))}function F(e){if(0===e.items.length)return t.jsx(v,{title:"No reflections to display",description:"There has not been any lesson progress just yet.",loading:e.loading,icon:"lessons"});var n=e.items.map((function(n){return t.jsxs("tr",{children:[t.jsx("td",{children:t.jsx(r.UnstyledButton,x({onClick:function(){return e.onClick(n)}},{children:n.lessonName}))}),t.jsx("td",{children:n.reflection}),t.jsx("td",{children:n.rating.toLocaleString()})]},n.lessonName)}));return t.jsx(r.ScrollArea.Autosize,x({maxHeight:500},{children:t.jsxs(r.Table,x({verticalSpacing:"sm",sx:{minWidth:700},highlightOnHover:!0,striped:!0},{children:[t.jsx("thead",{children:t.jsxs("tr",{children:[t.jsx("th",{children:"Lesson Name"}),t.jsx("th",{children:"Reflection"}),t.jsx("th",{children:"Rating"})]})}),t.jsx("tbody",{children:n})]}))}))}var q=r.createStyles((function(e,n){var t=n.from||"blue",i=n.to||"green";return{card:{position:"relative",cursor:"pointer",overflow:"hidden",transition:"transform 150ms ease, box-shadow 100ms ease",padding:e.spacing.xl,paddingLeft:2*e.spacing.xl,"&:hover":{boxShadow:e.shadows.md,transform:"scale(1.02)"},"&::before":{content:'""',position:"absolute",top:0,bottom:0,left:0,width:6,backgroundImage:e.fn.linearGradient(0,e.colors[t][6],e.colors[i][6])}}}}));function U(e){var n=q(e).classes,s=e.from||"blue",o=e.to||"green",l=e.icon||t.jsx(i.IconColorSwatch,{size:28,stroke:1.5});return t.jsxs(r.Paper,x({withBorder:!0,radius:"md",className:n.card,onClick:e.onClick},{children:[t.jsx(r.ThemeIcon,x({size:"xl",radius:"md",variant:"gradient",gradient:{deg:0,from:s,to:o}},{children:l})),t.jsx(r.Text,x({size:"xl",weight:500,mt:"md"},{children:e.title})),t.jsx(r.Text,x({size:"sm",mt:"sm",color:"dimmed"},{children:e.description}))]}))}var V=r.createStyles((function(e){return{card:{height:240,backgroundSize:"cover",backgroundPosition:"center"},content:{position:"absolute",padding:e.spacing.xl,zIndex:1,top:0,bottom:0,right:0,left:0},action:{position:"absolute",bottom:e.spacing.xl,right:e.spacing.xl},title:{color:e.white,marginBottom:e.spacing.xs/2},description:{color:e.white,maxWidth:220}}})),_=function(e){var n=e.title,i=e.description,s=e.image,o=e.action,l=e.style,a=e.className,c=function(e,n){var t={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&n.indexOf(i)<0&&(t[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(i=Object.getOwnPropertySymbols(e);s<i.length;s++)n.indexOf(i[s])<0&&Object.prototype.propertyIsEnumerable.call(e,i[s])&&(t[i[s]]=e[i[s]])}return t}(e,["title","description","image","action","style","className"]),d=V(),h=d.classes,u=d.cx,m=d.theme;return t.jsxs(r.Card,x({radius:"md",style:x({backgroundImage:"url(".concat(s,")")},l),className:u(h.card,a)},c,{children:[t.jsx(r.Overlay,{gradient:"linear-gradient(105deg, ".concat(m.black," 20%, #312f2f 50%, ").concat(m.colors.gray[4]," 100%)"),opacity:.55,zIndex:0}),t.jsxs("div",x({className:h.content},{children:[t.jsx(r.Text,x({size:"lg",weight:700,className:h.title},{children:n})),t.jsx(r.Text,x({size:"sm",className:h.description},{children:i})),t.jsx(r.Button,x({className:h.action,variant:"white",color:"dark",component:"a",size:"xs",href:o.link,target:"_blank"},{children:o.label}))]}))]}))};function Y(e){if(0===e.items.length)return t.jsx(v,{title:"No reflections to display",description:"There has not been any lesson progress just yet.",loading:e.loading,icon:"lessons"});var n=e.items.map((function(e){return t.jsxs("tr",{children:[t.jsx("td",{children:e.studentName}),t.jsx("td",{children:e.reflection}),t.jsx("td",{children:e.rating.toLocaleString()})]},e.studentName)}));return t.jsx(r.ScrollArea.Autosize,x({maxHeight:500},{children:t.jsxs(r.Table,x({verticalSpacing:"sm",sx:{minWidth:700},highlightOnHover:!0,striped:!0},{children:[t.jsx("thead",{children:t.jsxs("tr",{children:[t.jsx("th",{children:"Student Name"}),t.jsx("th",{children:"Reflection"}),t.jsx("th",{children:"Rating"})]})}),t.jsx("tbody",{children:n})]}))}))}function J(e){if(0===e.items.length)return t.jsx(v,{title:"No students to display",description:"You don't have any student data yet for this lesson",loading:e.loading,icon:"lessons"});var n=e.items.map((function(n){return t.jsxs("tr",{children:[t.jsx("td",{children:t.jsx(r.UnstyledButton,x({onClick:function(){return e.onClick&&e.onClick(n)}},{children:t.jsxs(r.Group,x({spacing:"sm"},{children:[t.jsx(r.Avatar,{size:40,src:n.avatar,radius:40}),t.jsxs("div",{children:[t.jsx(r.Text,x({size:"sm",weight:500},{children:n.name})),t.jsx(r.Text,x({size:"xs",color:"dimmed"},{children:n.email}))]})]}))}))}),t.jsxs("td",{children:[!!n.isComplete&&t.jsx(r.Badge,x({variant:"filled"},{children:"Complete"})),!n.isComplete&&!n.isStarted&&t.jsx(r.Badge,x({color:"red",variant:"filled"},{children:"Not started"})),!n.isComplete&&!!n.isStarted&&t.jsx(r.Badge,x({color:"violet",variant:"filled"},{children:"In progress"}))]})]},n.name)}));return t.jsx(r.ScrollArea.Autosize,x({maxHeight:500},{children:t.jsxs(r.Table,x({verticalSpacing:"sm",sx:{minWidth:700},highlightOnHover:!0,striped:!0},{children:[t.jsx("thead",{children:t.jsxs("tr",{children:[t.jsx("th",{children:"Lesson Name"}),t.jsx("th",{children:"Status"})]})}),t.jsx("tbody",{children:n})]}))}))}function X(e){var n=u.useMemo((function(){return{position:"left",getValue:function(e){return e.primary}}}),[]),i=u.useMemo((function(){return[{position:"bottom",getValue:function(e){return e.secondary}}]}),[]);if(0===e.items.length)return t.jsx(v,{title:"No questions to display",description:"There are no questions in this lesson.",loading:e.loading,icon:"lessons"});var s=e.items.map((function(e){if(e.chart){var s={},o=e.choices||[];return o.forEach((function(e){s[e]=0})),e.answers.forEach((function(e){return e.forEach((function(e){e in s&&(s[e]=s[e]?s[e]+1:1)}))})),t.jsx(r.Card,x({withBorder:!0,p:"xl",radius:"md"},{children:t.jsxs(r.Stack,x({spacing:4},{children:[t.jsx(r.Title,x({size:"lg"},{children:e.question})),t.jsxs(r.Text,x({size:"sm"},{children:[e.answers.length," answers"]})),t.jsx("div",x({style:{background:"white",height:"300px",width:"100%",position:"relative"}},{children:t.jsx(d.Chart,{options:{data:[{label:"",data:o.map((function(e){return{primary:$(e,50),secondary:s[e]}}))}],primaryAxis:n,secondaryAxes:i}})}))]}))}),e.question)}return t.jsx(r.Card,x({withBorder:!0,p:"xl",radius:"md"},{children:t.jsxs(r.Stack,x({spacing:4},{children:[t.jsx(r.Title,x({size:"lg"},{children:e.question})),t.jsxs(r.Text,x({size:"sm"},{children:[e.answers.length," answers"]})),t.jsx(r.ScrollArea.Autosize,x({maxHeight:500},{children:t.jsx(r.Stack,x({spacing:4},{children:e.answers.map((function(e){var n=e.join("\n");return t.jsx(r.Card,x({p:5,radius:0,bg:"gray.0"},{children:t.jsx(r.Text,{children:n})}),n)}))}))}))]}))}),e.question)}));return t.jsx(r.Stack,x({py:4,spacing:10,sx:{minWidth:700}},{children:s}))}var $=function(e,n){return e.substr(0,n-1)+(e.length>n?"&hellip;":"")},Q=r.createStyles((function(e){var n;return{title:(n={fontSize:34,fontWeight:900},n[e.fn.smallerThan("sm")]={fontSize:24},n),description:{maxWidth:600}}}));function K(e){if(0===e.items.length)return t.jsx(v,{title:"No lessons to display",description:"We don't have any lessons to show you just yet.",loading:e.loading,icon:"lessons"});var n=e.items.map((function(n){return t.jsx("tr",{children:t.jsx("td",{children:t.jsx(r.UnstyledButton,x({sx:function(e){return{display:"block",width:"100%",padding:e.spacing.md,color:"dark"===e.colorScheme?e.colors.dark[0]:e.black,"&:hover":{backgroundColor:"dark"===e.colorScheme?e.colors.dark[8]:e.colors.gray[1]}}},onClick:function(){return e.onClick&&e.onClick(n)}},{children:t.jsx(r.Group,{children:t.jsxs("div",{children:[t.jsx(r.Text,x({size:"sm",weight:500},{children:n.name})),t.jsx(r.Text,x({size:"xs",color:"dimmed"},{children:n.description}))]})})}))})},n.lessonId)}));return t.jsx(r.ScrollArea.Autosize,x({maxHeight:500},{children:t.jsx(r.Table,x({horizontalSpacing:0,verticalSpacing:0,sx:{minWidth:700}},{children:t.jsx("tbody",{children:n})}))}))}var Z=r.createStyles((function(e){var n;return{title:(n={fontSize:34,fontWeight:900},n[e.fn.smallerThan("sm")]={fontSize:24},n),description:{maxWidth:600}}})),ee=r.createEmotionCache({key:"mantine",prepend:!1}),ne=function(e){var n=l.useForm({initialValues:{active:e.account}});return t.jsx(r.Modal,x({centered:!0,opened:e.opened,onClose:function(){return e.onClose&&e.onClose()},size:"sm",title:t.jsx(r.Title,x({size:"h5"},{children:"Accounts"}))},{children:t.jsxs("form",x({onSubmit:n.onSubmit((function(){e.onChange&&e.onChange(n.values.active)}))},{children:[t.jsx(r.Select,x({required:!0,placeholder:"Select an account",defaultValue:e.account,data:e.accounts.map((function(e){return{value:e.accountId,label:e.name}}))},n.getInputProps("active"))),t.jsx(r.Button,x({type:"submit",fullWidth:!0,mt:"xl"},{children:"Switch"}))]}))}))},te=r.createStyles((function(e){return{link:{width:50,height:50,borderRadius:e.radius.md,display:"flex",alignItems:"center",justifyContent:"center",color:"dark"===e.colorScheme?e.colors.dark[0]:e.colors.gray[7],"&:hover":{backgroundColor:"dark"===e.colorScheme?e.colors.dark[5]:e.colors.gray[0]}},active:{"&, &:hover":{backgroundColor:e.fn.variant({variant:"light",color:e.primaryColor}).background,color:e.fn.variant({variant:"light",color:e.primaryColor}).color}}}})),ie=[{icon:i.IconHome2,label:"Home",href:"/home"},{icon:i.IconGauge,label:"Dashboard",href:"/dashboard"},{icon:i.IconCategory2,label:"Classes",href:"/classes"},{icon:i.IconAlbum,label:"Badges",href:"/badges"},{icon:i.IconLambda,label:"Lessons",href:"/lessons"}],se=function(e){var n,i=e.icon,s=e.label,o=e.active,l=e.onClick,a=te(),c=a.classes,d=a.cx;return t.jsx(r.Tooltip,x({label:s,position:"right",transitionDuration:0},{children:t.jsx(r.UnstyledButton,x({onClick:l,className:d(c.link,(n={},n[c.active]=o,n))},{children:t.jsx(i,{stroke:1.5})}))}))},re=function(e){var n=ie.map((function(n){return t.jsx(se,{label:n.label,icon:n.icon,active:n.label===e.active,onClick:function(){return e.navigate(n.href)}},n.label)}));return t.jsxs(r.Navbar,x({width:{base:80},p:"md"},{children:[t.jsx(r.Center,{children:t.jsx(r.Avatar,x({color:"blue",radius:"sm"},{children:t.jsx("div",x({style:{width:15,marginLeft:"auto",marginRight:"auto"}},{children:t.jsx(r.Image,{fit:"contain",src:"https://cdn.localcivics.io/brand/l.png"})}))}))}),t.jsx(r.Navbar.Section,x({grow:!0,mt:50},{children:t.jsx(r.Stack,x({justify:"center",spacing:0},{children:n}))})),t.jsx(r.Navbar.Section,{children:t.jsxs(r.Stack,x({justify:"center",spacing:0},{children:[t.jsx(se,{icon:i.IconSwitchHorizontal,label:"Switch accounts",onClick:e.onSwitchAccounts}),t.jsx(se,{icon:i.IconLogout,label:"Logout",onClick:e.onLogout})]}))})]}))},oe=r.createStyles((function(e){var n,t,i,s,r,o;return{footer:{paddingTop:2*e.spacing.xl,paddingBottom:2*e.spacing.xl,paddingLeft:3*e.spacing.xl,backgroundColor:"dark"===e.colorScheme?e.colors.dark[6]:e.colors.gray[0],borderTop:"1px solid ".concat("dark"===e.colorScheme?e.colors.dark[5]:e.colors.gray[2])},logo:(n={maxWidth:200},n[e.fn.smallerThan("sm")]={display:"flex",flexDirection:"column",alignItems:"center"},n),description:(t={marginTop:5},t[e.fn.smallerThan("sm")]={marginTop:e.spacing.xs,textAlign:"center"},t),inner:(i={display:"flex",justifyContent:"space-between"},i[e.fn.smallerThan("sm")]={flexDirection:"column",alignItems:"center"},i),groups:(s={display:"flex",flexWrap:"wrap"},s[e.fn.smallerThan("sm")]={display:"none"},s),wrapper:{width:160},link:{display:"block",color:"dark"===e.colorScheme?e.colors.dark[1]:e.colors.gray[6],fontSize:e.fontSizes.sm,paddingTop:3,paddingBottom:3,"&:hover":{textDecoration:"underline"}},title:{fontSize:e.fontSizes.md,fontWeight:700,fontFamily:"Greycliff CF, ".concat(e.fontFamily),marginBottom:e.spacing.xs/2,color:"dark"===e.colorScheme?e.white:e.black},afterFooter:(r={display:"flex",justifyContent:"space-between",alignItems:"center",marginTop:e.spacing.xl,paddingTop:e.spacing.xl,paddingBottom:e.spacing.xl,borderTop:"1px solid ".concat("dark"===e.colorScheme?e.colors.dark[4]:e.colors.gray[2])},r[e.fn.smallerThan("sm")]={flexDirection:"column"},r),social:(o={},o[e.fn.smallerThan("sm")]={marginTop:e.spacing.xs},o)}})),le=function(e,n,t){var i=JSON.stringify(n),r=s.useState(!1),o=r[0],l=r[1],a=s.useState(e),c=a[0],d=a[1];return u.useEffect((function(){d(e)}),[e,i]),{opened:o,account:c,accounts:n,setChangeModalOpen:l,onAccountChange:function(e){d(e),l(!1),t(e)}}};Object.defineProperty(e,"showNotification",{enumerable:!0,get:function(){return n.showNotification}}),Object.defineProperty(e,"updateNotification",{enumerable:!0,get:function(){return n.updateNotification}}),e.AdminProvider=function(e){return t.jsx(r.MantineProvider,x({withNormalizeCSS:!0,withGlobalStyles:!0,emotionCache:ee,theme:{loader:"bars"}},{children:t.jsx(n.NotificationsProvider,x({limit:e.notificationLimit||5},{children:t.jsx(c.ModalsProvider,{children:e.children})}))}))},e.App=function(e){var n=oe().classes,s=le(e.account,e.accounts,e.onAccountChange);return t.jsxs(r.AppShell,x({padding:"xs",navbar:t.jsx(re,{active:e.navbar.props.active,navigate:e.navbar.props.navigate,onLogout:e.navbar.props.onLogout,onSwitchAccounts:function(){return s.setChangeModalOpen(!0)}}),footer:t.jsx(t.Fragment,{children:!s.opened&&t.jsxs("footer",x({className:n.footer},{children:[t.jsxs(r.Container,x({className:n.inner},{children:[t.jsxs("div",x({className:n.logo},{children:[t.jsxs(r.Group,x({spacing:"xs"},{children:[t.jsx("div",x({style:{width:15}},{children:t.jsx(r.Image,{fit:"contain",src:"https://cdn.localcivics.io/brand/l.png"})})),t.jsx(r.Title,x({color:"dimmed",size:"h5"},{children:"Local Civics"}))]})),t.jsx(r.Text,x({size:"xs",color:"dimmed",className:n.description},{children:"We connect students to powerful civic learning experiences."}))]})),t.jsx("div",x({className:n.groups},{children:t.jsxs("div",x({className:n.wrapper},{children:[t.jsx(r.Text,x({className:n.link,component:"a",href:"https://www.localcivics.io",target:"_blank"},{children:"About"})),t.jsx(r.Text,x({className:n.link,component:"a",href:"https://www.localcivics.io/terms-of-service",target:"_blank"},{children:"Terms"})),t.jsx(r.Text,x({className:n.link,component:"a",href:"https://www.localcivics.io/privacy-policy",target:"_blank"},{children:"Privacy"})),t.jsx(r.Text,x({className:n.link,component:"a",href:"https://localcivics.notion.site/Help-Center-b52300f587b64fc0a61f512686e7626d",target:"_blank"},{children:"Help Center"}))]}))}))]})),t.jsxs(r.Container,x({className:n.afterFooter},{children:[t.jsxs(r.Text,x({color:"dimmed",size:"sm"},{children:["© ",(new Date).getFullYear()," Local Civics. All rights reserved."]})),t.jsxs(r.Group,x({spacing:0,className:n.social,position:"right",noWrap:!0},{children:[t.jsx(r.ActionIcon,x({component:"a",target:"_blank",href:"https://www.instagram.com/localcivics/",size:"lg"},{children:t.jsx(i.IconBrandInstagram,{size:18,stroke:1.5})})),t.jsx(r.ActionIcon,x({component:"a",target:"_blank",href:"https://www.linkedin.com/company/localcivics",size:"lg"},{children:t.jsx(i.IconBrandLinkedin,{size:18,stroke:1.5})})),t.jsx(r.ActionIcon,x({component:"a",target:"_blank",href:"https://www.facebook.com/localcivics/",size:"lg"},{children:t.jsx(i.IconBrandFacebook,{size:18,stroke:1.5})}))]}))]}))]}))}),styles:function(e){return{main:{backgroundColor:"dark"===e.colorScheme?e.colors.dark[8]:e.colors.gray[0]}}}},{children:[t.jsxs("div",x({style:{position:"relative"}},{children:[(e.loading||s.opened)&&t.jsx(r.Center,x({style:{height:400}},{children:t.jsx(r.Loader,{})})),!e.loading&&!s.opened&&e.page]})),t.jsx(ne,{opened:s.opened,account:s.account,accounts:s.accounts,onChange:s.onAccountChange,onClose:function(){return s.setChangeModalOpen(!1)}})]}))},e.Badge=function(e){var n=C().classes,o=s.useState("lessons"),l=o[0],a=o[1],c=e.students.length,d=c>0?e.students.filter((function(e){return e.isComplete})).length/c:0;return t.jsx(r.Container,x({size:"lg",py:"xl"},{children:t.jsxs(r.Stack,x({spacing:"md"},{children:[t.jsx(r.Grid,{children:t.jsxs(r.Grid.Col,x({sm:"auto"},{children:[t.jsx(r.Badge,x({variant:"filled",leftSection:t.jsx(r.ActionIcon,x({onClick:e.onBackClick,color:"blue",size:"xs",radius:"xl",variant:"filled"},{children:t.jsx(i.IconArrowLeft,{size:14})})),size:"lg"},{children:"Badges"})),t.jsxs(r.Group,{children:[t.jsxs(r.Stack,x({spacing:0},{children:[t.jsx(r.Title,x({order:2,className:n.title,mt:"md"},{children:e.displayName||"Badge"})),t.jsx(r.Text,x({color:"dimmed",className:n.description,mt:"sm"},{children:e.description||"No description"}))]})),t.jsx(r.Stack,x({ml:"auto"},{children:t.jsx(r.Button,x({variant:"gradient",onClick:e.onPreviewClick},{children:"Preview"}))}))]})]}))}),t.jsx("div",{children:t.jsxs("div",x({style:{position:"relative"}},{children:[t.jsx(r.LoadingOverlay,{visible:e.loading,overlayBlur:2}),t.jsxs(r.Stack,{children:[t.jsx(p,{data:[{title:"BADGE COMPLETION",value:d,unit:"%"}]}),t.jsx(r.Select,{clearable:!0,clearButtonLabel:"Clear class selection",size:"sm",placeholder:"Select a class",nothingFound:"No options",value:e.classId,onChange:e.onClassChange,icon:t.jsx(i.IconCategory2,{}),data:e.classes.map((function(e){return{value:e.classId,label:e.name}}))}),t.jsxs(r.Stack,x({spacing:0},{children:[t.jsx(j,{value:l,data:[{label:"By lesson",value:"lessons"},{label:"By student",value:"students"}],onChange:a}),"lessons"===l&&t.jsx(y,{loading:e.loading,items:e.lessons,onClick:e.onLessonClick}),"students"===l&&t.jsx(b,{loading:e.loading,items:e.students,onClick:e.onUserClick})]}))]})]}))})]}))}))},e.Badges=function(e){var n=k().classes;return t.jsx(r.Container,x({size:"lg",py:"xl"},{children:t.jsxs(r.Stack,x({spacing:"md"},{children:[t.jsx(r.Grid,{children:t.jsxs(r.Grid.Col,x({sm:"auto"},{children:[t.jsx(r.Badge,x({variant:"filled",size:"lg"},{children:"Badges"})),t.jsx(r.Title,x({order:2,className:n.title,mt:"md"},{children:"Badges and micro-credentials"})),t.jsx(r.Text,x({color:"dimmed",className:n.description,mt:"sm"},{children:"Project-sized skills acquisition and standards alignment."}))]}))}),t.jsx(r.Autocomplete,{placeholder:"Search for a badge that fits your needs",data:e.badges.map((function(e){return e.name})),onChange:e.onAutocompleteChange}),t.jsxs("div",x({style:{position:"relative"}},{children:[t.jsx(r.LoadingOverlay,{visible:e.loading,overlayBlur:2}),t.jsx(S,{loading:e.loading,items:e.badges,onClick:e.onBadgeClick})]}))]}))}))},e.Class=function(e){var n=P().classes,o=l.useForm({initialValues:{classId:"",studentId:"",email:"",givenName:"",familyName:"",avatar:"",role:"",readonly:!1,lastActivity:null,hasAccount:!1,lessonsCompleted:0,badgesEarned:0},validate:{email:function(n){return/^\S+@\S+$/.test(n)&&0===e.students.filter((function(e){return e.email===n})).length?null:"Invalid email"}}}),a=s.useState(!1),c=a[0],d=a[1];return t.jsxs(t.Fragment,{children:[t.jsx(r.Drawer,x({opened:c,onClose:function(){return d(!1)},title:t.jsx(r.Title,x({size:"h5"},{children:"Add students"})),padding:"xl",size:"xl"},{children:t.jsxs(r.Stack,x({spacing:"md"},{children:[t.jsx(D,x({},e,{close:function(){return d(!1)}})),t.jsx(r.Divider,{label:"or",labelPosition:"center",my:"md",variant:"dashed"}),t.jsx("form",x({onSubmit:o.onSubmit((function(){var n=o.values;o.reset(),d(!1),e.onCreateStudents&&e.onCreateStudents([n])}))},{children:t.jsxs(r.Stack,{children:[t.jsx(r.TextInput,x({withAsterisk:!0,label:"Email",placeholder:"Email"},o.getInputProps("email"))),t.jsxs(r.Group,x({grow:!0},{children:[t.jsx(r.TextInput,x({label:"Given name",placeholder:"Given name"},o.getInputProps("givenName"))),t.jsx(r.TextInput,x({label:"Family name",placeholder:"Family name"},o.getInputProps("familyName")))]})),t.jsx(r.Button,x({type:"submit",fullWidth:!0,mt:"md"},{children:"Submit"}))]})}))]}))})),t.jsx(r.Container,x({size:"lg",py:"xl"},{children:t.jsxs(r.Stack,x({spacing:"md"},{children:[t.jsxs(r.Grid,{children:[t.jsxs(r.Grid.Col,x({sm:"auto"},{children:[t.jsx(r.Badge,x({variant:"filled",leftSection:t.jsx(r.ActionIcon,x({onClick:e.onBackClick,color:"blue",size:"xs",radius:"xl",variant:"filled"},{children:t.jsx(i.IconArrowLeft,{size:14})})),size:"lg"},{children:"Classes"})),t.jsx(r.Title,x({order:2,className:n.title,mt:"md"},{children:e.displayName||"Class"})),t.jsx(r.Text,x({color:"dimmed",className:n.description,mt:"sm"},{children:e.description||"No description"}))]})),t.jsx(r.Grid.Col,x({sm:"content"},{children:!e.loading&&t.jsx(r.Button,x({onClick:function(){return d(!0)},leftIcon:t.jsx(i.IconPlaylistAdd,{size:14})},{children:"Add students"}))}))]}),t.jsxs("div",x({style:{position:"relative"}},{children:[t.jsx(r.LoadingOverlay,{visible:e.loading,overlayBlur:2}),t.jsxs(r.Stack,x({spacing:"sm"},{children:[t.jsx(p,{data:[{title:"# OF STUDENTS",value:e.students.length},{title:"ACCOUNT CREATION",value:e.percentageOfAccountsCreated,unit:"%"},{title:"BADGE COMPLETION",value:e.percentageOfBadgesEarned,unit:"%"},{title:"LESSON COMPLETION",value:e.percentageOfLessonsCompleted,unit:"%"}]}),t.jsx(L,{loading:e.loading,items:e.students,onDelete:e.onDeleteStudent,onViewProfile:function(n){return e.onStudentClick(n)}})]}))]}))]}))}))]})},e.Classes=function(e){var n=G().classes,o=l.useForm({initialValues:{classId:"",name:"",description:""},validate:{name:function(e){return e.length<=6?"Name should include at least 6 characters":null}}}),a=s.useState(!1),c=a[0],d=a[1];return t.jsxs(t.Fragment,{children:[t.jsx(r.Drawer,x({opened:c,onClose:function(){return d(!1)},title:t.jsxs(r.Group,x({spacing:0},{children:[t.jsx(r.Title,x({size:"h5"},{children:"Create a class"})),t.jsx(r.Tooltip,x({label:"Classes settings cannot be modified once created"},{children:t.jsx(r.ActionIcon,{children:t.jsx(i.IconInfoCircle,{color:"#3b82f6",size:14})})}))]})),padding:"xl",size:"xl"},{children:t.jsxs("form",x({onSubmit:o.onSubmit((function(){var n=o.values;o.reset(),d(!1),e.onCreateClass&&e.onCreateClass(n)}))},{children:[t.jsxs(r.Stack,{children:[t.jsx(r.TextInput,x({withAsterisk:!0,label:"Name",placeholder:"Class name"},o.getInputProps("name"))),t.jsx(r.TextInput,x({label:"Description",placeholder:"A class for my first period English students"},o.getInputProps("description")))]}),t.jsx(r.Button,x({type:"submit",fullWidth:!0,mt:"md"},{children:"Submit"}))]}))})),t.jsx(r.Container,x({size:"lg",py:"xl"},{children:t.jsxs(r.Stack,x({spacing:"md"},{children:[t.jsxs(r.Grid,{children:[t.jsxs(r.Grid.Col,x({sm:"auto"},{children:[t.jsx(r.Badge,x({variant:"filled",size:"lg"},{children:"Classes"})),t.jsx(r.Title,x({order:2,className:n.title,mt:"md"},{children:"Organize students into classes"})),t.jsx(r.Text,x({color:"dimmed",className:n.description,mt:"sm"},{children:"A class can be for a specific period of time, grade, team, or other cohorts."}))]})),t.jsx(r.Grid.Col,x({sm:"content"},{children:!e.loading&&t.jsx(r.Button,x({onClick:function(){return d(!0)},leftIcon:t.jsx(i.IconPlaylistAdd,{size:14})},{children:"Create class"}))}))]}),t.jsxs("div",x({style:{position:"relative"}},{children:[t.jsx(r.LoadingOverlay,{visible:e.loading,overlayBlur:2}),t.jsxs(r.Stack,x({spacing:"sm"},{children:[t.jsx(p,{data:[{title:"# OF CLASSES",value:e.classes.length}]}),t.jsx(W,{loading:e.loading,items:e.classes,onDeleteClass:e.onDeleteClass,onClick:e.onClassClick})]}))]}))]}))}))]})},e.Dashboard=function(e){var n=s.useState("students"),o=n[0],l=n[1];return t.jsx(r.Container,x({size:"lg",py:"xl"},{children:t.jsxs(r.Stack,{children:[t.jsxs(r.Stack,x({spacing:0},{children:[t.jsx(r.Title,x({size:"h3"},{children:"Dashboard"})),t.jsx(r.Text,x({color:"dimmed",size:"sm",mt:"md"},{children:"Fast-track learning for your students."}))]})),t.jsx(r.Stack,{children:t.jsxs("div",x({style:{position:"relative"}},{children:[t.jsx(r.LoadingOverlay,{visible:e.loading,overlayBlur:2}),t.jsxs(r.Stack,x({spacing:"sm"},{children:[t.jsx(p,{data:[{title:"# OF STUDENTS",value:e.students.length},{title:"ACCOUNT CREATION",value:e.percentageOfAccountsCreated,unit:"%"},{title:"BADGE COMPLETION",value:e.percentageOfBadgesEarned,unit:"%"},{title:"LESSON COMPLETION",value:e.percentageOfLessonsCompleted,unit:"%"}]}),t.jsx(r.Select,{clearable:!0,clearButtonLabel:"Clear class selection",size:"sm",placeholder:"Select a class",nothingFound:"No options",value:e.classId,onChange:e.onClassChange,icon:t.jsx(i.IconCategory2,{}),data:e.classes.map((function(e){return{value:e.classId,label:e.name}}))}),t.jsxs(r.Stack,x({spacing:0},{children:[t.jsx(j,{value:o,data:[{label:"My students",value:"students"},{label:"Impact statements",value:"impact"},{label:"Reflections",value:"reflections"},{label:"Badges",value:"badges"},{label:"Lessons",value:"lessons"}],onChange:l}),"impact"===o&&t.jsx(A,{loading:e.loading,items:e.impacts}),"reflections"===o&&t.jsx(I,{loading:e.loading,items:e.reflections}),"badges"===o&&t.jsx(B,{loading:e.loading,items:e.badges,onClick:e.onBadgeClick}),"lessons"===o&&t.jsx(O,{loading:e.loading,items:e.lessons,onClick:e.onLessonClick}),"students"===o&&t.jsx(N,{loading:e.loading,items:e.students,onViewProfile:e.onViewStudentProfile})]}))]}))]}))})]})}))},e.Home=function(e){return t.jsx(r.Container,x({size:"lg"},{children:t.jsxs(r.Stack,x({spacing:"lg"},{children:[t.jsxs(r.Grid,x({gutter:"md"},{children:[t.jsx(r.Grid.Col,x({md:6},{children:t.jsx(M,{variant:"compact",name:e.name,impactStatement:e.impactStatement})})),t.jsx(r.Grid.Col,x({md:6},{children:t.jsx(_,{title:e.organization.name,description:e.organization.description,image:e.organization.image,action:{label:"Visit website",link:e.organization.website}})}))]})),t.jsxs(r.Grid,x({gutter:"md"},{children:[t.jsx(r.Grid.Col,{children:t.jsx(U,{title:"Dashboard",description:"Track class performance across core areas of focus.",onClick:e.onDashboardClick})}),t.jsx(r.Grid.Col,{children:t.jsx(U,{title:"Classes",description:"Organize students into classes.",onClick:e.onClassesClick})}),t.jsx(r.Grid.Col,{children:t.jsx(U,{title:"Lessons",description:"Explore units of instruction and/or see corresponding class progress.",onClick:e.onLessonsClick})}),t.jsx(r.Grid.Col,{children:t.jsx(U,{title:"Badges",description:"Project-sized skills acquisition and standards alignment.",onClick:e.onBadgesClick})})]}))]}))}))},e.Lesson=function(e){var n=Q().classes,o=s.useState("question"),l=o[0],a=o[1],c=e.students.length,d=c>0?e.students.filter((function(e){return e.isComplete})).length/c:0;return t.jsx(r.Container,x({size:"lg",py:"xl"},{children:t.jsxs(r.Stack,x({spacing:"md"},{children:[t.jsx(r.Grid,{children:t.jsxs(r.Grid.Col,x({sm:"auto"},{children:[t.jsx(r.Badge,x({variant:"filled",leftSection:t.jsx(r.ActionIcon,x({onClick:e.onBackClick,color:"blue",size:"xs",radius:"xl",variant:"filled"},{children:t.jsx(i.IconArrowLeft,{size:14})})),size:"lg"},{children:"Lessons"})),t.jsxs(r.Group,{children:[t.jsxs(r.Stack,x({spacing:0},{children:[t.jsx(r.Title,x({order:2,className:n.title,mt:"md"},{children:e.displayName||"Lesson"})),t.jsx(r.Text,x({color:"dimmed",className:n.description,mt:"sm"},{children:e.description||"No description"}))]})),t.jsx(r.Stack,x({ml:"auto"},{children:t.jsx(r.Button,x({variant:"gradient",onClick:e.onPreviewClick},{children:"Preview"}))}))]})]}))}),t.jsx("div",{children:t.jsxs("div",x({style:{position:"relative"}},{children:[t.jsx(r.LoadingOverlay,{visible:e.loading,overlayBlur:2}),t.jsxs(r.Stack,{children:[t.jsx(p,{data:[{title:"LESSON COMPLETION",value:d,unit:"%"}]}),t.jsx(r.Select,{clearable:!0,clearButtonLabel:"Clear class selection",size:"sm",placeholder:"Select a class",nothingFound:"No options",value:e.classId,onChange:e.onClassChange,icon:t.jsx(i.IconCategory2,{}),data:e.classes.map((function(e){return{value:e.classId,label:e.name}}))}),t.jsxs(r.Stack,x({spacing:0},{children:[t.jsx(j,{value:l,data:[{label:"By question",value:"question"},{label:"By reflection",value:"reflections"},{label:"By student",value:"students"}],onChange:a}),"question"===l&&t.jsx(X,{loading:e.loading,items:e.questions}),"reflections"===l&&t.jsx(Y,{loading:e.loading,items:e.reflections}),"students"===l&&t.jsx(J,{loading:e.loading,items:e.students,onClick:e.onUserClick})]}))]})]}))})]}))}))},e.Lessons=function(e){var n=Z().classes;return t.jsx(r.Container,x({size:"lg",py:"xl"},{children:t.jsxs(r.Stack,x({spacing:"md"},{children:[t.jsx(r.Grid,{children:t.jsxs(r.Grid.Col,x({sm:"auto"},{children:[t.jsx(r.Badge,x({variant:"filled",size:"lg"},{children:"Lessons"})),t.jsx(r.Title,x({order:2,className:n.title,mt:"md"},{children:"Lessons"})),t.jsx(r.Text,x({color:"dimmed",className:n.description,mt:"sm"},{children:"Explore units of instruction and/or see corresponding class progress."}))]}))}),t.jsx(r.Autocomplete,{placeholder:"Search for a lesson that fits your needs",data:e.lessons.map((function(e){return e.name})),onChange:e.onAutocompleteChange}),t.jsxs("div",x({style:{position:"relative"}},{children:[t.jsx(r.LoadingOverlay,{visible:e.loading,overlayBlur:2}),t.jsx(K,{loading:e.loading,items:e.lessons,onClick:e.onLessonClick})]}))]}))}))},e.Navbar=re,e.Student=function(e){var n=s.useState("badges"),o=n[0],l=n[1],a=e.badges.length,c=a>0?e.badges.filter((function(e){return e.isComplete})).length/a:0;return t.jsx(r.Container,x({size:"lg",py:"xl"},{children:t.jsxs(r.Stack,x({spacing:"md"},{children:[t.jsx(r.Grid,x({gutter:"md"},{children:t.jsxs(r.Grid.Col,x({sm:"auto"},{children:[t.jsx(r.Badge,x({variant:"filled",leftSection:t.jsx(r.ActionIcon,x({onClick:e.onBackClick,color:"blue",size:"xs",radius:"xl",variant:"filled"},{children:t.jsx(i.IconArrowLeft,{size:14})})),size:"lg"},{children:"Students"})),t.jsx(M,{variant:"compact",name:e.name,impactStatement:e.impactStatement})]}))})),t.jsxs("div",x({style:{position:"relative"}},{children:[t.jsx(r.LoadingOverlay,{visible:e.loading,overlayBlur:2}),t.jsxs(r.Stack,x({spacing:"lg"},{children:[t.jsx(p,{data:[{title:"PROBLEMS SOLVED",value:e.numberOfProblemsSolved},{title:"LESSON COMPLETION",value:e.percentageOfLessonsCompleted,unit:"%"},{title:"BADGE COMPLETION",value:c,unit:"%"}]}),t.jsxs(r.Stack,x({spacing:0},{children:[t.jsx(j,{value:o,data:[{label:"My badges",value:"badges"},{label:"My answers",value:"answers"},{label:"My reflections",value:"reflections"}],onChange:l}),"badges"===o&&t.jsx(H,{loading:e.loading,items:e.badges,onClick:e.onBadgeClick}),"answers"===o&&t.jsx(R,{loading:e.loading,items:e.answers,onClick:e.onAnswerClick}),"reflections"===o&&t.jsx(F,{loading:e.loading,items:e.reflections,onClick:e.onReflectionClick})]}))]}))]}))]}))}))},e.SwitchAccount=ne,Object.defineProperty(e,"__esModule",{value:!0})}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@local-civics/mgmt-ui",
3
- "version": "0.1.46",
3
+ "version": "0.1.47",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.es.js",
6
6
  "scripts": {