@local-civics/mgmt-ui 0.1.10 → 0.1.12

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.
@@ -1,7 +1,8 @@
1
1
  /// <reference types="react" />
2
+ export type PlaceholderIcon = "badges" | "lessons" | "dashboard" | "groups" | "kindergarten" | "thinking";
2
3
  export interface PlaceholderBannerData {
3
4
  title: string;
4
- icon: "badges" | "lessons" | "dashboard" | "groups" | "kindergarten" | "thinking";
5
+ icon: PlaceholderIcon;
5
6
  description: string;
6
7
  }
7
8
  export interface PlaceholderBannerProps {
package/dist/index.es.js CHANGED
@@ -1 +1 @@
1
- import{jsx as e,jsxs as n,Fragment as a}from"react/jsx-runtime";import{createEmotionCache as i,MantineProvider as o,Tabs as t,createStyles as r,Title as l,Text as c,Image as d,UnstyledButton as s,Group as h,Avatar as u,ScrollArea as m,Table as g,Container as p,Stack as f,Grid as v,Badge as C,ActionIcon as b,Button as k,Divider as y,Select as S,LoadingOverlay as w,Autocomplete as x,Modal as z,Navbar as E,Center as N,Tooltip as D,Anchor as B,Timeline as L,Paper as O,Blockquote as T,Drawer as G,TextInput as A,Menu as P,Card as R,Overlay as M,ThemeIcon as W,SimpleGrid as F,AppShell as U,Loader as V}from"@mantine/core";import{ModalsProvider as I,openConfirmModal as j}from"@mantine/modals";import{NotificationsProvider as H}from"@mantine/notifications";export{showNotification,updateNotification}from"@mantine/notifications";import{IconArrowLeft as _,IconCategory2 as Y,IconSwitchHorizontal as q,IconLogout as K,IconHome2 as $,IconGauge as Q,IconAlbum as Z,IconLambda as J,IconBadges as X,IconSchool as ee,IconActivityHeartbeat as ne,IconTimelineEvent as ae,IconTrash as ie,IconPlaylistAdd as oe,IconDownload as te,IconX as re,IconCloudUpload as le,IconUsers as ce,IconDots as de,IconInfoCircle as se,IconArrowUpRight as he,IconArrowDownRight as ue,IconCalendar as me,IconBrandInstagram as ge,IconBrandLinkedin as pe,IconBrandFacebook as fe}from"@tabler/icons";import*as ve from"react";import{useState as Ce,createElement as be,useRef as ke}from"react";import{useForm as ye}from"@mantine/form";import{Dropzone as Se,MIME_TYPES as we}from"@mantine/dropzone";import*as xe from"papaparse";import{DateRangePicker as ze}from"@mantine/dates";import{ResponsiveContainer as Ee,AreaChart as Ne,XAxis as De,YAxis as Be,CartesianGrid as Le,Tooltip as Oe,Area as Te}from"recharts";var Ge=function(){return Ge=Object.assign||function(e){for(var n,a=1,i=arguments.length;a<i;a++)for(var o in n=arguments[a])Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o]);return e},Ge.apply(this,arguments)};function Ae(e,n,a){if(a||2===arguments.length)for(var i,o=0,t=n.length;o<t;o++)!i&&o in n||(i||(i=Array.prototype.slice.call(n,0,o)),i[o]=n[o]);return e.concat(i||Array.prototype.slice.call(n))}var Pe=i({key:"mantine",prepend:!1}),Re=function(n){return e(o,Ge({withNormalizeCSS:!0,withGlobalStyles:!0,emotionCache:Pe,theme:{loader:"bars"}},{children:e(H,Ge({limit:n.notificationLimit||5},{children:e(I,{children:n.children})}))}))},Me=function(n){var a,i=null===(a=n.data)||void 0===a?void 0:a.map((function(n){return e(t.Tab,Ge({value:n.value},{children:n.label||n.value}),n.value)}));return e(t,Ge({value:n.value,onTabChange:n.onChange},{children:e(t.List,{children:i})}))},We=r((function(e){var n,a,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:(a={maxWidth:"40%"},a["@media (max-width: ".concat(e.breakpoints.sm,"px)")]={maxWidth:"100%"},a),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}}})),Fe=function(a){var i=We().classes;return n("div",Ge({className:i.wrapper},{children:[n("div",Ge({className:i.body},{children:[e(l,Ge({className:i.title},{children:a.loading?"Loading...":a.data.title})),e(c,Ge({size:"sm",color:"dimmed"},{children:a.loading?"We're loading your data.":a.data.description}))]})),e(d,{src:"https://cdn.localcivics.io/illustrations/".concat(a.data.icon,".svg"),className:i.image})]}))};function Ue(a){if(0===a.data.length)return e(Fe,{loading:a.loading,data:{title:"No data for group",icon:"thinking",description:"You don't have any data for people in this group yet. Check back later or adjust your search."}});var i=a.data.map((function(i){return e("tr",{children:e("td",{children:e(s,Ge({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 a.onClick&&a.onClick(i)}},{children:n(h,{children:[e(u,{size:40,src:i.avatar,radius:40}),n("div",{children:[e(c,Ge({size:"sm",weight:500},{children:i.name})),e(c,Ge({size:"xs",color:"dimmed"},{children:i.email}))]})]})}))})},i.name)}));return e(m.Autosize,Ge({maxHeight:500},{children:e(g,Ge({horizontalSpacing:0,verticalSpacing:0,sx:{minWidth:700}},{children:e("tbody",{children:i})}))}))}var Ve=[{value:"Complete"},{value:"Incomplete"}],Ie=r((function(e){var n;return{title:(n={fontSize:34,fontWeight:900},n[e.fn.smallerThan("sm")]={fontSize:24},n),description:{maxWidth:600}}})),je=function(a){var i=He(a.data.groups,a.onGroupChange),o=_e(a.data.tab,a.onTabChange),t=Ie().classes;return e(p,Ge({size:"lg",py:"xl"},{children:n(f,Ge({spacing:"md"},{children:[e(v,{children:n(v.Col,Ge({sm:"auto"},{children:[e(C,Ge({variant:"filled",leftSection:e(b,Ge({onClick:a.onBackClick,color:"blue",size:"xs",radius:"xl",variant:"filled"},{children:e(_,{size:14})})),size:"lg"},{children:"Badges"})),n(h,{children:[n(f,Ge({spacing:0},{children:[e(l,Ge({order:2,className:t.title,mt:"md"},{children:a.data.name||"Badge"})),e(c,Ge({color:"dimmed",className:t.description,mt:"sm"},{children:a.data.description||"No description"}))]})),n(f,Ge({ml:"auto"},{children:[e(k,Ge({variant:"gradient",onClick:function(){return a.onPreview&&a.onPreview(a.data)}},{children:"Preview"})),e(y,{label:"or",labelPosition:"center",my:"xs",variant:"dashed"}),e(S,{size:"sm",placeholder:"Select a group",nothingFound:"No options",value:i.select,onChange:i.onSelectChange,icon:e(Y,{}),data:a.data.groups.map((function(e){return e.name}))})]}))]})]}))}),n("div",{children:[e(Me,{data:Ve,value:o.value,onChange:o.onChange}),n("div",Ge({style:{position:"relative"}},{children:[e(w,{visible:a.loading,overlayBlur:2}),e(Ue,{loading:a.loading,data:a.data.users,onClick:a.onUserClick})]}))]})]}))}))},He=function(e,n){var a=e.filter((function(e){return e.active})),i=ve.useState(a.length>0?a[0].name:null),o=i[0],t=i[1];return{select:o,onSelectChange:function(e){t(e),n&&n(e)}}},_e=function(e,n){var a=ve.useState(e),i=a[0],o=a[1];return{value:i,onChange:function(e){o(e),n&&n(e)}}};function Ye(a){if(0===a.data.length)return e(Fe,{loading:a.loading,data:{title:"No badges available",icon:"badges",description:"Adjust your search or contact a representative if your expecting results."}});var i=a.data.map((function(i){return e("tr",{children:e("td",{children:e(s,Ge({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 a.onClick&&a.onClick(i)}},{children:e(h,{children:n("div",{children:[e(c,Ge({size:"sm",weight:500},{children:i.name})),e(c,Ge({size:"xs",color:"dimmed"},{children:i.description}))]})})}))})},i.key)}));return e(m.Autosize,Ge({maxHeight:500},{children:e(g,Ge({horizontalSpacing:0,verticalSpacing:0,sx:{minWidth:700}},{children:e("tbody",{children:i})}))}))}var qe=r((function(e){var n;return{title:(n={fontSize:34,fontWeight:900},n[e.fn.smallerThan("sm")]={fontSize:24},n),description:{maxWidth:600}}})),Ke=function(a){var i=qe().classes,o=Ce(a.data.badgeOpen),t=o[0],r=o[1];return t?e(je,{loading:a.loading,data:a.data.badge,onBackClick:function(){return r(!1)},onGroupChange:a.onGroupChange,onTabChange:a.onTabChange,onUserClick:a.onUserClick,onPreview:a.onPreview}):e(p,Ge({size:"lg",py:"xl"},{children:n(f,Ge({spacing:"md"},{children:[e(v,{children:n(v.Col,Ge({sm:"auto"},{children:[e(C,Ge({variant:"filled",size:"lg"},{children:"Badges"})),e(l,Ge({order:2,className:i.title,mt:"md"},{children:"Badges and micro-credentials"})),e(c,Ge({color:"dimmed",className:i.description,mt:"sm"},{children:"Project-sized skills acquisition and standards alignment."}))]}))}),e(x,{placeholder:"Search for a badge that fits your needs",data:a.data.badges.map((function(e){return e.name})),onChange:a.onAutocompleteChange}),n("div",Ge({style:{position:"relative"}},{children:[e(w,{visible:a.loading,overlayBlur:2}),e(Ye,{loading:a.loading,data:a.data.badges,onClick:function(e){a.onBadgeClick&&a.onBadgeClick(e),r(!0)}})]}))]}))}))};function $e(a){if(0===a.data.length)return e(Fe,{loading:a.loading,data:{title:"No data for group",icon:"thinking",description:"You don't have any data for people in this group yet. Check back later or adjust your search."}});var i=a.data.map((function(i){return e("tr",{children:e("td",{children:e(s,Ge({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 a.onClick&&a.onClick(i)}},{children:n(h,{children:[e(u,{size:40,src:i.avatar,radius:40}),n("div",{children:[e(c,Ge({size:"sm",weight:500},{children:i.name})),e(c,Ge({size:"xs",color:"dimmed"},{children:i.email}))]})]})}))})},i.name)}));return e(m.Autosize,Ge({maxHeight:500},{children:e(g,Ge({horizontalSpacing:0,verticalSpacing:0,sx:{minWidth:700}},{children:e("tbody",{children:i})}))}))}var Qe=[{value:"Complete"},{value:"Incomplete"}],Ze=r((function(e){var n;return{title:(n={fontSize:34,fontWeight:900},n[e.fn.smallerThan("sm")]={fontSize:24},n),description:{maxWidth:600}}})),Je=function(a){var i=Xe(a.data.groups,a.onGroupChange),o=en(a.data.tab,a.onTabChange),t=Ze().classes;return e(p,Ge({size:"lg",py:"xl"},{children:n(f,Ge({spacing:"md"},{children:[e(v,{children:n(v.Col,Ge({sm:"auto"},{children:[e(C,Ge({variant:"filled",leftSection:e(b,Ge({onClick:a.onBackClick,color:"blue",size:"xs",radius:"xl",variant:"filled"},{children:e(_,{size:14})})),size:"lg"},{children:"Lessons"})),n(h,{children:[n(f,Ge({spacing:0},{children:[e(l,Ge({order:2,className:t.title,mt:"md"},{children:a.data.name||"Lesson"})),e(c,Ge({color:"dimmed",className:t.description,mt:"sm"},{children:a.data.description||"No description"}))]})),n(f,Ge({ml:"auto"},{children:[e(k,Ge({variant:"gradient",onClick:function(){return a.onPreview&&a.onPreview(a.data)}},{children:"Preview"})),e(y,{label:"or",labelPosition:"center",my:"xs",variant:"dashed"}),e(S,{size:"sm",placeholder:"Select a group",nothingFound:"No options",value:i.select,onChange:i.onSelectChange,icon:e(Y,{}),data:a.data.groups.map((function(e){return e.name}))})]}))]})]}))}),n("div",{children:[e(Me,{data:Qe,value:o.value,onChange:o.onChange}),n("div",Ge({style:{position:"relative"}},{children:[e(w,{visible:a.loading,overlayBlur:2}),e($e,{loading:a.loading,data:a.data.users,onClick:a.onUserClick})]}))]})]}))}))},Xe=function(e,n){var a=e.filter((function(e){return e.active})),i=ve.useState(a.length>0?a[0].name:null),o=i[0],t=i[1];return{select:o,onSelectChange:function(e){t(e),n&&n(e)}}},en=function(e,n){var a=ve.useState(e),i=a[0],o=a[1];return{value:i,onChange:function(e){o(e),n&&n(e)}}};function nn(a){if(0===a.data.length)return e(Fe,{loading:a.loading,data:{title:"No lessons available",icon:"lessons",description:"Adjust your search or contact a representative if your expecting results."}});var i=a.data.map((function(i){return e("tr",{children:e("td",{children:e(s,Ge({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 a.onClick&&a.onClick(i)}},{children:e(h,{children:n("div",{children:[e(c,Ge({size:"sm",weight:500},{children:i.name})),e(c,Ge({size:"xs",color:"dimmed"},{children:i.description}))]})})}))})},i.key)}));return e(m.Autosize,Ge({maxHeight:500},{children:e(g,Ge({horizontalSpacing:0,verticalSpacing:0,sx:{minWidth:700}},{children:e("tbody",{children:i})}))}))}var an=r((function(e){var n;return{title:(n={fontSize:34,fontWeight:900},n[e.fn.smallerThan("sm")]={fontSize:24},n),description:{maxWidth:600}}})),on=function(a){var i=an().classes,o=Ce(a.data.lessonOpen),t=o[0],r=o[1];return t?e(Je,{loading:a.loading,data:a.data.lesson,onBackClick:function(){return r(!1)},onGroupChange:a.onGroupChange,onTabChange:a.onTabChange,onUserClick:a.onUserClick,onPreview:a.onPreview}):e(p,Ge({size:"lg",py:"xl"},{children:n(f,Ge({spacing:"md"},{children:[e(v,{children:n(v.Col,Ge({sm:"auto"},{children:[e(C,Ge({variant:"filled",size:"lg"},{children:"Lessons"})),e(l,Ge({order:2,className:i.title,mt:"md"},{children:"Lessons"})),e(c,Ge({color:"dimmed",className:i.description,mt:"sm"},{children:"Well crafted units of instruction."}))]}))}),e(x,{placeholder:"Search for a lesson that fits your needs",data:a.data.lessons.map((function(e){return e.name})),onChange:a.onAutocompleteChange}),n("div",Ge({style:{position:"relative"}},{children:[e(w,{visible:a.loading,overlayBlur:2}),e(nn,{loading:a.loading,data:a.data.lessons,onClick:function(e){a.onLessonClick&&a.onLessonClick(e),r(!0)}})]}))]}))}))},tn=function(a){var i=ye({initialValues:{active:a.data.active}});return e(z,Ge({centered:!0,opened:a.opened,onClose:function(){return a.onClose&&a.onClose()},size:"sm",title:e(l,Ge({size:"h5"},{children:"Accounts"}))},{children:n("form",Ge({onSubmit:i.onSubmit((function(){a.onChange&&a.onChange(i.values.active)}))},{children:[e(S,Ge({required:!0,placeholder:"Select an account",defaultValue:a.data.active,data:a.data.accounts.map((function(e){return{value:e.key,label:e.name}}))},i.getInputProps("active"))),e(k,Ge({type:"submit",fullWidth:!0,mt:"xl"},{children:"Switch"}))]}))}))},rn=r((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}}}})),ln=[{icon:$,label:"Home"},{icon:Q,label:"Dashboard"},{icon:Y,label:"Groups"},{icon:Z,label:"Badges"},{icon:J,label:"Lessons"}],cn=function(n){var a,i=n.icon,o=n.label,t=n.active,r=n.onClick,l=rn(),c=l.classes,d=l.cx;return e(D,Ge({label:o,position:"right",transitionDuration:0},{children:e(s,Ge({onClick:r,className:d(c.link,(a={},a[c.active]=t,a))},{children:e(i,{stroke:1.5})}))}))},dn=["Logout","Change account"],sn=function(a){var i=ln.map((function(e){return be(cn,Ge({},e,{key:e.label,active:e.label===a.active,onClick:function(){return a.onClick&&a.onClick(e.label)}}))}));return n(E,Ge({width:{base:80},p:"md"},{children:[e(N,{children:e(u,Ge({color:"blue",radius:"sm"},{children:e("div",Ge({style:{width:15,marginLeft:"auto",marginRight:"auto"}},{children:e(d,{fit:"contain",src:"https://cdn.localcivics.io/brand/l.png"})}))}))}),e(E.Section,Ge({grow:!0,mt:50},{children:e(f,Ge({justify:"center",spacing:0},{children:i}))})),e(E.Section,{children:n(f,Ge({justify:"center",spacing:0},{children:[e(cn,{icon:q,label:"Change account",onClick:function(){return a.onClick&&a.onClick("Change account")}}),e(cn,{icon:K,label:"Logout",onClick:function(){return a.onClick&&a.onClick("Logout")}})]}))})]}))},hn=[{unit:"year",ms:31536e6},{unit:"month",ms:2628e6},{unit:"day",ms:864e5},{unit:"hour",ms:36e5},{unit:"minute",ms:6e4},{unit:"second",ms:1e3}],un=new Intl.RelativeTimeFormat("en",{numeric:"auto"});function mn(e,n){return void 0===n&&(n=new Date),e?function(e){for(var n=0,a=hn;n<a.length;n++){var i=a[n],o=i.unit,t=i.ms;if(Math.abs(e)>=t||"second"===o)return un.format(Math.round(e/t),o)}return""}(e.getTime()-n.getTime()):""}var gn={BadgeCompleted:e(X,{size:12}),BadgeStarted:e(X,{size:12}),LessonCompleted:e(ee,{size:12}),LessonStarted:e(ee,{size:12}),ProblemSolved:e(ne,{size:12})},pn=function(a){var i,o=ke(null),t=Ce({x:0,y:0}),r=t[0],l=t[1];ve.useEffect((function(){o.current&&r.y===o.current.scrollHeight-o.current.offsetHeight&&a.onScrollBottom&&a.onScrollBottom()}),[r.y]);var d=a.data.map((function(a){var o=a.name.split(/(?=[A-Z])/),t=o[0]===i?"dashed":"solid";i=o[0];var r=a.link?e(B,Ge({color:"dark",unstyled:!0,href:a.link},{children:"".concat(o[0]," ").concat(o[1].toLowerCase())})):"".concat(o[0]," ").concat(o[1].toLowerCase());return n(L.Item,Ge({bullet:fn(a.name),lineVariant:t,title:r},{children:[e(c,Ge({color:"dimmed",size:"sm"},{children:a.description})),e(c,Ge({size:"xs",mt:4},{children:mn(new Date(a.time))}))]}),a.key)}));return e(m.Autosize,Ge({maxHeight:300,onScrollPositionChange:l,viewportRef:o},{children:e(L,Ge({ml:"lg",active:1,bulletSize:24,lineWidth:2},{children:d}))}))},fn=function(n){var a=gn[n];return a||e(ae,{size:12})},vn=r((function(e){var n,a;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,"& + &":(a={paddingLeft:e.spacing.xl,marginLeft:e.spacing.xl,borderLeft:"1px solid ".concat(e.colors[e.primaryColor][3])},a[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])},a)}}})),Cn=function(a){var i=a.data,o=vn().classes,t=i.map((function(a){return n("div",Ge({className:o.stat},{children:[e(c,Ge({className:o.count},{children:a.value.toLocaleString()})),e(c,Ge({className:o.title},{children:a.title})),e(c,Ge({className:o.description},{children:"".concat(a.diff,"% ").concat(a.diff<0?"decrease":"increase"," compared to last period")}))]}),a.title)}));return e("div",Ge({className:o.root},{children:t}))},bn=r((function(e){var n;return{title:(n={fontSize:34,fontWeight:900,marginTop:16},n[e.fn.smallerThan("sm")]={fontSize:24},n),description:{maxWidth:600}}})),kn=function(i){var o=bn().classes,t=i.data.givenName?[i.data.givenName,i.data.familyName].join(" ").trim():i.data.email,r=i.data.givenName?i.data.givenName:"Me";return"compact"===i.variant?n(a,{children:[e(l,Ge({className:o.title},{children:t})),e(c,Ge({color:"dimmed",className:o.description,mt:"xs"},{children:i.data.quote}))]}):n(a,{children:[n(O,Ge({radius:"md",withBorder:!0,p:"lg",sx:function(e){return{backgroundColor:"dark"===e.colorScheme?e.colors.dark[8]:e.white}}},{children:[e(u,{src:i.data.avatar,size:135,radius:120,mx:"auto"}),e(c,Ge({align:"center",size:"lg",weight:500,mt:"md"},{children:t})),n(c,Ge({align:"center",color:"dimmed",size:"sm"},{children:[i.data.email," • ",i.data.job]}))]})),e(T,Ge({mt:"xl",color:"blue",cite:"– ".concat(r)},{children:i.data.quote}))]})},yn=[{value:"Member",label:"Member"},{value:"Admin",label:"Admin"}];function Sn(a){if(0===a.data.length)return e(Fe,{loading:a.loading,data:{title:"No one in group",icon:"thinking",description:"You don't have any people in this group yet. When your ready, get started by clicking the 'Add people' button above."}});var i=a.data.map((function(i){return n("tr",{children:[e("td",{children:e(s,Ge({onClick:function(){return a.onViewProfile&&a.onViewProfile(i)}},{children:n(h,Ge({spacing:"sm"},{children:[e(u,{size:40,src:i.avatar,radius:40}),n("div",{children:[e(c,Ge({size:"sm",weight:500},{children:i.givenName&&i.familyName?"".concat(i.givenName," ").concat(i.familyName):i.email})),e(c,Ge({size:"xs",color:"dimmed"},{children:i.email}))]})]}))}))}),e("td",{children:e(S,{data:Ae([],yn,!0).map((function(e){return i.readonly?Ge(Ge({},e),{disabled:e.value!==i.role}):e})),defaultValue:i.role,variant:"unstyled",onChange:function(e){return!i.readonly&&a.onChangeRole&&a.onChangeRole(i,e)}})}),e("td",{children:i.lastActivity?mn(i.lastActivity):""}),e("td",{children:e(h,Ge({noWrap:!0,spacing:0,position:"right"},{children:!i.readonly&&e(b,Ge({color:"red"},{children:e(ie,{onClick:function(){return j({title:'Delete "'.concat((n=i).givenName&&n.familyName?"".concat(n.givenName," ").concat(n.familyName):n.email,'"?'),centered:!0,children:e(c,Ge({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 a.onDelete&&a.onDelete(n)}});var n},size:16,stroke:1.5})}))}))})]},i.email)}));return e(m,{children:n(g,Ge({verticalSpacing:20,sx:{minWidth:700}},{children:[e("thead",{children:n("tr",{children:[e("th",{children:"Member"}),e("th",{children:"Role"}),e("th",{children:"Last active"}),e("th",{})]})}),e("tbody",{children:i})]}))})}var wn=r((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}}})),xn=function(i){var o=wn().classes,t=ye({initialValues:{key:"",email:"",givenName:"",familyName:"",avatar:"",role:"",readonly:!1,lastActivity:null},validate:{email:function(e){return/^\S+@\S+$/.test(e)&&0===i.data.users.filter((function(n){return n.email===e})).length?null:"Invalid email"}}}),r=Ce(!1),d=r[0],s=r[1],u=Ce(i.data.groupUserHomeOpen),m=u[0],g=u[1];return m?e(p,Ge({size:"lg",py:"xl"},{children:n(f,Ge({spacing:"md"},{children:[e(v,{children:n(v.Col,Ge({sm:"auto"},{children:[e(C,Ge({variant:"filled",leftSection:e(b,Ge({onClick:function(){return g(!1)},color:"blue",size:"xs",radius:"xl",variant:"filled"},{children:e(_,{size:14})})),size:"lg"},{children:"Users"})),e(kn,{variant:"compact",data:i.data.user})]}))}),n("div",Ge({style:{position:"relative"}},{children:[e(w,{visible:i.loading,overlayBlur:2}),n(f,Ge({spacing:"lg"},{children:[e(Cn,{data:[{title:"PROBLEMS SOLVED",value:i.data.stats["PROBLEMS SOLVED"].value,diff:i.data.stats["PROBLEMS SOLVED"].diff},{title:"LESSONS COMPLETED",value:i.data.stats["LESSONS COMPLETED"].value,diff:i.data.stats["LESSONS COMPLETED"].diff},{title:"BADGES EARNED",value:i.data.stats["BADGES EARNED"].value,diff:i.data.stats["BADGES EARNED"].diff}]}),e(pn,{onScrollBottom:i.onTimelineScrollBottom,data:i.data.timeline})]}))]}))]}))})):n(a,{children:[e(G,Ge({opened:d,onClose:function(){return s(!1)},title:e(l,Ge({size:"h5"},{children:"Add people"})),padding:"xl",size:"xl"},{children:n(f,Ge({spacing:"md"},{children:[e(zn,Ge({},i,{close:function(){return s(!1)}})),e(y,{label:"or",labelPosition:"center",my:"md",variant:"dashed"}),e("form",Ge({onSubmit:t.onSubmit((function(){var e=t.values;t.reset(),s(!1),i.onCreateUsers&&i.onCreateUsers([e])}))},{children:n(f,{children:[e(A,Ge({withAsterisk:!0,label:"Email",placeholder:"Email"},t.getInputProps("email"))),n(h,Ge({grow:!0},{children:[e(A,Ge({label:"Given name",placeholder:"Given name"},t.getInputProps("givenName"))),e(A,Ge({label:"Family name",placeholder:"Family name"},t.getInputProps("familyName")))]})),e(k,Ge({type:"submit",fullWidth:!0,mt:"md"},{children:"Submit"}))]})}))]}))})),e(p,Ge({size:"lg",py:"xl"},{children:n(f,Ge({spacing:"md"},{children:[n(v,{children:[n(v.Col,Ge({sm:"auto"},{children:[e(C,Ge({variant:"filled",leftSection:e(b,Ge({onClick:i.onBackClick,color:"blue",size:"xs",radius:"xl",variant:"filled"},{children:e(_,{size:14})})),size:"lg"},{children:"Groups"})),e(l,Ge({order:2,className:o.title,mt:"md"},{children:i.data.name||"Group"})),e(c,Ge({color:"dimmed",className:o.description,mt:"sm"},{children:i.data.description||"No description"}))]})),e(v.Col,Ge({sm:"content"},{children:!i.loading&&e(k,Ge({onClick:function(){return s(!0)},leftIcon:e(oe,{size:14})},{children:"Add people"}))}))]}),n("div",Ge({style:{position:"relative"}},{children:[e(w,{visible:i.loading,overlayBlur:2}),e(Sn,{loading:i.loading,data:i.data.users,onDelete:i.onDelete,onChangeRole:i.onRoleChange,onViewProfile:function(e){return i.onViewProfile(e).then((function(){g(!0)}))}})]}))]}))}))]})},zn=function(a){var i=wn(),o=i.classes,t=i.theme,r=ve.useRef(null),l=ve.useState(!1),d=l[0],s=l[1],u=ve.useCallback((function(e){s(!0),e.forEach((function(e){xe.parse(e,{download:!0,header:!0,dynamicTyping:!0,skipEmptyLines:!0,worker:!0,complete:function(e){var n=e.data.filter((function(e){return/^\S+@\S+$/.test(e.email)&&0===a.data.users.filter((function(n){return n.email===e.email})).length}));n.length>0&&a.onCreateUsers&&a.onCreateUsers(n),s(!1),a.close()}})}))}),[]);return n("div",Ge({className:o.wrapper},{children:[e(Se,Ge({loading:d,openRef:r,onDrop:u,className:o.dropzone,radius:"md",accept:[we.csv],maxSize:5*Math.pow(1024,2)},{children:n("div",Ge({style:{pointerEvents:"none"}},{children:[n(h,Ge({position:"center"},{children:[e(Se.Accept,{children:e(te,{size:50,color:t.colors[t.primaryColor][6],stroke:1.5})}),e(Se.Reject,{children:e(re,{size:50,color:t.colors.red[6],stroke:1.5})}),e(Se.Idle,{children:e(le,{size:50,color:"dark"===t.colorScheme?t.colors.dark[0]:t.black,stroke:1.5})})]})),n(c,Ge({align:"center",weight:700,size:"lg",mt:"xl"},{children:[e(Se.Accept,{children:"Drop files here"}),e(Se.Reject,{children:"Csv file less than 5mb"}),e(Se.Idle,{children:"Upload multiple"})]})),n(c,Ge({align:"center",size:"sm",mt:"xs",color:"dimmed"},{children:["Drag'n'drop files here to upload. We can accept only ",e("i",{children:".csv"})," files that are less than 5mb in size."]}))]}))})),e(k,Ge({className:o.control,size:"md",radius:"xl",onClick:function(){var e;return null===(e=r.current)||void 0===e?void 0:e.call(r)}},{children:"Select file"}))]}))};function En(a){if(0===a.data.length)return e(Fe,{loading:a.loading,data:{title:"No groups",icon:"groups",description:"You don't have any groups just yet. When your ready, get started by clicking the 'Create group' button above."}});var i=a.data.map((function(i){return n("tr",{children:[e("td",{children:e(c,Ge({size:14},{children:i.name}))}),e("td",{children:e(c,Ge({size:14},{children:i.description}))}),e("td",{children:n(h,Ge({noWrap:!0,spacing:0,position:"right"},{children:[e(b,Ge({color:"blue",onClick:function(){return a.onEditGroup&&a.onEditGroup(i)},variant:"subtle"},{children:e(ce,{size:16,stroke:1.5})})),n(P,Ge({transition:"pop",withArrow:!0,position:"bottom-end"},{children:[e(P.Target,{children:e(b,{children:e(de,{size:16,stroke:1.5})})}),e(P.Dropdown,{children:e(P.Item,Ge({onClick:function(){return j({title:'Delete "'.concat((n=i).name,'"?'),centered:!0,children:e(c,Ge({size:"sm"},{children:"Are you sure you want to delete this group? This action is destructive and you will have to contact support to restore your data."})),labels:{confirm:"Delete group",cancel:"No don't delete it"},confirmProps:{color:"red"},onConfirm:function(){return a.onDeleteGroup&&a.onDeleteGroup(n)}});var n},icon:e(ie,{size:16,stroke:1.5}),color:"red"},{children:"Delete"}))})]}))]}))})]},i.name)}));return e(m.Autosize,Ge({maxHeight:300},{children:n(g,Ge({verticalSpacing:20,sx:{minWidth:700}},{children:[e("thead",{children:n("tr",{children:[e("th",{children:"Name"}),e("th",{children:"Description"}),e("th",{})]})}),e("tbody",{children:i})]}))}))}var Nn=r((function(e){var n;return{title:(n={fontSize:34,fontWeight:900},n[e.fn.smallerThan("sm")]={fontSize:24},n),description:{maxWidth:600}}})),Dn=function(i){var o=Nn().classes,t=ye({initialValues:{key:"",name:"",description:""},validate:{name:function(e){return e.length<=6?"Name should include at least 6 characters":null}}}),r=Ce(i.data.formOpen),d=r[0],s=r[1],u=Ce(i.data.groupOpen),m=u[0],g=u[1];return m?e(xn,{loading:i.loading,data:i.data.group,onBackClick:function(){return g(!1)},onCreateUsers:i.onCreateGroupUsers,onDelete:i.onDeleteGroupUser,onViewProfile:i.onViewGroupUser,onRoleChange:i.onGroupUserRoleChange,onTimelineScrollBottom:i.onTimelineScrollBottom}):n(a,{children:[e(G,Ge({opened:d,onClose:function(){return s(!1)},title:n(h,Ge({spacing:0},{children:[e(l,Ge({size:"h5"},{children:"Create a group"})),e(D,Ge({label:"Groups settings cannot be modified once created"},{children:e(b,{children:e(se,{color:"#3b82f6",size:14})})}))]})),padding:"xl",size:"xl"},{children:n("form",Ge({onSubmit:t.onSubmit((function(){var e=t.values;t.reset(),s(!1),i.onCreateGroup&&i.onCreateGroup(e)}))},{children:[n(f,{children:[e(A,Ge({withAsterisk:!0,label:"Name",placeholder:"Group name"},t.getInputProps("name"))),e(A,Ge({label:"Description",placeholder:"A group for my first period class"},t.getInputProps("description")))]}),e(k,Ge({type:"submit",fullWidth:!0,mt:"md"},{children:"Submit"}))]}))})),e(p,Ge({size:"lg",py:"xl"},{children:n(f,Ge({spacing:"md"},{children:[n(v,{children:[n(v.Col,Ge({sm:"auto"},{children:[e(C,Ge({variant:"filled",size:"lg"},{children:"Groups"})),e(l,Ge({order:2,className:o.title,mt:"md"},{children:"Organize people into groups"})),e(c,Ge({color:"dimmed",className:o.description,mt:"sm"},{children:"A group can be a class, team, or other functioning organizations."}))]})),e(v.Col,Ge({sm:"content"},{children:!i.loading&&e(k,Ge({onClick:function(){return s(!0)},leftIcon:e(oe,{size:14})},{children:"Create group"}))}))]}),n("div",Ge({style:{position:"relative"}},{children:[e(w,{visible:i.loading,overlayBlur:2}),e(En,{loading:i.loading,data:i.data.groups,onDeleteGroup:i.onDeleteGroup,onEditGroup:function(e){i.onEditGroup&&i.onEditGroup(e),g(!0)}})]}))]}))}))]})},Bn=r((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}}})),Ln=function(a){var i=a.title,o=a.description,t=a.image,r=a.action,l=a.style,d=a.className,s=function(e,n){var a={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&n.indexOf(i)<0&&(a[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(i=Object.getOwnPropertySymbols(e);o<i.length;o++)n.indexOf(i[o])<0&&Object.prototype.propertyIsEnumerable.call(e,i[o])&&(a[i[o]]=e[i[o]])}return a}(a,["title","description","image","action","style","className"]),h=Bn(),u=h.classes,m=h.cx,g=h.theme;return n(R,Ge({radius:"md",style:Ge({backgroundImage:"url(".concat(t,")")},l),className:m(u.card,d)},s,{children:[e(M,{gradient:"linear-gradient(105deg, ".concat(g.black," 20%, #312f2f 50%, ").concat(g.colors.gray[4]," 100%)"),opacity:.55,zIndex:0}),n("div",Ge({className:u.content},{children:[e(c,Ge({size:"lg",weight:700,className:u.title},{children:i})),e(c,Ge({size:"sm",className:u.description},{children:o})),e(k,Ge({className:u.action,variant:"white",color:"dark",component:"a",size:"xs",href:r.link,target:"_blank"},{children:r.label}))]}))]}))},On=function(a){return e(p,Ge({size:"lg"},{children:n(f,Ge({spacing:"lg"},{children:[n(v,Ge({gutter:"md"},{children:[e(v.Col,Ge({md:6},{children:e(kn,{data:a.data.user})})),e(v.Col,Ge({md:6},{children:e(Ln,{title:a.data.tenant.name,description:a.data.tenant.description,image:a.data.tenant.image,action:{label:"Visit website",link:a.data.tenant.website}})}))]})),e(Cn,{data:[{title:"PROBLEMS SOLVED",value:a.data.stats["PROBLEMS SOLVED"].value,diff:a.data.stats["PROBLEMS SOLVED"].diff},{title:"LESSONS COMPLETED",value:a.data.stats["LESSONS COMPLETED"].value,diff:a.data.stats["LESSONS COMPLETED"].diff},{title:"BADGES EARNED",value:a.data.stats["BADGES EARNED"].value,diff:a.data.stats["BADGES EARNED"].diff}]}),e(pn,{onScrollBottom:a.onTimelineScrollBottom,data:a.data.timeline})]}))}))},Tn=r((function(e){return{header:{position:"sticky",top:0,backgroundColor:"dark"===e.colorScheme?e.colors.dark[7]:e.white,transition:"box-shadow 150ms ease","&::after":{content:'""',position:"absolute",left:0,right:0,bottom:0,borderBottom:"1px solid ".concat("dark"===e.colorScheme?e.colors.dark[3]:e.colors.gray[2])}},scrolled:{boxShadow:e.shadows.sm}}})),Gn=function(a){var i,o=a.data,t=Tn(),r=t.classes,l=t.cx,c=Ce(!1),d=c[0],s=c[1],h=o.map((function(e){return e.value})),u=Math.round(h.reduce((function(e,n){return e+n}))/h.length),p=o.map((function(a){return n("tr",{children:[e("td",{children:a.name}),e("td",{children:a.email}),e("td",{children:a.value}),e("td",{children:a.value>u?e(C,{children:"Above average"}):a.value===u?e(C,Ge({color:"gray"},{children:"Average"})):e(C,Ge({color:"red"},{children:"Below average"}))})]},a.name)}));return e(m,Ge({sx:{height:500},onScrollPositionChange:function(e){var n=e.y;return s(0!==n)}},{children:n(g,Ge({verticalSpacing:"md",sx:{minWidth:700}},{children:[e("thead",Ge({className:l(r.header,(i={},i[r.scrolled]=d,i))},{children:n("tr",{children:[e("th",{children:"Name"}),e("th",{children:"Email"}),e("th",{children:"Value"}),e("th",{children:"Status"})]})})),e("tbody",{children:p})]}))}))},An=function(a){return e(O,Ge({mih:150,p:"lg",withBorder:!0},{children:n(f,{children:[e(v,{children:e(v.Col,Ge({sm:"auto"},{children:n(h,Ge({spacing:0},{children:[e(l,Ge({size:"h5",mb:0},{children:"Performance History"})),e(D,Ge({label:"Shows group performance per person"},{children:e(b,{children:e(se,{color:"#3b82f6",size:14})})}))]}))}))}),e(h,Ge({spacing:"sm"},{children:e(S,{placeholder:"Select a metric",value:a.data.metric,onChange:a.onMetricChange,data:[{label:"PROBLEMS SOLVED",value:"PROBLEMS SOLVED"},{label:"LESSONS COMPLETED",value:"LESSONS COMPLETED"},{label:"BADGES EARNED",value:"BADGES EARNED"}]})})),e(Gn,{data:a.data.users})]})}))},Pn=r((function(e){return{axis:{fontSize:"12px",fontFamily:"Greycliff CF, ".concat(e.fontFamily)}}})),Rn=function(a){var i=Pn().theme;return e(O,Ge({p:"lg",withBorder:!0},{children:n(f,{children:[n(v,{children:[e(v.Col,Ge({sm:"auto"},{children:n(h,Ge({spacing:0},{children:[e(l,Ge({size:"h5",mb:0},{children:"Performance History"})),e(D,Ge({label:"Shows daily increase or decrease across group"},{children:e(b,{children:e(se,{color:"#3b82f6",size:14})})}))]}))})),e(v.Col,Ge({sm:5},{children:e(S,{placeholder:"Select a metric",value:a.data.metric,onChange:a.onMetricChange,data:[{label:"PROBLEMS SOLVED",value:"PROBLEMS SOLVED"},{label:"LESSONS COMPLETED",value:"LESSONS COMPLETED"},{label:"BADGES EARNED",value:"BADGES EARNED"}]})}))]}),e(Ee,Ge({width:"100%",height:400},{children:n(Ne,Ge({width:730,height:250,data:a.data.points,margin:{top:10,right:30,left:0,bottom:0}},{children:[e("defs",{children:n("linearGradient",Ge({id:"colorBlue",x1:"0",y1:"0",x2:"0",y2:"1"},{children:[e("stop",{offset:"5%",stopColor:"#3b82f6",stopOpacity:.4}),e("stop",{offset:"95%",stopColor:"#3b82f6",stopOpacity:0})]}))}),e(De,{tick:{fontSize:12,fontFamily:i.fontFamily},dataKey:"name"}),e(Be,{tick:{fontSize:12,fontFamily:i.fontFamily}}),e(Le,{strokeDasharray:"3 3",horizontal:!0,vertical:!1}),e(Oe,{contentStyle:{fontWeight:700,fontSize:12,fontFamily:i.fontFamily},labelStyle:{fontSize:12,fontFamily:i.fontFamily}}),e(Te,{type:"monotone",dataKey:"value",stroke:"#3b82f6",fillOpacity:1,fill:"url(#colorBlue)"})]}))}))]})}))},Mn=r((function(e){return{root:{paddingTop:1.5*e.spacing.xl,paddingBottom:1.5*e.spacing.xl},label:{fontFamily:"Greycliff CF, ".concat(e.fontFamily)}}})),Wn=function(a){var i=a.data,o=Mn().classes,t=i.map((function(a){var i=a.diff>0?he:ue;return n(O,Ge({withBorder:!0,p:"md",radius:"md"},{children:[n(h,Ge({position:"apart"},{children:[n("div",{children:[e(c,Ge({color:"dimmed",transform:"uppercase",weight:700,size:"xs",className:o.label},{children:a.title})),e(c,Ge({weight:700,size:"xl"},{children:a.value.toLocaleString()}))]}),e(W,Ge({color:"gray",variant:"light",sx:function(e){return{color:a.diff>0?e.colors.teal[6]:e.colors.red[6]}},size:38,radius:"md"},{children:e(i,{size:28,stroke:1.5})}))]})),n(c,Ge({color:"dimmed",size:"sm",mt:"md"},{children:[n(c,Ge({component:"span",color:a.diff>0?"teal":"red",weight:700},{children:[a.diff,"%"]}))," ",a.diff>0?"increase":"decrease"," compared to last period"]}))]}),a.title)}));return e("div",Ge({className:o.root},{children:e(F,Ge({cols:3,breakpoints:[{maxWidth:"sm",cols:1}]},{children:t}))}))},Fn=function(i){return n(a,{children:[e(Wn,{data:[{title:"PROBLEMS SOLVED",value:i.data.stats["PROBLEMS SOLVED"].value,diff:i.data.stats["PROBLEMS SOLVED"].diff},{title:"LESSONS COMPLETED",value:i.data.stats["LESSONS COMPLETED"].value,diff:i.data.stats["LESSONS COMPLETED"].diff},{title:"BADGES EARNED",value:i.data.stats["BADGES EARNED"].value,diff:i.data.stats["BADGES EARNED"].diff}]}),e(Rn,{data:i.data.areaChart,onMetricChange:i.onMetricChange})]})},Un=[{value:"Overview"},{value:"Breakdown"}],Vn=function(a){var i=jn(a.data.breakdown,a.onBreakdownMetricChange),o=Hn(a.data.dateRange,a.onDateRangeChange),t=_n(a.data.groups,a.onGroupChange),r=Yn(a.data.overview,a.onOverviewMetricChange),d=qn(a.data.tab,a.onTabChange);return e(p,Ge({size:"lg",py:"xl"},{children:n(f,{children:[n(v,{children:[n(v.Col,Ge({sm:"auto"},{children:[e(l,Ge({size:"h3"},{children:"Dashboard"})),e(c,Ge({color:"dimmed",size:"sm",mt:"md"},{children:"View core metrics on the state of your groups."}))]})),e(v.Col,Ge({sm:2.5},{children:e(S,{placeholder:"Select a group",nothingFound:"No options",value:t.select,onChange:t.onSelectChange,icon:e(Y,{}),data:a.data.groups.map((function(e){return e.name}))})})),e(v.Col,Ge({sm:"auto"},{children:e(ze,{placeholder:"Select a date",allowSingleDateInRange:!0,value:o.value,onChange:o.onChange,icon:e(me,{size:16})})}))]}),n(f,{children:[e(Me,{data:Un,value:d.value,onChange:d.onChange}),n("div",Ge({style:{position:"relative"}},{children:[e(w,{visible:a.loading,overlayBlur:2}),e(In,Ge({},a,{data:Ge(Ge({},a.data),{overview:r.data,breakdown:i.data}),active:d.value,onBreakdownMetricChange:i.onMetricChange,onOverviewMetricChange:r.onMetricChange}))]}))]})]})}))},In=function(n){if(0===n.data.overview.stats["PROBLEMS SOLVED"].value)return e(Fe,{loading:n.loading,data:{title:"No data for period",icon:"dashboard",description:"We haven't received any data yet for your group during this period. Check back later once progress has been made."}});switch(n.active){case"Overview":return e(Fn,{data:n.data.overview,onMetricChange:n.onOverviewMetricChange});case"Breakdown":return e(An,{data:n.data.breakdown,onMetricChange:n.onBreakdownMetricChange});default:return null}},jn=function(e,n){var a=ve.useState(e.metric),i=a[0],o=a[1];return{data:Ge(Ge({},e),{metric:i}),onMetricChange:function(e){o(e),n&&n(e)}}},Hn=function(e,n){var a=ve.useState(e),i=a[0],o=a[1];return{value:i,onChange:function(e){o(e),n&&n(e)}}},_n=function(e,n){var a=e.filter((function(e){return e.active})),i=ve.useState(a.length>0?a[0].name:null),o=i[0],t=i[1];return{select:o,onSelectChange:function(e){t(e),n&&n(e)}}},Yn=function(e,n){var a=ve.useState(e.areaChart.metric),i=a[0],o=a[1];return{data:Ge(Ge({},e),{areaChart:Ge(Ge({},e.areaChart),{metric:i})}),onMetricChange:function(e){o(e),n&&n(e)}}},qn=function(e,n){var a=ve.useState(e),i=a[0],o=a[1];return{value:i,onChange:function(e){o(e),n&&n(e)}}},Kn=r((function(e){var n,a,i,o,t,r;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:(a={marginTop:5},a[e.fn.smallerThan("sm")]={marginTop:e.spacing.xs,textAlign:"center"},a),inner:(i={display:"flex",justifyContent:"space-between"},i[e.fn.smallerThan("sm")]={flexDirection:"column",alignItems:"center"},i),groups:(o={display:"flex",flexWrap:"wrap"},o[e.fn.smallerThan("sm")]={display:"none"},o),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:(t={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])},t[e.fn.smallerThan("sm")]={flexDirection:"column"},t),social:(r={},r[e.fn.smallerThan("sm")]={marginTop:e.spacing.xs},r)}})),$n=function(i){var o=Kn().classes,t=Qn(i.data.account,i.onAccountChange),r=Zn(i.data.navbar.active,(function(e){if("Change account"===e)t.setChangeModalOpen(!0);i.onNavbarClick&&i.onNavbarClick(e)}));return n(U,Ge({padding:"xs",navbar:e(sn,{active:r.active,onClick:r.onClick},r.key),footer:e(a,{children:!t.opened&&n("footer",Ge({className:o.footer},{children:[n(p,Ge({className:o.inner},{children:[n("div",Ge({className:o.logo},{children:[n(h,Ge({spacing:"xs"},{children:[e("div",Ge({style:{width:15}},{children:e(d,{fit:"contain",src:"https://cdn.localcivics.io/brand/l.png"})})),e(l,Ge({color:"dimmed",size:"h5"},{children:"Local Civics"}))]})),e(c,Ge({size:"xs",color:"dimmed",className:o.description},{children:"We connect students to powerful civic learning experiences."}))]})),e("div",Ge({className:o.groups},{children:n("div",Ge({className:o.wrapper},{children:[e(c,Ge({className:o.link,component:"a",href:"https://www.localcivics.io",target:"_blank"},{children:"About"})),e(c,Ge({className:o.link,component:"a",href:"https://www.localcivics.io/terms-of-service",target:"_blank"},{children:"Terms"})),e(c,Ge({className:o.link,component:"a",href:"https://www.localcivics.io/privacy-policy",target:"_blank"},{children:"Privacy"})),e(c,Ge({className:o.link,component:"a",href:"https://localcivics.notion.site/Help-Center-b52300f587b64fc0a61f512686e7626d",target:"_blank"},{children:"FAQ"}))]}))}))]})),n(p,Ge({className:o.afterFooter},{children:[n(c,Ge({color:"dimmed",size:"sm"},{children:["© ",(new Date).getFullYear()," Local Civics. All rights reserved."]})),n(h,Ge({spacing:0,className:o.social,position:"right",noWrap:!0},{children:[e(b,Ge({component:"a",target:"_blank",href:"https://www.instagram.com/localcivics/",size:"lg"},{children:e(ge,{size:18,stroke:1.5})})),e(b,Ge({component:"a",target:"_blank",href:"https://www.linkedin.com/company/localcivics",size:"lg"},{children:e(pe,{size:18,stroke:1.5})})),e(b,Ge({component:"a",target:"_blank",href:"https://www.facebook.com/localcivics/",size:"lg"},{children:e(fe,{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",Ge({style:{position:"relative"}},{children:[(void 0===i.loading||t.opened)&&e(N,Ge({style:{height:400}},{children:e(V,{})})),void 0!==i.loading&&!t.opened&&e(Jn,Ge({},i,{active:r.active}))]})),e(tn,{opened:t.opened,data:t.data,onChange:t.onAccountChange,onClose:function(){return t.setChangeModalOpen(!1)}})]}))},Qn=function(e,n){var a=Ce(!1),i=a[0],o=a[1],t=Ce(e.active),r=t[0],l=t[1];return{opened:i,data:Ge(Ge({},e),{active:r}),setChangeModalOpen:o,onAccountChange:function(e){l(e),o(!1),n&&n(e)}}},Zn=function(e,n){var a=Ce(e||"Home"),i=a[0],o=a[1];return{key:i,active:i,onClick:function(e){var a;i!==e&&(a=e,-1===dn.indexOf(a)&&o(e),n&&n(e))}}},Jn=function(n){switch(n.active){case"Dashboard":return e(Vn,{loading:n.loading||!1,data:n.data.dashboard,onBreakdownMetricChange:n.onDashboardBreakdownMetricChange,onDateRangeChange:n.onDashboardDateRangeChange,onGroupChange:n.onDashboardGroupChange,onOverviewMetricChange:n.onDashboardOverviewMetricChange,onTabChange:n.onDashboardTabChange});case"Home":return e(On,{data:n.data.home,onTimelineScrollBottom:n.onHomeTimelineScrollBottom});case"Groups":return e(Dn,{loading:n.loading||!1,data:n.data.groups,onCreateGroup:n.onCreateGroup,onCreateGroupUsers:n.onCreateGroupUsers,onDeleteGroup:n.onDeleteGroup,onDeleteGroupUser:n.onDeleteGroupUser,onEditGroup:n.onEditGroup,onViewGroupUser:n.onViewGroupUser,onGroupUserRoleChange:n.onGroupUserRoleChange,onTimelineScrollBottom:n.onGroupUserTimelineScrollBottom});case"Lessons":return e(on,{loading:n.loading||!1,data:n.data.lessons,onAutocompleteChange:n.onLessonAutocompleteChange,onGroupChange:n.onLessonGroupChange,onLessonClick:n.onLessonClick,onPreview:n.onLessonPreview,onTabChange:n.onLessonTabChange,onUserClick:n.onLessonUserClick});case"Badges":return e(Ke,{loading:n.loading||!1,data:n.data.badges,onAutocompleteChange:n.onBadgeAutocompleteChange,onGroupChange:n.onBadgeGroupChange,onBadgeClick:n.onBadgeClick,onPreview:n.onBadgePreview,onTabChange:n.onBadgeTabChange,onUserClick:n.onBadgeUserClick});default:return null}};export{$n as Mgmt,Re as MgmtProvider,tn as SwitchAccount};
1
+ import{jsx as e,jsxs as n,Fragment as i}from"react/jsx-runtime";import{createEmotionCache as o,MantineProvider as r,Tabs as a,createStyles as t,Title as l,Text as c,Image as d,UnstyledButton as s,Group as h,Avatar as u,ScrollArea as m,Table as p,Container as g,Stack as f,Grid as v,Badge as C,ActionIcon as k,Button as b,Divider as y,Select as S,LoadingOverlay as x,Autocomplete as z,Modal as w,Navbar as E,Center as N,Tooltip as B,Anchor as D,Timeline as L,Paper as T,Blockquote as O,Drawer as G,TextInput as A,Menu as P,Card as R,Overlay as M,ThemeIcon as W,SimpleGrid as U,AppShell as F,Loader as V}from"@mantine/core";import{ModalsProvider as I,openConfirmModal as j}from"@mantine/modals";import{NotificationsProvider as H}from"@mantine/notifications";export{showNotification,updateNotification}from"@mantine/notifications";import{IconArrowLeft as _,IconCategory2 as Y,IconSwitchHorizontal as q,IconLogout as K,IconHome2 as $,IconGauge as Q,IconAlbum as Z,IconLambda as J,IconBadges as X,IconSchool as ee,IconActivityHeartbeat as ne,IconTimelineEvent as ie,IconTrash as oe,IconPlaylistAdd as re,IconDownload as ae,IconX as te,IconCloudUpload as le,IconUsers as ce,IconDots as de,IconInfoCircle as se,IconArrowUpRight as he,IconArrowDownRight as ue,IconCalendar as me,IconBrandInstagram as pe,IconBrandLinkedin as ge,IconBrandFacebook as fe}from"@tabler/icons";import*as ve from"react";import{createElement as Ce,useRef as ke,useState as be}from"react";import{useForm as ye}from"@mantine/form";import{Dropzone as Se,MIME_TYPES as xe}from"@mantine/dropzone";import*as ze from"papaparse";import{DateRangePicker as we}from"@mantine/dates";import{ResponsiveContainer as Ee,AreaChart as Ne,XAxis as Be,YAxis as De,CartesianGrid as Le,Tooltip as Te,Area as Oe}from"recharts";var Ge=function(){return Ge=Object.assign||function(e){for(var n,i=1,o=arguments.length;i<o;i++)for(var r in n=arguments[i])Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r]);return e},Ge.apply(this,arguments)};function Ae(e,n,i){if(i||2===arguments.length)for(var o,r=0,a=n.length;r<a;r++)!o&&r in n||(o||(o=Array.prototype.slice.call(n,0,r)),o[r]=n[r]);return e.concat(o||Array.prototype.slice.call(n))}var Pe=o({key:"mantine",prepend:!1}),Re=function(n){return e(r,Ge({withNormalizeCSS:!0,withGlobalStyles:!0,emotionCache:Pe,theme:{loader:"bars"}},{children:e(H,Ge({limit:n.notificationLimit||5},{children:e(I,{children:n.children})}))}))},Me=function(n){var i,o=null===(i=n.data)||void 0===i?void 0:i.map((function(n){return e(a.Tab,Ge({value:n.value},{children:n.label||n.value}),n.value)}));return e(a,Ge({value:n.value,onTabChange:n.onChange},{children:e(a.List,{children:o})}))},We=t((function(e){var n,i,o;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:(o={paddingRight:4*e.spacing.xl},o["@media (max-width: ".concat(e.breakpoints.sm,"px)")]={paddingRight:0,marginTop:e.spacing.xl},o),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}}})),Ue=function(i){var o=We().classes;return n("div",Ge({className:o.wrapper},{children:[n("div",Ge({className:o.body},{children:[e(l,Ge({className:o.title},{children:i.loading?"Loading...":i.data.title})),e(c,Ge({size:"sm",color:"dimmed"},{children:i.loading?"We're loading your data.":i.data.description}))]})),e(d,{src:"https://cdn.localcivics.io/illustrations/".concat(i.data.icon,".svg"),className:o.image})]}))};function Fe(i){if(0===i.data.length)return e(Ue,{loading:i.loading,data:{title:"No data for group",icon:"thinking",description:"You don't have any data for people in this group yet. Check back later or adjust your search."}});var o=i.data.map((function(o){return e("tr",{children:e("td",{children:e(s,Ge({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 i.onClick&&i.onClick(o)}},{children:n(h,{children:[e(u,{size:40,src:o.avatar,radius:40}),n("div",{children:[e(c,Ge({size:"sm",weight:500},{children:o.name})),e(c,Ge({size:"xs",color:"dimmed"},{children:o.email}))]})]})}))})},o.name)}));return e(m.Autosize,Ge({maxHeight:500},{children:e(p,Ge({horizontalSpacing:0,verticalSpacing:0,sx:{minWidth:700}},{children:e("tbody",{children:o})}))}))}var Ve=[{value:"Complete"},{value:"Incomplete"}],Ie=t((function(e){var n;return{title:(n={fontSize:34,fontWeight:900},n[e.fn.smallerThan("sm")]={fontSize:24},n),description:{maxWidth:600}}})),je=function(i){var o=He(i.groups,i.onGroupChange),r=_e(i.tab,i.onTabChange),a=Ie().classes;return e(g,Ge({size:"lg",py:"xl"},{children:n(f,Ge({spacing:"md"},{children:[e(v,{children:n(v.Col,Ge({sm:"auto"},{children:[e(C,Ge({variant:"filled",leftSection:e(k,Ge({onClick:i.onBackClick,color:"blue",size:"xs",radius:"xl",variant:"filled"},{children:e(_,{size:14})})),size:"lg"},{children:"Badges"})),n(h,{children:[n(f,Ge({spacing:0},{children:[e(l,Ge({order:2,className:a.title,mt:"md"},{children:i.name||"Badge"})),e(c,Ge({color:"dimmed",className:a.description,mt:"sm"},{children:i.description||"No description"}))]})),n(f,Ge({ml:"auto"},{children:[e(b,Ge({variant:"gradient",onClick:function(){return i.onPreview(i.id)}},{children:"Preview"})),e(y,{label:"or",labelPosition:"center",my:"xs",variant:"dashed"}),e(S,{size:"sm",placeholder:"Select a group",nothingFound:"No options",value:o.select,onChange:o.onSelectChange,icon:e(Y,{}),data:i.groups.map((function(e){return e.name}))})]}))]})]}))}),n("div",{children:[e(Me,{data:Ve,value:r.value,onChange:r.onChange}),n("div",Ge({style:{position:"relative"}},{children:[e(x,{visible:i.loading,overlayBlur:2}),e(Fe,{loading:i.loading,data:i.users,onClick:i.onUserClick})]}))]})]}))}))},He=function(e,n){var i=e.filter((function(e){return e.active})),o=ve.useState(i.length>0?i[0].name:null),r=o[0],a=o[1];return{select:r,onSelectChange:function(e){a(e),n&&n(e)}}},_e=function(e,n){var i=ve.useState(e),o=i[0],r=i[1];return{value:o,onChange:function(e){r(e),n&&n(e)}}};function Ye(i){if(0===i.data.length)return e(Ue,{loading:i.loading,data:{title:"No badges available",icon:"badges",description:"Adjust your search or contact a representative if your expecting results."}});var o=i.data.map((function(o){return e("tr",{children:e("td",{children:e(s,Ge({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 i.onClick&&i.onClick(o)}},{children:e(h,{children:n("div",{children:[e(c,Ge({size:"sm",weight:500},{children:o.name})),e(c,Ge({size:"xs",color:"dimmed"},{children:o.description}))]})})}))})},o.key)}));return e(m.Autosize,Ge({maxHeight:500},{children:e(p,Ge({horizontalSpacing:0,verticalSpacing:0,sx:{minWidth:700}},{children:e("tbody",{children:o})}))}))}var qe=t((function(e){var n;return{title:(n={fontSize:34,fontWeight:900},n[e.fn.smallerThan("sm")]={fontSize:24},n),description:{maxWidth:600}}})),Ke=function(i){var o=qe().classes;return i.badge?e(je,Ge({},i.badge,{onBackClick:i.onBackClick,onGroupChange:i.onGroupChange,onTabChange:i.onTabChange,onUserClick:i.onUserClick,onPreview:i.onPreview})):e(g,Ge({size:"lg",py:"xl"},{children:n(f,Ge({spacing:"md"},{children:[e(v,{children:n(v.Col,Ge({sm:"auto"},{children:[e(C,Ge({variant:"filled",size:"lg"},{children:"Badges"})),e(l,Ge({order:2,className:o.title,mt:"md"},{children:"Badges and micro-credentials"})),e(c,Ge({color:"dimmed",className:o.description,mt:"sm"},{children:"Project-sized skills acquisition and standards alignment."}))]}))}),e(z,{placeholder:"Search for a badge that fits your needs",data:i.badges.map((function(e){return e.name})),onChange:i.onAutocompleteChange}),n("div",Ge({style:{position:"relative"}},{children:[e(x,{visible:i.loading,overlayBlur:2}),e(Ye,{loading:i.loading,data:i.badges,onClick:i.onBadgeClick})]}))]}))}))};function $e(i){if(0===i.data.length)return e(Ue,{loading:i.loading,data:{title:"No data for group",icon:"thinking",description:"You don't have any data for people in this group yet. Check back later or adjust your search."}});var o=i.data.map((function(o){return e("tr",{children:e("td",{children:e(s,Ge({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 i.onClick&&i.onClick(o)}},{children:n(h,{children:[e(u,{size:40,src:o.avatar,radius:40}),n("div",{children:[e(c,Ge({size:"sm",weight:500},{children:o.name})),e(c,Ge({size:"xs",color:"dimmed"},{children:o.email}))]})]})}))})},o.name)}));return e(m.Autosize,Ge({maxHeight:500},{children:e(p,Ge({horizontalSpacing:0,verticalSpacing:0,sx:{minWidth:700}},{children:e("tbody",{children:o})}))}))}var Qe=[{value:"Complete"},{value:"Incomplete"}],Ze=t((function(e){var n;return{title:(n={fontSize:34,fontWeight:900},n[e.fn.smallerThan("sm")]={fontSize:24},n),description:{maxWidth:600}}})),Je=function(i){var o=Ze().classes;return e(g,Ge({size:"lg",py:"xl"},{children:n(f,Ge({spacing:"md"},{children:[e(v,{children:n(v.Col,Ge({sm:"auto"},{children:[e(C,Ge({variant:"filled",leftSection:e(k,Ge({onClick:i.onBackClick,color:"blue",size:"xs",radius:"xl",variant:"filled"},{children:e(_,{size:14})})),size:"lg"},{children:"Lessons"})),n(h,{children:[n(f,Ge({spacing:0},{children:[e(l,Ge({order:2,className:o.title,mt:"md"},{children:i.name||"Lesson"})),e(c,Ge({color:"dimmed",className:o.description,mt:"sm"},{children:i.description||"No description"}))]})),n(f,Ge({ml:"auto"},{children:[e(b,Ge({variant:"gradient",onClick:function(){return i.onPreview&&i.onPreview(i.id)}},{children:"Preview"})),e(y,{label:"or",labelPosition:"center",my:"xs",variant:"dashed"}),e(S,{size:"sm",placeholder:"Select a group",nothingFound:"No options",value:i.group,onChange:i.onGroupChange,icon:e(Y,{}),data:i.groups.map((function(e){return e.name}))})]}))]})]}))}),n("div",{children:[e(Me,{data:Qe,value:i.tab,onChange:i.onTabChange}),n("div",Ge({style:{position:"relative"}},{children:[e(x,{visible:i.loading,overlayBlur:2}),e($e,{loading:i.loading,data:i.users,onClick:i.onUserClick})]}))]})]}))}))};function Xe(i){if(0===i.data.length)return e(Ue,{loading:i.loading,data:{title:"No lessons available",icon:"lessons",description:"Adjust your search or contact a representative if your expecting results."}});var o=i.data.map((function(o){return e("tr",{children:e("td",{children:e(s,Ge({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 i.onClick&&i.onClick(o)}},{children:e(h,{children:n("div",{children:[e(c,Ge({size:"sm",weight:500},{children:o.name})),e(c,Ge({size:"xs",color:"dimmed"},{children:o.description}))]})})}))})},o.key)}));return e(m.Autosize,Ge({maxHeight:500},{children:e(p,Ge({horizontalSpacing:0,verticalSpacing:0,sx:{minWidth:700}},{children:e("tbody",{children:o})}))}))}var en=t((function(e){var n;return{title:(n={fontSize:34,fontWeight:900},n[e.fn.smallerThan("sm")]={fontSize:24},n),description:{maxWidth:600}}})),nn=function(i){var o=en().classes;return i.lesson?e(Je,Ge({},i.lesson,{onBackClick:i.onBackClick,onGroupChange:i.onGroupChange,onTabChange:i.onTabChange,onUserClick:i.onUserClick,onPreview:i.onPreview})):e(g,Ge({size:"lg",py:"xl"},{children:n(f,Ge({spacing:"md"},{children:[e(v,{children:n(v.Col,Ge({sm:"auto"},{children:[e(C,Ge({variant:"filled",size:"lg"},{children:"Lessons"})),e(l,Ge({order:2,className:o.title,mt:"md"},{children:"Lessons"})),e(c,Ge({color:"dimmed",className:o.description,mt:"sm"},{children:"Well crafted units of instruction."}))]}))}),e(z,{placeholder:"Search for a lesson that fits your needs",data:i.lessons.map((function(e){return e.name})),onChange:i.onAutocompleteChange}),n("div",Ge({style:{position:"relative"}},{children:[e(x,{visible:i.loading,overlayBlur:2}),e(Xe,{loading:i.loading,data:i.lessons,onClick:i.onLessonClick})]}))]}))}))},on=function(i){var o=ye({initialValues:{active:i.data.active}});return e(w,Ge({centered:!0,opened:i.opened,onClose:function(){return i.onClose&&i.onClose()},size:"sm",title:e(l,Ge({size:"h5"},{children:"Accounts"}))},{children:n("form",Ge({onSubmit:o.onSubmit((function(){i.onChange&&i.onChange(o.values.active)}))},{children:[e(S,Ge({required:!0,placeholder:"Select an account",defaultValue:i.data.active,data:i.data.accounts.map((function(e){return{value:e.key,label:e.name}}))},o.getInputProps("active"))),e(b,Ge({type:"submit",fullWidth:!0,mt:"xl"},{children:"Switch"}))]}))}))},rn=t((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}}}})),an=[{icon:$,label:"Home"},{icon:Q,label:"Dashboard"},{icon:Y,label:"Groups"},{icon:Z,label:"Badges"},{icon:J,label:"Lessons"}],tn=function(n){var i,o=n.icon,r=n.label,a=n.active,t=n.onClick,l=rn(),c=l.classes,d=l.cx;return e(B,Ge({label:r,position:"right",transitionDuration:0},{children:e(s,Ge({onClick:t,className:d(c.link,(i={},i[c.active]=a,i))},{children:e(o,{stroke:1.5})}))}))},ln=["Logout","Change account"],cn=function(i){var o=an.map((function(e){return Ce(tn,Ge({},e,{key:e.label,active:e.label===i.active,onClick:function(){return i.onClick&&i.onClick(e.label)}}))}));return n(E,Ge({width:{base:80},p:"md"},{children:[e(N,{children:e(u,Ge({color:"blue",radius:"sm"},{children:e("div",Ge({style:{width:15,marginLeft:"auto",marginRight:"auto"}},{children:e(d,{fit:"contain",src:"https://cdn.localcivics.io/brand/l.png"})}))}))}),e(E.Section,Ge({grow:!0,mt:50},{children:e(f,Ge({justify:"center",spacing:0},{children:o}))})),e(E.Section,{children:n(f,Ge({justify:"center",spacing:0},{children:[e(tn,{icon:q,label:"Change account",onClick:function(){return i.onClick&&i.onClick("Change account")}}),e(tn,{icon:K,label:"Logout",onClick:function(){return i.onClick&&i.onClick("Logout")}})]}))})]}))},dn=[{unit:"year",ms:31536e6},{unit:"month",ms:2628e6},{unit:"day",ms:864e5},{unit:"hour",ms:36e5},{unit:"minute",ms:6e4},{unit:"second",ms:1e3}],sn=new Intl.RelativeTimeFormat("en",{numeric:"auto"});function hn(e,n){return void 0===n&&(n=new Date),e?function(e){for(var n=0,i=dn;n<i.length;n++){var o=i[n],r=o.unit,a=o.ms;if(Math.abs(e)>=a||"second"===r)return sn.format(Math.round(e/a),r)}return""}(e.getTime()-n.getTime()):""}var un={BadgeCompleted:e(X,{size:12}),BadgeStarted:e(X,{size:12}),LessonCompleted:e(ee,{size:12}),LessonStarted:e(ee,{size:12}),ProblemSolved:e(ne,{size:12})},mn=function(i){var o,r=ke(null),a=be({x:0,y:0}),t=a[0],l=a[1];ve.useEffect((function(){r.current&&t.y===r.current.scrollHeight-r.current.offsetHeight&&i.onScrollBottom&&i.onScrollBottom()}),[t.y]);var d=i.data.map((function(i){var r=i.name.split(/(?=[A-Z])/),a=r[0]===o?"dashed":"solid";o=r[0];var t=i.link?e(D,Ge({color:"dark",unstyled:!0,href:i.link},{children:"".concat(r[0]," ").concat(r[1].toLowerCase())})):"".concat(r[0]," ").concat(r[1].toLowerCase());return n(L.Item,Ge({bullet:pn(i.name),lineVariant:a,title:t},{children:[e(c,Ge({color:"dimmed",size:"sm"},{children:i.description})),e(c,Ge({size:"xs",mt:4},{children:hn(new Date(i.time))}))]}),i.key)}));return e(m.Autosize,Ge({maxHeight:300,onScrollPositionChange:l,viewportRef:r},{children:e(L,Ge({ml:"lg",active:1,bulletSize:24,lineWidth:2},{children:d}))}))},pn=function(n){var i=un[n];return i||e(ie,{size:12})},gn=t((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)}}})),fn=function(i){var o=i.data,r=gn().classes,a=o.map((function(i){return n("div",Ge({className:r.stat},{children:[e(c,Ge({className:r.count},{children:i.value.toLocaleString()})),e(c,Ge({className:r.title},{children:i.title})),e(c,Ge({className:r.description},{children:"".concat(i.diff,"% ").concat(i.diff<0?"decrease":"increase"," compared to last period")}))]}),i.title)}));return e("div",Ge({className:r.root},{children:a}))},vn=t((function(e){var n;return{title:(n={fontSize:34,fontWeight:900,marginTop:16},n[e.fn.smallerThan("sm")]={fontSize:24},n),description:{maxWidth:600}}})),Cn=function(o){var r=vn().classes,a=o.data.givenName?[o.data.givenName,o.data.familyName].join(" ").trim():o.data.email,t=o.data.givenName?o.data.givenName:"Me";return"compact"===o.variant?n(i,{children:[e(l,Ge({className:r.title},{children:a})),e(c,Ge({color:"dimmed",className:r.description,mt:"xs"},{children:o.data.quote}))]}):n(i,{children:[n(T,Ge({radius:"md",withBorder:!0,p:"lg",sx:function(e){return{backgroundColor:"dark"===e.colorScheme?e.colors.dark[8]:e.white}}},{children:[e(u,{src:o.data.avatar,size:135,radius:120,mx:"auto"}),e(c,Ge({align:"center",size:"lg",weight:500,mt:"md"},{children:a})),n(c,Ge({align:"center",color:"dimmed",size:"sm"},{children:[o.data.email," • ",o.data.job]}))]})),e(O,Ge({mt:"xl",color:"blue",cite:"– ".concat(t)},{children:o.data.quote}))]})},kn=[{value:"Member",label:"Member"},{value:"Admin",label:"Admin"}];function bn(i){if(0===i.data.length)return e(Ue,{loading:i.loading,data:{title:"No one in group",icon:"thinking",description:"You don't have any people in this group yet. When your ready, get started by clicking the 'Add people' button above."}});var o=i.data.map((function(o){return n("tr",{children:[e("td",{children:e(s,Ge({onClick:function(){return i.onViewProfile&&i.onViewProfile(o)}},{children:n(h,Ge({spacing:"sm"},{children:[e(u,{size:40,src:o.avatar,radius:40}),n("div",{children:[e(c,Ge({size:"sm",weight:500},{children:o.givenName&&o.familyName?"".concat(o.givenName," ").concat(o.familyName):o.email})),e(c,Ge({size:"xs",color:"dimmed"},{children:o.email}))]})]}))}))}),e("td",{children:e(S,{data:Ae([],kn,!0).map((function(e){return o.readonly?Ge(Ge({},e),{disabled:e.value!==o.role}):e})),defaultValue:o.role,variant:"unstyled",onChange:function(e){return!o.readonly&&i.onChangeRole&&i.onChangeRole(o,e)}})}),e("td",{children:o.lastActivity?hn(o.lastActivity):""}),e("td",{children:e(h,Ge({noWrap:!0,spacing:0,position:"right"},{children:!o.readonly&&e(k,Ge({color:"red"},{children:e(oe,{onClick:function(){return j({title:'Delete "'.concat((n=o).givenName&&n.familyName?"".concat(n.givenName," ").concat(n.familyName):n.email,'"?'),centered:!0,children:e(c,Ge({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 i.onDelete&&i.onDelete(n)}});var n},size:16,stroke:1.5})}))}))})]},o.email)}));return e(m,{children:n(p,Ge({verticalSpacing:20,sx:{minWidth:700}},{children:[e("thead",{children:n("tr",{children:[e("th",{children:"Member"}),e("th",{children:"Role"}),e("th",{children:"Last active"}),e("th",{})]})}),e("tbody",{children:o})]}))})}var yn=t((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}}})),Sn=function(o){var r=yn().classes,a=ye({initialValues:{key:"",email:"",givenName:"",familyName:"",avatar:"",role:"",readonly:!1,lastActivity:null},validate:{email:function(e){return/^\S+@\S+$/.test(e)&&0===o.users.filter((function(n){return n.email===e})).length?null:"Invalid email"}}}),t=be(!1),d=t[0],s=t[1];return o.user?e(g,Ge({size:"lg",py:"xl"},{children:n(f,Ge({spacing:"md"},{children:[e(v,{children:n(v.Col,Ge({sm:"auto"},{children:[e(C,Ge({variant:"filled",leftSection:e(k,Ge({onClick:o.onUserBackClick,color:"blue",size:"xs",radius:"xl",variant:"filled"},{children:e(_,{size:14})})),size:"lg"},{children:"Users"})),e(Cn,{variant:"compact",data:o.user})]}))}),n("div",Ge({style:{position:"relative"}},{children:[e(x,{visible:o.loading,overlayBlur:2}),n(f,Ge({spacing:"lg"},{children:[e(fn,{data:[{title:"PROBLEMS SOLVED",value:o.stats["PROBLEMS SOLVED"].value,diff:o.stats["PROBLEMS SOLVED"].diff},{title:"LESSONS COMPLETED",value:o.stats["LESSONS COMPLETED"].value,diff:o.stats["LESSONS COMPLETED"].diff},{title:"BADGES EARNED",value:o.stats["BADGES EARNED"].value,diff:o.stats["BADGES EARNED"].diff}]}),e(mn,{onScrollBottom:o.onTimelineScrollBottom,data:o.timeline})]}))]}))]}))})):n(i,{children:[e(G,Ge({opened:d,onClose:function(){return s(!1)},title:e(l,Ge({size:"h5"},{children:"Add people"})),padding:"xl",size:"xl"},{children:n(f,Ge({spacing:"md"},{children:[e(xn,Ge({},o,{close:function(){return s(!1)}})),e(y,{label:"or",labelPosition:"center",my:"md",variant:"dashed"}),e("form",Ge({onSubmit:a.onSubmit((function(){var e=a.values;a.reset(),s(!1),o.onCreateUsers&&o.onCreateUsers([e])}))},{children:n(f,{children:[e(A,Ge({withAsterisk:!0,label:"Email",placeholder:"Email"},a.getInputProps("email"))),n(h,Ge({grow:!0},{children:[e(A,Ge({label:"Given name",placeholder:"Given name"},a.getInputProps("givenName"))),e(A,Ge({label:"Family name",placeholder:"Family name"},a.getInputProps("familyName")))]})),e(b,Ge({type:"submit",fullWidth:!0,mt:"md"},{children:"Submit"}))]})}))]}))})),e(g,Ge({size:"lg",py:"xl"},{children:n(f,Ge({spacing:"md"},{children:[n(v,{children:[n(v.Col,Ge({sm:"auto"},{children:[e(C,Ge({variant:"filled",leftSection:e(k,Ge({onClick:o.onBackClick,color:"blue",size:"xs",radius:"xl",variant:"filled"},{children:e(_,{size:14})})),size:"lg"},{children:"Groups"})),e(l,Ge({order:2,className:r.title,mt:"md"},{children:o.name||"Group"})),e(c,Ge({color:"dimmed",className:r.description,mt:"sm"},{children:o.description||"No description"}))]})),e(v.Col,Ge({sm:"content"},{children:!o.loading&&e(b,Ge({onClick:function(){return s(!0)},leftIcon:e(re,{size:14})},{children:"Add people"}))}))]}),n("div",Ge({style:{position:"relative"}},{children:[e(x,{visible:o.loading,overlayBlur:2}),e(bn,{loading:o.loading,data:o.users,onDelete:o.onDelete,onChangeRole:o.onRoleChange,onViewProfile:function(e){return o.onViewProfile(e)}})]}))]}))}))]})},xn=function(i){var o=yn(),r=o.classes,a=o.theme,t=ve.useRef(null),l=ve.useState(!1),d=l[0],s=l[1],u=ve.useCallback((function(e){s(!0),e.forEach((function(e){ze.parse(e,{download:!0,header:!0,dynamicTyping:!0,skipEmptyLines:!0,worker:!0,complete:function(e){var n=e.data.filter((function(e){return/^\S+@\S+$/.test(e.email)&&0===i.users.filter((function(n){return n.email===e.email})).length}));n.length>0&&i.onCreateUsers&&i.onCreateUsers(n),s(!1),i.close()}})}))}),[]);return n("div",Ge({className:r.wrapper},{children:[e(Se,Ge({loading:d,openRef:t,onDrop:u,className:r.dropzone,radius:"md",accept:[xe.csv],maxSize:5*Math.pow(1024,2)},{children:n("div",Ge({style:{pointerEvents:"none"}},{children:[n(h,Ge({position:"center"},{children:[e(Se.Accept,{children:e(ae,{size:50,color:a.colors[a.primaryColor][6],stroke:1.5})}),e(Se.Reject,{children:e(te,{size:50,color:a.colors.red[6],stroke:1.5})}),e(Se.Idle,{children:e(le,{size:50,color:"dark"===a.colorScheme?a.colors.dark[0]:a.black,stroke:1.5})})]})),n(c,Ge({align:"center",weight:700,size:"lg",mt:"xl"},{children:[e(Se.Accept,{children:"Drop files here"}),e(Se.Reject,{children:"Csv file less than 5mb"}),e(Se.Idle,{children:"Upload multiple"})]})),n(c,Ge({align:"center",size:"sm",mt:"xs",color:"dimmed"},{children:["Drag'n'drop files here to upload. We can accept only ",e("i",{children:".csv"})," files that are less than 5mb in size."]}))]}))})),e(b,Ge({className:r.control,size:"md",radius:"xl",onClick:function(){var e;return null===(e=t.current)||void 0===e?void 0:e.call(t)}},{children:"Select file"}))]}))};function zn(i){if(0===i.data.length)return e(Ue,{loading:i.loading,data:{title:"No groups",icon:"groups",description:"You don't have any groups just yet. When your ready, get started by clicking the 'Create group' button above."}});var o=i.data.map((function(o){return n("tr",{children:[e("td",{children:e(c,Ge({size:14},{children:o.name}))}),e("td",{children:e(c,Ge({size:14},{children:o.description}))}),e("td",{children:n(h,Ge({noWrap:!0,spacing:0,position:"right"},{children:[e(k,Ge({color:"blue",onClick:function(){return i.onEditGroup&&i.onEditGroup(o)},variant:"subtle"},{children:e(ce,{size:16,stroke:1.5})})),n(P,Ge({transition:"pop",withArrow:!0,position:"bottom-end"},{children:[e(P.Target,{children:e(k,{children:e(de,{size:16,stroke:1.5})})}),e(P.Dropdown,{children:e(P.Item,Ge({onClick:function(){return j({title:'Delete "'.concat((n=o).name,'"?'),centered:!0,children:e(c,Ge({size:"sm"},{children:"Are you sure you want to delete this group? This action is destructive and you will have to contact support to restore your data."})),labels:{confirm:"Delete group",cancel:"No don't delete it"},confirmProps:{color:"red"},onConfirm:function(){return i.onDeleteGroup&&i.onDeleteGroup(n)}});var n},icon:e(oe,{size:16,stroke:1.5}),color:"red"},{children:"Delete"}))})]}))]}))})]},o.name)}));return e(m.Autosize,Ge({maxHeight:300},{children:n(p,Ge({verticalSpacing:20,sx:{minWidth:700}},{children:[e("thead",{children:n("tr",{children:[e("th",{children:"Name"}),e("th",{children:"Description"}),e("th",{})]})}),e("tbody",{children:o})]}))}))}var wn=t((function(e){var n;return{title:(n={fontSize:34,fontWeight:900},n[e.fn.smallerThan("sm")]={fontSize:24},n),description:{maxWidth:600}}})),En=function(o){var r=wn().classes,a=ye({initialValues:{key:"",name:"",description:""},validate:{name:function(e){return e.length<=6?"Name should include at least 6 characters":null}}}),t=be(!1),d=t[0],s=t[1];return o.group?e(Sn,Ge({},o.group,{onBackClick:o.onBackClick,onCreateUsers:o.onCreateGroupUsers,onDelete:o.onDeleteGroupUser,onViewProfile:o.onViewGroupUser,onRoleChange:o.onGroupUserRoleChange,onUserBackClick:o.onGroupUserBackClick,onTimelineScrollBottom:o.onTimelineScrollBottom})):n(i,{children:[e(G,Ge({opened:d,onClose:function(){return s(!1)},title:n(h,Ge({spacing:0},{children:[e(l,Ge({size:"h5"},{children:"Create a group"})),e(B,Ge({label:"Groups settings cannot be modified once created"},{children:e(k,{children:e(se,{color:"#3b82f6",size:14})})}))]})),padding:"xl",size:"xl"},{children:n("form",Ge({onSubmit:a.onSubmit((function(){var e=a.values;a.reset(),s(!1),o.onCreateGroup&&o.onCreateGroup(e)}))},{children:[n(f,{children:[e(A,Ge({withAsterisk:!0,label:"Name",placeholder:"Group name"},a.getInputProps("name"))),e(A,Ge({label:"Description",placeholder:"A group for my first period class"},a.getInputProps("description")))]}),e(b,Ge({type:"submit",fullWidth:!0,mt:"md"},{children:"Submit"}))]}))})),e(g,Ge({size:"lg",py:"xl"},{children:n(f,Ge({spacing:"md"},{children:[n(v,{children:[n(v.Col,Ge({sm:"auto"},{children:[e(C,Ge({variant:"filled",size:"lg"},{children:"Groups"})),e(l,Ge({order:2,className:r.title,mt:"md"},{children:"Organize people into groups"})),e(c,Ge({color:"dimmed",className:r.description,mt:"sm"},{children:"A group can be a class, team, or other functioning organizations."}))]})),e(v.Col,Ge({sm:"content"},{children:!o.loading&&e(b,Ge({onClick:function(){return s(!0)},leftIcon:e(re,{size:14})},{children:"Create group"}))}))]}),n("div",Ge({style:{position:"relative"}},{children:[e(x,{visible:o.loading,overlayBlur:2}),e(zn,{loading:o.loading,data:o.groups,onDeleteGroup:o.onDeleteGroup,onEditGroup:o.onEditGroup})]}))]}))}))]})},Nn=t((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}}})),Bn=function(i){var o=i.title,r=i.description,a=i.image,t=i.action,l=i.style,d=i.className,s=function(e,n){var i={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&n.indexOf(o)<0&&(i[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(o=Object.getOwnPropertySymbols(e);r<o.length;r++)n.indexOf(o[r])<0&&Object.prototype.propertyIsEnumerable.call(e,o[r])&&(i[o[r]]=e[o[r]])}return i}(i,["title","description","image","action","style","className"]),h=Nn(),u=h.classes,m=h.cx,p=h.theme;return n(R,Ge({radius:"md",style:Ge({backgroundImage:"url(".concat(a,")")},l),className:m(u.card,d)},s,{children:[e(M,{gradient:"linear-gradient(105deg, ".concat(p.black," 20%, #312f2f 50%, ").concat(p.colors.gray[4]," 100%)"),opacity:.55,zIndex:0}),n("div",Ge({className:u.content},{children:[e(c,Ge({size:"lg",weight:700,className:u.title},{children:o})),e(c,Ge({size:"sm",className:u.description},{children:r})),e(b,Ge({className:u.action,variant:"white",color:"dark",component:"a",size:"xs",href:t.link,target:"_blank"},{children:t.label}))]}))]}))},Dn=function(i){return e(g,Ge({size:"lg"},{children:n(f,Ge({spacing:"lg"},{children:[n(v,Ge({gutter:"md"},{children:[e(v.Col,Ge({md:6},{children:e(Cn,{data:i.user})})),e(v.Col,Ge({md:6},{children:e(Bn,{title:i.tenant.name,description:i.tenant.description,image:i.tenant.image,action:{label:"Visit website",link:i.tenant.website}})}))]})),e(fn,{data:[{title:"PROBLEMS SOLVED",value:i.stats["PROBLEMS SOLVED"].value,diff:i.stats["PROBLEMS SOLVED"].diff},{title:"LESSONS COMPLETED",value:i.stats["LESSONS COMPLETED"].value,diff:i.stats["LESSONS COMPLETED"].diff},{title:"BADGES EARNED",value:i.stats["BADGES EARNED"].value,diff:i.stats["BADGES EARNED"].diff}]}),e(mn,{onScrollBottom:i.onTimelineScrollBottom,data:i.timeline})]}))}))},Ln=t((function(e){return{header:{position:"sticky",top:0,backgroundColor:"dark"===e.colorScheme?e.colors.dark[7]:e.white,transition:"box-shadow 150ms ease","&::after":{content:'""',position:"absolute",left:0,right:0,bottom:0,borderBottom:"1px solid ".concat("dark"===e.colorScheme?e.colors.dark[3]:e.colors.gray[2])}},scrolled:{boxShadow:e.shadows.sm}}})),Tn=function(i){var o,r=i.data,a=Ln(),t=a.classes,l=a.cx,c=be(!1),d=c[0],s=c[1],h=r.map((function(e){return e.value})),u=Math.round(h.reduce((function(e,n){return e+n}))/h.length),g=r.map((function(i){return n("tr",{children:[e("td",{children:i.name}),e("td",{children:i.email}),e("td",{children:i.value}),e("td",{children:i.value>u?e(C,{children:"Above average"}):i.value===u?e(C,Ge({color:"gray"},{children:"Average"})):e(C,Ge({color:"red"},{children:"Below average"}))})]},i.name)}));return e(m,Ge({sx:{height:500},onScrollPositionChange:function(e){var n=e.y;return s(0!==n)}},{children:n(p,Ge({verticalSpacing:"md",sx:{minWidth:700}},{children:[e("thead",Ge({className:l(t.header,(o={},o[t.scrolled]=d,o))},{children:n("tr",{children:[e("th",{children:"Name"}),e("th",{children:"Email"}),e("th",{children:"Value"}),e("th",{children:"Status"})]})})),e("tbody",{children:g})]}))}))},On=function(i){return e(T,Ge({mih:150,p:"lg",withBorder:!0},{children:n(f,{children:[e(v,{children:e(v.Col,Ge({sm:"auto"},{children:n(h,Ge({spacing:0},{children:[e(l,Ge({size:"h5",mb:0},{children:"Performance History"})),e(B,Ge({label:"Shows group performance per person"},{children:e(k,{children:e(se,{color:"#3b82f6",size:14})})}))]}))}))}),e(h,Ge({spacing:"sm"},{children:e(S,{placeholder:"Select a metric",value:i.data.metric,onChange:i.onMetricChange,data:[{label:"PROBLEMS SOLVED",value:"PROBLEMS SOLVED"},{label:"LESSONS COMPLETED",value:"LESSONS COMPLETED"},{label:"BADGES EARNED",value:"BADGES EARNED"}]})})),e(Tn,{data:i.data.users})]})}))},Gn=t((function(e){return{axis:{fontSize:"12px",fontFamily:"Greycliff CF, ".concat(e.fontFamily)}}})),An=function(i){var o=Gn().theme;return e(T,Ge({p:"lg",withBorder:!0},{children:n(f,{children:[n(v,{children:[e(v.Col,Ge({sm:"auto"},{children:n(h,Ge({spacing:0},{children:[e(l,Ge({size:"h5",mb:0},{children:"Performance History"})),e(B,Ge({label:"Shows daily increase or decrease across group"},{children:e(k,{children:e(se,{color:"#3b82f6",size:14})})}))]}))})),e(v.Col,Ge({sm:5},{children:e(S,{placeholder:"Select a metric",value:i.data.metric,onChange:i.onMetricChange,data:[{label:"PROBLEMS SOLVED",value:"PROBLEMS SOLVED"},{label:"LESSONS COMPLETED",value:"LESSONS COMPLETED"},{label:"BADGES EARNED",value:"BADGES EARNED"}]})}))]}),e(Ee,Ge({width:"100%",height:400},{children:n(Ne,Ge({width:730,height:250,data:i.data.points,margin:{top:10,right:30,left:0,bottom:0}},{children:[e("defs",{children:n("linearGradient",Ge({id:"colorBlue",x1:"0",y1:"0",x2:"0",y2:"1"},{children:[e("stop",{offset:"5%",stopColor:"#3b82f6",stopOpacity:.4}),e("stop",{offset:"95%",stopColor:"#3b82f6",stopOpacity:0})]}))}),e(Be,{tick:{fontSize:12,fontFamily:o.fontFamily},dataKey:"name"}),e(De,{tick:{fontSize:12,fontFamily:o.fontFamily}}),e(Le,{strokeDasharray:"3 3",horizontal:!0,vertical:!1}),e(Te,{contentStyle:{fontWeight:700,fontSize:12,fontFamily:o.fontFamily},labelStyle:{fontSize:12,fontFamily:o.fontFamily}}),e(Oe,{type:"monotone",dataKey:"value",stroke:"#3b82f6",fillOpacity:1,fill:"url(#colorBlue)"})]}))}))]})}))},Pn=t((function(e){return{root:{paddingTop:1.5*e.spacing.xl,paddingBottom:1.5*e.spacing.xl},label:{fontFamily:"Greycliff CF, ".concat(e.fontFamily)}}})),Rn=function(i){var o=i.data,r=Pn().classes,a=o.map((function(i){var o=i.diff>0?he:ue;return n(T,Ge({withBorder:!0,p:"md",radius:"md"},{children:[n(h,Ge({position:"apart"},{children:[n("div",{children:[e(c,Ge({color:"dimmed",transform:"uppercase",weight:700,size:"xs",className:r.label},{children:i.title})),e(c,Ge({weight:700,size:"xl"},{children:i.value.toLocaleString()}))]}),e(W,Ge({color:"gray",variant:"light",sx:function(e){return{color:i.diff>0?e.colors.teal[6]:e.colors.red[6]}},size:38,radius:"md"},{children:e(o,{size:28,stroke:1.5})}))]})),n(c,Ge({color:"dimmed",size:"sm",mt:"md"},{children:[n(c,Ge({component:"span",color:i.diff>0?"teal":"red",weight:700},{children:[i.diff,"%"]}))," ",i.diff>0?"increase":"decrease"," compared to last period"]}))]}),i.title)}));return e("div",Ge({className:r.root},{children:e(U,Ge({cols:3,breakpoints:[{maxWidth:"sm",cols:1}]},{children:a}))}))},Mn=function(o){return n(i,{children:[e(Rn,{data:[{title:"PROBLEMS SOLVED",value:o.data.stats["PROBLEMS SOLVED"].value,diff:o.data.stats["PROBLEMS SOLVED"].diff},{title:"LESSONS COMPLETED",value:o.data.stats["LESSONS COMPLETED"].value,diff:o.data.stats["LESSONS COMPLETED"].diff},{title:"BADGES EARNED",value:o.data.stats["BADGES EARNED"].value,diff:o.data.stats["BADGES EARNED"].diff}]}),e(An,{data:o.data.areaChart,onMetricChange:o.onMetricChange})]})},Wn=[{value:"Overview"},{value:"Breakdown"}],Un=function(i){return e(g,Ge({size:"lg",py:"xl"},{children:n(f,{children:[n(v,{children:[n(v.Col,Ge({sm:"auto"},{children:[e(l,Ge({size:"h3"},{children:"Dashboard"})),e(c,Ge({color:"dimmed",size:"sm",mt:"md"},{children:"View core metrics on the state of your groups."}))]})),e(v.Col,Ge({sm:2.5},{children:e(S,{placeholder:"Select a group",nothingFound:"No options",value:i.group,onChange:i.onGroupChange,icon:e(Y,{}),data:i.groups.map((function(e){return e.name}))})})),e(v.Col,Ge({sm:"auto"},{children:e(we,{placeholder:"Select a date",allowSingleDateInRange:!0,value:i.dateRange,onChange:i.onDateRangeChange,icon:e(me,{size:16})})}))]}),n(f,{children:[e(Me,{data:Wn,value:i.tab,onChange:i.onTabChange}),n("div",Ge({style:{position:"relative"}},{children:[e(x,{visible:i.loading,overlayBlur:2}),e(Fn,Ge({},i,{active:i.tab,onBreakdownMetricChange:i.onBreakdownMetricChange,onOverviewMetricChange:i.onOverviewMetricChange}))]}))]})]})}))},Fn=function(n){if(0===n.overview.stats["PROBLEMS SOLVED"].value)return e(Ue,{loading:n.loading,data:{title:"No data for period",icon:"dashboard",description:"We haven't received any data yet for your group during this period. Check back later once progress has been made."}});switch(n.active){case"Overview":return e(Mn,{data:n.overview,onMetricChange:n.onOverviewMetricChange});case"Breakdown":return e(On,{data:n.breakdown,onMetricChange:n.onBreakdownMetricChange});default:return null}},Vn=t((function(e){var n,i,o,r,a,t;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:(o={display:"flex",justifyContent:"space-between"},o[e.fn.smallerThan("sm")]={flexDirection:"column",alignItems:"center"},o),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:(a={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])},a[e.fn.smallerThan("sm")]={flexDirection:"column"},a),social:(t={},t[e.fn.smallerThan("sm")]={marginTop:e.spacing.xs},t)}})),In=function(o){var r=Vn().classes,a=jn(o.account,o.onAccountChange),t=Hn(o.navbar.active,(function(e){if("Change account"===e)a.setChangeModalOpen(!0);o.onNavbarClick&&o.onNavbarClick(e)}));return n(F,Ge({padding:"xs",navbar:e(cn,{active:t.active,onClick:t.onClick},t.key),footer:e(i,{children:!a.opened&&n("footer",Ge({className:r.footer},{children:[n(g,Ge({className:r.inner},{children:[n("div",Ge({className:r.logo},{children:[n(h,Ge({spacing:"xs"},{children:[e("div",Ge({style:{width:15}},{children:e(d,{fit:"contain",src:"https://cdn.localcivics.io/brand/l.png"})})),e(l,Ge({color:"dimmed",size:"h5"},{children:"Local Civics"}))]})),e(c,Ge({size:"xs",color:"dimmed",className:r.description},{children:"We connect students to powerful civic learning experiences."}))]})),e("div",Ge({className:r.groups},{children:n("div",Ge({className:r.wrapper},{children:[e(c,Ge({className:r.link,component:"a",href:"https://www.localcivics.io",target:"_blank"},{children:"About"})),e(c,Ge({className:r.link,component:"a",href:"https://www.localcivics.io/terms-of-service",target:"_blank"},{children:"Terms"})),e(c,Ge({className:r.link,component:"a",href:"https://www.localcivics.io/privacy-policy",target:"_blank"},{children:"Privacy"})),e(c,Ge({className:r.link,component:"a",href:"https://localcivics.notion.site/Help-Center-b52300f587b64fc0a61f512686e7626d",target:"_blank"},{children:"FAQ"}))]}))}))]})),n(g,Ge({className:r.afterFooter},{children:[n(c,Ge({color:"dimmed",size:"sm"},{children:["© ",(new Date).getFullYear()," Local Civics. All rights reserved."]})),n(h,Ge({spacing:0,className:r.social,position:"right",noWrap:!0},{children:[e(k,Ge({component:"a",target:"_blank",href:"https://www.instagram.com/localcivics/",size:"lg"},{children:e(pe,{size:18,stroke:1.5})})),e(k,Ge({component:"a",target:"_blank",href:"https://www.linkedin.com/company/localcivics",size:"lg"},{children:e(ge,{size:18,stroke:1.5})})),e(k,Ge({component:"a",target:"_blank",href:"https://www.facebook.com/localcivics/",size:"lg"},{children:e(fe,{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",Ge({style:{position:"relative"}},{children:[(null===o.loading||a.opened)&&e(N,Ge({style:{height:400}},{children:e(V,{})})),null!==o.loading&&!a.opened&&e(_n,Ge({},o,{active:t.active}))]})),e(on,{opened:a.opened,data:a.data,onChange:a.onAccountChange,onClose:function(){return a.setChangeModalOpen(!1)}})]}))},jn=function(e,n){var i=be(!1),o=i[0],r=i[1],a=be(e.active),t=a[0],l=a[1];return{opened:o,data:Ge(Ge({},e),{active:t}),setChangeModalOpen:r,onAccountChange:function(e){l(e),r(!1),n&&n(e)}}},Hn=function(e,n){var i=be(e||"Home"),o=i[0],r=i[1];return{key:o,active:o,onClick:function(e){var i;o!==e&&(i=e,-1===ln.indexOf(i)&&r(e),n&&n(e))}}},_n=function(n){switch(n.active){case"Dashboard":return e(Un,Ge({},n.dashboard,{onBreakdownMetricChange:n.onDashboardBreakdownMetricChange,onDateRangeChange:n.onDashboardDateRangeChange,onGroupChange:n.onDashboardGroupChange,onOverviewMetricChange:n.onDashboardOverviewMetricChange,onTabChange:n.onDashboardTabChange}));case"Home":return e(Dn,Ge({},n.home,{onTimelineScrollBottom:n.onHomeTimelineScrollBottom}));case"Groups":return e(En,Ge({},n.groups,{onBackClick:n.onGroupBackClick,onCreateGroup:n.onCreateGroup,onCreateGroupUsers:n.onCreateGroupUsers,onDeleteGroup:n.onDeleteGroup,onDeleteGroupUser:n.onDeleteGroupUser,onEditGroup:n.onEditGroup,onViewGroupUser:n.onViewGroupUser,onGroupUserRoleChange:n.onGroupUserRoleChange,onGroupUserBackClick:n.onGroupUserBackClick,onTimelineScrollBottom:n.onGroupUserTimelineScrollBottom}));case"Lessons":return e(nn,Ge({},n.lessons,{onBackClick:n.onLessonBackClick,onAutocompleteChange:n.onLessonAutocompleteChange,onGroupChange:n.onLessonGroupChange,onLessonClick:n.onLessonClick,onPreview:n.onLessonPreview,onTabChange:n.onLessonTabChange,onUserClick:n.onLessonUserClick}));case"Badges":return e(Ke,Ge({},n.badges,{onBackClick:n.onBadgeBackClick,onAutocompleteChange:n.onBadgeAutocompleteChange,onGroupChange:n.onBadgeGroupChange,onBadgeClick:n.onBadgeClick,onPreview:n.onBadgePreview,onTabChange:n.onBadgeTabChange,onUserClick:n.onBadgeUserClick}));default:return null}};export{In as Mgmt,Re as MgmtProvider,on as SwitchAccount};
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- !function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("react/jsx-runtime"),require("@mantine/core"),require("@mantine/modals"),require("@mantine/notifications"),require("@tabler/icons"),require("react"),require("@mantine/form"),require("@mantine/dropzone"),require("papaparse"),require("@mantine/dates"),require("recharts")):"function"==typeof define&&define.amd?define(["exports","react/jsx-runtime","@mantine/core","@mantine/modals","@mantine/notifications","@tabler/icons","react","@mantine/form","@mantine/dropzone","papaparse","@mantine/dates","recharts"],n):n((e="undefined"!=typeof globalThis?globalThis:e||self).components={},e.ReactJSXRuntime,e.MantineCore,e.MantineModals,e.MantineNotifications,e.TablerIcons,e.React,e.MantineForm,e.MantineDropzone,e.Papaparse,e.MantineDates,e.Recharts)}(this,(function(e,n,t,a,i,o,r,l,s,c,d,u){"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 a=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(n,t,a.get?a:{enumerable:!0,get:function(){return e[t]}})}})),n.default=e,Object.freeze(n)}var m=h(r),x=h(c),p=function(){return p=Object.assign||function(e){for(var n,t=1,a=arguments.length;t<a;t++)for(var i in n=arguments[t])Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i]);return e},p.apply(this,arguments)};function g(e,n,t){if(t||2===arguments.length)for(var a,i=0,o=n.length;i<o;i++)!a&&i in n||(a||(a=Array.prototype.slice.call(n,0,i)),a[i]=n[i]);return e.concat(a||Array.prototype.slice.call(n))}var f=t.createEmotionCache({key:"mantine",prepend:!1}),j=function(e){var a,i=null===(a=e.data)||void 0===a?void 0:a.map((function(e){return n.jsx(t.Tabs.Tab,p({value:e.value},{children:e.label||e.value}),e.value)}));return n.jsx(t.Tabs,p({value:e.value,onTabChange:e.onChange},{children:n.jsx(t.Tabs.List,{children:i})}))},v=t.createStyles((function(e){var n,t,a;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:(a={paddingRight:4*e.spacing.xl},a["@media (max-width: ".concat(e.breakpoints.sm,"px)")]={paddingRight:0,marginTop:e.spacing.xl},a),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}}})),C=function(e){var a=v().classes;return n.jsxs("div",p({className:a.wrapper},{children:[n.jsxs("div",p({className:a.body},{children:[n.jsx(t.Title,p({className:a.title},{children:e.loading?"Loading...":e.data.title})),n.jsx(t.Text,p({size:"sm",color:"dimmed"},{children:e.loading?"We're loading your data.":e.data.description}))]})),n.jsx(t.Image,{src:"https://cdn.localcivics.io/illustrations/".concat(e.data.icon,".svg"),className:a.image})]}))};function S(e){if(0===e.data.length)return n.jsx(C,{loading:e.loading,data:{title:"No data for group",icon:"thinking",description:"You don't have any data for people in this group yet. Check back later or adjust your search."}});var a=e.data.map((function(a){return n.jsx("tr",{children:n.jsx("td",{children:n.jsx(t.UnstyledButton,p({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(a)}},{children:n.jsxs(t.Group,{children:[n.jsx(t.Avatar,{size:40,src:a.avatar,radius:40}),n.jsxs("div",{children:[n.jsx(t.Text,p({size:"sm",weight:500},{children:a.name})),n.jsx(t.Text,p({size:"xs",color:"dimmed"},{children:a.email}))]})]})}))})},a.name)}));return n.jsx(t.ScrollArea.Autosize,p({maxHeight:500},{children:n.jsx(t.Table,p({horizontalSpacing:0,verticalSpacing:0,sx:{minWidth:700}},{children:n.jsx("tbody",{children:a})}))}))}var b=[{value:"Complete"},{value:"Incomplete"}],y=t.createStyles((function(e){var n;return{title:(n={fontSize:34,fontWeight:900},n[e.fn.smallerThan("sm")]={fontSize:24},n),description:{maxWidth:600}}})),k=function(e){var a=T(e.data.groups,e.onGroupChange),i=w(e.data.tab,e.onTabChange),r=y().classes;return n.jsx(t.Container,p({size:"lg",py:"xl"},{children:n.jsxs(t.Stack,p({spacing:"md"},{children:[n.jsx(t.Grid,{children:n.jsxs(t.Grid.Col,p({sm:"auto"},{children:[n.jsx(t.Badge,p({variant:"filled",leftSection:n.jsx(t.ActionIcon,p({onClick:e.onBackClick,color:"blue",size:"xs",radius:"xl",variant:"filled"},{children:n.jsx(o.IconArrowLeft,{size:14})})),size:"lg"},{children:"Badges"})),n.jsxs(t.Group,{children:[n.jsxs(t.Stack,p({spacing:0},{children:[n.jsx(t.Title,p({order:2,className:r.title,mt:"md"},{children:e.data.name||"Badge"})),n.jsx(t.Text,p({color:"dimmed",className:r.description,mt:"sm"},{children:e.data.description||"No description"}))]})),n.jsxs(t.Stack,p({ml:"auto"},{children:[n.jsx(t.Button,p({variant:"gradient",onClick:function(){return e.onPreview&&e.onPreview(e.data)}},{children:"Preview"})),n.jsx(t.Divider,{label:"or",labelPosition:"center",my:"xs",variant:"dashed"}),n.jsx(t.Select,{size:"sm",placeholder:"Select a group",nothingFound:"No options",value:a.select,onChange:a.onSelectChange,icon:n.jsx(o.IconCategory2,{}),data:e.data.groups.map((function(e){return e.name}))})]}))]})]}))}),n.jsxs("div",{children:[n.jsx(j,{data:b,value:i.value,onChange:i.onChange}),n.jsxs("div",p({style:{position:"relative"}},{children:[n.jsx(t.LoadingOverlay,{visible:e.loading,overlayBlur:2}),n.jsx(S,{loading:e.loading,data:e.data.users,onClick:e.onUserClick})]}))]})]}))}))},T=function(e,n){var t=e.filter((function(e){return e.active})),a=m.useState(t.length>0?t[0].name:null),i=a[0],o=a[1];return{select:i,onSelectChange:function(e){o(e),n&&n(e)}}},w=function(e,n){var t=m.useState(e),a=t[0],i=t[1];return{value:a,onChange:function(e){i(e),n&&n(e)}}};function z(e){if(0===e.data.length)return n.jsx(C,{loading:e.loading,data:{title:"No badges available",icon:"badges",description:"Adjust your search or contact a representative if your expecting results."}});var a=e.data.map((function(a){return n.jsx("tr",{children:n.jsx("td",{children:n.jsx(t.UnstyledButton,p({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(a)}},{children:n.jsx(t.Group,{children:n.jsxs("div",{children:[n.jsx(t.Text,p({size:"sm",weight:500},{children:a.name})),n.jsx(t.Text,p({size:"xs",color:"dimmed"},{children:a.description}))]})})}))})},a.key)}));return n.jsx(t.ScrollArea.Autosize,p({maxHeight:500},{children:n.jsx(t.Table,p({horizontalSpacing:0,verticalSpacing:0,sx:{minWidth:700}},{children:n.jsx("tbody",{children:a})}))}))}var B=t.createStyles((function(e){var n;return{title:(n={fontSize:34,fontWeight:900},n[e.fn.smallerThan("sm")]={fontSize:24},n),description:{maxWidth:600}}})),E=function(e){var a=B().classes,i=r.useState(e.data.badgeOpen),o=i[0],l=i[1];return o?n.jsx(k,{loading:e.loading,data:e.data.badge,onBackClick:function(){return l(!1)},onGroupChange:e.onGroupChange,onTabChange:e.onTabChange,onUserClick:e.onUserClick,onPreview:e.onPreview}):n.jsx(t.Container,p({size:"lg",py:"xl"},{children:n.jsxs(t.Stack,p({spacing:"md"},{children:[n.jsx(t.Grid,{children:n.jsxs(t.Grid.Col,p({sm:"auto"},{children:[n.jsx(t.Badge,p({variant:"filled",size:"lg"},{children:"Badges"})),n.jsx(t.Title,p({order:2,className:a.title,mt:"md"},{children:"Badges and micro-credentials"})),n.jsx(t.Text,p({color:"dimmed",className:a.description,mt:"sm"},{children:"Project-sized skills acquisition and standards alignment."}))]}))}),n.jsx(t.Autocomplete,{placeholder:"Search for a badge that fits your needs",data:e.data.badges.map((function(e){return e.name})),onChange:e.onAutocompleteChange}),n.jsxs("div",p({style:{position:"relative"}},{children:[n.jsx(t.LoadingOverlay,{visible:e.loading,overlayBlur:2}),n.jsx(z,{loading:e.loading,data:e.data.badges,onClick:function(n){e.onBadgeClick&&e.onBadgeClick(n),l(!0)}})]}))]}))}))};function N(e){if(0===e.data.length)return n.jsx(C,{loading:e.loading,data:{title:"No data for group",icon:"thinking",description:"You don't have any data for people in this group yet. Check back later or adjust your search."}});var a=e.data.map((function(a){return n.jsx("tr",{children:n.jsx("td",{children:n.jsx(t.UnstyledButton,p({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(a)}},{children:n.jsxs(t.Group,{children:[n.jsx(t.Avatar,{size:40,src:a.avatar,radius:40}),n.jsxs("div",{children:[n.jsx(t.Text,p({size:"sm",weight:500},{children:a.name})),n.jsx(t.Text,p({size:"xs",color:"dimmed"},{children:a.email}))]})]})}))})},a.name)}));return n.jsx(t.ScrollArea.Autosize,p({maxHeight:500},{children:n.jsx(t.Table,p({horizontalSpacing:0,verticalSpacing:0,sx:{minWidth:700}},{children:n.jsx("tbody",{children:a})}))}))}var G=[{value:"Complete"},{value:"Incomplete"}],D=t.createStyles((function(e){var n;return{title:(n={fontSize:34,fontWeight:900},n[e.fn.smallerThan("sm")]={fontSize:24},n),description:{maxWidth:600}}})),A=function(e){var a=L(e.data.groups,e.onGroupChange),i=O(e.data.tab,e.onTabChange),r=D().classes;return n.jsx(t.Container,p({size:"lg",py:"xl"},{children:n.jsxs(t.Stack,p({spacing:"md"},{children:[n.jsx(t.Grid,{children:n.jsxs(t.Grid.Col,p({sm:"auto"},{children:[n.jsx(t.Badge,p({variant:"filled",leftSection:n.jsx(t.ActionIcon,p({onClick:e.onBackClick,color:"blue",size:"xs",radius:"xl",variant:"filled"},{children:n.jsx(o.IconArrowLeft,{size:14})})),size:"lg"},{children:"Lessons"})),n.jsxs(t.Group,{children:[n.jsxs(t.Stack,p({spacing:0},{children:[n.jsx(t.Title,p({order:2,className:r.title,mt:"md"},{children:e.data.name||"Lesson"})),n.jsx(t.Text,p({color:"dimmed",className:r.description,mt:"sm"},{children:e.data.description||"No description"}))]})),n.jsxs(t.Stack,p({ml:"auto"},{children:[n.jsx(t.Button,p({variant:"gradient",onClick:function(){return e.onPreview&&e.onPreview(e.data)}},{children:"Preview"})),n.jsx(t.Divider,{label:"or",labelPosition:"center",my:"xs",variant:"dashed"}),n.jsx(t.Select,{size:"sm",placeholder:"Select a group",nothingFound:"No options",value:a.select,onChange:a.onSelectChange,icon:n.jsx(o.IconCategory2,{}),data:e.data.groups.map((function(e){return e.name}))})]}))]})]}))}),n.jsxs("div",{children:[n.jsx(j,{data:G,value:i.value,onChange:i.onChange}),n.jsxs("div",p({style:{position:"relative"}},{children:[n.jsx(t.LoadingOverlay,{visible:e.loading,overlayBlur:2}),n.jsx(N,{loading:e.loading,data:e.data.users,onClick:e.onUserClick})]}))]})]}))}))},L=function(e,n){var t=e.filter((function(e){return e.active})),a=m.useState(t.length>0?t[0].name:null),i=a[0],o=a[1];return{select:i,onSelectChange:function(e){o(e),n&&n(e)}}},O=function(e,n){var t=m.useState(e),a=t[0],i=t[1];return{value:a,onChange:function(e){i(e),n&&n(e)}}};function I(e){if(0===e.data.length)return n.jsx(C,{loading:e.loading,data:{title:"No lessons available",icon:"lessons",description:"Adjust your search or contact a representative if your expecting results."}});var a=e.data.map((function(a){return n.jsx("tr",{children:n.jsx("td",{children:n.jsx(t.UnstyledButton,p({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(a)}},{children:n.jsx(t.Group,{children:n.jsxs("div",{children:[n.jsx(t.Text,p({size:"sm",weight:500},{children:a.name})),n.jsx(t.Text,p({size:"xs",color:"dimmed"},{children:a.description}))]})})}))})},a.key)}));return n.jsx(t.ScrollArea.Autosize,p({maxHeight:500},{children:n.jsx(t.Table,p({horizontalSpacing:0,verticalSpacing:0,sx:{minWidth:700}},{children:n.jsx("tbody",{children:a})}))}))}var P=t.createStyles((function(e){var n;return{title:(n={fontSize:34,fontWeight:900},n[e.fn.smallerThan("sm")]={fontSize:24},n),description:{maxWidth:600}}})),M=function(e){var a=P().classes,i=r.useState(e.data.lessonOpen),o=i[0],l=i[1];return o?n.jsx(A,{loading:e.loading,data:e.data.lesson,onBackClick:function(){return l(!1)},onGroupChange:e.onGroupChange,onTabChange:e.onTabChange,onUserClick:e.onUserClick,onPreview:e.onPreview}):n.jsx(t.Container,p({size:"lg",py:"xl"},{children:n.jsxs(t.Stack,p({spacing:"md"},{children:[n.jsx(t.Grid,{children:n.jsxs(t.Grid.Col,p({sm:"auto"},{children:[n.jsx(t.Badge,p({variant:"filled",size:"lg"},{children:"Lessons"})),n.jsx(t.Title,p({order:2,className:a.title,mt:"md"},{children:"Lessons"})),n.jsx(t.Text,p({color:"dimmed",className:a.description,mt:"sm"},{children:"Well crafted units of instruction."}))]}))}),n.jsx(t.Autocomplete,{placeholder:"Search for a lesson that fits your needs",data:e.data.lessons.map((function(e){return e.name})),onChange:e.onAutocompleteChange}),n.jsxs("div",p({style:{position:"relative"}},{children:[n.jsx(t.LoadingOverlay,{visible:e.loading,overlayBlur:2}),n.jsx(I,{loading:e.loading,data:e.data.lessons,onClick:function(n){e.onLessonClick&&e.onLessonClick(n),l(!0)}})]}))]}))}))},R=function(e){var a=l.useForm({initialValues:{active:e.data.active}});return n.jsx(t.Modal,p({centered:!0,opened:e.opened,onClose:function(){return e.onClose&&e.onClose()},size:"sm",title:n.jsx(t.Title,p({size:"h5"},{children:"Accounts"}))},{children:n.jsxs("form",p({onSubmit:a.onSubmit((function(){e.onChange&&e.onChange(a.values.active)}))},{children:[n.jsx(t.Select,p({required:!0,placeholder:"Select an account",defaultValue:e.data.active,data:e.data.accounts.map((function(e){return{value:e.key,label:e.name}}))},a.getInputProps("active"))),n.jsx(t.Button,p({type:"submit",fullWidth:!0,mt:"xl"},{children:"Switch"}))]}))}))},W=t.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}}}})),F=[{icon:o.IconHome2,label:"Home"},{icon:o.IconGauge,label:"Dashboard"},{icon:o.IconCategory2,label:"Groups"},{icon:o.IconAlbum,label:"Badges"},{icon:o.IconLambda,label:"Lessons"}],U=function(e){var a,i=e.icon,o=e.label,r=e.active,l=e.onClick,s=W(),c=s.classes,d=s.cx;return n.jsx(t.Tooltip,p({label:o,position:"right",transitionDuration:0},{children:n.jsx(t.UnstyledButton,p({onClick:l,className:d(c.link,(a={},a[c.active]=r,a))},{children:n.jsx(i,{stroke:1.5})}))}))},V=["Logout","Change account"],H=function(e){var a=F.map((function(n){return r.createElement(U,p({},n,{key:n.label,active:n.label===e.active,onClick:function(){return e.onClick&&e.onClick(n.label)}}))}));return n.jsxs(t.Navbar,p({width:{base:80},p:"md"},{children:[n.jsx(t.Center,{children:n.jsx(t.Avatar,p({color:"blue",radius:"sm"},{children:n.jsx("div",p({style:{width:15,marginLeft:"auto",marginRight:"auto"}},{children:n.jsx(t.Image,{fit:"contain",src:"https://cdn.localcivics.io/brand/l.png"})}))}))}),n.jsx(t.Navbar.Section,p({grow:!0,mt:50},{children:n.jsx(t.Stack,p({justify:"center",spacing:0},{children:a}))})),n.jsx(t.Navbar.Section,{children:n.jsxs(t.Stack,p({justify:"center",spacing:0},{children:[n.jsx(U,{icon:o.IconSwitchHorizontal,label:"Change account",onClick:function(){return e.onClick&&e.onClick("Change account")}}),n.jsx(U,{icon:o.IconLogout,label:"Logout",onClick:function(){return e.onClick&&e.onClick("Logout")}})]}))})]}))},q=[{unit:"year",ms:31536e6},{unit:"month",ms:2628e6},{unit:"day",ms:864e5},{unit:"hour",ms:36e5},{unit:"minute",ms:6e4},{unit:"second",ms:1e3}],_=new Intl.RelativeTimeFormat("en",{numeric:"auto"});function Y(e,n){return void 0===n&&(n=new Date),e?function(e){for(var n=0,t=q;n<t.length;n++){var a=t[n],i=a.unit,o=a.ms;if(Math.abs(e)>=o||"second"===i)return _.format(Math.round(e/o),i)}return""}(e.getTime()-n.getTime()):""}var X={BadgeCompleted:n.jsx(o.IconBadges,{size:12}),BadgeStarted:n.jsx(o.IconBadges,{size:12}),LessonCompleted:n.jsx(o.IconSchool,{size:12}),LessonStarted:n.jsx(o.IconSchool,{size:12}),ProblemSolved:n.jsx(o.IconActivityHeartbeat,{size:12})},K=function(e){var a,i=r.useRef(null),o=r.useState({x:0,y:0}),l=o[0],s=o[1];m.useEffect((function(){i.current&&l.y===i.current.scrollHeight-i.current.offsetHeight&&e.onScrollBottom&&e.onScrollBottom()}),[l.y]);var c=e.data.map((function(e){var i=e.name.split(/(?=[A-Z])/),o=i[0]===a?"dashed":"solid";a=i[0];var r=e.link?n.jsx(t.Anchor,p({color:"dark",unstyled:!0,href:e.link},{children:"".concat(i[0]," ").concat(i[1].toLowerCase())})):"".concat(i[0]," ").concat(i[1].toLowerCase());return n.jsxs(t.Timeline.Item,p({bullet:$(e.name),lineVariant:o,title:r},{children:[n.jsx(t.Text,p({color:"dimmed",size:"sm"},{children:e.description})),n.jsx(t.Text,p({size:"xs",mt:4},{children:Y(new Date(e.time))}))]}),e.key)}));return n.jsx(t.ScrollArea.Autosize,p({maxHeight:300,onScrollPositionChange:s,viewportRef:i},{children:n.jsx(t.Timeline,p({ml:"lg",active:1,bulletSize:24,lineWidth:2},{children:c}))}))},$=function(e){var t=X[e];return t||n.jsx(o.IconTimelineEvent,{size:12})},J=t.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)}}})),Q=function(e){var a=e.data,i=J().classes,o=a.map((function(e){return n.jsxs("div",p({className:i.stat},{children:[n.jsx(t.Text,p({className:i.count},{children:e.value.toLocaleString()})),n.jsx(t.Text,p({className:i.title},{children:e.title})),n.jsx(t.Text,p({className:i.description},{children:"".concat(e.diff,"% ").concat(e.diff<0?"decrease":"increase"," compared to last period")}))]}),e.title)}));return n.jsx("div",p({className:i.root},{children:o}))},Z=t.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}}})),ee=function(e){var a=Z().classes,i=e.data.givenName?[e.data.givenName,e.data.familyName].join(" ").trim():e.data.email,o=e.data.givenName?e.data.givenName:"Me";return"compact"===e.variant?n.jsxs(n.Fragment,{children:[n.jsx(t.Title,p({className:a.title},{children:i})),n.jsx(t.Text,p({color:"dimmed",className:a.description,mt:"xs"},{children:e.data.quote}))]}):n.jsxs(n.Fragment,{children:[n.jsxs(t.Paper,p({radius:"md",withBorder:!0,p:"lg",sx:function(e){return{backgroundColor:"dark"===e.colorScheme?e.colors.dark[8]:e.white}}},{children:[n.jsx(t.Avatar,{src:e.data.avatar,size:135,radius:120,mx:"auto"}),n.jsx(t.Text,p({align:"center",size:"lg",weight:500,mt:"md"},{children:i})),n.jsxs(t.Text,p({align:"center",color:"dimmed",size:"sm"},{children:[e.data.email," • ",e.data.job]}))]})),n.jsx(t.Blockquote,p({mt:"xl",color:"blue",cite:"– ".concat(o)},{children:e.data.quote}))]})},ne=[{value:"Member",label:"Member"},{value:"Admin",label:"Admin"}];function te(e){if(0===e.data.length)return n.jsx(C,{loading:e.loading,data:{title:"No one in group",icon:"thinking",description:"You don't have any people in this group yet. When your ready, get started by clicking the 'Add people' button above."}});var i=e.data.map((function(i){return n.jsxs("tr",{children:[n.jsx("td",{children:n.jsx(t.UnstyledButton,p({onClick:function(){return e.onViewProfile&&e.onViewProfile(i)}},{children:n.jsxs(t.Group,p({spacing:"sm"},{children:[n.jsx(t.Avatar,{size:40,src:i.avatar,radius:40}),n.jsxs("div",{children:[n.jsx(t.Text,p({size:"sm",weight:500},{children:i.givenName&&i.familyName?"".concat(i.givenName," ").concat(i.familyName):i.email})),n.jsx(t.Text,p({size:"xs",color:"dimmed"},{children:i.email}))]})]}))}))}),n.jsx("td",{children:n.jsx(t.Select,{data:g([],ne,!0).map((function(e){return i.readonly?p(p({},e),{disabled:e.value!==i.role}):e})),defaultValue:i.role,variant:"unstyled",onChange:function(n){return!i.readonly&&e.onChangeRole&&e.onChangeRole(i,n)}})}),n.jsx("td",{children:i.lastActivity?Y(i.lastActivity):""}),n.jsx("td",{children:n.jsx(t.Group,p({noWrap:!0,spacing:0,position:"right"},{children:!i.readonly&&n.jsx(t.ActionIcon,p({color:"red"},{children:n.jsx(o.IconTrash,{onClick:function(){return o=i,a.openConfirmModal({title:'Delete "'.concat(o.givenName&&o.familyName?"".concat(o.givenName," ").concat(o.familyName):o.email,'"?'),centered:!0,children:n.jsx(t.Text,p({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(o)}});var o},size:16,stroke:1.5})}))}))})]},i.email)}));return n.jsx(t.ScrollArea,{children:n.jsxs(t.Table,p({verticalSpacing:20,sx:{minWidth:700}},{children:[n.jsx("thead",{children:n.jsxs("tr",{children:[n.jsx("th",{children:"Member"}),n.jsx("th",{children:"Role"}),n.jsx("th",{children:"Last active"}),n.jsx("th",{})]})}),n.jsx("tbody",{children:i})]}))})}var ae=t.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}}})),ie=function(e){var a=ae().classes,i=l.useForm({initialValues:{key:"",email:"",givenName:"",familyName:"",avatar:"",role:"",readonly:!1,lastActivity:null},validate:{email:function(n){return/^\S+@\S+$/.test(n)&&0===e.data.users.filter((function(e){return e.email===n})).length?null:"Invalid email"}}}),s=r.useState(!1),c=s[0],d=s[1],u=r.useState(e.data.groupUserHomeOpen),h=u[0],m=u[1];return h?n.jsx(t.Container,p({size:"lg",py:"xl"},{children:n.jsxs(t.Stack,p({spacing:"md"},{children:[n.jsx(t.Grid,{children:n.jsxs(t.Grid.Col,p({sm:"auto"},{children:[n.jsx(t.Badge,p({variant:"filled",leftSection:n.jsx(t.ActionIcon,p({onClick:function(){return m(!1)},color:"blue",size:"xs",radius:"xl",variant:"filled"},{children:n.jsx(o.IconArrowLeft,{size:14})})),size:"lg"},{children:"Users"})),n.jsx(ee,{variant:"compact",data:e.data.user})]}))}),n.jsxs("div",p({style:{position:"relative"}},{children:[n.jsx(t.LoadingOverlay,{visible:e.loading,overlayBlur:2}),n.jsxs(t.Stack,p({spacing:"lg"},{children:[n.jsx(Q,{data:[{title:"PROBLEMS SOLVED",value:e.data.stats["PROBLEMS SOLVED"].value,diff:e.data.stats["PROBLEMS SOLVED"].diff},{title:"LESSONS COMPLETED",value:e.data.stats["LESSONS COMPLETED"].value,diff:e.data.stats["LESSONS COMPLETED"].diff},{title:"BADGES EARNED",value:e.data.stats["BADGES EARNED"].value,diff:e.data.stats["BADGES EARNED"].diff}]}),n.jsx(K,{onScrollBottom:e.onTimelineScrollBottom,data:e.data.timeline})]}))]}))]}))})):n.jsxs(n.Fragment,{children:[n.jsx(t.Drawer,p({opened:c,onClose:function(){return d(!1)},title:n.jsx(t.Title,p({size:"h5"},{children:"Add people"})),padding:"xl",size:"xl"},{children:n.jsxs(t.Stack,p({spacing:"md"},{children:[n.jsx(oe,p({},e,{close:function(){return d(!1)}})),n.jsx(t.Divider,{label:"or",labelPosition:"center",my:"md",variant:"dashed"}),n.jsx("form",p({onSubmit:i.onSubmit((function(){var n=i.values;i.reset(),d(!1),e.onCreateUsers&&e.onCreateUsers([n])}))},{children:n.jsxs(t.Stack,{children:[n.jsx(t.TextInput,p({withAsterisk:!0,label:"Email",placeholder:"Email"},i.getInputProps("email"))),n.jsxs(t.Group,p({grow:!0},{children:[n.jsx(t.TextInput,p({label:"Given name",placeholder:"Given name"},i.getInputProps("givenName"))),n.jsx(t.TextInput,p({label:"Family name",placeholder:"Family name"},i.getInputProps("familyName")))]})),n.jsx(t.Button,p({type:"submit",fullWidth:!0,mt:"md"},{children:"Submit"}))]})}))]}))})),n.jsx(t.Container,p({size:"lg",py:"xl"},{children:n.jsxs(t.Stack,p({spacing:"md"},{children:[n.jsxs(t.Grid,{children:[n.jsxs(t.Grid.Col,p({sm:"auto"},{children:[n.jsx(t.Badge,p({variant:"filled",leftSection:n.jsx(t.ActionIcon,p({onClick:e.onBackClick,color:"blue",size:"xs",radius:"xl",variant:"filled"},{children:n.jsx(o.IconArrowLeft,{size:14})})),size:"lg"},{children:"Groups"})),n.jsx(t.Title,p({order:2,className:a.title,mt:"md"},{children:e.data.name||"Group"})),n.jsx(t.Text,p({color:"dimmed",className:a.description,mt:"sm"},{children:e.data.description||"No description"}))]})),n.jsx(t.Grid.Col,p({sm:"content"},{children:!e.loading&&n.jsx(t.Button,p({onClick:function(){return d(!0)},leftIcon:n.jsx(o.IconPlaylistAdd,{size:14})},{children:"Add people"}))}))]}),n.jsxs("div",p({style:{position:"relative"}},{children:[n.jsx(t.LoadingOverlay,{visible:e.loading,overlayBlur:2}),n.jsx(te,{loading:e.loading,data:e.data.users,onDelete:e.onDelete,onChangeRole:e.onRoleChange,onViewProfile:function(n){return e.onViewProfile(n).then((function(){m(!0)}))}})]}))]}))}))]})},oe=function(e){var a=ae(),i=a.classes,r=a.theme,l=m.useRef(null),c=m.useState(!1),d=c[0],u=c[1],h=m.useCallback((function(n){u(!0),n.forEach((function(n){x.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.data.users.filter((function(e){return e.email===n.email})).length}));t.length>0&&e.onCreateUsers&&e.onCreateUsers(t),u(!1),e.close()}})}))}),[]);return n.jsxs("div",p({className:i.wrapper},{children:[n.jsx(s.Dropzone,p({loading:d,openRef:l,onDrop:h,className:i.dropzone,radius:"md",accept:[s.MIME_TYPES.csv],maxSize:5*Math.pow(1024,2)},{children:n.jsxs("div",p({style:{pointerEvents:"none"}},{children:[n.jsxs(t.Group,p({position:"center"},{children:[n.jsx(s.Dropzone.Accept,{children:n.jsx(o.IconDownload,{size:50,color:r.colors[r.primaryColor][6],stroke:1.5})}),n.jsx(s.Dropzone.Reject,{children:n.jsx(o.IconX,{size:50,color:r.colors.red[6],stroke:1.5})}),n.jsx(s.Dropzone.Idle,{children:n.jsx(o.IconCloudUpload,{size:50,color:"dark"===r.colorScheme?r.colors.dark[0]:r.black,stroke:1.5})})]})),n.jsxs(t.Text,p({align:"center",weight:700,size:"lg",mt:"xl"},{children:[n.jsx(s.Dropzone.Accept,{children:"Drop files here"}),n.jsx(s.Dropzone.Reject,{children:"Csv file less than 5mb"}),n.jsx(s.Dropzone.Idle,{children:"Upload multiple"})]})),n.jsxs(t.Text,p({align:"center",size:"sm",mt:"xs",color:"dimmed"},{children:["Drag'n'drop files here to upload. We can accept only ",n.jsx("i",{children:".csv"})," files that are less than 5mb in size."]}))]}))})),n.jsx(t.Button,p({className:i.control,size:"md",radius:"xl",onClick:function(){var e;return null===(e=l.current)||void 0===e?void 0:e.call(l)}},{children:"Select file"}))]}))};function re(e){if(0===e.data.length)return n.jsx(C,{loading:e.loading,data:{title:"No groups",icon:"groups",description:"You don't have any groups just yet. When your ready, get started by clicking the 'Create group' button above."}});var i=e.data.map((function(i){return n.jsxs("tr",{children:[n.jsx("td",{children:n.jsx(t.Text,p({size:14},{children:i.name}))}),n.jsx("td",{children:n.jsx(t.Text,p({size:14},{children:i.description}))}),n.jsx("td",{children:n.jsxs(t.Group,p({noWrap:!0,spacing:0,position:"right"},{children:[n.jsx(t.ActionIcon,p({color:"blue",onClick:function(){return e.onEditGroup&&e.onEditGroup(i)},variant:"subtle"},{children:n.jsx(o.IconUsers,{size:16,stroke:1.5})})),n.jsxs(t.Menu,p({transition:"pop",withArrow:!0,position:"bottom-end"},{children:[n.jsx(t.Menu.Target,{children:n.jsx(t.ActionIcon,{children:n.jsx(o.IconDots,{size:16,stroke:1.5})})}),n.jsx(t.Menu.Dropdown,{children:n.jsx(t.Menu.Item,p({onClick:function(){return o=i,a.openConfirmModal({title:'Delete "'.concat(o.name,'"?'),centered:!0,children:n.jsx(t.Text,p({size:"sm"},{children:"Are you sure you want to delete this group? This action is destructive and you will have to contact support to restore your data."})),labels:{confirm:"Delete group",cancel:"No don't delete it"},confirmProps:{color:"red"},onConfirm:function(){return e.onDeleteGroup&&e.onDeleteGroup(o)}});var o},icon:n.jsx(o.IconTrash,{size:16,stroke:1.5}),color:"red"},{children:"Delete"}))})]}))]}))})]},i.name)}));return n.jsx(t.ScrollArea.Autosize,p({maxHeight:300},{children:n.jsxs(t.Table,p({verticalSpacing:20,sx:{minWidth:700}},{children:[n.jsx("thead",{children:n.jsxs("tr",{children:[n.jsx("th",{children:"Name"}),n.jsx("th",{children:"Description"}),n.jsx("th",{})]})}),n.jsx("tbody",{children:i})]}))}))}var le=t.createStyles((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 a=le().classes,i=l.useForm({initialValues:{key:"",name:"",description:""},validate:{name:function(e){return e.length<=6?"Name should include at least 6 characters":null}}}),s=r.useState(e.data.formOpen),c=s[0],d=s[1],u=r.useState(e.data.groupOpen),h=u[0],m=u[1];return h?n.jsx(ie,{loading:e.loading,data:e.data.group,onBackClick:function(){return m(!1)},onCreateUsers:e.onCreateGroupUsers,onDelete:e.onDeleteGroupUser,onViewProfile:e.onViewGroupUser,onRoleChange:e.onGroupUserRoleChange,onTimelineScrollBottom:e.onTimelineScrollBottom}):n.jsxs(n.Fragment,{children:[n.jsx(t.Drawer,p({opened:c,onClose:function(){return d(!1)},title:n.jsxs(t.Group,p({spacing:0},{children:[n.jsx(t.Title,p({size:"h5"},{children:"Create a group"})),n.jsx(t.Tooltip,p({label:"Groups settings cannot be modified once created"},{children:n.jsx(t.ActionIcon,{children:n.jsx(o.IconInfoCircle,{color:"#3b82f6",size:14})})}))]})),padding:"xl",size:"xl"},{children:n.jsxs("form",p({onSubmit:i.onSubmit((function(){var n=i.values;i.reset(),d(!1),e.onCreateGroup&&e.onCreateGroup(n)}))},{children:[n.jsxs(t.Stack,{children:[n.jsx(t.TextInput,p({withAsterisk:!0,label:"Name",placeholder:"Group name"},i.getInputProps("name"))),n.jsx(t.TextInput,p({label:"Description",placeholder:"A group for my first period class"},i.getInputProps("description")))]}),n.jsx(t.Button,p({type:"submit",fullWidth:!0,mt:"md"},{children:"Submit"}))]}))})),n.jsx(t.Container,p({size:"lg",py:"xl"},{children:n.jsxs(t.Stack,p({spacing:"md"},{children:[n.jsxs(t.Grid,{children:[n.jsxs(t.Grid.Col,p({sm:"auto"},{children:[n.jsx(t.Badge,p({variant:"filled",size:"lg"},{children:"Groups"})),n.jsx(t.Title,p({order:2,className:a.title,mt:"md"},{children:"Organize people into groups"})),n.jsx(t.Text,p({color:"dimmed",className:a.description,mt:"sm"},{children:"A group can be a class, team, or other functioning organizations."}))]})),n.jsx(t.Grid.Col,p({sm:"content"},{children:!e.loading&&n.jsx(t.Button,p({onClick:function(){return d(!0)},leftIcon:n.jsx(o.IconPlaylistAdd,{size:14})},{children:"Create group"}))}))]}),n.jsxs("div",p({style:{position:"relative"}},{children:[n.jsx(t.LoadingOverlay,{visible:e.loading,overlayBlur:2}),n.jsx(re,{loading:e.loading,data:e.data.groups,onDeleteGroup:e.onDeleteGroup,onEditGroup:function(n){e.onEditGroup&&e.onEditGroup(n),m(!0)}})]}))]}))}))]})},ce=t.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}}})),de=function(e){var a=e.title,i=e.description,o=e.image,r=e.action,l=e.style,s=e.className,c=function(e,n){var t={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&n.indexOf(a)<0&&(t[a]=e[a]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(a=Object.getOwnPropertySymbols(e);i<a.length;i++)n.indexOf(a[i])<0&&Object.prototype.propertyIsEnumerable.call(e,a[i])&&(t[a[i]]=e[a[i]])}return t}(e,["title","description","image","action","style","className"]),d=ce(),u=d.classes,h=d.cx,m=d.theme;return n.jsxs(t.Card,p({radius:"md",style:p({backgroundImage:"url(".concat(o,")")},l),className:h(u.card,s)},c,{children:[n.jsx(t.Overlay,{gradient:"linear-gradient(105deg, ".concat(m.black," 20%, #312f2f 50%, ").concat(m.colors.gray[4]," 100%)"),opacity:.55,zIndex:0}),n.jsxs("div",p({className:u.content},{children:[n.jsx(t.Text,p({size:"lg",weight:700,className:u.title},{children:a})),n.jsx(t.Text,p({size:"sm",className:u.description},{children:i})),n.jsx(t.Button,p({className:u.action,variant:"white",color:"dark",component:"a",size:"xs",href:r.link,target:"_blank"},{children:r.label}))]}))]}))},ue=function(e){return n.jsx(t.Container,p({size:"lg"},{children:n.jsxs(t.Stack,p({spacing:"lg"},{children:[n.jsxs(t.Grid,p({gutter:"md"},{children:[n.jsx(t.Grid.Col,p({md:6},{children:n.jsx(ee,{data:e.data.user})})),n.jsx(t.Grid.Col,p({md:6},{children:n.jsx(de,{title:e.data.tenant.name,description:e.data.tenant.description,image:e.data.tenant.image,action:{label:"Visit website",link:e.data.tenant.website}})}))]})),n.jsx(Q,{data:[{title:"PROBLEMS SOLVED",value:e.data.stats["PROBLEMS SOLVED"].value,diff:e.data.stats["PROBLEMS SOLVED"].diff},{title:"LESSONS COMPLETED",value:e.data.stats["LESSONS COMPLETED"].value,diff:e.data.stats["LESSONS COMPLETED"].diff},{title:"BADGES EARNED",value:e.data.stats["BADGES EARNED"].value,diff:e.data.stats["BADGES EARNED"].diff}]}),n.jsx(K,{onScrollBottom:e.onTimelineScrollBottom,data:e.data.timeline})]}))}))},he=t.createStyles((function(e){return{header:{position:"sticky",top:0,backgroundColor:"dark"===e.colorScheme?e.colors.dark[7]:e.white,transition:"box-shadow 150ms ease","&::after":{content:'""',position:"absolute",left:0,right:0,bottom:0,borderBottom:"1px solid ".concat("dark"===e.colorScheme?e.colors.dark[3]:e.colors.gray[2])}},scrolled:{boxShadow:e.shadows.sm}}})),me=function(e){var a,i=e.data,o=he(),l=o.classes,s=o.cx,c=r.useState(!1),d=c[0],u=c[1],h=i.map((function(e){return e.value})),m=Math.round(h.reduce((function(e,n){return e+n}))/h.length),x=i.map((function(e){return n.jsxs("tr",{children:[n.jsx("td",{children:e.name}),n.jsx("td",{children:e.email}),n.jsx("td",{children:e.value}),n.jsx("td",{children:e.value>m?n.jsx(t.Badge,{children:"Above average"}):e.value===m?n.jsx(t.Badge,p({color:"gray"},{children:"Average"})):n.jsx(t.Badge,p({color:"red"},{children:"Below average"}))})]},e.name)}));return n.jsx(t.ScrollArea,p({sx:{height:500},onScrollPositionChange:function(e){var n=e.y;return u(0!==n)}},{children:n.jsxs(t.Table,p({verticalSpacing:"md",sx:{minWidth:700}},{children:[n.jsx("thead",p({className:s(l.header,(a={},a[l.scrolled]=d,a))},{children:n.jsxs("tr",{children:[n.jsx("th",{children:"Name"}),n.jsx("th",{children:"Email"}),n.jsx("th",{children:"Value"}),n.jsx("th",{children:"Status"})]})})),n.jsx("tbody",{children:x})]}))}))},xe=function(e){return n.jsx(t.Paper,p({mih:150,p:"lg",withBorder:!0},{children:n.jsxs(t.Stack,{children:[n.jsx(t.Grid,{children:n.jsx(t.Grid.Col,p({sm:"auto"},{children:n.jsxs(t.Group,p({spacing:0},{children:[n.jsx(t.Title,p({size:"h5",mb:0},{children:"Performance History"})),n.jsx(t.Tooltip,p({label:"Shows group performance per person"},{children:n.jsx(t.ActionIcon,{children:n.jsx(o.IconInfoCircle,{color:"#3b82f6",size:14})})}))]}))}))}),n.jsx(t.Group,p({spacing:"sm"},{children:n.jsx(t.Select,{placeholder:"Select a metric",value:e.data.metric,onChange:e.onMetricChange,data:[{label:"PROBLEMS SOLVED",value:"PROBLEMS SOLVED"},{label:"LESSONS COMPLETED",value:"LESSONS COMPLETED"},{label:"BADGES EARNED",value:"BADGES EARNED"}]})})),n.jsx(me,{data:e.data.users})]})}))},pe=t.createStyles((function(e){return{axis:{fontSize:"12px",fontFamily:"Greycliff CF, ".concat(e.fontFamily)}}})),ge=function(e){var a=pe().theme;return n.jsx(t.Paper,p({p:"lg",withBorder:!0},{children:n.jsxs(t.Stack,{children:[n.jsxs(t.Grid,{children:[n.jsx(t.Grid.Col,p({sm:"auto"},{children:n.jsxs(t.Group,p({spacing:0},{children:[n.jsx(t.Title,p({size:"h5",mb:0},{children:"Performance History"})),n.jsx(t.Tooltip,p({label:"Shows daily increase or decrease across group"},{children:n.jsx(t.ActionIcon,{children:n.jsx(o.IconInfoCircle,{color:"#3b82f6",size:14})})}))]}))})),n.jsx(t.Grid.Col,p({sm:5},{children:n.jsx(t.Select,{placeholder:"Select a metric",value:e.data.metric,onChange:e.onMetricChange,data:[{label:"PROBLEMS SOLVED",value:"PROBLEMS SOLVED"},{label:"LESSONS COMPLETED",value:"LESSONS COMPLETED"},{label:"BADGES EARNED",value:"BADGES EARNED"}]})}))]}),n.jsx(u.ResponsiveContainer,p({width:"100%",height:400},{children:n.jsxs(u.AreaChart,p({width:730,height:250,data:e.data.points,margin:{top:10,right:30,left:0,bottom:0}},{children:[n.jsx("defs",{children:n.jsxs("linearGradient",p({id:"colorBlue",x1:"0",y1:"0",x2:"0",y2:"1"},{children:[n.jsx("stop",{offset:"5%",stopColor:"#3b82f6",stopOpacity:.4}),n.jsx("stop",{offset:"95%",stopColor:"#3b82f6",stopOpacity:0})]}))}),n.jsx(u.XAxis,{tick:{fontSize:12,fontFamily:a.fontFamily},dataKey:"name"}),n.jsx(u.YAxis,{tick:{fontSize:12,fontFamily:a.fontFamily}}),n.jsx(u.CartesianGrid,{strokeDasharray:"3 3",horizontal:!0,vertical:!1}),n.jsx(u.Tooltip,{contentStyle:{fontWeight:700,fontSize:12,fontFamily:a.fontFamily},labelStyle:{fontSize:12,fontFamily:a.fontFamily}}),n.jsx(u.Area,{type:"monotone",dataKey:"value",stroke:"#3b82f6",fillOpacity:1,fill:"url(#colorBlue)"})]}))}))]})}))},fe=t.createStyles((function(e){return{root:{paddingTop:1.5*e.spacing.xl,paddingBottom:1.5*e.spacing.xl},label:{fontFamily:"Greycliff CF, ".concat(e.fontFamily)}}})),je=function(e){var a=e.data,i=fe().classes,r=a.map((function(e){var a=e.diff>0?o.IconArrowUpRight:o.IconArrowDownRight;return n.jsxs(t.Paper,p({withBorder:!0,p:"md",radius:"md"},{children:[n.jsxs(t.Group,p({position:"apart"},{children:[n.jsxs("div",{children:[n.jsx(t.Text,p({color:"dimmed",transform:"uppercase",weight:700,size:"xs",className:i.label},{children:e.title})),n.jsx(t.Text,p({weight:700,size:"xl"},{children:e.value.toLocaleString()}))]}),n.jsx(t.ThemeIcon,p({color:"gray",variant:"light",sx:function(n){return{color:e.diff>0?n.colors.teal[6]:n.colors.red[6]}},size:38,radius:"md"},{children:n.jsx(a,{size:28,stroke:1.5})}))]})),n.jsxs(t.Text,p({color:"dimmed",size:"sm",mt:"md"},{children:[n.jsxs(t.Text,p({component:"span",color:e.diff>0?"teal":"red",weight:700},{children:[e.diff,"%"]}))," ",e.diff>0?"increase":"decrease"," compared to last period"]}))]}),e.title)}));return n.jsx("div",p({className:i.root},{children:n.jsx(t.SimpleGrid,p({cols:3,breakpoints:[{maxWidth:"sm",cols:1}]},{children:r}))}))},ve=function(e){return n.jsxs(n.Fragment,{children:[n.jsx(je,{data:[{title:"PROBLEMS SOLVED",value:e.data.stats["PROBLEMS SOLVED"].value,diff:e.data.stats["PROBLEMS SOLVED"].diff},{title:"LESSONS COMPLETED",value:e.data.stats["LESSONS COMPLETED"].value,diff:e.data.stats["LESSONS COMPLETED"].diff},{title:"BADGES EARNED",value:e.data.stats["BADGES EARNED"].value,diff:e.data.stats["BADGES EARNED"].diff}]}),n.jsx(ge,{data:e.data.areaChart,onMetricChange:e.onMetricChange})]})},Ce=[{value:"Overview"},{value:"Breakdown"}],Se=function(e){var a=ye(e.data.breakdown,e.onBreakdownMetricChange),i=ke(e.data.dateRange,e.onDateRangeChange),r=Te(e.data.groups,e.onGroupChange),l=we(e.data.overview,e.onOverviewMetricChange),s=ze(e.data.tab,e.onTabChange);return n.jsx(t.Container,p({size:"lg",py:"xl"},{children:n.jsxs(t.Stack,{children:[n.jsxs(t.Grid,{children:[n.jsxs(t.Grid.Col,p({sm:"auto"},{children:[n.jsx(t.Title,p({size:"h3"},{children:"Dashboard"})),n.jsx(t.Text,p({color:"dimmed",size:"sm",mt:"md"},{children:"View core metrics on the state of your groups."}))]})),n.jsx(t.Grid.Col,p({sm:2.5},{children:n.jsx(t.Select,{placeholder:"Select a group",nothingFound:"No options",value:r.select,onChange:r.onSelectChange,icon:n.jsx(o.IconCategory2,{}),data:e.data.groups.map((function(e){return e.name}))})})),n.jsx(t.Grid.Col,p({sm:"auto"},{children:n.jsx(d.DateRangePicker,{placeholder:"Select a date",allowSingleDateInRange:!0,value:i.value,onChange:i.onChange,icon:n.jsx(o.IconCalendar,{size:16})})}))]}),n.jsxs(t.Stack,{children:[n.jsx(j,{data:Ce,value:s.value,onChange:s.onChange}),n.jsxs("div",p({style:{position:"relative"}},{children:[n.jsx(t.LoadingOverlay,{visible:e.loading,overlayBlur:2}),n.jsx(be,p({},e,{data:p(p({},e.data),{overview:l.data,breakdown:a.data}),active:s.value,onBreakdownMetricChange:a.onMetricChange,onOverviewMetricChange:l.onMetricChange}))]}))]})]})}))},be=function(e){if(0===e.data.overview.stats["PROBLEMS SOLVED"].value)return n.jsx(C,{loading:e.loading,data:{title:"No data for period",icon:"dashboard",description:"We haven't received any data yet for your group during this period. Check back later once progress has been made."}});switch(e.active){case"Overview":return n.jsx(ve,{data:e.data.overview,onMetricChange:e.onOverviewMetricChange});case"Breakdown":return n.jsx(xe,{data:e.data.breakdown,onMetricChange:e.onBreakdownMetricChange});default:return null}},ye=function(e,n){var t=m.useState(e.metric),a=t[0],i=t[1];return{data:p(p({},e),{metric:a}),onMetricChange:function(e){i(e),n&&n(e)}}},ke=function(e,n){var t=m.useState(e),a=t[0],i=t[1];return{value:a,onChange:function(e){i(e),n&&n(e)}}},Te=function(e,n){var t=e.filter((function(e){return e.active})),a=m.useState(t.length>0?t[0].name:null),i=a[0],o=a[1];return{select:i,onSelectChange:function(e){o(e),n&&n(e)}}},we=function(e,n){var t=m.useState(e.areaChart.metric),a=t[0],i=t[1];return{data:p(p({},e),{areaChart:p(p({},e.areaChart),{metric:a})}),onMetricChange:function(e){i(e),n&&n(e)}}},ze=function(e,n){var t=m.useState(e),a=t[0],i=t[1];return{value:a,onChange:function(e){i(e),n&&n(e)}}},Be=t.createStyles((function(e){var n,t,a,i,o,r;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:(a={display:"flex",justifyContent:"space-between"},a[e.fn.smallerThan("sm")]={flexDirection:"column",alignItems:"center"},a),groups:(i={display:"flex",flexWrap:"wrap"},i[e.fn.smallerThan("sm")]={display:"none"},i),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:(o={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])},o[e.fn.smallerThan("sm")]={flexDirection:"column"},o),social:(r={},r[e.fn.smallerThan("sm")]={marginTop:e.spacing.xs},r)}})),Ee=function(e,n){var t=r.useState(!1),a=t[0],i=t[1],o=r.useState(e.active),l=o[0],s=o[1];return{opened:a,data:p(p({},e),{active:l}),setChangeModalOpen:i,onAccountChange:function(e){s(e),i(!1),n&&n(e)}}},Ne=function(e,n){var t=r.useState(e||"Home"),a=t[0],i=t[1];return{key:a,active:a,onClick:function(e){var t;a!==e&&(t=e,-1===V.indexOf(t)&&i(e),n&&n(e))}}},Ge=function(e){switch(e.active){case"Dashboard":return n.jsx(Se,{loading:e.loading||!1,data:e.data.dashboard,onBreakdownMetricChange:e.onDashboardBreakdownMetricChange,onDateRangeChange:e.onDashboardDateRangeChange,onGroupChange:e.onDashboardGroupChange,onOverviewMetricChange:e.onDashboardOverviewMetricChange,onTabChange:e.onDashboardTabChange});case"Home":return n.jsx(ue,{data:e.data.home,onTimelineScrollBottom:e.onHomeTimelineScrollBottom});case"Groups":return n.jsx(se,{loading:e.loading||!1,data:e.data.groups,onCreateGroup:e.onCreateGroup,onCreateGroupUsers:e.onCreateGroupUsers,onDeleteGroup:e.onDeleteGroup,onDeleteGroupUser:e.onDeleteGroupUser,onEditGroup:e.onEditGroup,onViewGroupUser:e.onViewGroupUser,onGroupUserRoleChange:e.onGroupUserRoleChange,onTimelineScrollBottom:e.onGroupUserTimelineScrollBottom});case"Lessons":return n.jsx(M,{loading:e.loading||!1,data:e.data.lessons,onAutocompleteChange:e.onLessonAutocompleteChange,onGroupChange:e.onLessonGroupChange,onLessonClick:e.onLessonClick,onPreview:e.onLessonPreview,onTabChange:e.onLessonTabChange,onUserClick:e.onLessonUserClick});case"Badges":return n.jsx(E,{loading:e.loading||!1,data:e.data.badges,onAutocompleteChange:e.onBadgeAutocompleteChange,onGroupChange:e.onBadgeGroupChange,onBadgeClick:e.onBadgeClick,onPreview:e.onBadgePreview,onTabChange:e.onBadgeTabChange,onUserClick:e.onBadgeUserClick});default:return null}};Object.defineProperty(e,"showNotification",{enumerable:!0,get:function(){return i.showNotification}}),Object.defineProperty(e,"updateNotification",{enumerable:!0,get:function(){return i.updateNotification}}),e.Mgmt=function(e){var a=Be().classes,i=Ee(e.data.account,e.onAccountChange),r=Ne(e.data.navbar.active,(function(n){if("Change account"===n)i.setChangeModalOpen(!0);e.onNavbarClick&&e.onNavbarClick(n)}));return n.jsxs(t.AppShell,p({padding:"xs",navbar:n.jsx(H,{active:r.active,onClick:r.onClick},r.key),footer:n.jsx(n.Fragment,{children:!i.opened&&n.jsxs("footer",p({className:a.footer},{children:[n.jsxs(t.Container,p({className:a.inner},{children:[n.jsxs("div",p({className:a.logo},{children:[n.jsxs(t.Group,p({spacing:"xs"},{children:[n.jsx("div",p({style:{width:15}},{children:n.jsx(t.Image,{fit:"contain",src:"https://cdn.localcivics.io/brand/l.png"})})),n.jsx(t.Title,p({color:"dimmed",size:"h5"},{children:"Local Civics"}))]})),n.jsx(t.Text,p({size:"xs",color:"dimmed",className:a.description},{children:"We connect students to powerful civic learning experiences."}))]})),n.jsx("div",p({className:a.groups},{children:n.jsxs("div",p({className:a.wrapper},{children:[n.jsx(t.Text,p({className:a.link,component:"a",href:"https://www.localcivics.io",target:"_blank"},{children:"About"})),n.jsx(t.Text,p({className:a.link,component:"a",href:"https://www.localcivics.io/terms-of-service",target:"_blank"},{children:"Terms"})),n.jsx(t.Text,p({className:a.link,component:"a",href:"https://www.localcivics.io/privacy-policy",target:"_blank"},{children:"Privacy"})),n.jsx(t.Text,p({className:a.link,component:"a",href:"https://localcivics.notion.site/Help-Center-b52300f587b64fc0a61f512686e7626d",target:"_blank"},{children:"FAQ"}))]}))}))]})),n.jsxs(t.Container,p({className:a.afterFooter},{children:[n.jsxs(t.Text,p({color:"dimmed",size:"sm"},{children:["© ",(new Date).getFullYear()," Local Civics. All rights reserved."]})),n.jsxs(t.Group,p({spacing:0,className:a.social,position:"right",noWrap:!0},{children:[n.jsx(t.ActionIcon,p({component:"a",target:"_blank",href:"https://www.instagram.com/localcivics/",size:"lg"},{children:n.jsx(o.IconBrandInstagram,{size:18,stroke:1.5})})),n.jsx(t.ActionIcon,p({component:"a",target:"_blank",href:"https://www.linkedin.com/company/localcivics",size:"lg"},{children:n.jsx(o.IconBrandLinkedin,{size:18,stroke:1.5})})),n.jsx(t.ActionIcon,p({component:"a",target:"_blank",href:"https://www.facebook.com/localcivics/",size:"lg"},{children:n.jsx(o.IconBrandFacebook,{size:18,stroke:1.5})}))]}))]}))]}))}),styles:function(e){return{main:{backgroundColor:"dark"===e.colorScheme?e.colors.dark[8]:e.colors.gray[0]}}}},{children:[n.jsxs("div",p({style:{position:"relative"}},{children:[(void 0===e.loading||i.opened)&&n.jsx(t.Center,p({style:{height:400}},{children:n.jsx(t.Loader,{})})),void 0!==e.loading&&!i.opened&&n.jsx(Ge,p({},e,{active:r.active}))]})),n.jsx(R,{opened:i.opened,data:i.data,onChange:i.onAccountChange,onClose:function(){return i.setChangeModalOpen(!1)}})]}))},e.MgmtProvider=function(e){return n.jsx(t.MantineProvider,p({withNormalizeCSS:!0,withGlobalStyles:!0,emotionCache:f,theme:{loader:"bars"}},{children:n.jsx(i.NotificationsProvider,p({limit:e.notificationLimit||5},{children:n.jsx(a.ModalsProvider,{children:e.children})}))}))},e.SwitchAccount=R,Object.defineProperty(e,"__esModule",{value:!0})}));
1
+ !function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("react/jsx-runtime"),require("@mantine/core"),require("@mantine/modals"),require("@mantine/notifications"),require("@tabler/icons"),require("react"),require("@mantine/form"),require("@mantine/dropzone"),require("papaparse"),require("@mantine/dates"),require("recharts")):"function"==typeof define&&define.amd?define(["exports","react/jsx-runtime","@mantine/core","@mantine/modals","@mantine/notifications","@tabler/icons","react","@mantine/form","@mantine/dropzone","papaparse","@mantine/dates","recharts"],n):n((e="undefined"!=typeof globalThis?globalThis:e||self).components={},e.ReactJSXRuntime,e.MantineCore,e.MantineModals,e.MantineNotifications,e.TablerIcons,e.React,e.MantineForm,e.MantineDropzone,e.Papaparse,e.MantineDates,e.Recharts)}(this,(function(e,n,i,o,t,r,a,l,s,c,d,u){"use strict";function h(e){if(e&&e.__esModule)return e;var n=Object.create(null);return e&&Object.keys(e).forEach((function(i){if("default"!==i){var o=Object.getOwnPropertyDescriptor(e,i);Object.defineProperty(n,i,o.get?o:{enumerable:!0,get:function(){return e[i]}})}})),n.default=e,Object.freeze(n)}var m=h(a),x=h(c),p=function(){return p=Object.assign||function(e){for(var n,i=1,o=arguments.length;i<o;i++)for(var t in n=arguments[i])Object.prototype.hasOwnProperty.call(n,t)&&(e[t]=n[t]);return e},p.apply(this,arguments)};function g(e,n,i){if(i||2===arguments.length)for(var o,t=0,r=n.length;t<r;t++)!o&&t in n||(o||(o=Array.prototype.slice.call(n,0,t)),o[t]=n[t]);return e.concat(o||Array.prototype.slice.call(n))}var f=i.createEmotionCache({key:"mantine",prepend:!1}),j=function(e){var o,t=null===(o=e.data)||void 0===o?void 0:o.map((function(e){return n.jsx(i.Tabs.Tab,p({value:e.value},{children:e.label||e.value}),e.value)}));return n.jsx(i.Tabs,p({value:e.value,onTabChange:e.onChange},{children:n.jsx(i.Tabs.List,{children:t})}))},v=i.createStyles((function(e){var n,i,o;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:(o={paddingRight:4*e.spacing.xl},o["@media (max-width: ".concat(e.breakpoints.sm,"px)")]={paddingRight:0,marginTop:e.spacing.xl},o),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}}})),C=function(e){var o=v().classes;return n.jsxs("div",p({className:o.wrapper},{children:[n.jsxs("div",p({className:o.body},{children:[n.jsx(i.Title,p({className:o.title},{children:e.loading?"Loading...":e.data.title})),n.jsx(i.Text,p({size:"sm",color:"dimmed"},{children:e.loading?"We're loading your data.":e.data.description}))]})),n.jsx(i.Image,{src:"https://cdn.localcivics.io/illustrations/".concat(e.data.icon,".svg"),className:o.image})]}))};function k(e){if(0===e.data.length)return n.jsx(C,{loading:e.loading,data:{title:"No data for group",icon:"thinking",description:"You don't have any data for people in this group yet. Check back later or adjust your search."}});var o=e.data.map((function(o){return n.jsx("tr",{children:n.jsx("td",{children:n.jsx(i.UnstyledButton,p({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(o)}},{children:n.jsxs(i.Group,{children:[n.jsx(i.Avatar,{size:40,src:o.avatar,radius:40}),n.jsxs("div",{children:[n.jsx(i.Text,p({size:"sm",weight:500},{children:o.name})),n.jsx(i.Text,p({size:"xs",color:"dimmed"},{children:o.email}))]})]})}))})},o.name)}));return n.jsx(i.ScrollArea.Autosize,p({maxHeight:500},{children:n.jsx(i.Table,p({horizontalSpacing:0,verticalSpacing:0,sx:{minWidth:700}},{children:n.jsx("tbody",{children:o})}))}))}var b=[{value:"Complete"},{value:"Incomplete"}],S=i.createStyles((function(e){var n;return{title:(n={fontSize:34,fontWeight:900},n[e.fn.smallerThan("sm")]={fontSize:24},n),description:{maxWidth:600}}})),y=function(e){var o=T(e.groups,e.onGroupChange),t=w(e.tab,e.onTabChange),a=S().classes;return n.jsx(i.Container,p({size:"lg",py:"xl"},{children:n.jsxs(i.Stack,p({spacing:"md"},{children:[n.jsx(i.Grid,{children:n.jsxs(i.Grid.Col,p({sm:"auto"},{children:[n.jsx(i.Badge,p({variant:"filled",leftSection:n.jsx(i.ActionIcon,p({onClick:e.onBackClick,color:"blue",size:"xs",radius:"xl",variant:"filled"},{children:n.jsx(r.IconArrowLeft,{size:14})})),size:"lg"},{children:"Badges"})),n.jsxs(i.Group,{children:[n.jsxs(i.Stack,p({spacing:0},{children:[n.jsx(i.Title,p({order:2,className:a.title,mt:"md"},{children:e.name||"Badge"})),n.jsx(i.Text,p({color:"dimmed",className:a.description,mt:"sm"},{children:e.description||"No description"}))]})),n.jsxs(i.Stack,p({ml:"auto"},{children:[n.jsx(i.Button,p({variant:"gradient",onClick:function(){return e.onPreview(e.id)}},{children:"Preview"})),n.jsx(i.Divider,{label:"or",labelPosition:"center",my:"xs",variant:"dashed"}),n.jsx(i.Select,{size:"sm",placeholder:"Select a group",nothingFound:"No options",value:o.select,onChange:o.onSelectChange,icon:n.jsx(r.IconCategory2,{}),data:e.groups.map((function(e){return e.name}))})]}))]})]}))}),n.jsxs("div",{children:[n.jsx(j,{data:b,value:t.value,onChange:t.onChange}),n.jsxs("div",p({style:{position:"relative"}},{children:[n.jsx(i.LoadingOverlay,{visible:e.loading,overlayBlur:2}),n.jsx(k,{loading:e.loading,data:e.users,onClick:e.onUserClick})]}))]})]}))}))},T=function(e,n){var i=e.filter((function(e){return e.active})),o=m.useState(i.length>0?i[0].name:null),t=o[0],r=o[1];return{select:t,onSelectChange:function(e){r(e),n&&n(e)}}},w=function(e,n){var i=m.useState(e),o=i[0],t=i[1];return{value:o,onChange:function(e){t(e),n&&n(e)}}};function z(e){if(0===e.data.length)return n.jsx(C,{loading:e.loading,data:{title:"No badges available",icon:"badges",description:"Adjust your search or contact a representative if your expecting results."}});var o=e.data.map((function(o){return n.jsx("tr",{children:n.jsx("td",{children:n.jsx(i.UnstyledButton,p({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(o)}},{children:n.jsx(i.Group,{children:n.jsxs("div",{children:[n.jsx(i.Text,p({size:"sm",weight:500},{children:o.name})),n.jsx(i.Text,p({size:"xs",color:"dimmed"},{children:o.description}))]})})}))})},o.key)}));return n.jsx(i.ScrollArea.Autosize,p({maxHeight:500},{children:n.jsx(i.Table,p({horizontalSpacing:0,verticalSpacing:0,sx:{minWidth:700}},{children:n.jsx("tbody",{children:o})}))}))}var B=i.createStyles((function(e){var n;return{title:(n={fontSize:34,fontWeight:900},n[e.fn.smallerThan("sm")]={fontSize:24},n),description:{maxWidth:600}}})),E=function(e){var o=B().classes;return e.badge?n.jsx(y,p({},e.badge,{onBackClick:e.onBackClick,onGroupChange:e.onGroupChange,onTabChange:e.onTabChange,onUserClick:e.onUserClick,onPreview:e.onPreview})):n.jsx(i.Container,p({size:"lg",py:"xl"},{children:n.jsxs(i.Stack,p({spacing:"md"},{children:[n.jsx(i.Grid,{children:n.jsxs(i.Grid.Col,p({sm:"auto"},{children:[n.jsx(i.Badge,p({variant:"filled",size:"lg"},{children:"Badges"})),n.jsx(i.Title,p({order:2,className:o.title,mt:"md"},{children:"Badges and micro-credentials"})),n.jsx(i.Text,p({color:"dimmed",className:o.description,mt:"sm"},{children:"Project-sized skills acquisition and standards alignment."}))]}))}),n.jsx(i.Autocomplete,{placeholder:"Search for a badge that fits your needs",data:e.badges.map((function(e){return e.name})),onChange:e.onAutocompleteChange}),n.jsxs("div",p({style:{position:"relative"}},{children:[n.jsx(i.LoadingOverlay,{visible:e.loading,overlayBlur:2}),n.jsx(z,{loading:e.loading,data:e.badges,onClick:e.onBadgeClick})]}))]}))}))};function G(e){if(0===e.data.length)return n.jsx(C,{loading:e.loading,data:{title:"No data for group",icon:"thinking",description:"You don't have any data for people in this group yet. Check back later or adjust your search."}});var o=e.data.map((function(o){return n.jsx("tr",{children:n.jsx("td",{children:n.jsx(i.UnstyledButton,p({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(o)}},{children:n.jsxs(i.Group,{children:[n.jsx(i.Avatar,{size:40,src:o.avatar,radius:40}),n.jsxs("div",{children:[n.jsx(i.Text,p({size:"sm",weight:500},{children:o.name})),n.jsx(i.Text,p({size:"xs",color:"dimmed"},{children:o.email}))]})]})}))})},o.name)}));return n.jsx(i.ScrollArea.Autosize,p({maxHeight:500},{children:n.jsx(i.Table,p({horizontalSpacing:0,verticalSpacing:0,sx:{minWidth:700}},{children:n.jsx("tbody",{children:o})}))}))}var N=[{value:"Complete"},{value:"Incomplete"}],D=i.createStyles((function(e){var n;return{title:(n={fontSize:34,fontWeight:900},n[e.fn.smallerThan("sm")]={fontSize:24},n),description:{maxWidth:600}}})),A=function(e){var o=D().classes;return n.jsx(i.Container,p({size:"lg",py:"xl"},{children:n.jsxs(i.Stack,p({spacing:"md"},{children:[n.jsx(i.Grid,{children:n.jsxs(i.Grid.Col,p({sm:"auto"},{children:[n.jsx(i.Badge,p({variant:"filled",leftSection:n.jsx(i.ActionIcon,p({onClick:e.onBackClick,color:"blue",size:"xs",radius:"xl",variant:"filled"},{children:n.jsx(r.IconArrowLeft,{size:14})})),size:"lg"},{children:"Lessons"})),n.jsxs(i.Group,{children:[n.jsxs(i.Stack,p({spacing:0},{children:[n.jsx(i.Title,p({order:2,className:o.title,mt:"md"},{children:e.name||"Lesson"})),n.jsx(i.Text,p({color:"dimmed",className:o.description,mt:"sm"},{children:e.description||"No description"}))]})),n.jsxs(i.Stack,p({ml:"auto"},{children:[n.jsx(i.Button,p({variant:"gradient",onClick:function(){return e.onPreview&&e.onPreview(e.id)}},{children:"Preview"})),n.jsx(i.Divider,{label:"or",labelPosition:"center",my:"xs",variant:"dashed"}),n.jsx(i.Select,{size:"sm",placeholder:"Select a group",nothingFound:"No options",value:e.group,onChange:e.onGroupChange,icon:n.jsx(r.IconCategory2,{}),data:e.groups.map((function(e){return e.name}))})]}))]})]}))}),n.jsxs("div",{children:[n.jsx(j,{data:N,value:e.tab,onChange:e.onTabChange}),n.jsxs("div",p({style:{position:"relative"}},{children:[n.jsx(i.LoadingOverlay,{visible:e.loading,overlayBlur:2}),n.jsx(G,{loading:e.loading,data:e.users,onClick:e.onUserClick})]}))]})]}))}))};function L(e){if(0===e.data.length)return n.jsx(C,{loading:e.loading,data:{title:"No lessons available",icon:"lessons",description:"Adjust your search or contact a representative if your expecting results."}});var o=e.data.map((function(o){return n.jsx("tr",{children:n.jsx("td",{children:n.jsx(i.UnstyledButton,p({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(o)}},{children:n.jsx(i.Group,{children:n.jsxs("div",{children:[n.jsx(i.Text,p({size:"sm",weight:500},{children:o.name})),n.jsx(i.Text,p({size:"xs",color:"dimmed"},{children:o.description}))]})})}))})},o.key)}));return n.jsx(i.ScrollArea.Autosize,p({maxHeight:500},{children:n.jsx(i.Table,p({horizontalSpacing:0,verticalSpacing:0,sx:{minWidth:700}},{children:n.jsx("tbody",{children:o})}))}))}var O=i.createStyles((function(e){var n;return{title:(n={fontSize:34,fontWeight:900},n[e.fn.smallerThan("sm")]={fontSize:24},n),description:{maxWidth:600}}})),I=function(e){var o=O().classes;return e.lesson?n.jsx(A,p({},e.lesson,{onBackClick:e.onBackClick,onGroupChange:e.onGroupChange,onTabChange:e.onTabChange,onUserClick:e.onUserClick,onPreview:e.onPreview})):n.jsx(i.Container,p({size:"lg",py:"xl"},{children:n.jsxs(i.Stack,p({spacing:"md"},{children:[n.jsx(i.Grid,{children:n.jsxs(i.Grid.Col,p({sm:"auto"},{children:[n.jsx(i.Badge,p({variant:"filled",size:"lg"},{children:"Lessons"})),n.jsx(i.Title,p({order:2,className:o.title,mt:"md"},{children:"Lessons"})),n.jsx(i.Text,p({color:"dimmed",className:o.description,mt:"sm"},{children:"Well crafted units of instruction."}))]}))}),n.jsx(i.Autocomplete,{placeholder:"Search for a lesson that fits your needs",data:e.lessons.map((function(e){return e.name})),onChange:e.onAutocompleteChange}),n.jsxs("div",p({style:{position:"relative"}},{children:[n.jsx(i.LoadingOverlay,{visible:e.loading,overlayBlur:2}),n.jsx(L,{loading:e.loading,data:e.lessons,onClick:e.onLessonClick})]}))]}))}))},P=function(e){var o=l.useForm({initialValues:{active:e.data.active}});return n.jsx(i.Modal,p({centered:!0,opened:e.opened,onClose:function(){return e.onClose&&e.onClose()},size:"sm",title:n.jsx(i.Title,p({size:"h5"},{children:"Accounts"}))},{children:n.jsxs("form",p({onSubmit:o.onSubmit((function(){e.onChange&&e.onChange(o.values.active)}))},{children:[n.jsx(i.Select,p({required:!0,placeholder:"Select an account",defaultValue:e.data.active,data:e.data.accounts.map((function(e){return{value:e.key,label:e.name}}))},o.getInputProps("active"))),n.jsx(i.Button,p({type:"submit",fullWidth:!0,mt:"xl"},{children:"Switch"}))]}))}))},M=i.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}}}})),R=[{icon:r.IconHome2,label:"Home"},{icon:r.IconGauge,label:"Dashboard"},{icon:r.IconCategory2,label:"Groups"},{icon:r.IconAlbum,label:"Badges"},{icon:r.IconLambda,label:"Lessons"}],W=function(e){var o,t=e.icon,r=e.label,a=e.active,l=e.onClick,s=M(),c=s.classes,d=s.cx;return n.jsx(i.Tooltip,p({label:r,position:"right",transitionDuration:0},{children:n.jsx(i.UnstyledButton,p({onClick:l,className:d(c.link,(o={},o[c.active]=a,o))},{children:n.jsx(t,{stroke:1.5})}))}))},F=["Logout","Change account"],U=function(e){var o=R.map((function(n){return a.createElement(W,p({},n,{key:n.label,active:n.label===e.active,onClick:function(){return e.onClick&&e.onClick(n.label)}}))}));return n.jsxs(i.Navbar,p({width:{base:80},p:"md"},{children:[n.jsx(i.Center,{children:n.jsx(i.Avatar,p({color:"blue",radius:"sm"},{children:n.jsx("div",p({style:{width:15,marginLeft:"auto",marginRight:"auto"}},{children:n.jsx(i.Image,{fit:"contain",src:"https://cdn.localcivics.io/brand/l.png"})}))}))}),n.jsx(i.Navbar.Section,p({grow:!0,mt:50},{children:n.jsx(i.Stack,p({justify:"center",spacing:0},{children:o}))})),n.jsx(i.Navbar.Section,{children:n.jsxs(i.Stack,p({justify:"center",spacing:0},{children:[n.jsx(W,{icon:r.IconSwitchHorizontal,label:"Change account",onClick:function(){return e.onClick&&e.onClick("Change account")}}),n.jsx(W,{icon:r.IconLogout,label:"Logout",onClick:function(){return e.onClick&&e.onClick("Logout")}})]}))})]}))},V=[{unit:"year",ms:31536e6},{unit:"month",ms:2628e6},{unit:"day",ms:864e5},{unit:"hour",ms:36e5},{unit:"minute",ms:6e4},{unit:"second",ms:1e3}],H=new Intl.RelativeTimeFormat("en",{numeric:"auto"});function q(e,n){return void 0===n&&(n=new Date),e?function(e){for(var n=0,i=V;n<i.length;n++){var o=i[n],t=o.unit,r=o.ms;if(Math.abs(e)>=r||"second"===t)return H.format(Math.round(e/r),t)}return""}(e.getTime()-n.getTime()):""}var _={BadgeCompleted:n.jsx(r.IconBadges,{size:12}),BadgeStarted:n.jsx(r.IconBadges,{size:12}),LessonCompleted:n.jsx(r.IconSchool,{size:12}),LessonStarted:n.jsx(r.IconSchool,{size:12}),ProblemSolved:n.jsx(r.IconActivityHeartbeat,{size:12})},Y=function(e){var o,t=a.useRef(null),r=a.useState({x:0,y:0}),l=r[0],s=r[1];m.useEffect((function(){t.current&&l.y===t.current.scrollHeight-t.current.offsetHeight&&e.onScrollBottom&&e.onScrollBottom()}),[l.y]);var c=e.data.map((function(e){var t=e.name.split(/(?=[A-Z])/),r=t[0]===o?"dashed":"solid";o=t[0];var a=e.link?n.jsx(i.Anchor,p({color:"dark",unstyled:!0,href:e.link},{children:"".concat(t[0]," ").concat(t[1].toLowerCase())})):"".concat(t[0]," ").concat(t[1].toLowerCase());return n.jsxs(i.Timeline.Item,p({bullet:X(e.name),lineVariant:r,title:a},{children:[n.jsx(i.Text,p({color:"dimmed",size:"sm"},{children:e.description})),n.jsx(i.Text,p({size:"xs",mt:4},{children:q(new Date(e.time))}))]}),e.key)}));return n.jsx(i.ScrollArea.Autosize,p({maxHeight:300,onScrollPositionChange:s,viewportRef:t},{children:n.jsx(i.Timeline,p({ml:"lg",active:1,bulletSize:24,lineWidth:2},{children:c}))}))},X=function(e){var i=_[e];return i||n.jsx(r.IconTimelineEvent,{size:12})},K=i.createStyles((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)}}})),$=function(e){var o=e.data,t=K().classes,r=o.map((function(e){return n.jsxs("div",p({className:t.stat},{children:[n.jsx(i.Text,p({className:t.count},{children:e.value.toLocaleString()})),n.jsx(i.Text,p({className:t.title},{children:e.title})),n.jsx(i.Text,p({className:t.description},{children:"".concat(e.diff,"% ").concat(e.diff<0?"decrease":"increase"," compared to last period")}))]}),e.title)}));return n.jsx("div",p({className:t.root},{children:r}))},J=i.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}}})),Q=function(e){var o=J().classes,t=e.data.givenName?[e.data.givenName,e.data.familyName].join(" ").trim():e.data.email,r=e.data.givenName?e.data.givenName:"Me";return"compact"===e.variant?n.jsxs(n.Fragment,{children:[n.jsx(i.Title,p({className:o.title},{children:t})),n.jsx(i.Text,p({color:"dimmed",className:o.description,mt:"xs"},{children:e.data.quote}))]}):n.jsxs(n.Fragment,{children:[n.jsxs(i.Paper,p({radius:"md",withBorder:!0,p:"lg",sx:function(e){return{backgroundColor:"dark"===e.colorScheme?e.colors.dark[8]:e.white}}},{children:[n.jsx(i.Avatar,{src:e.data.avatar,size:135,radius:120,mx:"auto"}),n.jsx(i.Text,p({align:"center",size:"lg",weight:500,mt:"md"},{children:t})),n.jsxs(i.Text,p({align:"center",color:"dimmed",size:"sm"},{children:[e.data.email," • ",e.data.job]}))]})),n.jsx(i.Blockquote,p({mt:"xl",color:"blue",cite:"– ".concat(r)},{children:e.data.quote}))]})},Z=[{value:"Member",label:"Member"},{value:"Admin",label:"Admin"}];function ee(e){if(0===e.data.length)return n.jsx(C,{loading:e.loading,data:{title:"No one in group",icon:"thinking",description:"You don't have any people in this group yet. When your ready, get started by clicking the 'Add people' button above."}});var t=e.data.map((function(t){return n.jsxs("tr",{children:[n.jsx("td",{children:n.jsx(i.UnstyledButton,p({onClick:function(){return e.onViewProfile&&e.onViewProfile(t)}},{children:n.jsxs(i.Group,p({spacing:"sm"},{children:[n.jsx(i.Avatar,{size:40,src:t.avatar,radius:40}),n.jsxs("div",{children:[n.jsx(i.Text,p({size:"sm",weight:500},{children:t.givenName&&t.familyName?"".concat(t.givenName," ").concat(t.familyName):t.email})),n.jsx(i.Text,p({size:"xs",color:"dimmed"},{children:t.email}))]})]}))}))}),n.jsx("td",{children:n.jsx(i.Select,{data:g([],Z,!0).map((function(e){return t.readonly?p(p({},e),{disabled:e.value!==t.role}):e})),defaultValue:t.role,variant:"unstyled",onChange:function(n){return!t.readonly&&e.onChangeRole&&e.onChangeRole(t,n)}})}),n.jsx("td",{children:t.lastActivity?q(t.lastActivity):""}),n.jsx("td",{children:n.jsx(i.Group,p({noWrap:!0,spacing:0,position:"right"},{children:!t.readonly&&n.jsx(i.ActionIcon,p({color:"red"},{children:n.jsx(r.IconTrash,{onClick:function(){return r=t,o.openConfirmModal({title:'Delete "'.concat(r.givenName&&r.familyName?"".concat(r.givenName," ").concat(r.familyName):r.email,'"?'),centered:!0,children:n.jsx(i.Text,p({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(r)}});var r},size:16,stroke:1.5})}))}))})]},t.email)}));return n.jsx(i.ScrollArea,{children:n.jsxs(i.Table,p({verticalSpacing:20,sx:{minWidth:700}},{children:[n.jsx("thead",{children:n.jsxs("tr",{children:[n.jsx("th",{children:"Member"}),n.jsx("th",{children:"Role"}),n.jsx("th",{children:"Last active"}),n.jsx("th",{})]})}),n.jsx("tbody",{children:t})]}))})}var ne=i.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}}})),ie=function(e){var o=ne().classes,t=l.useForm({initialValues:{key:"",email:"",givenName:"",familyName:"",avatar:"",role:"",readonly:!1,lastActivity:null},validate:{email:function(n){return/^\S+@\S+$/.test(n)&&0===e.users.filter((function(e){return e.email===n})).length?null:"Invalid email"}}}),s=a.useState(!1),c=s[0],d=s[1];return e.user?n.jsx(i.Container,p({size:"lg",py:"xl"},{children:n.jsxs(i.Stack,p({spacing:"md"},{children:[n.jsx(i.Grid,{children:n.jsxs(i.Grid.Col,p({sm:"auto"},{children:[n.jsx(i.Badge,p({variant:"filled",leftSection:n.jsx(i.ActionIcon,p({onClick:e.onUserBackClick,color:"blue",size:"xs",radius:"xl",variant:"filled"},{children:n.jsx(r.IconArrowLeft,{size:14})})),size:"lg"},{children:"Users"})),n.jsx(Q,{variant:"compact",data:e.user})]}))}),n.jsxs("div",p({style:{position:"relative"}},{children:[n.jsx(i.LoadingOverlay,{visible:e.loading,overlayBlur:2}),n.jsxs(i.Stack,p({spacing:"lg"},{children:[n.jsx($,{data:[{title:"PROBLEMS SOLVED",value:e.stats["PROBLEMS SOLVED"].value,diff:e.stats["PROBLEMS SOLVED"].diff},{title:"LESSONS COMPLETED",value:e.stats["LESSONS COMPLETED"].value,diff:e.stats["LESSONS COMPLETED"].diff},{title:"BADGES EARNED",value:e.stats["BADGES EARNED"].value,diff:e.stats["BADGES EARNED"].diff}]}),n.jsx(Y,{onScrollBottom:e.onTimelineScrollBottom,data:e.timeline})]}))]}))]}))})):n.jsxs(n.Fragment,{children:[n.jsx(i.Drawer,p({opened:c,onClose:function(){return d(!1)},title:n.jsx(i.Title,p({size:"h5"},{children:"Add people"})),padding:"xl",size:"xl"},{children:n.jsxs(i.Stack,p({spacing:"md"},{children:[n.jsx(oe,p({},e,{close:function(){return d(!1)}})),n.jsx(i.Divider,{label:"or",labelPosition:"center",my:"md",variant:"dashed"}),n.jsx("form",p({onSubmit:t.onSubmit((function(){var n=t.values;t.reset(),d(!1),e.onCreateUsers&&e.onCreateUsers([n])}))},{children:n.jsxs(i.Stack,{children:[n.jsx(i.TextInput,p({withAsterisk:!0,label:"Email",placeholder:"Email"},t.getInputProps("email"))),n.jsxs(i.Group,p({grow:!0},{children:[n.jsx(i.TextInput,p({label:"Given name",placeholder:"Given name"},t.getInputProps("givenName"))),n.jsx(i.TextInput,p({label:"Family name",placeholder:"Family name"},t.getInputProps("familyName")))]})),n.jsx(i.Button,p({type:"submit",fullWidth:!0,mt:"md"},{children:"Submit"}))]})}))]}))})),n.jsx(i.Container,p({size:"lg",py:"xl"},{children:n.jsxs(i.Stack,p({spacing:"md"},{children:[n.jsxs(i.Grid,{children:[n.jsxs(i.Grid.Col,p({sm:"auto"},{children:[n.jsx(i.Badge,p({variant:"filled",leftSection:n.jsx(i.ActionIcon,p({onClick:e.onBackClick,color:"blue",size:"xs",radius:"xl",variant:"filled"},{children:n.jsx(r.IconArrowLeft,{size:14})})),size:"lg"},{children:"Groups"})),n.jsx(i.Title,p({order:2,className:o.title,mt:"md"},{children:e.name||"Group"})),n.jsx(i.Text,p({color:"dimmed",className:o.description,mt:"sm"},{children:e.description||"No description"}))]})),n.jsx(i.Grid.Col,p({sm:"content"},{children:!e.loading&&n.jsx(i.Button,p({onClick:function(){return d(!0)},leftIcon:n.jsx(r.IconPlaylistAdd,{size:14})},{children:"Add people"}))}))]}),n.jsxs("div",p({style:{position:"relative"}},{children:[n.jsx(i.LoadingOverlay,{visible:e.loading,overlayBlur:2}),n.jsx(ee,{loading:e.loading,data:e.users,onDelete:e.onDelete,onChangeRole:e.onRoleChange,onViewProfile:function(n){return e.onViewProfile(n)}})]}))]}))}))]})},oe=function(e){var o=ne(),t=o.classes,a=o.theme,l=m.useRef(null),c=m.useState(!1),d=c[0],u=c[1],h=m.useCallback((function(n){u(!0),n.forEach((function(n){x.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.users.filter((function(e){return e.email===n.email})).length}));i.length>0&&e.onCreateUsers&&e.onCreateUsers(i),u(!1),e.close()}})}))}),[]);return n.jsxs("div",p({className:t.wrapper},{children:[n.jsx(s.Dropzone,p({loading:d,openRef:l,onDrop:h,className:t.dropzone,radius:"md",accept:[s.MIME_TYPES.csv],maxSize:5*Math.pow(1024,2)},{children:n.jsxs("div",p({style:{pointerEvents:"none"}},{children:[n.jsxs(i.Group,p({position:"center"},{children:[n.jsx(s.Dropzone.Accept,{children:n.jsx(r.IconDownload,{size:50,color:a.colors[a.primaryColor][6],stroke:1.5})}),n.jsx(s.Dropzone.Reject,{children:n.jsx(r.IconX,{size:50,color:a.colors.red[6],stroke:1.5})}),n.jsx(s.Dropzone.Idle,{children:n.jsx(r.IconCloudUpload,{size:50,color:"dark"===a.colorScheme?a.colors.dark[0]:a.black,stroke:1.5})})]})),n.jsxs(i.Text,p({align:"center",weight:700,size:"lg",mt:"xl"},{children:[n.jsx(s.Dropzone.Accept,{children:"Drop files here"}),n.jsx(s.Dropzone.Reject,{children:"Csv file less than 5mb"}),n.jsx(s.Dropzone.Idle,{children:"Upload multiple"})]})),n.jsxs(i.Text,p({align:"center",size:"sm",mt:"xs",color:"dimmed"},{children:["Drag'n'drop files here to upload. We can accept only ",n.jsx("i",{children:".csv"})," files that are less than 5mb in size."]}))]}))})),n.jsx(i.Button,p({className:t.control,size:"md",radius:"xl",onClick:function(){var e;return null===(e=l.current)||void 0===e?void 0:e.call(l)}},{children:"Select file"}))]}))};function te(e){if(0===e.data.length)return n.jsx(C,{loading:e.loading,data:{title:"No groups",icon:"groups",description:"You don't have any groups just yet. When your ready, get started by clicking the 'Create group' button above."}});var t=e.data.map((function(t){return n.jsxs("tr",{children:[n.jsx("td",{children:n.jsx(i.Text,p({size:14},{children:t.name}))}),n.jsx("td",{children:n.jsx(i.Text,p({size:14},{children:t.description}))}),n.jsx("td",{children:n.jsxs(i.Group,p({noWrap:!0,spacing:0,position:"right"},{children:[n.jsx(i.ActionIcon,p({color:"blue",onClick:function(){return e.onEditGroup&&e.onEditGroup(t)},variant:"subtle"},{children:n.jsx(r.IconUsers,{size:16,stroke:1.5})})),n.jsxs(i.Menu,p({transition:"pop",withArrow:!0,position:"bottom-end"},{children:[n.jsx(i.Menu.Target,{children:n.jsx(i.ActionIcon,{children:n.jsx(r.IconDots,{size:16,stroke:1.5})})}),n.jsx(i.Menu.Dropdown,{children:n.jsx(i.Menu.Item,p({onClick:function(){return r=t,o.openConfirmModal({title:'Delete "'.concat(r.name,'"?'),centered:!0,children:n.jsx(i.Text,p({size:"sm"},{children:"Are you sure you want to delete this group? This action is destructive and you will have to contact support to restore your data."})),labels:{confirm:"Delete group",cancel:"No don't delete it"},confirmProps:{color:"red"},onConfirm:function(){return e.onDeleteGroup&&e.onDeleteGroup(r)}});var r},icon:n.jsx(r.IconTrash,{size:16,stroke:1.5}),color:"red"},{children:"Delete"}))})]}))]}))})]},t.name)}));return n.jsx(i.ScrollArea.Autosize,p({maxHeight:300},{children:n.jsxs(i.Table,p({verticalSpacing:20,sx:{minWidth:700}},{children:[n.jsx("thead",{children:n.jsxs("tr",{children:[n.jsx("th",{children:"Name"}),n.jsx("th",{children:"Description"}),n.jsx("th",{})]})}),n.jsx("tbody",{children:t})]}))}))}var re=i.createStyles((function(e){var n;return{title:(n={fontSize:34,fontWeight:900},n[e.fn.smallerThan("sm")]={fontSize:24},n),description:{maxWidth:600}}})),ae=function(e){var o=re().classes,t=l.useForm({initialValues:{key:"",name:"",description:""},validate:{name:function(e){return e.length<=6?"Name should include at least 6 characters":null}}}),s=a.useState(!1),c=s[0],d=s[1];return e.group?n.jsx(ie,p({},e.group,{onBackClick:e.onBackClick,onCreateUsers:e.onCreateGroupUsers,onDelete:e.onDeleteGroupUser,onViewProfile:e.onViewGroupUser,onRoleChange:e.onGroupUserRoleChange,onUserBackClick:e.onGroupUserBackClick,onTimelineScrollBottom:e.onTimelineScrollBottom})):n.jsxs(n.Fragment,{children:[n.jsx(i.Drawer,p({opened:c,onClose:function(){return d(!1)},title:n.jsxs(i.Group,p({spacing:0},{children:[n.jsx(i.Title,p({size:"h5"},{children:"Create a group"})),n.jsx(i.Tooltip,p({label:"Groups settings cannot be modified once created"},{children:n.jsx(i.ActionIcon,{children:n.jsx(r.IconInfoCircle,{color:"#3b82f6",size:14})})}))]})),padding:"xl",size:"xl"},{children:n.jsxs("form",p({onSubmit:t.onSubmit((function(){var n=t.values;t.reset(),d(!1),e.onCreateGroup&&e.onCreateGroup(n)}))},{children:[n.jsxs(i.Stack,{children:[n.jsx(i.TextInput,p({withAsterisk:!0,label:"Name",placeholder:"Group name"},t.getInputProps("name"))),n.jsx(i.TextInput,p({label:"Description",placeholder:"A group for my first period class"},t.getInputProps("description")))]}),n.jsx(i.Button,p({type:"submit",fullWidth:!0,mt:"md"},{children:"Submit"}))]}))})),n.jsx(i.Container,p({size:"lg",py:"xl"},{children:n.jsxs(i.Stack,p({spacing:"md"},{children:[n.jsxs(i.Grid,{children:[n.jsxs(i.Grid.Col,p({sm:"auto"},{children:[n.jsx(i.Badge,p({variant:"filled",size:"lg"},{children:"Groups"})),n.jsx(i.Title,p({order:2,className:o.title,mt:"md"},{children:"Organize people into groups"})),n.jsx(i.Text,p({color:"dimmed",className:o.description,mt:"sm"},{children:"A group can be a class, team, or other functioning organizations."}))]})),n.jsx(i.Grid.Col,p({sm:"content"},{children:!e.loading&&n.jsx(i.Button,p({onClick:function(){return d(!0)},leftIcon:n.jsx(r.IconPlaylistAdd,{size:14})},{children:"Create group"}))}))]}),n.jsxs("div",p({style:{position:"relative"}},{children:[n.jsx(i.LoadingOverlay,{visible:e.loading,overlayBlur:2}),n.jsx(te,{loading:e.loading,data:e.groups,onDeleteGroup:e.onDeleteGroup,onEditGroup:e.onEditGroup})]}))]}))}))]})},le=i.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}}})),se=function(e){var o=e.title,t=e.description,r=e.image,a=e.action,l=e.style,s=e.className,c=function(e,n){var i={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&n.indexOf(o)<0&&(i[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var t=0;for(o=Object.getOwnPropertySymbols(e);t<o.length;t++)n.indexOf(o[t])<0&&Object.prototype.propertyIsEnumerable.call(e,o[t])&&(i[o[t]]=e[o[t]])}return i}(e,["title","description","image","action","style","className"]),d=le(),u=d.classes,h=d.cx,m=d.theme;return n.jsxs(i.Card,p({radius:"md",style:p({backgroundImage:"url(".concat(r,")")},l),className:h(u.card,s)},c,{children:[n.jsx(i.Overlay,{gradient:"linear-gradient(105deg, ".concat(m.black," 20%, #312f2f 50%, ").concat(m.colors.gray[4]," 100%)"),opacity:.55,zIndex:0}),n.jsxs("div",p({className:u.content},{children:[n.jsx(i.Text,p({size:"lg",weight:700,className:u.title},{children:o})),n.jsx(i.Text,p({size:"sm",className:u.description},{children:t})),n.jsx(i.Button,p({className:u.action,variant:"white",color:"dark",component:"a",size:"xs",href:a.link,target:"_blank"},{children:a.label}))]}))]}))},ce=function(e){return n.jsx(i.Container,p({size:"lg"},{children:n.jsxs(i.Stack,p({spacing:"lg"},{children:[n.jsxs(i.Grid,p({gutter:"md"},{children:[n.jsx(i.Grid.Col,p({md:6},{children:n.jsx(Q,{data:e.user})})),n.jsx(i.Grid.Col,p({md:6},{children:n.jsx(se,{title:e.tenant.name,description:e.tenant.description,image:e.tenant.image,action:{label:"Visit website",link:e.tenant.website}})}))]})),n.jsx($,{data:[{title:"PROBLEMS SOLVED",value:e.stats["PROBLEMS SOLVED"].value,diff:e.stats["PROBLEMS SOLVED"].diff},{title:"LESSONS COMPLETED",value:e.stats["LESSONS COMPLETED"].value,diff:e.stats["LESSONS COMPLETED"].diff},{title:"BADGES EARNED",value:e.stats["BADGES EARNED"].value,diff:e.stats["BADGES EARNED"].diff}]}),n.jsx(Y,{onScrollBottom:e.onTimelineScrollBottom,data:e.timeline})]}))}))},de=i.createStyles((function(e){return{header:{position:"sticky",top:0,backgroundColor:"dark"===e.colorScheme?e.colors.dark[7]:e.white,transition:"box-shadow 150ms ease","&::after":{content:'""',position:"absolute",left:0,right:0,bottom:0,borderBottom:"1px solid ".concat("dark"===e.colorScheme?e.colors.dark[3]:e.colors.gray[2])}},scrolled:{boxShadow:e.shadows.sm}}})),ue=function(e){var o,t=e.data,r=de(),l=r.classes,s=r.cx,c=a.useState(!1),d=c[0],u=c[1],h=t.map((function(e){return e.value})),m=Math.round(h.reduce((function(e,n){return e+n}))/h.length),x=t.map((function(e){return n.jsxs("tr",{children:[n.jsx("td",{children:e.name}),n.jsx("td",{children:e.email}),n.jsx("td",{children:e.value}),n.jsx("td",{children:e.value>m?n.jsx(i.Badge,{children:"Above average"}):e.value===m?n.jsx(i.Badge,p({color:"gray"},{children:"Average"})):n.jsx(i.Badge,p({color:"red"},{children:"Below average"}))})]},e.name)}));return n.jsx(i.ScrollArea,p({sx:{height:500},onScrollPositionChange:function(e){var n=e.y;return u(0!==n)}},{children:n.jsxs(i.Table,p({verticalSpacing:"md",sx:{minWidth:700}},{children:[n.jsx("thead",p({className:s(l.header,(o={},o[l.scrolled]=d,o))},{children:n.jsxs("tr",{children:[n.jsx("th",{children:"Name"}),n.jsx("th",{children:"Email"}),n.jsx("th",{children:"Value"}),n.jsx("th",{children:"Status"})]})})),n.jsx("tbody",{children:x})]}))}))},he=function(e){return n.jsx(i.Paper,p({mih:150,p:"lg",withBorder:!0},{children:n.jsxs(i.Stack,{children:[n.jsx(i.Grid,{children:n.jsx(i.Grid.Col,p({sm:"auto"},{children:n.jsxs(i.Group,p({spacing:0},{children:[n.jsx(i.Title,p({size:"h5",mb:0},{children:"Performance History"})),n.jsx(i.Tooltip,p({label:"Shows group performance per person"},{children:n.jsx(i.ActionIcon,{children:n.jsx(r.IconInfoCircle,{color:"#3b82f6",size:14})})}))]}))}))}),n.jsx(i.Group,p({spacing:"sm"},{children:n.jsx(i.Select,{placeholder:"Select a metric",value:e.data.metric,onChange:e.onMetricChange,data:[{label:"PROBLEMS SOLVED",value:"PROBLEMS SOLVED"},{label:"LESSONS COMPLETED",value:"LESSONS COMPLETED"},{label:"BADGES EARNED",value:"BADGES EARNED"}]})})),n.jsx(ue,{data:e.data.users})]})}))},me=i.createStyles((function(e){return{axis:{fontSize:"12px",fontFamily:"Greycliff CF, ".concat(e.fontFamily)}}})),xe=function(e){var o=me().theme;return n.jsx(i.Paper,p({p:"lg",withBorder:!0},{children:n.jsxs(i.Stack,{children:[n.jsxs(i.Grid,{children:[n.jsx(i.Grid.Col,p({sm:"auto"},{children:n.jsxs(i.Group,p({spacing:0},{children:[n.jsx(i.Title,p({size:"h5",mb:0},{children:"Performance History"})),n.jsx(i.Tooltip,p({label:"Shows daily increase or decrease across group"},{children:n.jsx(i.ActionIcon,{children:n.jsx(r.IconInfoCircle,{color:"#3b82f6",size:14})})}))]}))})),n.jsx(i.Grid.Col,p({sm:5},{children:n.jsx(i.Select,{placeholder:"Select a metric",value:e.data.metric,onChange:e.onMetricChange,data:[{label:"PROBLEMS SOLVED",value:"PROBLEMS SOLVED"},{label:"LESSONS COMPLETED",value:"LESSONS COMPLETED"},{label:"BADGES EARNED",value:"BADGES EARNED"}]})}))]}),n.jsx(u.ResponsiveContainer,p({width:"100%",height:400},{children:n.jsxs(u.AreaChart,p({width:730,height:250,data:e.data.points,margin:{top:10,right:30,left:0,bottom:0}},{children:[n.jsx("defs",{children:n.jsxs("linearGradient",p({id:"colorBlue",x1:"0",y1:"0",x2:"0",y2:"1"},{children:[n.jsx("stop",{offset:"5%",stopColor:"#3b82f6",stopOpacity:.4}),n.jsx("stop",{offset:"95%",stopColor:"#3b82f6",stopOpacity:0})]}))}),n.jsx(u.XAxis,{tick:{fontSize:12,fontFamily:o.fontFamily},dataKey:"name"}),n.jsx(u.YAxis,{tick:{fontSize:12,fontFamily:o.fontFamily}}),n.jsx(u.CartesianGrid,{strokeDasharray:"3 3",horizontal:!0,vertical:!1}),n.jsx(u.Tooltip,{contentStyle:{fontWeight:700,fontSize:12,fontFamily:o.fontFamily},labelStyle:{fontSize:12,fontFamily:o.fontFamily}}),n.jsx(u.Area,{type:"monotone",dataKey:"value",stroke:"#3b82f6",fillOpacity:1,fill:"url(#colorBlue)"})]}))}))]})}))},pe=i.createStyles((function(e){return{root:{paddingTop:1.5*e.spacing.xl,paddingBottom:1.5*e.spacing.xl},label:{fontFamily:"Greycliff CF, ".concat(e.fontFamily)}}})),ge=function(e){var o=e.data,t=pe().classes,a=o.map((function(e){var o=e.diff>0?r.IconArrowUpRight:r.IconArrowDownRight;return n.jsxs(i.Paper,p({withBorder:!0,p:"md",radius:"md"},{children:[n.jsxs(i.Group,p({position:"apart"},{children:[n.jsxs("div",{children:[n.jsx(i.Text,p({color:"dimmed",transform:"uppercase",weight:700,size:"xs",className:t.label},{children:e.title})),n.jsx(i.Text,p({weight:700,size:"xl"},{children:e.value.toLocaleString()}))]}),n.jsx(i.ThemeIcon,p({color:"gray",variant:"light",sx:function(n){return{color:e.diff>0?n.colors.teal[6]:n.colors.red[6]}},size:38,radius:"md"},{children:n.jsx(o,{size:28,stroke:1.5})}))]})),n.jsxs(i.Text,p({color:"dimmed",size:"sm",mt:"md"},{children:[n.jsxs(i.Text,p({component:"span",color:e.diff>0?"teal":"red",weight:700},{children:[e.diff,"%"]}))," ",e.diff>0?"increase":"decrease"," compared to last period"]}))]}),e.title)}));return n.jsx("div",p({className:t.root},{children:n.jsx(i.SimpleGrid,p({cols:3,breakpoints:[{maxWidth:"sm",cols:1}]},{children:a}))}))},fe=function(e){return n.jsxs(n.Fragment,{children:[n.jsx(ge,{data:[{title:"PROBLEMS SOLVED",value:e.data.stats["PROBLEMS SOLVED"].value,diff:e.data.stats["PROBLEMS SOLVED"].diff},{title:"LESSONS COMPLETED",value:e.data.stats["LESSONS COMPLETED"].value,diff:e.data.stats["LESSONS COMPLETED"].diff},{title:"BADGES EARNED",value:e.data.stats["BADGES EARNED"].value,diff:e.data.stats["BADGES EARNED"].diff}]}),n.jsx(xe,{data:e.data.areaChart,onMetricChange:e.onMetricChange})]})},je=[{value:"Overview"},{value:"Breakdown"}],ve=function(e){return n.jsx(i.Container,p({size:"lg",py:"xl"},{children:n.jsxs(i.Stack,{children:[n.jsxs(i.Grid,{children:[n.jsxs(i.Grid.Col,p({sm:"auto"},{children:[n.jsx(i.Title,p({size:"h3"},{children:"Dashboard"})),n.jsx(i.Text,p({color:"dimmed",size:"sm",mt:"md"},{children:"View core metrics on the state of your groups."}))]})),n.jsx(i.Grid.Col,p({sm:2.5},{children:n.jsx(i.Select,{placeholder:"Select a group",nothingFound:"No options",value:e.group,onChange:e.onGroupChange,icon:n.jsx(r.IconCategory2,{}),data:e.groups.map((function(e){return e.name}))})})),n.jsx(i.Grid.Col,p({sm:"auto"},{children:n.jsx(d.DateRangePicker,{placeholder:"Select a date",allowSingleDateInRange:!0,value:e.dateRange,onChange:e.onDateRangeChange,icon:n.jsx(r.IconCalendar,{size:16})})}))]}),n.jsxs(i.Stack,{children:[n.jsx(j,{data:je,value:e.tab,onChange:e.onTabChange}),n.jsxs("div",p({style:{position:"relative"}},{children:[n.jsx(i.LoadingOverlay,{visible:e.loading,overlayBlur:2}),n.jsx(Ce,p({},e,{active:e.tab,onBreakdownMetricChange:e.onBreakdownMetricChange,onOverviewMetricChange:e.onOverviewMetricChange}))]}))]})]})}))},Ce=function(e){if(0===e.overview.stats["PROBLEMS SOLVED"].value)return n.jsx(C,{loading:e.loading,data:{title:"No data for period",icon:"dashboard",description:"We haven't received any data yet for your group during this period. Check back later once progress has been made."}});switch(e.active){case"Overview":return n.jsx(fe,{data:e.overview,onMetricChange:e.onOverviewMetricChange});case"Breakdown":return n.jsx(he,{data:e.breakdown,onMetricChange:e.onBreakdownMetricChange});default:return null}},ke=i.createStyles((function(e){var n,i,o,t,r,a;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:(o={display:"flex",justifyContent:"space-between"},o[e.fn.smallerThan("sm")]={flexDirection:"column",alignItems:"center"},o),groups:(t={display:"flex",flexWrap:"wrap"},t[e.fn.smallerThan("sm")]={display:"none"},t),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:(a={},a[e.fn.smallerThan("sm")]={marginTop:e.spacing.xs},a)}})),be=function(e,n){var i=a.useState(!1),o=i[0],t=i[1],r=a.useState(e.active),l=r[0],s=r[1];return{opened:o,data:p(p({},e),{active:l}),setChangeModalOpen:t,onAccountChange:function(e){s(e),t(!1),n&&n(e)}}},Se=function(e,n){var i=a.useState(e||"Home"),o=i[0],t=i[1];return{key:o,active:o,onClick:function(e){var i;o!==e&&(i=e,-1===F.indexOf(i)&&t(e),n&&n(e))}}},ye=function(e){switch(e.active){case"Dashboard":return n.jsx(ve,p({},e.dashboard,{onBreakdownMetricChange:e.onDashboardBreakdownMetricChange,onDateRangeChange:e.onDashboardDateRangeChange,onGroupChange:e.onDashboardGroupChange,onOverviewMetricChange:e.onDashboardOverviewMetricChange,onTabChange:e.onDashboardTabChange}));case"Home":return n.jsx(ce,p({},e.home,{onTimelineScrollBottom:e.onHomeTimelineScrollBottom}));case"Groups":return n.jsx(ae,p({},e.groups,{onBackClick:e.onGroupBackClick,onCreateGroup:e.onCreateGroup,onCreateGroupUsers:e.onCreateGroupUsers,onDeleteGroup:e.onDeleteGroup,onDeleteGroupUser:e.onDeleteGroupUser,onEditGroup:e.onEditGroup,onViewGroupUser:e.onViewGroupUser,onGroupUserRoleChange:e.onGroupUserRoleChange,onGroupUserBackClick:e.onGroupUserBackClick,onTimelineScrollBottom:e.onGroupUserTimelineScrollBottom}));case"Lessons":return n.jsx(I,p({},e.lessons,{onBackClick:e.onLessonBackClick,onAutocompleteChange:e.onLessonAutocompleteChange,onGroupChange:e.onLessonGroupChange,onLessonClick:e.onLessonClick,onPreview:e.onLessonPreview,onTabChange:e.onLessonTabChange,onUserClick:e.onLessonUserClick}));case"Badges":return n.jsx(E,p({},e.badges,{onBackClick:e.onBadgeBackClick,onAutocompleteChange:e.onBadgeAutocompleteChange,onGroupChange:e.onBadgeGroupChange,onBadgeClick:e.onBadgeClick,onPreview:e.onBadgePreview,onTabChange:e.onBadgeTabChange,onUserClick:e.onBadgeUserClick}));default:return null}};Object.defineProperty(e,"showNotification",{enumerable:!0,get:function(){return t.showNotification}}),Object.defineProperty(e,"updateNotification",{enumerable:!0,get:function(){return t.updateNotification}}),e.Mgmt=function(e){var o=ke().classes,t=be(e.account,e.onAccountChange),a=Se(e.navbar.active,(function(n){if("Change account"===n)t.setChangeModalOpen(!0);e.onNavbarClick&&e.onNavbarClick(n)}));return n.jsxs(i.AppShell,p({padding:"xs",navbar:n.jsx(U,{active:a.active,onClick:a.onClick},a.key),footer:n.jsx(n.Fragment,{children:!t.opened&&n.jsxs("footer",p({className:o.footer},{children:[n.jsxs(i.Container,p({className:o.inner},{children:[n.jsxs("div",p({className:o.logo},{children:[n.jsxs(i.Group,p({spacing:"xs"},{children:[n.jsx("div",p({style:{width:15}},{children:n.jsx(i.Image,{fit:"contain",src:"https://cdn.localcivics.io/brand/l.png"})})),n.jsx(i.Title,p({color:"dimmed",size:"h5"},{children:"Local Civics"}))]})),n.jsx(i.Text,p({size:"xs",color:"dimmed",className:o.description},{children:"We connect students to powerful civic learning experiences."}))]})),n.jsx("div",p({className:o.groups},{children:n.jsxs("div",p({className:o.wrapper},{children:[n.jsx(i.Text,p({className:o.link,component:"a",href:"https://www.localcivics.io",target:"_blank"},{children:"About"})),n.jsx(i.Text,p({className:o.link,component:"a",href:"https://www.localcivics.io/terms-of-service",target:"_blank"},{children:"Terms"})),n.jsx(i.Text,p({className:o.link,component:"a",href:"https://www.localcivics.io/privacy-policy",target:"_blank"},{children:"Privacy"})),n.jsx(i.Text,p({className:o.link,component:"a",href:"https://localcivics.notion.site/Help-Center-b52300f587b64fc0a61f512686e7626d",target:"_blank"},{children:"FAQ"}))]}))}))]})),n.jsxs(i.Container,p({className:o.afterFooter},{children:[n.jsxs(i.Text,p({color:"dimmed",size:"sm"},{children:["© ",(new Date).getFullYear()," Local Civics. All rights reserved."]})),n.jsxs(i.Group,p({spacing:0,className:o.social,position:"right",noWrap:!0},{children:[n.jsx(i.ActionIcon,p({component:"a",target:"_blank",href:"https://www.instagram.com/localcivics/",size:"lg"},{children:n.jsx(r.IconBrandInstagram,{size:18,stroke:1.5})})),n.jsx(i.ActionIcon,p({component:"a",target:"_blank",href:"https://www.linkedin.com/company/localcivics",size:"lg"},{children:n.jsx(r.IconBrandLinkedin,{size:18,stroke:1.5})})),n.jsx(i.ActionIcon,p({component:"a",target:"_blank",href:"https://www.facebook.com/localcivics/",size:"lg"},{children:n.jsx(r.IconBrandFacebook,{size:18,stroke:1.5})}))]}))]}))]}))}),styles:function(e){return{main:{backgroundColor:"dark"===e.colorScheme?e.colors.dark[8]:e.colors.gray[0]}}}},{children:[n.jsxs("div",p({style:{position:"relative"}},{children:[(null===e.loading||t.opened)&&n.jsx(i.Center,p({style:{height:400}},{children:n.jsx(i.Loader,{})})),null!==e.loading&&!t.opened&&n.jsx(ye,p({},e,{active:a.active}))]})),n.jsx(P,{opened:t.opened,data:t.data,onChange:t.onAccountChange,onClose:function(){return t.setChangeModalOpen(!1)}})]}))},e.MgmtProvider=function(e){return n.jsx(i.MantineProvider,p({withNormalizeCSS:!0,withGlobalStyles:!0,emotionCache:f,theme:{loader:"bars"}},{children:n.jsx(t.NotificationsProvider,p({limit:e.notificationLimit||5},{children:n.jsx(o.ModalsProvider,{children:e.children})}))}))},e.SwitchAccount=P,Object.defineProperty(e,"__esModule",{value:!0})}));
@@ -1,11 +1,12 @@
1
1
  /// <reference types="react" />
2
2
  import { TabsValue } from '@mantine/core';
3
- import { BadgeUserItem } from "./BadgeUserTable";
3
+ import { BadgeUserItem } from "./Table";
4
4
  /**
5
5
  * BadgeData
6
6
  */
7
- export interface BadgeData {
8
- key: string;
7
+ export type BadgeData = {
8
+ id: string;
9
+ loading: boolean;
9
10
  name: string;
10
11
  description: string;
11
12
  groups: {
@@ -14,19 +15,21 @@ export interface BadgeData {
14
15
  }[];
15
16
  tab: TabsValue;
16
17
  users: BadgeUserItem[];
17
- }
18
+ };
18
19
  /**
19
- * BadgeProps
20
+ * BadgeMethods
20
21
  */
21
- export interface BadgeProps {
22
- loading: boolean;
23
- data: BadgeData;
22
+ export type BadgeMethods = {
24
23
  onBackClick: () => void;
25
24
  onGroupChange: (next: string) => void;
26
- onPreview: (badge: BadgeData) => void;
27
- onTabChange: (next: TabsValue) => void;
28
- onUserClick: (user: BadgeUserItem) => void;
29
- }
25
+ onPreview: (id: string) => void;
26
+ onTabChange: (value: TabsValue) => void;
27
+ onUserClick: (item: BadgeUserItem) => void;
28
+ };
29
+ /**
30
+ * BadgeProps
31
+ */
32
+ export type BadgeProps = BadgeData & BadgeMethods;
30
33
  /**
31
34
  * Badge
32
35
  * @param props
@@ -0,0 +1,33 @@
1
+ /// <reference types="react" />
2
+ /**
3
+ * Item
4
+ */
5
+ export interface BadgeUserItem {
6
+ key: string;
7
+ avatar: string;
8
+ name: string;
9
+ email: string;
10
+ }
11
+ /**
12
+ * TableData
13
+ */
14
+ export type TableData = {
15
+ loading: boolean;
16
+ data: BadgeUserItem[];
17
+ };
18
+ /**
19
+ * TableMethods
20
+ */
21
+ export type TableMethods = {
22
+ onClick: (item: BadgeUserItem) => void;
23
+ };
24
+ /**
25
+ * TableProps
26
+ */
27
+ export type TableProps = TableData & TableMethods;
28
+ /**
29
+ * Table
30
+ * @constructor
31
+ * @param props
32
+ */
33
+ export declare function Table(props: TableProps): JSX.Element;
@@ -1,29 +1,23 @@
1
1
  /// <reference types="react" />
2
- import { TabsValue } from '@mantine/core';
3
- import { BadgeData } from "./Badge/Badge";
4
- import { BadgeUserItem } from "./Badge/BadgeUserTable";
5
- import { BadgeItem } from "./BadgeTable";
2
+ import { BadgeData, BadgeMethods } from "./Badge/Badge";
3
+ import { BadgeItem } from "./Table";
6
4
  /**
7
- * BadgesData
5
+ * BadgeData
8
6
  */
9
- export interface BadgesData {
10
- badge: BadgeData;
11
- badgeOpen: boolean;
7
+ export type BadgesData = {
8
+ loading: boolean;
12
9
  badges: BadgeItem[];
13
- }
10
+ badge: BadgeData | null;
11
+ };
12
+ export type BadgesMethods = BadgeMethods & {
13
+ onAutocompleteChange: (value: string) => void;
14
+ onGroupChange: (value: string) => void;
15
+ onBadgeClick: (item: BadgeItem) => void;
16
+ };
14
17
  /**
15
18
  * BadgesProps
16
19
  */
17
- export interface BadgesProps {
18
- loading: boolean;
19
- data: BadgesData;
20
- onAutocompleteChange: (next: string) => void;
21
- onGroupChange: (next: string) => void;
22
- onBadgeClick: (badge: BadgeItem) => void;
23
- onPreview: (badge: BadgeItem) => void;
24
- onTabChange: (tab: TabsValue) => void;
25
- onUserClick: (user: BadgeUserItem) => void;
26
- }
20
+ export type BadgesProps = BadgesData & BadgesMethods;
27
21
  /**
28
22
  * Badges
29
23
  * @param props
@@ -8,16 +8,25 @@ export interface BadgeItem {
8
8
  description: string;
9
9
  }
10
10
  /**
11
- * BadgeTableProps
11
+ * TableData
12
12
  */
13
- export interface BadgeTableProps {
13
+ export type TableData = {
14
14
  loading: boolean;
15
15
  data: BadgeItem[];
16
+ };
17
+ /**
18
+ * TableMethods
19
+ */
20
+ export type TableMethods = {
16
21
  onClick: (badge: BadgeItem) => void;
17
- }
22
+ };
23
+ /**
24
+ * TableProps
25
+ */
26
+ export type TableProps = TableData & TableMethods;
18
27
  /**
19
- * BadgeTable
28
+ * Table
20
29
  * @param props
21
30
  * @constructor
22
31
  */
23
- export declare function BadgeTable(props: BadgeTableProps): JSX.Element;
32
+ export declare function Table(props: TableProps): JSX.Element;
@@ -0,0 +1,21 @@
1
+ /// <reference types="react" />
2
+ /**
3
+ * Item
4
+ */
5
+ export interface Item {
6
+ name: string;
7
+ email: string;
8
+ value: number;
9
+ }
10
+ /**
11
+ * TableProps
12
+ */
13
+ export interface TableProps {
14
+ data: Item[];
15
+ }
16
+ /**
17
+ * Table
18
+ * @param data
19
+ * @constructor
20
+ */
21
+ export declare const Table: ({ data }: TableProps) => JSX.Element;
@@ -6,28 +6,32 @@ import { OverviewData } from "./Overview/Overview";
6
6
  /**
7
7
  * DashboardData
8
8
  */
9
- export interface DashboardData {
9
+ export type DashboardData = {
10
+ loading: boolean;
10
11
  dateRange: DateRangePickerValue;
11
12
  overview: OverviewData;
12
13
  breakdown: BreakdownData;
14
+ group: string;
13
15
  groups: {
14
16
  name: string;
15
17
  active?: boolean;
16
18
  }[];
17
19
  tab: TabsValue;
18
- }
20
+ };
19
21
  /**
20
- * DashboardProps
22
+ * DashboardMethods
21
23
  */
22
- export interface DashboardProps {
23
- loading: boolean;
24
- data: DashboardData;
24
+ export type DashboardMethods = {
25
25
  onBreakdownMetricChange: (next: string) => void;
26
26
  onDateRangeChange: (next: DateRangePickerValue) => void;
27
27
  onGroupChange: (next: string) => void;
28
28
  onOverviewMetricChange: (next: string) => void;
29
29
  onTabChange: (next: TabsValue) => void;
30
- }
30
+ };
31
+ /**
32
+ * DashboardProps
33
+ */
34
+ export type DashboardProps = DashboardData & DashboardMethods;
31
35
  /**
32
36
  * Dashboard
33
37
  * @param props
@@ -3,10 +3,11 @@ import { GroupUserItem } from "./GroupUserTable";
3
3
  /**
4
4
  * GroupData
5
5
  */
6
- export interface GroupData {
6
+ export type GroupData = {
7
+ id: string;
8
+ loading: boolean;
7
9
  description: string;
8
10
  name: string;
9
- groupUserHomeOpen: boolean;
10
11
  user: {
11
12
  avatar: string;
12
13
  givenName: string;
@@ -14,7 +15,7 @@ export interface GroupData {
14
15
  email: string;
15
16
  job: string;
16
17
  quote: string;
17
- };
18
+ } | null;
18
19
  tenant: {
19
20
  name: string;
20
21
  description: string;
@@ -43,20 +44,23 @@ export interface GroupData {
43
44
  time: string;
44
45
  }[];
45
46
  users: GroupUserItem[];
46
- }
47
+ };
47
48
  /**
48
- * GroupProps
49
+ * GroupMethods
49
50
  */
50
- export interface GroupProps {
51
- loading: boolean;
52
- data: GroupData;
51
+ export type GroupMethods = {
53
52
  onBackClick: () => void;
54
53
  onCreateUsers: (users: GroupUserItem[]) => void;
55
54
  onDelete: (user: GroupUserItem) => void;
56
55
  onRoleChange: (user: GroupUserItem, role: string | null) => void;
57
- onViewProfile: (user: GroupUserItem) => Promise<void>;
56
+ onViewProfile: (user: GroupUserItem) => void;
58
57
  onTimelineScrollBottom: () => void;
59
- }
58
+ onUserBackClick: () => void;
59
+ };
60
+ /**
61
+ * GroupProps
62
+ */
63
+ export type GroupProps = GroupData & GroupMethods;
60
64
  /**
61
65
  * Group
62
66
  * @param props
@@ -5,27 +5,30 @@ import { GroupStackItem } from "./GroupsStack";
5
5
  /**
6
6
  * GroupsData
7
7
  */
8
- export interface GroupsData {
9
- formOpen: boolean;
10
- group: GroupData;
11
- groupOpen: boolean;
8
+ export type GroupsData = {
9
+ loading: boolean;
10
+ group: GroupData | null;
12
11
  groups: GroupStackItem[];
13
- }
12
+ };
14
13
  /**
15
- * GroupsProps
14
+ * GroupsMethods
16
15
  */
17
- export interface GroupsProps {
18
- loading: boolean;
19
- data: GroupsData;
16
+ export type GroupsMethods = {
20
17
  onCreateGroup: (group: GroupStackItem) => void;
21
18
  onCreateGroupUsers: (users: GroupUserItem[]) => void;
22
19
  onDeleteGroup: (group: GroupStackItem) => void;
23
20
  onDeleteGroupUser: (user: GroupUserItem) => void;
24
21
  onEditGroup: (group: GroupStackItem) => void;
25
- onViewGroupUser: (user: GroupUserItem) => Promise<void>;
22
+ onViewGroupUser: (user: GroupUserItem) => void;
26
23
  onGroupUserRoleChange: (user: GroupUserItem, next: string | null) => void;
27
24
  onTimelineScrollBottom: () => void;
28
- }
25
+ onGroupUserBackClick: () => void;
26
+ onBackClick: () => void;
27
+ };
28
+ /**
29
+ * GroupsProps
30
+ */
31
+ export type GroupsProps = GroupsData & GroupsMethods;
29
32
  /**
30
33
  * Groups
31
34
  * @param props
@@ -2,7 +2,7 @@
2
2
  /**
3
3
  * HomeData
4
4
  */
5
- export interface HomeData {
5
+ export type HomeData = {
6
6
  user: {
7
7
  avatar: string;
8
8
  givenName: string;
@@ -38,14 +38,17 @@ export interface HomeData {
38
38
  description: string;
39
39
  time: string;
40
40
  }[];
41
- }
41
+ };
42
42
  /**
43
- * HomeProps
43
+ * HomeMethods
44
44
  */
45
- export interface HomeProps {
46
- data: HomeData;
45
+ export type HomeMethods = {
47
46
  onTimelineScrollBottom: () => void;
48
- }
47
+ };
48
+ /**
49
+ * HomeProps
50
+ */
51
+ export type HomeProps = HomeData & HomeMethods;
49
52
  /**
50
53
  * Home
51
54
  * @param props
@@ -4,29 +4,33 @@ import { LessonUserItem } from "./LessonUserTable";
4
4
  /**
5
5
  * LessonData
6
6
  */
7
- export interface LessonData {
8
- key: string;
7
+ export type LessonData = {
8
+ loading: boolean;
9
+ id: string;
9
10
  name: string;
10
11
  description: string;
12
+ group: string;
11
13
  groups: {
12
14
  name: string;
13
15
  active?: boolean;
14
16
  }[];
15
17
  tab: TabsValue;
16
18
  users: LessonUserItem[];
17
- }
19
+ };
18
20
  /**
19
- * LessonProps
21
+ * LessonMethods
20
22
  */
21
- export interface LessonProps {
22
- loading: boolean;
23
- data: LessonData;
23
+ export type LessonMethods = {
24
24
  onBackClick: () => void;
25
- onGroupChange: (next: string) => void;
26
- onPreview: (lesson: LessonData) => void;
27
- onTabChange: (next: TabsValue) => void;
28
- onUserClick: (user: LessonUserItem) => void;
29
- }
25
+ onGroupChange: (value: string) => void;
26
+ onPreview: (id: string) => void;
27
+ onTabChange: (value: TabsValue) => void;
28
+ onUserClick: (item: LessonUserItem) => void;
29
+ };
30
+ /**
31
+ * LessonProps
32
+ */
33
+ export type LessonProps = LessonData & LessonMethods;
30
34
  /**
31
35
  * Lesson
32
36
  * @param props
@@ -6,24 +6,27 @@ import { LessonItem } from "./LessonTable";
6
6
  /**
7
7
  * LessonsData
8
8
  */
9
- export interface LessonsData {
10
- lesson: LessonData;
11
- lessonOpen: boolean;
9
+ export type LessonsData = {
10
+ loading: boolean;
12
11
  lessons: LessonItem[];
13
- }
12
+ lesson: LessonData | null;
13
+ };
14
14
  /**
15
- * LessonsProps
15
+ * LessonsMethods
16
16
  */
17
- export interface LessonsProps {
18
- loading: boolean;
19
- data: LessonsData;
17
+ export type LessonsMethods = {
20
18
  onAutocompleteChange: (next: string) => void;
21
19
  onGroupChange: (next: string) => void;
22
20
  onLessonClick: (lesson: LessonItem) => void;
23
- onPreview: (lesson: LessonItem) => void;
21
+ onPreview: (id: string) => void;
24
22
  onTabChange: (tab: TabsValue) => void;
25
23
  onUserClick: (user: LessonUserItem) => void;
26
- }
24
+ onBackClick: () => void;
25
+ };
26
+ /**
27
+ * LessonsProps
28
+ */
29
+ export type LessonsProps = LessonsData & LessonsMethods;
27
30
  /**
28
31
  * Lessons
29
32
  * @param props
@@ -1,9 +1,9 @@
1
1
  /// <reference types="react" />
2
2
  import { TabsValue } from "@mantine/core";
3
3
  import { DateRangePickerValue } from "@mantine/dates";
4
- import { BadgeUserItem } from "../../pages/Badges/Badge/BadgeUserTable";
4
+ import { BadgeUserItem } from "../../pages/Badges/Badge/Table";
5
5
  import { BadgesData } from "../../pages/Badges/Badges";
6
- import { BadgeItem } from "../../pages/Badges/BadgeTable";
6
+ import { BadgeItem } from "../../pages/Badges/Table";
7
7
  import { GroupStackItem } from "../../pages/Groups/GroupsStack";
8
8
  import { LessonUserItem } from "../../pages/Lessons/Lesson/LessonUserTable";
9
9
  import { LessonsData } from "../../pages/Lessons/Lessons";
@@ -16,7 +16,8 @@ import { HomeData } from "../../pages/Home/Home";
16
16
  /**
17
17
  * MgmtData
18
18
  */
19
- export interface MgmtData {
19
+ export type MgmtData = {
20
+ loading: boolean;
20
21
  navbar: {
21
22
  active: string;
22
23
  };
@@ -26,13 +27,11 @@ export interface MgmtData {
26
27
  account: AccountData;
27
28
  lessons: LessonsData;
28
29
  badges: BadgesData;
29
- }
30
+ };
30
31
  /**
31
- * MgmtProps
32
+ * MgmtMethods
32
33
  */
33
- export interface MgmtProps {
34
- loading?: boolean;
35
- data: MgmtData;
34
+ export type MgmtMethods = {
36
35
  onAccountChange: (next: string) => void;
37
36
  onDashboardBreakdownMetricChange: (next: string) => void;
38
37
  onDashboardDateRangeChange: (next: DateRangePickerValue) => void;
@@ -46,22 +45,30 @@ export interface MgmtProps {
46
45
  onDeleteGroup: (group: GroupStackItem) => void;
47
46
  onDeleteGroupUser: (user: GroupUserItem) => void;
48
47
  onEditGroup: (group: GroupStackItem) => void;
49
- onViewGroupUser: (user: GroupUserItem) => Promise<void>;
48
+ onViewGroupUser: (user: GroupUserItem) => void;
49
+ onGroupBackClick: () => void;
50
50
  onGroupUserRoleChange: (user: GroupUserItem, next: string | null) => void;
51
+ onGroupUserBackClick: () => void;
51
52
  onLessonAutocompleteChange: (next: string) => void;
52
53
  onLessonGroupChange: (next: string) => void;
53
54
  onLessonClick: (lesson: LessonItem) => void;
54
- onLessonPreview: (lesson: LessonItem) => void;
55
+ onLessonPreview: (id: string) => void;
55
56
  onLessonTabChange: (tab: TabsValue) => void;
56
57
  onLessonUserClick: (user: LessonUserItem) => void;
58
+ onLessonBackClick: () => void;
57
59
  onGroupUserTimelineScrollBottom: () => void;
58
60
  onBadgeAutocompleteChange: (next: string) => void;
59
- onBadgePreview: (badge: BadgeItem) => void;
61
+ onBadgePreview: (id: string) => void;
60
62
  onBadgeGroupChange: (next: string) => void;
61
63
  onBadgeClick: (badge: BadgeItem) => void;
62
64
  onBadgeTabChange: (tab: TabsValue) => void;
63
65
  onBadgeUserClick: (user: BadgeUserItem) => void;
64
- }
66
+ onBadgeBackClick: () => void;
67
+ };
68
+ /**
69
+ * MgmtProps
70
+ */
71
+ export type MgmtProps = MgmtData & MgmtMethods;
65
72
  /**
66
73
  * Mgmt
67
74
  * @param props
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@local-civics/mgmt-ui",
3
- "version": "0.1.10",
3
+ "version": "0.1.12",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.es.js",
6
6
  "scripts": {
@@ -1,24 +0,0 @@
1
- /// <reference types="react" />
2
- /**
3
- * BadgeUserItem
4
- */
5
- export interface BadgeUserItem {
6
- key: string;
7
- avatar: string;
8
- name: string;
9
- email: string;
10
- }
11
- /**
12
- * BadgeUserTableProps
13
- */
14
- export interface BadgeUserTableProps {
15
- loading: boolean;
16
- data: BadgeUserItem[];
17
- onClick: (user: BadgeUserItem) => void;
18
- }
19
- /**
20
- * BadgeUserTable
21
- * @constructor
22
- * @param props
23
- */
24
- export declare function BadgeUserTable(props: BadgeUserTableProps): JSX.Element;
@@ -1,21 +0,0 @@
1
- /// <reference types="react" />
2
- /**
3
- * BreakdownUserItem
4
- */
5
- export interface BreakdownUserItem {
6
- name: string;
7
- email: string;
8
- value: number;
9
- }
10
- /**
11
- * BreakdownUserTableProps
12
- */
13
- export interface BreakdownUserTableProps {
14
- data: BreakdownUserItem[];
15
- }
16
- /**
17
- * BreakdownUserTable
18
- * @param data
19
- * @constructor
20
- */
21
- export declare const BreakdownUserTable: ({ data }: BreakdownUserTableProps) => JSX.Element;