@local-civics/mgmt-ui 0.1.26 → 0.1.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.es.js +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{NotificationsProvider as e}from"@mantine/notifications";export{showNotification,updateNotification}from"@mantine/notifications";import{jsxs as i,jsx as n,Fragment as r}from"react/jsx-runtime";import{IconArrowLeft as o,IconCategory2 as t,IconInfoCircle as l,IconCalendar as a,IconArrowUpRight as c,IconArrowDownRight as d,IconTrash as s,IconPlaylistAdd as m,IconDownload as h,IconX as u,IconCloudUpload as p,IconUsers as g,IconDots as f,IconBadges as v,IconSchool as b,IconActivityHeartbeat as y,IconTimelineEvent as C,IconSwitchHorizontal as S,IconLogout as k,IconHome2 as z,IconGauge as x,IconAlbum as w,IconLambda as N,IconBrandInstagram as D,IconBrandLinkedin as E,IconBrandFacebook as L}from"@tabler/icons";import{createStyles as B,Title as T,Text as A,Image as O,UnstyledButton as W,Group as P,Avatar as R,Badge as I,ScrollArea as F,Table as G,Container as M,Stack as j,Grid as V,ActionIcon as H,Button as U,Divider as _,Select as q,LoadingOverlay as K,Autocomplete as $,Paper as J,Tooltip as Q,Tabs as Y,ThemeIcon as Z,SimpleGrid as X,Drawer as ee,TextInput as ie,Menu as ne,Anchor as re,Timeline as oe,Blockquote as te,Card as le,Overlay as ae,createEmotionCache as ce,MantineProvider as de,Modal as se,Navbar as me,Center as he,AppShell as ue,Loader as pe}from"@mantine/core";import*as ge from"react";import{useState as fe,useRef as ve}from"react";import{DateRangePicker as be}from"@mantine/dates";import{ResponsiveContainer as ye,AreaChart as Ce,XAxis as Se,YAxis as ke,CartesianGrid as ze,Tooltip as xe,Area as we}from"recharts";import{Dropzone as Ne,MIME_TYPES as De}from"@mantine/dropzone";import{useForm as Ee}from"@mantine/form";import*as Le from"papaparse";import{openConfirmModal as Be,ModalsProvider as Te}from"@mantine/modals";var Ae=function(){return Ae=Object.assign||function(e){for(var i,n=1,r=arguments.length;n<r;n++)for(var o in i=arguments[n])Object.prototype.hasOwnProperty.call(i,o)&&(e[o]=i[o]);return e},Ae.apply(this,arguments)};function Oe(e,i,n){if(n||2===arguments.length)for(var r,o=0,t=i.length;o<t;o++)!r&&o in i||(r||(r=Array.prototype.slice.call(i,0,o)),r[o]=i[o]);return e.concat(r||Array.prototype.slice.call(i))}var We=B((function(e){var i,n,r;return{wrapper:(i={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])},i["@media (max-width: ".concat(e.breakpoints.sm,"px)")]={flexDirection:"column-reverse",padding:e.spacing.xl},i),image:(n={maxWidth:"40%"},n["@media (max-width: ".concat(e.breakpoints.sm,"px)")]={maxWidth:"100%"},n),body:(r={paddingRight:4*e.spacing.xl},r["@media (max-width: ".concat(e.breakpoints.sm,"px)")]={paddingRight:0,marginTop:e.spacing.xl},r),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}}})),Pe=function(e){var r=We().classes;return i("div",Ae({className:r.wrapper},{children:[i("div",Ae({className:r.body},{children:[n(T,Ae({className:r.title},{children:e.loading?"Loading...":"Nothing to display"})),n(A,Ae({size:"sm",color:"dimmed"},{children:e.loading?"Hold on, we're loading your data.":"We don't have anything to show you here just yet. Add data, check back later, or adjust your search."}))]})),n(O,{src:"https://cdn.localcivics.io/illustrations/".concat(e.icon,".svg"),className:r.image})]}))};function Re(e){if(0===e.items.length)return n(Pe,{loading:e.loading,icon:"badges"});var r=e.items.map((function(r){return i("tr",{children:[n("td",{children:n(W,Ae({onClick:function(){return e.onClick&&e.onClick(r)}},{children:i(P,{children:[n(R,{size:40,src:r.avatar,radius:40}),i("div",{children:[n(A,Ae({size:"sm",weight:500},{children:r.name})),n(A,Ae({size:"xs",color:"dimmed"},{children:r.email}))]})]})}))}),i("td",{children:[!!r.isComplete&&n(I,Ae({variant:"filled"},{children:"Complete"})),!r.isComplete&&n(I,Ae({color:"gray",variant:"filled"},{children:"Incomplete"}))]})]},r.name)}));return n(F.Autosize,Ae({maxHeight:500},{children:i(G,Ae({horizontalSpacing:0,verticalSpacing:"sm",sx:{minWidth:700}},{children:[n("thead",{children:i("tr",{children:[n("th",{children:"Name"}),n("th",{children:"Status"})]})}),n("tbody",{children:r})]}))}))}var Ie=B((function(e){var i;return{title:(i={fontSize:34,fontWeight:900},i[e.fn.smallerThan("sm")]={fontSize:24},i),description:{maxWidth:600}}})),Fe=function(e){var r=Ie().classes;return n(M,Ae({size:"lg",py:"xl"},{children:i(j,Ae({spacing:"md"},{children:[n(V,{children:i(V.Col,Ae({sm:"auto"},{children:[n(I,Ae({variant:"filled",leftSection:n(H,Ae({onClick:e.onBackClick,color:"blue",size:"xs",radius:"xl",variant:"filled"},{children:n(o,{size:14})})),size:"lg"},{children:"Badges"})),i(P,{children:[i(j,Ae({spacing:0},{children:[n(T,Ae({order:2,className:r.title,mt:"md"},{children:e.displayName||"Badge"})),n(A,Ae({color:"dimmed",className:r.description,mt:"sm"},{children:e.description||"No description"}))]})),i(j,Ae({spacing:"xs",ml:"auto"},{children:[n(U,Ae({variant:"gradient",onClick:e.onPreviewClick},{children:"Preview"})),n(_,{label:"or",labelPosition:"center",my:"xs",variant:"dashed"}),n(q,{size:"sm",placeholder:"Select a group",nothingFound:"No options",value:e.groupId,onChange:e.onGroupChange,icon:n(t,{}),data:e.groups.map((function(e){return{value:e.groupId,label:e.name}}))})]}))]})]}))}),n("div",{children:i("div",Ae({style:{position:"relative"}},{children:[n(K,{visible:e.loading,overlayBlur:2}),n(Re,{loading:e.loading,items:e.users,onClick:e.onUserClick})]}))})]}))}))};function Ge(e){if(0===e.items.length)return n(Pe,{loading:e.loading,icon:"badges"});var r=e.items.map((function(r){return n("tr",{children:n("td",{children:n(W,Ae({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(r)}},{children:n(P,{children:i("div",{children:[n(A,Ae({size:"sm",weight:500},{children:r.name})),n(A,Ae({size:"xs",color:"dimmed"},{children:r.description}))]})})}))})},r.badgeId)}));return n(F.Autosize,Ae({maxHeight:500},{children:n(G,Ae({horizontalSpacing:0,verticalSpacing:0,sx:{minWidth:700}},{children:n("tbody",{children:r})}))}))}var Me=B((function(e){var i;return{title:(i={fontSize:34,fontWeight:900},i[e.fn.smallerThan("sm")]={fontSize:24},i),description:{maxWidth:600}}})),je=function(e){var r=Me().classes;return n(M,Ae({size:"lg",py:"xl"},{children:i(j,Ae({spacing:"md"},{children:[n(V,{children:i(V.Col,Ae({sm:"auto"},{children:[n(I,Ae({variant:"filled",size:"lg"},{children:"Badges"})),n(T,Ae({order:2,className:r.title,mt:"md"},{children:"Badges and micro-credentials"})),n(A,Ae({color:"dimmed",className:r.description,mt:"sm"},{children:"Project-sized skills acquisition and standards alignment."}))]}))}),n($,{placeholder:"Search for a badge that fits your needs",data:e.badges.map((function(e){return e.name})),onChange:e.onAutocompleteChange}),i("div",Ae({style:{position:"relative"}},{children:[n(K,{visible:e.loading,overlayBlur:2}),n(Ge,{loading:e.loading,items:e.badges,onClick:e.onBadgeClick})]}))]}))}))},Ve=B((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}}})),He=function(e){var r,o=Ve(),t=o.classes,l=o.cx,a=fe(!1),c=a[0],d=a[1],s=e.items.map((function(e){return e.value})),m=Math.round(s.reduce((function(e,i){return e+i}))/s.length),h=e.items.map((function(e){return i("tr",{children:[n("td",{children:e.name}),n("td",{children:e.email}),n("td",{children:e.value}),n("td",{children:e.value>m?n(I,{children:"Above average"}):e.value===m?n(I,Ae({color:"gray"},{children:"Average"})):n(I,Ae({color:"red"},{children:"Below average"}))})]},e.name)}));return n(F,Ae({sx:{height:500},onScrollPositionChange:function(e){var i=e.y;return d(0!==i)}},{children:i(G,Ae({verticalSpacing:"md",sx:{minWidth:700}},{children:[n("thead",Ae({className:l(t.header,(r={},r[t.scrolled]=c,r))},{children:i("tr",{children:[n("th",{children:"Name"}),n("th",{children:"Email"}),n("th",{children:"Value"}),n("th",{children:"Status"})]})})),n("tbody",{children:h})]}))}))},Ue=function(e){return e.loading||0===e.points.length?n(Pe,{loading:e.loading,icon:"dashboard"}):n(J,Ae({mih:150,p:"lg",withBorder:!0},{children:i(j,{children:[n(V,{children:n(V.Col,Ae({sm:"auto"},{children:i(P,Ae({spacing:0},{children:[n(T,Ae({size:"h5",mb:0},{children:"Performance History"})),n(Q,Ae({label:"Shows group performance per person"},{children:n(H,{children:n(l,{color:"#3b82f6",size:14})})}))]}))}))}),n(P,Ae({spacing:"sm"},{children:n(q,{placeholder:"Select a metric",value:e.metric,onChange:e.onMetricChange,data:[{label:"PROBLEMS SOLVED",value:"PROBLEMS SOLVED"},{label:"LESSONS COMPLETED",value:"LESSONS COMPLETED"},{label:"BADGES EARNED",value:"BADGES EARNED"}]})})),n(He,{items:e.points})]})}))},_e=function(e){var i,r=null===(i=e.data)||void 0===i?void 0:i.map((function(e){return n(Y.Tab,Ae({value:e.value},{children:e.label||e.value}),e.value)}));return n(Y,Ae({value:e.value,onTabChange:e.onChange},{children:n(Y.List,{children:r})}))},qe=[{value:"Overview"},{value:"Breakdown"}],Ke=function(e){return n(M,Ae({size:"lg",py:"xl"},{children:i(j,{children:[i(V,{children:[i(V.Col,Ae({sm:"auto"},{children:[n(T,Ae({size:"h3"},{children:"Dashboard"})),n(A,Ae({color:"dimmed",size:"sm",mt:"md"},{children:"View core metrics on the state of your groups."}))]})),n(V.Col,Ae({sm:2.5},{children:n(q,{placeholder:"Select a group",nothingFound:"No options",value:e.group,onChange:e.onGroupChange,icon:n(t,{}),data:e.groups.map((function(e){return e.name}))})})),n(V.Col,Ae({sm:"auto"},{children:n(be,{placeholder:"Select a date",allowSingleDateInRange:!0,value:e.dateRange,onChange:e.onDateRangeChange,icon:n(a,{size:16})})}))]}),i(j,{children:[n(_e,{data:qe,value:e.tab,onChange:e.onTabChange}),i("div",Ae({style:{position:"relative"}},{children:[n(K,{visible:e.loading,overlayBlur:2}),e.body]}))]})]})}))},$e=B((function(e){return{axis:{fontSize:"12px",fontFamily:"Greycliff CF, ".concat(e.fontFamily)}}})),Je=function(e){var r=$e().theme;return n(J,Ae({p:"lg",withBorder:!0},{children:i(j,{children:[i(V,{children:[n(V.Col,Ae({sm:"auto"},{children:i(P,Ae({spacing:0},{children:[n(T,Ae({size:"h5",mb:0},{children:"Performance History"})),n(Q,Ae({label:"Shows daily increase or decrease across group"},{children:n(H,{children:n(l,{color:"#3b82f6",size:14})})}))]}))})),n(V.Col,Ae({sm:5},{children:n(q,{placeholder:"Select a metric",value:e.metric,onChange:e.onMetricChange,data:[{label:"PROBLEMS SOLVED",value:"PROBLEMS SOLVED"},{label:"LESSONS COMPLETED",value:"LESSONS COMPLETED"},{label:"BADGES EARNED",value:"BADGES EARNED"}]})}))]}),n(ye,Ae({width:"100%",height:400},{children:i(Ce,Ae({width:730,height:250,data:e.points,margin:{top:10,right:30,left:0,bottom:0}},{children:[n("defs",{children:i("linearGradient",Ae({id:"colorBlue",x1:"0",y1:"0",x2:"0",y2:"1"},{children:[n("stop",{offset:"5%",stopColor:"#3b82f6",stopOpacity:.4}),n("stop",{offset:"95%",stopColor:"#3b82f6",stopOpacity:0})]}))}),n(Se,{tick:{fontSize:12,fontFamily:r.fontFamily},dataKey:"name"}),n(ke,{tick:{fontSize:12,fontFamily:r.fontFamily}}),n(ze,{strokeDasharray:"3 3",horizontal:!0,vertical:!1}),n(xe,{contentStyle:{fontWeight:700,fontSize:12,fontFamily:r.fontFamily},labelStyle:{fontSize:12,fontFamily:r.fontFamily}}),n(we,{type:"monotone",dataKey:"value",stroke:"#3b82f6",fillOpacity:1,fill:"url(#colorBlue)"})]}))}))]})}))},Qe=B((function(e){return{root:{paddingTop:1.5*e.spacing.xl,paddingBottom:1.5*e.spacing.xl},label:{fontFamily:"Greycliff CF, ".concat(e.fontFamily)}}})),Ye=function(e){var r=e.data,o=Qe().classes,t=r.map((function(e){var r=e.diff>0?c:d;return i(J,Ae({withBorder:!0,p:"md",radius:"md"},{children:[i(P,Ae({position:"apart"},{children:[i("div",{children:[n(A,Ae({color:"dimmed",transform:"uppercase",weight:700,size:"xs",className:o.label},{children:e.title})),n(A,Ae({weight:700,size:"xl"},{children:e.value.toLocaleString()}))]}),!!e.diff&&n(Z,Ae({color:"gray",variant:"light",sx:function(i){return{color:e.diff>0?i.colors.teal[6]:i.colors.red[6]}},size:38,radius:"md"},{children:n(r,{size:28,stroke:1.5})}))]})),!!e.diff&&i(A,Ae({color:"dimmed",size:"sm",mt:"md"},{children:[i(A,Ae({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("div",Ae({className:o.root},{children:n(X,Ae({cols:3,breakpoints:[{maxWidth:"sm",cols:1}]},{children:t}))}))},Ze=function(e){return e.loading||!e.problemsSolved?n(Pe,{loading:e.loading,icon:"dashboard"}):i(r,{children:[n(Ye,{data:[{title:"PROBLEMS SOLVED",value:e.problemsSolved,diff:e.problemsSolvedDiff},{title:"LESSONS COMPLETED",value:e.lessonsCompleted,diff:e.lessonsCompletedDiff},{title:"BADGES EARNED",value:e.badgesCompleted,diff:e.badgesCompletedDiff}]}),n(Je,{metric:e.metric,points:e.points,onMetricChange:e.onMetricChange})]})},Xe=[{unit:"year",ms:31536e6},{unit:"month",ms:2628e6},{unit:"day",ms:864e5},{unit:"hour",ms:36e5},{unit:"minute",ms:6e4},{unit:"second",ms:1e3}],ei=new Intl.RelativeTimeFormat("en",{numeric:"auto"});function ii(e,i){return void 0===i&&(i=new Date),e?function(e){for(var i=0,n=Xe;i<n.length;i++){var r=n[i],o=r.unit,t=r.ms;if(Math.abs(e)>=t||"second"===o)return ei.format(Math.round(e/t),o)}return""}(e.getTime()-i.getTime()):""}var ni=[{value:"Member",label:"Member"},{value:"Admin",label:"Admin"}];function ri(e){if(0===e.items.length)return n(Pe,{loading:e.loading,icon:"groups"});var r=e.items.map((function(r){return i("tr",{children:[n("td",{children:n(W,Ae({onClick:function(){return e.onViewProfile&&e.onViewProfile(r)}},{children:i(P,Ae({spacing:"sm"},{children:[n(R,{size:40,src:r.avatar,radius:40}),i("div",{children:[n(A,Ae({size:"sm",weight:500},{children:r.givenName&&r.familyName?"".concat(r.givenName," ").concat(r.familyName):r.email})),n(A,Ae({size:"xs",color:"dimmed"},{children:r.email}))]})]}))}))}),n("td",{children:n(q,{data:Oe([],ni,!0).map((function(e){return r.readonly?Ae(Ae({},e),{disabled:e.value!==r.role}):e})),defaultValue:r.role,variant:"unstyled",onChange:function(i){return!r.readonly&&e.onChangeRole&&e.onChangeRole(r,i)}})}),n("td",{children:r.lastActivity?ii(r.lastActivity):""}),n("td",{children:n(P,Ae({noWrap:!0,spacing:0,position:"right"},{children:!r.readonly&&n(H,Ae({color:"red"},{children:n(s,{onClick:function(){return Be({title:'Delete "'.concat((i=r).givenName&&i.familyName?"".concat(i.givenName," ").concat(i.familyName):i.email,'"?'),centered:!0,children:n(A,Ae({size:"sm"},{children:"Are you sure you want to delete this person? This action is destructive and you will have to contact support to restore your data."})),labels:{confirm:"Delete",cancel:"No don't delete them"},confirmProps:{color:"red"},onConfirm:function(){return e.onDelete&&e.onDelete(i)}});var i},size:16,stroke:1.5})}))}))})]},r.email)}));return n(F,{children:i(G,Ae({verticalSpacing:20,sx:{minWidth:700}},{children:[n("thead",{children:i("tr",{children:[n("th",{children:"Member"}),n("th",{children:"Role"}),n("th",{children:"Last active"}),n("th",{})]})}),n("tbody",{children:r})]}))})}var oi=B((function(e){var i;return{title:(i={fontSize:34,fontWeight:900},i[e.fn.smallerThan("sm")]={fontSize:24},i),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}}})),ti=function(e){var t=oi().classes,l=Ee({initialValues:{groupId:"",userId:"",email:"",givenName:"",familyName:"",avatar:"",role:"",readonly:!1,lastActivity:null},validate:{email:function(i){return/^\S+@\S+$/.test(i)&&0===e.users.filter((function(e){return e.email===i})).length?null:"Invalid email"}}}),a=fe(!1),c=a[0],d=a[1];return i(r,{children:[n(ee,Ae({opened:c,onClose:function(){return d(!1)},title:n(T,Ae({size:"h5"},{children:"Add people"})),padding:"xl",size:"xl"},{children:i(j,Ae({spacing:"md"},{children:[n(li,Ae({},e,{close:function(){return d(!1)}})),n(_,{label:"or",labelPosition:"center",my:"md",variant:"dashed"}),n("form",Ae({onSubmit:l.onSubmit((function(){var i=l.values;l.reset(),d(!1),e.onCreateUsers&&e.onCreateUsers([i])}))},{children:i(j,{children:[n(ie,Ae({withAsterisk:!0,label:"Email",placeholder:"Email"},l.getInputProps("email"))),i(P,Ae({grow:!0},{children:[n(ie,Ae({label:"Given name",placeholder:"Given name"},l.getInputProps("givenName"))),n(ie,Ae({label:"Family name",placeholder:"Family name"},l.getInputProps("familyName")))]})),n(U,Ae({type:"submit",fullWidth:!0,mt:"md"},{children:"Submit"}))]})}))]}))})),n(M,Ae({size:"lg",py:"xl"},{children:i(j,Ae({spacing:"md"},{children:[i(V,{children:[i(V.Col,Ae({sm:"auto"},{children:[n(I,Ae({variant:"filled",leftSection:n(H,Ae({onClick:e.onBackClick,color:"blue",size:"xs",radius:"xl",variant:"filled"},{children:n(o,{size:14})})),size:"lg"},{children:"Groups"})),n(T,Ae({order:2,className:t.title,mt:"md"},{children:e.displayName||"Group"})),n(A,Ae({color:"dimmed",className:t.description,mt:"sm"},{children:e.description||"No description"}))]})),n(V.Col,Ae({sm:"content"},{children:!e.loading&&n(U,Ae({onClick:function(){return d(!0)},leftIcon:n(m,{size:14})},{children:"Add people"}))}))]}),i("div",Ae({style:{position:"relative"}},{children:[n(K,{visible:e.loading,overlayBlur:2}),n(ri,{loading:e.loading,items:e.users,onDelete:e.onDeleteUser,onChangeRole:e.onRoleChange,onViewProfile:function(i){return e.onUserClick(i)}})]}))]}))}))]})},li=function(e){var r=oi(),o=r.classes,t=r.theme,l=ge.useRef(null),a=ge.useState(!1),c=a[0],d=a[1],s=ge.useCallback((function(i){d(!0),i.forEach((function(i){Le.parse(i,{download:!0,header:!0,dynamicTyping:!0,skipEmptyLines:!0,worker:!0,complete:function(i){var n=i.data.filter((function(i){return/^\S+@\S+$/.test(i.email)&&0===e.users.filter((function(e){return e.email===i.email})).length}));n.length>0&&e.onCreateUsers&&e.onCreateUsers(n),d(!1),e.close()}})}))}),[]);return i("div",Ae({className:o.wrapper},{children:[n(Ne,Ae({loading:c,openRef:l,onDrop:s,className:o.dropzone,radius:"md",accept:[De.csv],maxSize:5*Math.pow(1024,2)},{children:i("div",Ae({style:{pointerEvents:"none"}},{children:[i(P,Ae({position:"center"},{children:[n(Ne.Accept,{children:n(h,{size:50,color:t.colors[t.primaryColor][6],stroke:1.5})}),n(Ne.Reject,{children:n(u,{size:50,color:t.colors.red[6],stroke:1.5})}),n(Ne.Idle,{children:n(p,{size:50,color:"dark"===t.colorScheme?t.colors.dark[0]:t.black,stroke:1.5})})]})),i(A,Ae({align:"center",weight:700,size:"lg",mt:"xl"},{children:[n(Ne.Accept,{children:"Drop files here"}),n(Ne.Reject,{children:"Csv file less than 5mb"}),n(Ne.Idle,{children:"Upload multiple"})]})),i(A,Ae({align:"center",size:"sm",mt:"xs",color:"dimmed"},{children:["Drag'n'drop files here to upload. We can accept only ",n("i",{children:".csv"})," files that are less than 5mb in size."]}))]}))})),n(U,Ae({className:o.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 ai(e){if(0===e.items.length)return n(Pe,{loading:e.loading,icon:"groups"});var r=e.items.map((function(r){return i("tr",{children:[n("td",{children:n(A,Ae({size:14},{children:r.name}))}),n("td",{children:n(A,Ae({size:14},{children:r.description}))}),n("td",{children:i(P,Ae({noWrap:!0,spacing:0,position:"right"},{children:[n(H,Ae({color:"blue",onClick:function(){return e.onClick(r)},variant:"subtle"},{children:n(g,{size:16,stroke:1.5})})),i(ne,Ae({transition:"pop",withArrow:!0,position:"bottom-end"},{children:[n(ne.Target,{children:n(H,{children:n(f,{size:16,stroke:1.5})})}),n(ne.Dropdown,{children:n(ne.Item,Ae({onClick:function(){return Be({title:'Delete "'.concat((i=r).name,'"?'),centered:!0,children:n(A,Ae({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(i)}});var i},icon:n(s,{size:16,stroke:1.5}),color:"red"},{children:"Delete"}))})]}))]}))})]},r.groupId)}));return n(F.Autosize,Ae({maxHeight:300},{children:i(G,Ae({verticalSpacing:20,sx:{minWidth:700}},{children:[n("thead",{children:i("tr",{children:[n("th",{children:"Name"}),n("th",{children:"Description"}),n("th",{})]})}),n("tbody",{children:r})]}))}))}var ci=B((function(e){var i;return{title:(i={fontSize:34,fontWeight:900},i[e.fn.smallerThan("sm")]={fontSize:24},i),description:{maxWidth:600}}})),di=function(e){var o=ci().classes,t=Ee({initialValues:{groupId:"",name:"",description:""},validate:{name:function(e){return e.length<=6?"Name should include at least 6 characters":null}}}),a=fe(!1),c=a[0],d=a[1];return i(r,{children:[n(ee,Ae({opened:c,onClose:function(){return d(!1)},title:i(P,Ae({spacing:0},{children:[n(T,Ae({size:"h5"},{children:"Create a group"})),n(Q,Ae({label:"Groups settings cannot be modified once created"},{children:n(H,{children:n(l,{color:"#3b82f6",size:14})})}))]})),padding:"xl",size:"xl"},{children:i("form",Ae({onSubmit:t.onSubmit((function(){var i=t.values;t.reset(),d(!1),e.onCreateGroup&&e.onCreateGroup(i)}))},{children:[i(j,{children:[n(ie,Ae({withAsterisk:!0,label:"Name",placeholder:"Group name"},t.getInputProps("name"))),n(ie,Ae({label:"Description",placeholder:"A group for my first period class"},t.getInputProps("description")))]}),n(U,Ae({type:"submit",fullWidth:!0,mt:"md"},{children:"Submit"}))]}))})),n(M,Ae({size:"lg",py:"xl"},{children:i(j,Ae({spacing:"md"},{children:[i(V,{children:[i(V.Col,Ae({sm:"auto"},{children:[n(I,Ae({variant:"filled",size:"lg"},{children:"Groups"})),n(T,Ae({order:2,className:o.title,mt:"md"},{children:"Organize people into groups"})),n(A,Ae({color:"dimmed",className:o.description,mt:"sm"},{children:"A group can be a class, team, or other functioning organizations."}))]})),n(V.Col,Ae({sm:"content"},{children:!e.loading&&n(U,Ae({onClick:function(){return d(!0)},leftIcon:n(m,{size:14})},{children:"Create group"}))}))]}),i("div",Ae({style:{position:"relative"}},{children:[n(K,{visible:e.loading,overlayBlur:2}),n(ai,{loading:e.loading,items:e.groups,onDeleteGroup:e.onDeleteGroup,onClick:e.onGroupClick})]}))]}))}))]})},si=B((function(e){var i,n;return{root:(i={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},i[e.fn.smallerThan("sm")]={flexDirection:"column"},i),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,"& + &":(n={paddingLeft:e.spacing.xl,marginLeft:e.spacing.xl,borderLeft:"1px solid ".concat(e.colors[e.primaryColor][3])},n[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])},n)}}})),mi=function(e){var r=e.data,o=si().classes,t=r.map((function(e){return i("div",Ae({className:o.stat},{children:[n(A,Ae({className:o.count},{children:e.value.toLocaleString()})),n(A,Ae({className:o.title},{children:e.title})),!!e.diff&&n(A,Ae({className:o.description},{children:"".concat(e.diff,"% ").concat(e.diff<0?"decrease":"increase"," compared to last period")}))]}),e.title)}));return n("div",Ae({className:o.root},{children:t}))},hi={BadgeCompleted:n(v,{size:12}),BadgeStarted:n(v,{size:12}),LessonCompleted:n(b,{size:12}),LessonStarted:n(b,{size:12}),ProblemSolved:n(y,{size:12})},ui=function(e){var r,o=ve(null),t=fe({x:0,y:0}),l=t[0],a=t[1];ge.useEffect((function(){o.current&&l.y===o.current.scrollHeight-o.current.offsetHeight&&e.onScrollBottom&&e.onScrollBottom()}),[l.y]);var c=e.items.map((function(e){var o=e.name.split(/(?=[A-Z])/),t=o[0]===r?"dashed":"solid";r=o[0];var l=e.link?n(re,Ae({color:"dark",unstyled:!0,href:e.link},{children:"".concat(o[0]," ").concat(o[1].toLowerCase())})):"".concat(o[0]," ").concat(o[1].toLowerCase());return i(oe.Item,Ae({bullet:pi(e.name),lineVariant:t,title:l},{children:[n(A,Ae({color:"dimmed",size:"sm"},{children:e.description})),n(A,Ae({size:"xs",mt:4},{children:ii(new Date(e.time))}))]}),e.key)}));return n(F.Autosize,Ae({maxHeight:300,onScrollPositionChange:a,viewportRef:o},{children:n(oe,Ae({ml:"lg",active:1,bulletSize:24,lineWidth:2},{children:c}))}))},pi=function(e){var i=hi[e];return i||n(C,{size:12})},gi=B((function(e){var i;return{title:(i={fontSize:34,fontWeight:900,marginTop:16},i[e.fn.smallerThan("sm")]={fontSize:24},i),description:{maxWidth:600}}})),fi=function(e){var o=gi().classes,t=e.givenName?[e.givenName,e.familyName].join(" ").trim():e.email,l=e.givenName?e.givenName:"Me";return"compact"===e.variant?i(r,{children:[n(T,Ae({className:o.title},{children:t})),n(A,Ae({color:"dimmed",className:o.description,mt:"xs"},{children:e.quote}))]}):i(r,{children:[i(J,Ae({radius:"md",withBorder:!0,p:"lg",sx:function(e){return{backgroundColor:"dark"===e.colorScheme?e.colors.dark[8]:e.white}}},{children:[n(R,{src:e.avatar,size:135,radius:120,mx:"auto"}),n(A,Ae({align:"center",size:"lg",weight:500,mt:"md"},{children:t})),i(A,Ae({align:"center",color:"dimmed",size:"sm"},{children:[e.email," • ",e.job]}))]})),n(te,Ae({mt:"xl",color:"blue",cite:"– ".concat(l)},{children:e.quote}))]})},vi=function(e){return n(M,Ae({size:"lg",py:"xl"},{children:i(j,Ae({spacing:"md"},{children:[n(V,{children:i(V.Col,Ae({sm:"auto"},{children:[n(I,Ae({variant:"filled",leftSection:n(H,Ae({onClick:e.onBackClick,color:"blue",size:"xs",radius:"xl",variant:"filled"},{children:n(o,{size:14})})),size:"lg"},{children:"Users"})),n(fi,{variant:"compact",givenName:e.givenName,familyName:e.familyName,avatar:e.avatarURL,email:e.email,quote:e.impactStatement,job:e.job})]}))}),i("div",Ae({style:{position:"relative"}},{children:[n(K,{visible:e.loading,overlayBlur:2}),i(j,Ae({spacing:"lg"},{children:[n(mi,{data:[{title:"PROBLEMS SOLVED",value:e.problemsSolved,diff:e.problemsSolvedDiff},{title:"LESSONS COMPLETED",value:e.lessonsCompleted,diff:e.lessonsCompletedDiff},{title:"BADGES EARNED",value:e.badgesCompleted,diff:e.badgesCompletedDiff}]}),n(ui,{onScrollBottom:e.onScrollBottom,items:e.events})]}))]}))]}))}))},bi=B((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}}})),yi=function(e){var r=e.title,o=e.description,t=e.image,l=e.action,a=e.style,c=e.className,d=function(e,i){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&i.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)i.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}(e,["title","description","image","action","style","className"]),s=bi(),m=s.classes,h=s.cx,u=s.theme;return i(le,Ae({radius:"md",style:Ae({backgroundImage:"url(".concat(t,")")},a),className:h(m.card,c)},d,{children:[n(ae,{gradient:"linear-gradient(105deg, ".concat(u.black," 20%, #312f2f 50%, ").concat(u.colors.gray[4]," 100%)"),opacity:.55,zIndex:0}),i("div",Ae({className:m.content},{children:[n(A,Ae({size:"lg",weight:700,className:m.title},{children:r})),n(A,Ae({size:"sm",className:m.description},{children:o})),n(U,Ae({className:m.action,variant:"white",color:"dark",component:"a",size:"xs",href:l.link,target:"_blank"},{children:l.label}))]}))]}))},Ci=function(e){return n(M,Ae({size:"lg"},{children:i(j,Ae({spacing:"lg"},{children:[i(V,Ae({gutter:"md"},{children:[n(V.Col,Ae({md:6},{children:n(fi,{variant:"compact",givenName:e.givenName,familyName:e.familyName,avatar:e.avatarURL,email:e.email,quote:e.impactStatement,job:e.job})})),n(V.Col,Ae({md:6},{children:n(yi,{title:e.tenantName,description:e.tenantDescription,image:e.tenantImage,action:{label:"Visit website",link:e.tenantWebsite}})}))]})),n(mi,{data:[{title:"PROBLEMS SOLVED",value:e.problemsSolved,diff:e.problemsSolvedDiff},{title:"LESSONS COMPLETED",value:e.lessonsCompleted,diff:e.lessonsCompletedDiff},{title:"BADGES EARNED",value:e.badgesCompleted,diff:e.badgesCompletedDiff}]}),n(ui,{onScrollBottom:e.onScrollBottom,items:e.events})]}))}))};function Si(e){if(0===e.items.length)return n(Pe,{loading:e.loading,icon:"lessons"});var r=e.items.map((function(r){return i("tr",{children:[n("td",{children:n(W,Ae({onClick:function(){return e.onClick&&e.onClick(r)}},{children:i(P,{children:[n(R,{size:40,src:r.avatar,radius:40}),i("div",{children:[n(A,Ae({size:"sm",weight:500},{children:r.name})),n(A,Ae({size:"xs",color:"dimmed"},{children:r.email}))]})]})}))}),i("td",{children:[!!r.isComplete&&n(I,Ae({variant:"filled"},{children:"Complete"})),!r.isComplete&&!r.isStarted&&n(I,Ae({color:"red",variant:"filled"},{children:"Not started"})),!r.isComplete&&!!r.isStarted&&n(I,Ae({color:"violet",variant:"filled"},{children:"In progress"}))]})]},r.name)}));return n(F.Autosize,Ae({maxHeight:500},{children:i(G,Ae({horizontalSpacing:0,verticalSpacing:"sm",sx:{minWidth:700}},{children:[n("thead",{children:i("tr",{children:[n("th",{children:"Name"}),n("th",{children:"Status"})]})}),n("tbody",{children:r})]}))}))}var ki=B((function(e){var i;return{title:(i={fontSize:34,fontWeight:900},i[e.fn.smallerThan("sm")]={fontSize:24},i),description:{maxWidth:600}}})),zi=function(e){var r=ki().classes;return n(M,Ae({size:"lg",py:"xl"},{children:i(j,Ae({spacing:"md"},{children:[n(V,{children:i(V.Col,Ae({sm:"auto"},{children:[n(I,Ae({variant:"filled",leftSection:n(H,Ae({onClick:e.onBackClick,color:"blue",size:"xs",radius:"xl",variant:"filled"},{children:n(o,{size:14})})),size:"lg"},{children:"Lessons"})),i(P,{children:[i(j,Ae({spacing:0},{children:[n(T,Ae({order:2,className:r.title,mt:"md"},{children:e.displayName||"Lesson"})),n(A,Ae({color:"dimmed",className:r.description,mt:"sm"},{children:e.description||"No description"}))]})),i(j,Ae({spacing:"xs",ml:"auto"},{children:[n(U,Ae({variant:"gradient",onClick:e.onPreviewClick},{children:"Preview"})),n(_,{label:"or",labelPosition:"center",my:"xs",variant:"dashed"}),n(q,{size:"sm",placeholder:"Select a group",nothingFound:"No options",value:e.groupId,onChange:e.onGroupChange,icon:n(t,{}),data:e.groups.map((function(e){return{value:e.groupId,label:e.name}}))})]}))]})]}))}),n("div",{children:i("div",Ae({style:{position:"relative"}},{children:[n(K,{visible:e.loading,overlayBlur:2}),n(Si,{loading:e.loading,items:e.users,onClick:e.onUserClick})]}))})]}))}))};function xi(e){if(0===e.items.length)return n(Pe,{loading:e.loading,icon:"lessons"});var r=e.items.map((function(r){return n("tr",{children:n("td",{children:n(W,Ae({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(r)}},{children:n(P,{children:i("div",{children:[n(A,Ae({size:"sm",weight:500},{children:r.name})),n(A,Ae({size:"xs",color:"dimmed"},{children:r.description}))]})})}))})},r.lessonId)}));return n(F.Autosize,Ae({maxHeight:500},{children:n(G,Ae({horizontalSpacing:0,verticalSpacing:0,sx:{minWidth:700}},{children:n("tbody",{children:r})}))}))}var wi=B((function(e){var i;return{title:(i={fontSize:34,fontWeight:900},i[e.fn.smallerThan("sm")]={fontSize:24},i),description:{maxWidth:600}}})),Ni=function(e){var r=wi().classes;return n(M,Ae({size:"lg",py:"xl"},{children:i(j,Ae({spacing:"md"},{children:[n(V,{children:i(V.Col,Ae({sm:"auto"},{children:[n(I,Ae({variant:"filled",size:"lg"},{children:"Lessons"})),n(T,Ae({order:2,className:r.title,mt:"md"},{children:"Lessons"})),n(A,Ae({color:"dimmed",className:r.description,mt:"sm"},{children:"Well crafted units of instruction."}))]}))}),n($,{placeholder:"Search for a lesson that fits your needs",data:e.lessons.map((function(e){return e.name})),onChange:e.onAutocompleteChange}),i("div",Ae({style:{position:"relative"}},{children:[n(K,{visible:e.loading,overlayBlur:2}),n(xi,{loading:e.loading,items:e.lessons,onClick:e.onLessonClick})]}))]}))}))},Di=ce({key:"mantine",prepend:!1}),Ei=function(i){return n(de,Ae({withNormalizeCSS:!0,withGlobalStyles:!0,emotionCache:Di,theme:{loader:"bars"}},{children:n(e,Ae({limit:i.notificationLimit||5},{children:n(Te,{children:i.children})}))}))},Li=function(e){var r=Ee({initialValues:{active:e.account}});return n(se,Ae({centered:!0,opened:e.opened,onClose:function(){return e.onClose&&e.onClose()},size:"sm",title:n(T,Ae({size:"h5"},{children:"Accounts"}))},{children:i("form",Ae({onSubmit:r.onSubmit((function(){e.onChange&&e.onChange(r.values.active)}))},{children:[n(q,Ae({required:!0,placeholder:"Select an account",defaultValue:e.account,data:e.accounts.map((function(e){return{value:e.accountId,label:e.name}}))},r.getInputProps("active"))),n(U,Ae({type:"submit",fullWidth:!0,mt:"xl"},{children:"Switch"}))]}))}))},Bi=B((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}}}})),Ti=[{icon:z,label:"Home",href:"/home"},{icon:x,label:"Dashboard",href:"/dashboard"},{icon:t,label:"Groups",href:"/groups"},{icon:w,label:"Badges",href:"/badges"},{icon:N,label:"Lessons",href:"/lessons"}],Ai=function(e){var i,r=e.icon,o=e.label,t=e.active,l=e.onClick,a=Bi(),c=a.classes,d=a.cx;return n(Q,Ae({label:o,position:"right",transitionDuration:0},{children:n(W,Ae({onClick:l,className:d(c.link,(i={},i[c.active]=t,i))},{children:n(r,{stroke:1.5})}))}))},Oi=function(e){var r=Ti.map((function(i){return n(Ai,{label:i.label,icon:i.icon,active:i.label===e.active,onClick:function(){return e.navigate(i.href)}},i.label)}));return i(me,Ae({width:{base:80},p:"md"},{children:[n(he,{children:n(R,Ae({color:"blue",radius:"sm"},{children:n("div",Ae({style:{width:15,marginLeft:"auto",marginRight:"auto"}},{children:n(O,{fit:"contain",src:"https://cdn.localcivics.io/brand/l.png"})}))}))}),n(me.Section,Ae({grow:!0,mt:50},{children:n(j,Ae({justify:"center",spacing:0},{children:r}))})),n(me.Section,{children:i(j,Ae({justify:"center",spacing:0},{children:[n(Ai,{icon:S,label:"Switch accounts",onClick:e.onSwitchAccounts}),n(Ai,{icon:k,label:"Logout",onClick:e.onLogout})]}))})]}))},Wi=B((function(e){var i,n,r,o,t,l;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:(i={maxWidth:200},i[e.fn.smallerThan("sm")]={display:"flex",flexDirection:"column",alignItems:"center"},i),description:(n={marginTop:5},n[e.fn.smallerThan("sm")]={marginTop:e.spacing.xs,textAlign:"center"},n),inner:(r={display:"flex",justifyContent:"space-between"},r[e.fn.smallerThan("sm")]={flexDirection:"column",alignItems:"center"},r),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:(l={},l[e.fn.smallerThan("sm")]={marginTop:e.spacing.xs},l)}})),Pi=function(e){var o=Wi().classes,t=Ri(e.account,e.accounts,e.onAccountChange);return i(ue,Ae({padding:"xs",navbar:n(Oi,{active:e.navbar.props.active,navigate:e.navbar.props.navigate,onLogout:e.navbar.props.onLogout,onSwitchAccounts:function(){return t.setChangeModalOpen(!0)}}),footer:n(r,{children:!t.opened&&i("footer",Ae({className:o.footer},{children:[i(M,Ae({className:o.inner},{children:[i("div",Ae({className:o.logo},{children:[i(P,Ae({spacing:"xs"},{children:[n("div",Ae({style:{width:15}},{children:n(O,{fit:"contain",src:"https://cdn.localcivics.io/brand/l.png"})})),n(T,Ae({color:"dimmed",size:"h5"},{children:"Local Civics"}))]})),n(A,Ae({size:"xs",color:"dimmed",className:o.description},{children:"We connect students to powerful civic learning experiences."}))]})),n("div",Ae({className:o.groups},{children:i("div",Ae({className:o.wrapper},{children:[n(A,Ae({className:o.link,component:"a",href:"https://www.localcivics.io",target:"_blank"},{children:"About"})),n(A,Ae({className:o.link,component:"a",href:"https://www.localcivics.io/terms-of-service",target:"_blank"},{children:"Terms"})),n(A,Ae({className:o.link,component:"a",href:"https://www.localcivics.io/privacy-policy",target:"_blank"},{children:"Privacy"})),n(A,Ae({className:o.link,component:"a",href:"https://localcivics.notion.site/Help-Center-b52300f587b64fc0a61f512686e7626d",target:"_blank"},{children:"FAQ"}))]}))}))]})),i(M,Ae({className:o.afterFooter},{children:[i(A,Ae({color:"dimmed",size:"sm"},{children:["© ",(new Date).getFullYear()," Local Civics. All rights reserved."]})),i(P,Ae({spacing:0,className:o.social,position:"right",noWrap:!0},{children:[n(H,Ae({component:"a",target:"_blank",href:"https://www.instagram.com/localcivics/",size:"lg"},{children:n(D,{size:18,stroke:1.5})})),n(H,Ae({component:"a",target:"_blank",href:"https://www.linkedin.com/company/localcivics",size:"lg"},{children:n(E,{size:18,stroke:1.5})})),n(H,Ae({component:"a",target:"_blank",href:"https://www.facebook.com/localcivics/",size:"lg"},{children:n(L,{size:18,stroke:1.5})}))]}))]}))]}))}),styles:function(e){return{main:{backgroundColor:"dark"===e.colorScheme?e.colors.dark[8]:e.colors.gray[0]}}}},{children:[i("div",Ae({style:{position:"relative"}},{children:[(e.loading||t.opened)&&n(he,Ae({style:{height:400}},{children:n(pe,{})})),!e.loading&&!t.opened&&e.page]})),n(Li,{opened:t.opened,account:t.account,accounts:t.accounts,onChange:t.onAccountChange,onClose:function(){return t.setChangeModalOpen(!1)}})]}))},Ri=function(e,i,n){var r=JSON.stringify(i),o=fe(!1),t=o[0],l=o[1],a=fe(e),c=a[0],d=a[1];return ge.useEffect((function(){d(e)}),[e,r]),{opened:t,account:c,accounts:i,setChangeModalOpen:l,onAccountChange:function(e){d(e),l(!1),n(e)}}};export{Ei as AdminProvider,Pi as App,Fe as Badge,je as Badges,Ue as DataBreakdown,Ke as DataDashboard,Ze as DataOverview,ti as Group,vi as GroupUser,di as Groups,Ci as Home,zi as Lesson,Ni as Lessons,Oi as Navbar,Li as SwitchAccount};
|
|
1
|
+
import{NotificationsProvider as e}from"@mantine/notifications";export{showNotification,updateNotification}from"@mantine/notifications";import{jsxs as i,jsx as n,Fragment as r}from"react/jsx-runtime";import{IconArrowLeft as o,IconCategory2 as t,IconInfoCircle as l,IconCalendar as a,IconArrowUpRight as c,IconArrowDownRight as d,IconTrash as s,IconPlaylistAdd as m,IconDownload as h,IconX as u,IconCloudUpload as p,IconUsers as g,IconDots as f,IconBadges as v,IconSchool as b,IconActivityHeartbeat as y,IconTimelineEvent as C,IconSwitchHorizontal as S,IconLogout as k,IconHome2 as z,IconGauge as x,IconAlbum as w,IconLambda as N,IconBrandInstagram as D,IconBrandLinkedin as E,IconBrandFacebook as L}from"@tabler/icons";import{createStyles as B,Title as T,Text as A,Image as O,UnstyledButton as W,Group as P,Avatar as R,Badge as I,ScrollArea as F,Table as G,Container as M,Stack as j,Grid as V,ActionIcon as H,Button as U,Divider as _,Select as q,LoadingOverlay as K,Autocomplete as $,Paper as J,Tooltip as Q,Tabs as Y,ThemeIcon as Z,SimpleGrid as X,Drawer as ee,TextInput as ie,Menu as ne,Anchor as re,Timeline as oe,Blockquote as te,Card as le,Overlay as ae,createEmotionCache as ce,MantineProvider as de,Modal as se,Navbar as me,Center as he,AppShell as ue,Loader as pe}from"@mantine/core";import*as ge from"react";import{useState as fe,useRef as ve}from"react";import{DateRangePicker as be}from"@mantine/dates";import{ResponsiveContainer as ye,AreaChart as Ce,XAxis as Se,YAxis as ke,CartesianGrid as ze,Tooltip as xe,Area as we}from"recharts";import{Dropzone as Ne,MIME_TYPES as De}from"@mantine/dropzone";import{useForm as Ee}from"@mantine/form";import*as Le from"papaparse";import{openConfirmModal as Be,ModalsProvider as Te}from"@mantine/modals";var Ae=function(){return Ae=Object.assign||function(e){for(var i,n=1,r=arguments.length;n<r;n++)for(var o in i=arguments[n])Object.prototype.hasOwnProperty.call(i,o)&&(e[o]=i[o]);return e},Ae.apply(this,arguments)};function Oe(e,i,n){if(n||2===arguments.length)for(var r,o=0,t=i.length;o<t;o++)!r&&o in i||(r||(r=Array.prototype.slice.call(i,0,o)),r[o]=i[o]);return e.concat(r||Array.prototype.slice.call(i))}var We=B((function(e){var i,n,r;return{wrapper:(i={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])},i["@media (max-width: ".concat(e.breakpoints.sm,"px)")]={flexDirection:"column-reverse",padding:e.spacing.xl},i),image:(n={maxWidth:"40%"},n["@media (max-width: ".concat(e.breakpoints.sm,"px)")]={maxWidth:"100%"},n),body:(r={paddingRight:4*e.spacing.xl},r["@media (max-width: ".concat(e.breakpoints.sm,"px)")]={paddingRight:0,marginTop:e.spacing.xl},r),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}}})),Pe=function(e){var r=We().classes;return i("div",Ae({className:r.wrapper},{children:[i("div",Ae({className:r.body},{children:[n(T,Ae({className:r.title},{children:e.loading?"Loading...":"Nothing to display"})),n(A,Ae({size:"sm",color:"dimmed"},{children:e.loading?"Hold on, we're loading your data.":"We don't have anything to show you here just yet. Add data, check back later, or adjust your search."}))]})),n(O,{src:"https://cdn.localcivics.io/illustrations/".concat(e.icon,".svg"),className:r.image})]}))};function Re(e){if(0===e.items.length)return n(Pe,{loading:e.loading,icon:"badges"});var r=e.items.map((function(r){return i("tr",{children:[n("td",{children:n(W,Ae({onClick:function(){return e.onClick&&e.onClick(r)}},{children:i(P,{children:[n(R,{size:40,src:r.avatar,radius:40}),i("div",{children:[n(A,Ae({size:"sm",weight:500},{children:r.name})),n(A,Ae({size:"xs",color:"dimmed"},{children:r.email}))]})]})}))}),i("td",{children:[!!r.isComplete&&n(I,Ae({variant:"filled"},{children:"Complete"})),!r.isComplete&&n(I,Ae({color:"gray",variant:"filled"},{children:"Incomplete"}))]})]},r.name)}));return n(F.Autosize,Ae({maxHeight:500},{children:i(G,Ae({horizontalSpacing:0,verticalSpacing:"sm",sx:{minWidth:700},highlightOnHover:!0,striped:!0},{children:[n("thead",{children:i("tr",{children:[n("th",{children:"Name"}),n("th",{children:"Status"})]})}),n("tbody",{children:r})]}))}))}var Ie=B((function(e){var i;return{title:(i={fontSize:34,fontWeight:900},i[e.fn.smallerThan("sm")]={fontSize:24},i),description:{maxWidth:600}}})),Fe=function(e){var r=Ie().classes;return n(M,Ae({size:"lg",py:"xl"},{children:i(j,Ae({spacing:"md"},{children:[n(V,{children:i(V.Col,Ae({sm:"auto"},{children:[n(I,Ae({variant:"filled",leftSection:n(H,Ae({onClick:e.onBackClick,color:"blue",size:"xs",radius:"xl",variant:"filled"},{children:n(o,{size:14})})),size:"lg"},{children:"Badges"})),i(P,{children:[i(j,Ae({spacing:0},{children:[n(T,Ae({order:2,className:r.title,mt:"md"},{children:e.displayName||"Badge"})),n(A,Ae({color:"dimmed",className:r.description,mt:"sm"},{children:e.description||"No description"}))]})),i(j,Ae({spacing:"xs",ml:"auto"},{children:[n(U,Ae({variant:"gradient",onClick:e.onPreviewClick},{children:"Preview"})),n(_,{label:"or",labelPosition:"center",my:"xs",variant:"dashed"}),n(q,{size:"sm",placeholder:"Select a group",nothingFound:"No options",value:e.groupId,onChange:e.onGroupChange,icon:n(t,{}),data:e.groups.map((function(e){return{value:e.groupId,label:e.name}}))})]}))]})]}))}),n("div",{children:i("div",Ae({style:{position:"relative"}},{children:[n(K,{visible:e.loading,overlayBlur:2}),n(Re,{loading:e.loading,items:e.users,onClick:e.onUserClick})]}))})]}))}))};function Ge(e){if(0===e.items.length)return n(Pe,{loading:e.loading,icon:"badges"});var r=e.items.map((function(r){return n("tr",{children:n("td",{children:n(W,Ae({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(r)}},{children:n(P,{children:i("div",{children:[n(A,Ae({size:"sm",weight:500},{children:r.name})),n(A,Ae({size:"xs",color:"dimmed"},{children:r.description}))]})})}))})},r.badgeId)}));return n(F.Autosize,Ae({maxHeight:500},{children:n(G,Ae({horizontalSpacing:0,verticalSpacing:0,sx:{minWidth:700}},{children:n("tbody",{children:r})}))}))}var Me=B((function(e){var i;return{title:(i={fontSize:34,fontWeight:900},i[e.fn.smallerThan("sm")]={fontSize:24},i),description:{maxWidth:600}}})),je=function(e){var r=Me().classes;return n(M,Ae({size:"lg",py:"xl"},{children:i(j,Ae({spacing:"md"},{children:[n(V,{children:i(V.Col,Ae({sm:"auto"},{children:[n(I,Ae({variant:"filled",size:"lg"},{children:"Badges"})),n(T,Ae({order:2,className:r.title,mt:"md"},{children:"Badges and micro-credentials"})),n(A,Ae({color:"dimmed",className:r.description,mt:"sm"},{children:"Project-sized skills acquisition and standards alignment."}))]}))}),n($,{placeholder:"Search for a badge that fits your needs",data:e.badges.map((function(e){return e.name})),onChange:e.onAutocompleteChange}),i("div",Ae({style:{position:"relative"}},{children:[n(K,{visible:e.loading,overlayBlur:2}),n(Ge,{loading:e.loading,items:e.badges,onClick:e.onBadgeClick})]}))]}))}))},Ve=B((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}}})),He=function(e){var r,o=Ve(),t=o.classes,l=o.cx,a=fe(!1),c=a[0],d=a[1],s=e.items.map((function(e){return e.value})),m=Math.round(s.reduce((function(e,i){return e+i}))/s.length),h=e.items.map((function(e){return i("tr",{children:[n("td",{children:e.name}),n("td",{children:e.email}),n("td",{children:e.value}),n("td",{children:e.value>m?n(I,{children:"Above average"}):e.value===m?n(I,Ae({color:"gray"},{children:"Average"})):n(I,Ae({color:"red"},{children:"Below average"}))})]},e.name)}));return n(F,Ae({sx:{height:500},onScrollPositionChange:function(e){var i=e.y;return d(0!==i)}},{children:i(G,Ae({verticalSpacing:"md",sx:{minWidth:700}},{children:[n("thead",Ae({className:l(t.header,(r={},r[t.scrolled]=c,r))},{children:i("tr",{children:[n("th",{children:"Name"}),n("th",{children:"Email"}),n("th",{children:"Value"}),n("th",{children:"Status"})]})})),n("tbody",{children:h})]}))}))},Ue=function(e){return e.loading||0===e.points.length?n(Pe,{loading:e.loading,icon:"dashboard"}):n(J,Ae({mih:150,p:"lg",withBorder:!0},{children:i(j,{children:[n(V,{children:n(V.Col,Ae({sm:"auto"},{children:i(P,Ae({spacing:0},{children:[n(T,Ae({size:"h5",mb:0},{children:"Performance History"})),n(Q,Ae({label:"Shows group performance per person"},{children:n(H,{children:n(l,{color:"#3b82f6",size:14})})}))]}))}))}),n(P,Ae({spacing:"sm"},{children:n(q,{placeholder:"Select a metric",value:e.metric,onChange:e.onMetricChange,data:[{label:"PROBLEMS SOLVED",value:"PROBLEMS SOLVED"},{label:"LESSONS COMPLETED",value:"LESSONS COMPLETED"},{label:"BADGES EARNED",value:"BADGES EARNED"}]})})),n(He,{items:e.points})]})}))},_e=function(e){var i,r=null===(i=e.data)||void 0===i?void 0:i.map((function(e){return n(Y.Tab,Ae({value:e.value},{children:e.label||e.value}),e.value)}));return n(Y,Ae({value:e.value,onTabChange:e.onChange},{children:n(Y.List,{children:r})}))},qe=[{value:"Overview"},{value:"Breakdown"}],Ke=function(e){return n(M,Ae({size:"lg",py:"xl"},{children:i(j,{children:[i(V,{children:[i(V.Col,Ae({sm:"auto"},{children:[n(T,Ae({size:"h3"},{children:"Dashboard"})),n(A,Ae({color:"dimmed",size:"sm",mt:"md"},{children:"View core metrics on the state of your groups."}))]})),n(V.Col,Ae({sm:2.5},{children:n(q,{placeholder:"Select a group",nothingFound:"No options",value:e.group,onChange:e.onGroupChange,icon:n(t,{}),data:e.groups.map((function(e){return e.name}))})})),n(V.Col,Ae({sm:"auto"},{children:n(be,{placeholder:"Select a date",allowSingleDateInRange:!0,value:e.dateRange,onChange:e.onDateRangeChange,icon:n(a,{size:16})})}))]}),i(j,{children:[n(_e,{data:qe,value:e.tab,onChange:e.onTabChange}),i("div",Ae({style:{position:"relative"}},{children:[n(K,{visible:e.loading,overlayBlur:2}),e.body]}))]})]})}))},$e=B((function(e){return{axis:{fontSize:"12px",fontFamily:"Greycliff CF, ".concat(e.fontFamily)}}})),Je=function(e){var r=$e().theme;return n(J,Ae({p:"lg",withBorder:!0},{children:i(j,{children:[i(V,{children:[n(V.Col,Ae({sm:"auto"},{children:i(P,Ae({spacing:0},{children:[n(T,Ae({size:"h5",mb:0},{children:"Performance History"})),n(Q,Ae({label:"Shows daily increase or decrease across group"},{children:n(H,{children:n(l,{color:"#3b82f6",size:14})})}))]}))})),n(V.Col,Ae({sm:5},{children:n(q,{placeholder:"Select a metric",value:e.metric,onChange:e.onMetricChange,data:[{label:"PROBLEMS SOLVED",value:"PROBLEMS SOLVED"},{label:"LESSONS COMPLETED",value:"LESSONS COMPLETED"},{label:"BADGES EARNED",value:"BADGES EARNED"}]})}))]}),n(ye,Ae({width:"100%",height:400},{children:i(Ce,Ae({width:730,height:250,data:e.points,margin:{top:10,right:30,left:0,bottom:0}},{children:[n("defs",{children:i("linearGradient",Ae({id:"colorBlue",x1:"0",y1:"0",x2:"0",y2:"1"},{children:[n("stop",{offset:"5%",stopColor:"#3b82f6",stopOpacity:.4}),n("stop",{offset:"95%",stopColor:"#3b82f6",stopOpacity:0})]}))}),n(Se,{tick:{fontSize:12,fontFamily:r.fontFamily},dataKey:"name"}),n(ke,{tick:{fontSize:12,fontFamily:r.fontFamily}}),n(ze,{strokeDasharray:"3 3",horizontal:!0,vertical:!1}),n(xe,{contentStyle:{fontWeight:700,fontSize:12,fontFamily:r.fontFamily},labelStyle:{fontSize:12,fontFamily:r.fontFamily}}),n(we,{type:"monotone",dataKey:"value",stroke:"#3b82f6",fillOpacity:1,fill:"url(#colorBlue)"})]}))}))]})}))},Qe=B((function(e){return{root:{paddingTop:1.5*e.spacing.xl,paddingBottom:1.5*e.spacing.xl},label:{fontFamily:"Greycliff CF, ".concat(e.fontFamily)}}})),Ye=function(e){var r=e.data,o=Qe().classes,t=r.map((function(e){var r=e.diff>0?c:d;return i(J,Ae({withBorder:!0,p:"md",radius:"md"},{children:[i(P,Ae({position:"apart"},{children:[i("div",{children:[n(A,Ae({color:"dimmed",transform:"uppercase",weight:700,size:"xs",className:o.label},{children:e.title})),n(A,Ae({weight:700,size:"xl"},{children:e.value.toLocaleString()}))]}),!!e.diff&&n(Z,Ae({color:"gray",variant:"light",sx:function(i){return{color:e.diff>0?i.colors.teal[6]:i.colors.red[6]}},size:38,radius:"md"},{children:n(r,{size:28,stroke:1.5})}))]})),!!e.diff&&i(A,Ae({color:"dimmed",size:"sm",mt:"md"},{children:[i(A,Ae({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("div",Ae({className:o.root},{children:n(X,Ae({cols:3,breakpoints:[{maxWidth:"sm",cols:1}]},{children:t}))}))},Ze=function(e){return e.loading||!e.problemsSolved?n(Pe,{loading:e.loading,icon:"dashboard"}):i(r,{children:[n(Ye,{data:[{title:"PROBLEMS SOLVED",value:e.problemsSolved,diff:e.problemsSolvedDiff},{title:"LESSONS COMPLETED",value:e.lessonsCompleted,diff:e.lessonsCompletedDiff},{title:"BADGES EARNED",value:e.badgesCompleted,diff:e.badgesCompletedDiff}]}),n(Je,{metric:e.metric,points:e.points,onMetricChange:e.onMetricChange})]})},Xe=[{unit:"year",ms:31536e6},{unit:"month",ms:2628e6},{unit:"day",ms:864e5},{unit:"hour",ms:36e5},{unit:"minute",ms:6e4},{unit:"second",ms:1e3}],ei=new Intl.RelativeTimeFormat("en",{numeric:"auto"});function ii(e,i){return void 0===i&&(i=new Date),e?function(e){for(var i=0,n=Xe;i<n.length;i++){var r=n[i],o=r.unit,t=r.ms;if(Math.abs(e)>=t||"second"===o)return ei.format(Math.round(e/t),o)}return""}(e.getTime()-i.getTime()):""}var ni=[{value:"Member",label:"Member"},{value:"Admin",label:"Admin"}];function ri(e){if(0===e.items.length)return n(Pe,{loading:e.loading,icon:"groups"});var r=e.items.map((function(r){return i("tr",{children:[n("td",{children:n(W,Ae({onClick:function(){return e.onViewProfile&&e.onViewProfile(r)}},{children:i(P,Ae({spacing:"sm"},{children:[n(R,{size:40,src:r.avatar,radius:40}),i("div",{children:[n(A,Ae({size:"sm",weight:500},{children:r.givenName&&r.familyName?"".concat(r.givenName," ").concat(r.familyName):r.email})),n(A,Ae({size:"xs",color:"dimmed"},{children:r.email}))]})]}))}))}),n("td",{children:n(q,{data:Oe([],ni,!0).map((function(e){return r.readonly?Ae(Ae({},e),{disabled:e.value!==r.role}):e})),defaultValue:r.role,variant:"unstyled",onChange:function(i){return!r.readonly&&e.onChangeRole&&e.onChangeRole(r,i)}})}),n("td",{children:r.lastActivity?ii(r.lastActivity):""}),n("td",{children:n(P,Ae({noWrap:!0,spacing:0,position:"right"},{children:!r.readonly&&n(H,Ae({color:"red"},{children:n(s,{onClick:function(){return Be({title:'Delete "'.concat((i=r).givenName&&i.familyName?"".concat(i.givenName," ").concat(i.familyName):i.email,'"?'),centered:!0,children:n(A,Ae({size:"sm"},{children:"Are you sure you want to delete this person? This action is destructive and you will have to contact support to restore your data."})),labels:{confirm:"Delete",cancel:"No don't delete them"},confirmProps:{color:"red"},onConfirm:function(){return e.onDelete&&e.onDelete(i)}});var i},size:16,stroke:1.5})}))}))})]},r.email)}));return n(F,{children:i(G,Ae({verticalSpacing:20,sx:{minWidth:700}},{children:[n("thead",{children:i("tr",{children:[n("th",{children:"Member"}),n("th",{children:"Role"}),n("th",{children:"Last active"}),n("th",{})]})}),n("tbody",{children:r})]}))})}var oi=B((function(e){var i;return{title:(i={fontSize:34,fontWeight:900},i[e.fn.smallerThan("sm")]={fontSize:24},i),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}}})),ti=function(e){var t=oi().classes,l=Ee({initialValues:{groupId:"",userId:"",email:"",givenName:"",familyName:"",avatar:"",role:"",readonly:!1,lastActivity:null},validate:{email:function(i){return/^\S+@\S+$/.test(i)&&0===e.users.filter((function(e){return e.email===i})).length?null:"Invalid email"}}}),a=fe(!1),c=a[0],d=a[1];return i(r,{children:[n(ee,Ae({opened:c,onClose:function(){return d(!1)},title:n(T,Ae({size:"h5"},{children:"Add people"})),padding:"xl",size:"xl"},{children:i(j,Ae({spacing:"md"},{children:[n(li,Ae({},e,{close:function(){return d(!1)}})),n(_,{label:"or",labelPosition:"center",my:"md",variant:"dashed"}),n("form",Ae({onSubmit:l.onSubmit((function(){var i=l.values;l.reset(),d(!1),e.onCreateUsers&&e.onCreateUsers([i])}))},{children:i(j,{children:[n(ie,Ae({withAsterisk:!0,label:"Email",placeholder:"Email"},l.getInputProps("email"))),i(P,Ae({grow:!0},{children:[n(ie,Ae({label:"Given name",placeholder:"Given name"},l.getInputProps("givenName"))),n(ie,Ae({label:"Family name",placeholder:"Family name"},l.getInputProps("familyName")))]})),n(U,Ae({type:"submit",fullWidth:!0,mt:"md"},{children:"Submit"}))]})}))]}))})),n(M,Ae({size:"lg",py:"xl"},{children:i(j,Ae({spacing:"md"},{children:[i(V,{children:[i(V.Col,Ae({sm:"auto"},{children:[n(I,Ae({variant:"filled",leftSection:n(H,Ae({onClick:e.onBackClick,color:"blue",size:"xs",radius:"xl",variant:"filled"},{children:n(o,{size:14})})),size:"lg"},{children:"Groups"})),n(T,Ae({order:2,className:t.title,mt:"md"},{children:e.displayName||"Group"})),n(A,Ae({color:"dimmed",className:t.description,mt:"sm"},{children:e.description||"No description"}))]})),n(V.Col,Ae({sm:"content"},{children:!e.loading&&n(U,Ae({onClick:function(){return d(!0)},leftIcon:n(m,{size:14})},{children:"Add people"}))}))]}),i("div",Ae({style:{position:"relative"}},{children:[n(K,{visible:e.loading,overlayBlur:2}),n(ri,{loading:e.loading,items:e.users,onDelete:e.onDeleteUser,onChangeRole:e.onRoleChange,onViewProfile:function(i){return e.onUserClick(i)}})]}))]}))}))]})},li=function(e){var r=oi(),o=r.classes,t=r.theme,l=ge.useRef(null),a=ge.useState(!1),c=a[0],d=a[1],s=ge.useCallback((function(i){d(!0),i.forEach((function(i){Le.parse(i,{download:!0,header:!0,dynamicTyping:!0,skipEmptyLines:!0,worker:!0,complete:function(i){var n=i.data.filter((function(i){return/^\S+@\S+$/.test(i.email)&&0===e.users.filter((function(e){return e.email===i.email})).length}));n.length>0&&e.onCreateUsers&&e.onCreateUsers(n),d(!1),e.close()}})}))}),[]);return i("div",Ae({className:o.wrapper},{children:[n(Ne,Ae({loading:c,openRef:l,onDrop:s,className:o.dropzone,radius:"md",accept:[De.csv],maxSize:5*Math.pow(1024,2)},{children:i("div",Ae({style:{pointerEvents:"none"}},{children:[i(P,Ae({position:"center"},{children:[n(Ne.Accept,{children:n(h,{size:50,color:t.colors[t.primaryColor][6],stroke:1.5})}),n(Ne.Reject,{children:n(u,{size:50,color:t.colors.red[6],stroke:1.5})}),n(Ne.Idle,{children:n(p,{size:50,color:"dark"===t.colorScheme?t.colors.dark[0]:t.black,stroke:1.5})})]})),i(A,Ae({align:"center",weight:700,size:"lg",mt:"xl"},{children:[n(Ne.Accept,{children:"Drop files here"}),n(Ne.Reject,{children:"Csv file less than 5mb"}),n(Ne.Idle,{children:"Upload multiple"})]})),i(A,Ae({align:"center",size:"sm",mt:"xs",color:"dimmed"},{children:["Drag'n'drop files here to upload. We can accept only ",n("i",{children:".csv"})," files that are less than 5mb in size."]}))]}))})),n(U,Ae({className:o.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 ai(e){if(0===e.items.length)return n(Pe,{loading:e.loading,icon:"groups"});var r=e.items.map((function(r){return i("tr",{children:[n("td",{children:n(A,Ae({size:14},{children:r.name}))}),n("td",{children:n(A,Ae({size:14},{children:r.description}))}),n("td",{children:i(P,Ae({noWrap:!0,spacing:0,position:"right"},{children:[n(H,Ae({color:"blue",onClick:function(){return e.onClick(r)},variant:"subtle"},{children:n(g,{size:16,stroke:1.5})})),i(ne,Ae({transition:"pop",withArrow:!0,position:"bottom-end"},{children:[n(ne.Target,{children:n(H,{children:n(f,{size:16,stroke:1.5})})}),n(ne.Dropdown,{children:n(ne.Item,Ae({onClick:function(){return Be({title:'Delete "'.concat((i=r).name,'"?'),centered:!0,children:n(A,Ae({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(i)}});var i},icon:n(s,{size:16,stroke:1.5}),color:"red"},{children:"Delete"}))})]}))]}))})]},r.groupId)}));return n(F.Autosize,Ae({maxHeight:300},{children:i(G,Ae({verticalSpacing:20,sx:{minWidth:700}},{children:[n("thead",{children:i("tr",{children:[n("th",{children:"Name"}),n("th",{children:"Description"}),n("th",{})]})}),n("tbody",{children:r})]}))}))}var ci=B((function(e){var i;return{title:(i={fontSize:34,fontWeight:900},i[e.fn.smallerThan("sm")]={fontSize:24},i),description:{maxWidth:600}}})),di=function(e){var o=ci().classes,t=Ee({initialValues:{groupId:"",name:"",description:""},validate:{name:function(e){return e.length<=6?"Name should include at least 6 characters":null}}}),a=fe(!1),c=a[0],d=a[1];return i(r,{children:[n(ee,Ae({opened:c,onClose:function(){return d(!1)},title:i(P,Ae({spacing:0},{children:[n(T,Ae({size:"h5"},{children:"Create a group"})),n(Q,Ae({label:"Groups settings cannot be modified once created"},{children:n(H,{children:n(l,{color:"#3b82f6",size:14})})}))]})),padding:"xl",size:"xl"},{children:i("form",Ae({onSubmit:t.onSubmit((function(){var i=t.values;t.reset(),d(!1),e.onCreateGroup&&e.onCreateGroup(i)}))},{children:[i(j,{children:[n(ie,Ae({withAsterisk:!0,label:"Name",placeholder:"Group name"},t.getInputProps("name"))),n(ie,Ae({label:"Description",placeholder:"A group for my first period class"},t.getInputProps("description")))]}),n(U,Ae({type:"submit",fullWidth:!0,mt:"md"},{children:"Submit"}))]}))})),n(M,Ae({size:"lg",py:"xl"},{children:i(j,Ae({spacing:"md"},{children:[i(V,{children:[i(V.Col,Ae({sm:"auto"},{children:[n(I,Ae({variant:"filled",size:"lg"},{children:"Groups"})),n(T,Ae({order:2,className:o.title,mt:"md"},{children:"Organize people into groups"})),n(A,Ae({color:"dimmed",className:o.description,mt:"sm"},{children:"A group can be a class, team, or other functioning organizations."}))]})),n(V.Col,Ae({sm:"content"},{children:!e.loading&&n(U,Ae({onClick:function(){return d(!0)},leftIcon:n(m,{size:14})},{children:"Create group"}))}))]}),i("div",Ae({style:{position:"relative"}},{children:[n(K,{visible:e.loading,overlayBlur:2}),n(ai,{loading:e.loading,items:e.groups,onDeleteGroup:e.onDeleteGroup,onClick:e.onGroupClick})]}))]}))}))]})},si=B((function(e){var i,n;return{root:(i={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},i[e.fn.smallerThan("sm")]={flexDirection:"column"},i),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,"& + &":(n={paddingLeft:e.spacing.xl,marginLeft:e.spacing.xl,borderLeft:"1px solid ".concat(e.colors[e.primaryColor][3])},n[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])},n)}}})),mi=function(e){var r=e.data,o=si().classes,t=r.map((function(e){return i("div",Ae({className:o.stat},{children:[n(A,Ae({className:o.count},{children:e.value.toLocaleString()})),n(A,Ae({className:o.title},{children:e.title})),!!e.diff&&n(A,Ae({className:o.description},{children:"".concat(e.diff,"% ").concat(e.diff<0?"decrease":"increase"," compared to last period")}))]}),e.title)}));return n("div",Ae({className:o.root},{children:t}))},hi={BadgeCompleted:n(v,{size:12}),BadgeStarted:n(v,{size:12}),LessonCompleted:n(b,{size:12}),LessonStarted:n(b,{size:12}),ProblemSolved:n(y,{size:12})},ui=function(e){var r,o=ve(null),t=fe({x:0,y:0}),l=t[0],a=t[1];ge.useEffect((function(){o.current&&l.y===o.current.scrollHeight-o.current.offsetHeight&&e.onScrollBottom&&e.onScrollBottom()}),[l.y]);var c=e.items.map((function(e){var o=e.name.split(/(?=[A-Z])/),t=o[0]===r?"dashed":"solid";r=o[0];var l=e.link?n(re,Ae({color:"dark",unstyled:!0,href:e.link},{children:"".concat(o[0]," ").concat(o[1].toLowerCase())})):"".concat(o[0]," ").concat(o[1].toLowerCase());return i(oe.Item,Ae({bullet:pi(e.name),lineVariant:t,title:l},{children:[n(A,Ae({color:"dimmed",size:"sm"},{children:e.description})),n(A,Ae({size:"xs",mt:4},{children:ii(new Date(e.time))}))]}),e.key)}));return n(F.Autosize,Ae({maxHeight:300,onScrollPositionChange:a,viewportRef:o},{children:n(oe,Ae({ml:"lg",active:1,bulletSize:24,lineWidth:2},{children:c}))}))},pi=function(e){var i=hi[e];return i||n(C,{size:12})},gi=B((function(e){var i;return{title:(i={fontSize:34,fontWeight:900,marginTop:16},i[e.fn.smallerThan("sm")]={fontSize:24},i),description:{maxWidth:600}}})),fi=function(e){var o=gi().classes,t=e.givenName?[e.givenName,e.familyName].join(" ").trim():e.email,l=e.givenName?e.givenName:"Me";return"compact"===e.variant?i(r,{children:[n(T,Ae({className:o.title},{children:t})),n(A,Ae({color:"dimmed",className:o.description,mt:"xs"},{children:e.quote}))]}):i(r,{children:[i(J,Ae({radius:"md",withBorder:!0,p:"lg",sx:function(e){return{backgroundColor:"dark"===e.colorScheme?e.colors.dark[8]:e.white}}},{children:[n(R,{src:e.avatar,size:135,radius:120,mx:"auto"}),n(A,Ae({align:"center",size:"lg",weight:500,mt:"md"},{children:t})),i(A,Ae({align:"center",color:"dimmed",size:"sm"},{children:[e.email," • ",e.job]}))]})),n(te,Ae({mt:"xl",color:"blue",cite:"– ".concat(l)},{children:e.quote}))]})},vi=function(e){return n(M,Ae({size:"lg",py:"xl"},{children:i(j,Ae({spacing:"md"},{children:[n(V,{children:i(V.Col,Ae({sm:"auto"},{children:[n(I,Ae({variant:"filled",leftSection:n(H,Ae({onClick:e.onBackClick,color:"blue",size:"xs",radius:"xl",variant:"filled"},{children:n(o,{size:14})})),size:"lg"},{children:"Users"})),n(fi,{variant:"compact",givenName:e.givenName,familyName:e.familyName,avatar:e.avatarURL,email:e.email,quote:e.impactStatement,job:e.job})]}))}),i("div",Ae({style:{position:"relative"}},{children:[n(K,{visible:e.loading,overlayBlur:2}),i(j,Ae({spacing:"lg"},{children:[n(mi,{data:[{title:"PROBLEMS SOLVED",value:e.problemsSolved,diff:e.problemsSolvedDiff},{title:"LESSONS COMPLETED",value:e.lessonsCompleted,diff:e.lessonsCompletedDiff},{title:"BADGES EARNED",value:e.badgesCompleted,diff:e.badgesCompletedDiff}]}),n(ui,{onScrollBottom:e.onScrollBottom,items:e.events})]}))]}))]}))}))},bi=B((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}}})),yi=function(e){var r=e.title,o=e.description,t=e.image,l=e.action,a=e.style,c=e.className,d=function(e,i){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&i.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)i.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}(e,["title","description","image","action","style","className"]),s=bi(),m=s.classes,h=s.cx,u=s.theme;return i(le,Ae({radius:"md",style:Ae({backgroundImage:"url(".concat(t,")")},a),className:h(m.card,c)},d,{children:[n(ae,{gradient:"linear-gradient(105deg, ".concat(u.black," 20%, #312f2f 50%, ").concat(u.colors.gray[4]," 100%)"),opacity:.55,zIndex:0}),i("div",Ae({className:m.content},{children:[n(A,Ae({size:"lg",weight:700,className:m.title},{children:r})),n(A,Ae({size:"sm",className:m.description},{children:o})),n(U,Ae({className:m.action,variant:"white",color:"dark",component:"a",size:"xs",href:l.link,target:"_blank"},{children:l.label}))]}))]}))},Ci=function(e){return n(M,Ae({size:"lg"},{children:i(j,Ae({spacing:"lg"},{children:[i(V,Ae({gutter:"md"},{children:[n(V.Col,Ae({md:6},{children:n(fi,{variant:"compact",givenName:e.givenName,familyName:e.familyName,avatar:e.avatarURL,email:e.email,quote:e.impactStatement,job:e.job})})),n(V.Col,Ae({md:6},{children:n(yi,{title:e.tenantName,description:e.tenantDescription,image:e.tenantImage,action:{label:"Visit website",link:e.tenantWebsite}})}))]})),n(mi,{data:[{title:"PROBLEMS SOLVED",value:e.problemsSolved,diff:e.problemsSolvedDiff},{title:"LESSONS COMPLETED",value:e.lessonsCompleted,diff:e.lessonsCompletedDiff},{title:"BADGES EARNED",value:e.badgesCompleted,diff:e.badgesCompletedDiff}]}),n(ui,{onScrollBottom:e.onScrollBottom,items:e.events})]}))}))};function Si(e){if(0===e.items.length)return n(Pe,{loading:e.loading,icon:"lessons"});var r=e.items.map((function(r){return i("tr",{children:[n("td",{children:n(W,Ae({onClick:function(){return e.onClick&&e.onClick(r)}},{children:i(P,{children:[n(R,{size:40,src:r.avatar,radius:40}),i("div",{children:[n(A,Ae({size:"sm",weight:500},{children:r.name})),n(A,Ae({size:"xs",color:"dimmed"},{children:r.email}))]})]})}))}),i("td",{children:[!!r.isComplete&&n(I,Ae({variant:"filled"},{children:"Complete"})),!r.isComplete&&!r.isStarted&&n(I,Ae({color:"red",variant:"filled"},{children:"Not started"})),!r.isComplete&&!!r.isStarted&&n(I,Ae({color:"violet",variant:"filled"},{children:"In progress"}))]})]},r.name)}));return n(F.Autosize,Ae({maxHeight:500},{children:i(G,Ae({horizontalSpacing:0,verticalSpacing:"sm",sx:{minWidth:700},highlightOnHover:!0,striped:!0},{children:[n("thead",{children:i("tr",{children:[n("th",{children:"Name"}),n("th",{children:"Status"})]})}),n("tbody",{children:r})]}))}))}var ki=B((function(e){var i;return{title:(i={fontSize:34,fontWeight:900},i[e.fn.smallerThan("sm")]={fontSize:24},i),description:{maxWidth:600}}})),zi=function(e){var r=ki().classes;return n(M,Ae({size:"lg",py:"xl"},{children:i(j,Ae({spacing:"md"},{children:[n(V,{children:i(V.Col,Ae({sm:"auto"},{children:[n(I,Ae({variant:"filled",leftSection:n(H,Ae({onClick:e.onBackClick,color:"blue",size:"xs",radius:"xl",variant:"filled"},{children:n(o,{size:14})})),size:"lg"},{children:"Lessons"})),i(P,{children:[i(j,Ae({spacing:0},{children:[n(T,Ae({order:2,className:r.title,mt:"md"},{children:e.displayName||"Lesson"})),n(A,Ae({color:"dimmed",className:r.description,mt:"sm"},{children:e.description||"No description"}))]})),i(j,Ae({spacing:"xs",ml:"auto"},{children:[n(U,Ae({variant:"gradient",onClick:e.onPreviewClick},{children:"Preview"})),n(_,{label:"or",labelPosition:"center",my:"xs",variant:"dashed"}),n(q,{size:"sm",placeholder:"Select a group",nothingFound:"No options",value:e.groupId,onChange:e.onGroupChange,icon:n(t,{}),data:e.groups.map((function(e){return{value:e.groupId,label:e.name}}))})]}))]})]}))}),n("div",{children:i("div",Ae({style:{position:"relative"}},{children:[n(K,{visible:e.loading,overlayBlur:2}),n(Si,{loading:e.loading,items:e.users,onClick:e.onUserClick})]}))})]}))}))};function xi(e){if(0===e.items.length)return n(Pe,{loading:e.loading,icon:"lessons"});var r=e.items.map((function(r){return n("tr",{children:n("td",{children:n(W,Ae({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(r)}},{children:n(P,{children:i("div",{children:[n(A,Ae({size:"sm",weight:500},{children:r.name})),n(A,Ae({size:"xs",color:"dimmed"},{children:r.description}))]})})}))})},r.lessonId)}));return n(F.Autosize,Ae({maxHeight:500},{children:n(G,Ae({horizontalSpacing:0,verticalSpacing:0,sx:{minWidth:700}},{children:n("tbody",{children:r})}))}))}var wi=B((function(e){var i;return{title:(i={fontSize:34,fontWeight:900},i[e.fn.smallerThan("sm")]={fontSize:24},i),description:{maxWidth:600}}})),Ni=function(e){var r=wi().classes;return n(M,Ae({size:"lg",py:"xl"},{children:i(j,Ae({spacing:"md"},{children:[n(V,{children:i(V.Col,Ae({sm:"auto"},{children:[n(I,Ae({variant:"filled",size:"lg"},{children:"Lessons"})),n(T,Ae({order:2,className:r.title,mt:"md"},{children:"Lessons"})),n(A,Ae({color:"dimmed",className:r.description,mt:"sm"},{children:"Well crafted units of instruction."}))]}))}),n($,{placeholder:"Search for a lesson that fits your needs",data:e.lessons.map((function(e){return e.name})),onChange:e.onAutocompleteChange}),i("div",Ae({style:{position:"relative"}},{children:[n(K,{visible:e.loading,overlayBlur:2}),n(xi,{loading:e.loading,items:e.lessons,onClick:e.onLessonClick})]}))]}))}))},Di=ce({key:"mantine",prepend:!1}),Ei=function(i){return n(de,Ae({withNormalizeCSS:!0,withGlobalStyles:!0,emotionCache:Di,theme:{loader:"bars"}},{children:n(e,Ae({limit:i.notificationLimit||5},{children:n(Te,{children:i.children})}))}))},Li=function(e){var r=Ee({initialValues:{active:e.account}});return n(se,Ae({centered:!0,opened:e.opened,onClose:function(){return e.onClose&&e.onClose()},size:"sm",title:n(T,Ae({size:"h5"},{children:"Accounts"}))},{children:i("form",Ae({onSubmit:r.onSubmit((function(){e.onChange&&e.onChange(r.values.active)}))},{children:[n(q,Ae({required:!0,placeholder:"Select an account",defaultValue:e.account,data:e.accounts.map((function(e){return{value:e.accountId,label:e.name}}))},r.getInputProps("active"))),n(U,Ae({type:"submit",fullWidth:!0,mt:"xl"},{children:"Switch"}))]}))}))},Bi=B((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}}}})),Ti=[{icon:z,label:"Home",href:"/home"},{icon:x,label:"Dashboard",href:"/dashboard"},{icon:t,label:"Groups",href:"/groups"},{icon:w,label:"Badges",href:"/badges"},{icon:N,label:"Lessons",href:"/lessons"}],Ai=function(e){var i,r=e.icon,o=e.label,t=e.active,l=e.onClick,a=Bi(),c=a.classes,d=a.cx;return n(Q,Ae({label:o,position:"right",transitionDuration:0},{children:n(W,Ae({onClick:l,className:d(c.link,(i={},i[c.active]=t,i))},{children:n(r,{stroke:1.5})}))}))},Oi=function(e){var r=Ti.map((function(i){return n(Ai,{label:i.label,icon:i.icon,active:i.label===e.active,onClick:function(){return e.navigate(i.href)}},i.label)}));return i(me,Ae({width:{base:80},p:"md"},{children:[n(he,{children:n(R,Ae({color:"blue",radius:"sm"},{children:n("div",Ae({style:{width:15,marginLeft:"auto",marginRight:"auto"}},{children:n(O,{fit:"contain",src:"https://cdn.localcivics.io/brand/l.png"})}))}))}),n(me.Section,Ae({grow:!0,mt:50},{children:n(j,Ae({justify:"center",spacing:0},{children:r}))})),n(me.Section,{children:i(j,Ae({justify:"center",spacing:0},{children:[n(Ai,{icon:S,label:"Switch accounts",onClick:e.onSwitchAccounts}),n(Ai,{icon:k,label:"Logout",onClick:e.onLogout})]}))})]}))},Wi=B((function(e){var i,n,r,o,t,l;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:(i={maxWidth:200},i[e.fn.smallerThan("sm")]={display:"flex",flexDirection:"column",alignItems:"center"},i),description:(n={marginTop:5},n[e.fn.smallerThan("sm")]={marginTop:e.spacing.xs,textAlign:"center"},n),inner:(r={display:"flex",justifyContent:"space-between"},r[e.fn.smallerThan("sm")]={flexDirection:"column",alignItems:"center"},r),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:(l={},l[e.fn.smallerThan("sm")]={marginTop:e.spacing.xs},l)}})),Pi=function(e){var o=Wi().classes,t=Ri(e.account,e.accounts,e.onAccountChange);return i(ue,Ae({padding:"xs",navbar:n(Oi,{active:e.navbar.props.active,navigate:e.navbar.props.navigate,onLogout:e.navbar.props.onLogout,onSwitchAccounts:function(){return t.setChangeModalOpen(!0)}}),footer:n(r,{children:!t.opened&&i("footer",Ae({className:o.footer},{children:[i(M,Ae({className:o.inner},{children:[i("div",Ae({className:o.logo},{children:[i(P,Ae({spacing:"xs"},{children:[n("div",Ae({style:{width:15}},{children:n(O,{fit:"contain",src:"https://cdn.localcivics.io/brand/l.png"})})),n(T,Ae({color:"dimmed",size:"h5"},{children:"Local Civics"}))]})),n(A,Ae({size:"xs",color:"dimmed",className:o.description},{children:"We connect students to powerful civic learning experiences."}))]})),n("div",Ae({className:o.groups},{children:i("div",Ae({className:o.wrapper},{children:[n(A,Ae({className:o.link,component:"a",href:"https://www.localcivics.io",target:"_blank"},{children:"About"})),n(A,Ae({className:o.link,component:"a",href:"https://www.localcivics.io/terms-of-service",target:"_blank"},{children:"Terms"})),n(A,Ae({className:o.link,component:"a",href:"https://www.localcivics.io/privacy-policy",target:"_blank"},{children:"Privacy"})),n(A,Ae({className:o.link,component:"a",href:"https://localcivics.notion.site/Help-Center-b52300f587b64fc0a61f512686e7626d",target:"_blank"},{children:"FAQ"}))]}))}))]})),i(M,Ae({className:o.afterFooter},{children:[i(A,Ae({color:"dimmed",size:"sm"},{children:["© ",(new Date).getFullYear()," Local Civics. All rights reserved."]})),i(P,Ae({spacing:0,className:o.social,position:"right",noWrap:!0},{children:[n(H,Ae({component:"a",target:"_blank",href:"https://www.instagram.com/localcivics/",size:"lg"},{children:n(D,{size:18,stroke:1.5})})),n(H,Ae({component:"a",target:"_blank",href:"https://www.linkedin.com/company/localcivics",size:"lg"},{children:n(E,{size:18,stroke:1.5})})),n(H,Ae({component:"a",target:"_blank",href:"https://www.facebook.com/localcivics/",size:"lg"},{children:n(L,{size:18,stroke:1.5})}))]}))]}))]}))}),styles:function(e){return{main:{backgroundColor:"dark"===e.colorScheme?e.colors.dark[8]:e.colors.gray[0]}}}},{children:[i("div",Ae({style:{position:"relative"}},{children:[(e.loading||t.opened)&&n(he,Ae({style:{height:400}},{children:n(pe,{})})),!e.loading&&!t.opened&&e.page]})),n(Li,{opened:t.opened,account:t.account,accounts:t.accounts,onChange:t.onAccountChange,onClose:function(){return t.setChangeModalOpen(!1)}})]}))},Ri=function(e,i,n){var r=JSON.stringify(i),o=fe(!1),t=o[0],l=o[1],a=fe(e),c=a[0],d=a[1];return ge.useEffect((function(){d(e)}),[e,r]),{opened:t,account:c,accounts:i,setChangeModalOpen:l,onAccountChange:function(e){d(e),l(!1),n(e)}}};export{Ei as AdminProvider,Pi as App,Fe as Badge,je as Badges,Ue as DataBreakdown,Ke as DataDashboard,Ze as DataOverview,ti as Group,vi as GroupUser,di as Groups,Ci as Home,zi as Lesson,Ni as Lessons,Oi as Navbar,Li as SwitchAccount};
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("@mantine/notifications"),require("react/jsx-runtime"),require("@tabler/icons"),require("@mantine/core"),require("react"),require("@mantine/dates"),require("recharts"),require("@mantine/dropzone"),require("@mantine/form"),require("papaparse"),require("@mantine/modals")):"function"==typeof define&&define.amd?define(["exports","@mantine/notifications","react/jsx-runtime","@tabler/icons","@mantine/core","react","@mantine/dates","recharts","@mantine/dropzone","@mantine/form","papaparse","@mantine/modals"],n):n((e="undefined"!=typeof globalThis?globalThis:e||self).components={},e.MantineNotifications,e.ReactJSXRuntime,e.TablerIcons,e.MantineCore,e.React,e.MantineDates,e.Recharts,e.MantineDropzone,e.MantineForm,e.Papaparse,e.MantineModals)}(this,(function(e,n,i,t,r,o,s,a,l,c,d,m){"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 t=Object.getOwnPropertyDescriptor(e,i);Object.defineProperty(n,i,t.get?t:{enumerable:!0,get:function(){return e[i]}})}})),n.default=e,Object.freeze(n)}var u=h(o),x=h(d),p=function(){return p=Object.assign||function(e){for(var n,i=1,t=arguments.length;i<t;i++)for(var r in n=arguments[i])Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r]);return e},p.apply(this,arguments)};function g(e,n,i){if(i||2===arguments.length)for(var t,r=0,o=n.length;r<o;r++)!t&&r in n||(t||(t=Array.prototype.slice.call(n,0,r)),t[r]=n[r]);return e.concat(t||Array.prototype.slice.call(n))}var f=r.createStyles((function(e){var n,i,t;return{wrapper:(n={display:"flex",alignItems:"center",padding:2*e.spacing.xl,borderRadius:e.radius.md,backgroundColor:"dark"===e.colorScheme?e.colors.dark[8]:e.white,border:"1px solid ".concat("dark"===e.colorScheme?e.colors.dark[8]:e.colors.gray[3])},n["@media (max-width: ".concat(e.breakpoints.sm,"px)")]={flexDirection:"column-reverse",padding:e.spacing.xl},n),image:(i={maxWidth:"40%"},i["@media (max-width: ".concat(e.breakpoints.sm,"px)")]={maxWidth:"100%"},i),body:(t={paddingRight:4*e.spacing.xl},t["@media (max-width: ".concat(e.breakpoints.sm,"px)")]={paddingRight:0,marginTop:e.spacing.xl},t),title:{color:"dark"===e.colorScheme?e.white:e.black,fontFamily:"Greycliff CF, ".concat(e.fontFamily),lineHeight:1,marginBottom:e.spacing.md},controls:{display:"flex",marginTop:e.spacing.xl},inputWrapper:{width:"100%",flex:"1"},input:{borderTopRightRadius:0,borderBottomRightRadius:0,borderRight:0},control:{borderTopLeftRadius:0,borderBottomLeftRadius:0}}})),j=function(e){var n=f().classes;return i.jsxs("div",p({className:n.wrapper},{children:[i.jsxs("div",p({className:n.body},{children:[i.jsx(r.Title,p({className:n.title},{children:e.loading?"Loading...":"Nothing to display"})),i.jsx(r.Text,p({size:"sm",color:"dimmed"},{children:e.loading?"Hold on, we're loading your data.":"We don't have anything to show you here just yet. Add data, check back later, or adjust your search."}))]})),i.jsx(r.Image,{src:"https://cdn.localcivics.io/illustrations/".concat(e.icon,".svg"),className:n.image})]}))};function v(e){if(0===e.items.length)return i.jsx(j,{loading:e.loading,icon:"badges"});var n=e.items.map((function(n){return i.jsxs("tr",{children:[i.jsx("td",{children:i.jsx(r.UnstyledButton,p({onClick:function(){return e.onClick&&e.onClick(n)}},{children:i.jsxs(r.Group,{children:[i.jsx(r.Avatar,{size:40,src:n.avatar,radius:40}),i.jsxs("div",{children:[i.jsx(r.Text,p({size:"sm",weight:500},{children:n.name})),i.jsx(r.Text,p({size:"xs",color:"dimmed"},{children:n.email}))]})]})}))}),i.jsxs("td",{children:[!!n.isComplete&&i.jsx(r.Badge,p({variant:"filled"},{children:"Complete"})),!n.isComplete&&i.jsx(r.Badge,p({color:"gray",variant:"filled"},{children:"Incomplete"}))]})]},n.name)}));return i.jsx(r.ScrollArea.Autosize,p({maxHeight:500},{children:i.jsxs(r.Table,p({horizontalSpacing:0,verticalSpacing:"sm",sx:{minWidth:700}},{children:[i.jsx("thead",{children:i.jsxs("tr",{children:[i.jsx("th",{children:"Name"}),i.jsx("th",{children:"Status"})]})}),i.jsx("tbody",{children:n})]}))}))}var b=r.createStyles((function(e){var n;return{title:(n={fontSize:34,fontWeight:900},n[e.fn.smallerThan("sm")]={fontSize:24},n),description:{maxWidth:600}}}));function y(e){if(0===e.items.length)return i.jsx(j,{loading:e.loading,icon:"badges"});var n=e.items.map((function(n){return i.jsx("tr",{children:i.jsx("td",{children:i.jsx(r.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(n)}},{children:i.jsx(r.Group,{children:i.jsxs("div",{children:[i.jsx(r.Text,p({size:"sm",weight:500},{children:n.name})),i.jsx(r.Text,p({size:"xs",color:"dimmed"},{children:n.description}))]})})}))})},n.badgeId)}));return i.jsx(r.ScrollArea.Autosize,p({maxHeight:500},{children:i.jsx(r.Table,p({horizontalSpacing:0,verticalSpacing:0,sx:{minWidth:700}},{children:i.jsx("tbody",{children:n})}))}))}var S=r.createStyles((function(e){var n;return{title:(n={fontSize:34,fontWeight:900},n[e.fn.smallerThan("sm")]={fontSize:24},n),description:{maxWidth:600}}})),C=r.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}}})),k=function(e){var n,t=C(),s=t.classes,a=t.cx,l=o.useState(!1),c=l[0],d=l[1],m=e.items.map((function(e){return e.value})),h=Math.round(m.reduce((function(e,n){return e+n}))/m.length),u=e.items.map((function(e){return i.jsxs("tr",{children:[i.jsx("td",{children:e.name}),i.jsx("td",{children:e.email}),i.jsx("td",{children:e.value}),i.jsx("td",{children:e.value>h?i.jsx(r.Badge,{children:"Above average"}):e.value===h?i.jsx(r.Badge,p({color:"gray"},{children:"Average"})):i.jsx(r.Badge,p({color:"red"},{children:"Below average"}))})]},e.name)}));return i.jsx(r.ScrollArea,p({sx:{height:500},onScrollPositionChange:function(e){var n=e.y;return d(0!==n)}},{children:i.jsxs(r.Table,p({verticalSpacing:"md",sx:{minWidth:700}},{children:[i.jsx("thead",p({className:a(s.header,(n={},n[s.scrolled]=c,n))},{children:i.jsxs("tr",{children:[i.jsx("th",{children:"Name"}),i.jsx("th",{children:"Email"}),i.jsx("th",{children:"Value"}),i.jsx("th",{children:"Status"})]})})),i.jsx("tbody",{children:u})]}))}))},z=function(e){var n,t=null===(n=e.data)||void 0===n?void 0:n.map((function(e){return i.jsx(r.Tabs.Tab,p({value:e.value},{children:e.label||e.value}),e.value)}));return i.jsx(r.Tabs,p({value:e.value,onTabChange:e.onChange},{children:i.jsx(r.Tabs.List,{children:t})}))},T=[{value:"Overview"},{value:"Breakdown"}],w=r.createStyles((function(e){return{axis:{fontSize:"12px",fontFamily:"Greycliff CF, ".concat(e.fontFamily)}}})),N=function(e){var n=w().theme;return i.jsx(r.Paper,p({p:"lg",withBorder:!0},{children:i.jsxs(r.Stack,{children:[i.jsxs(r.Grid,{children:[i.jsx(r.Grid.Col,p({sm:"auto"},{children:i.jsxs(r.Group,p({spacing:0},{children:[i.jsx(r.Title,p({size:"h5",mb:0},{children:"Performance History"})),i.jsx(r.Tooltip,p({label:"Shows daily increase or decrease across group"},{children:i.jsx(r.ActionIcon,{children:i.jsx(t.IconInfoCircle,{color:"#3b82f6",size:14})})}))]}))})),i.jsx(r.Grid.Col,p({sm:5},{children:i.jsx(r.Select,{placeholder:"Select a metric",value:e.metric,onChange:e.onMetricChange,data:[{label:"PROBLEMS SOLVED",value:"PROBLEMS SOLVED"},{label:"LESSONS COMPLETED",value:"LESSONS COMPLETED"},{label:"BADGES EARNED",value:"BADGES EARNED"}]})}))]}),i.jsx(a.ResponsiveContainer,p({width:"100%",height:400},{children:i.jsxs(a.AreaChart,p({width:730,height:250,data:e.points,margin:{top:10,right:30,left:0,bottom:0}},{children:[i.jsx("defs",{children:i.jsxs("linearGradient",p({id:"colorBlue",x1:"0",y1:"0",x2:"0",y2:"1"},{children:[i.jsx("stop",{offset:"5%",stopColor:"#3b82f6",stopOpacity:.4}),i.jsx("stop",{offset:"95%",stopColor:"#3b82f6",stopOpacity:0})]}))}),i.jsx(a.XAxis,{tick:{fontSize:12,fontFamily:n.fontFamily},dataKey:"name"}),i.jsx(a.YAxis,{tick:{fontSize:12,fontFamily:n.fontFamily}}),i.jsx(a.CartesianGrid,{strokeDasharray:"3 3",horizontal:!0,vertical:!1}),i.jsx(a.Tooltip,{contentStyle:{fontWeight:700,fontSize:12,fontFamily:n.fontFamily},labelStyle:{fontSize:12,fontFamily:n.fontFamily}}),i.jsx(a.Area,{type:"monotone",dataKey:"value",stroke:"#3b82f6",fillOpacity:1,fill:"url(#colorBlue)"})]}))}))]})}))},I=r.createStyles((function(e){return{root:{paddingTop:1.5*e.spacing.xl,paddingBottom:1.5*e.spacing.xl},label:{fontFamily:"Greycliff CF, ".concat(e.fontFamily)}}})),A=function(e){var n=e.data,o=I().classes,s=n.map((function(e){var n=e.diff>0?t.IconArrowUpRight:t.IconArrowDownRight;return i.jsxs(r.Paper,p({withBorder:!0,p:"md",radius:"md"},{children:[i.jsxs(r.Group,p({position:"apart"},{children:[i.jsxs("div",{children:[i.jsx(r.Text,p({color:"dimmed",transform:"uppercase",weight:700,size:"xs",className:o.label},{children:e.title})),i.jsx(r.Text,p({weight:700,size:"xl"},{children:e.value.toLocaleString()}))]}),!!e.diff&&i.jsx(r.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:i.jsx(n,{size:28,stroke:1.5})}))]})),!!e.diff&&i.jsxs(r.Text,p({color:"dimmed",size:"sm",mt:"md"},{children:[i.jsxs(r.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 i.jsx("div",p({className:o.root},{children:i.jsx(r.SimpleGrid,p({cols:3,breakpoints:[{maxWidth:"sm",cols:1}]},{children:s}))}))},B=[{unit:"year",ms:31536e6},{unit:"month",ms:2628e6},{unit:"day",ms:864e5},{unit:"hour",ms:36e5},{unit:"minute",ms:6e4},{unit:"second",ms:1e3}],D=new Intl.RelativeTimeFormat("en",{numeric:"auto"});function G(e,n){return void 0===n&&(n=new Date),e?function(e){for(var n=0,i=B;n<i.length;n++){var t=i[n],r=t.unit,o=t.ms;if(Math.abs(e)>=o||"second"===r)return D.format(Math.round(e/o),r)}return""}(e.getTime()-n.getTime()):""}var L=[{value:"Member",label:"Member"},{value:"Admin",label:"Admin"}];function E(e){if(0===e.items.length)return i.jsx(j,{loading:e.loading,icon:"groups"});var n=e.items.map((function(n){return i.jsxs("tr",{children:[i.jsx("td",{children:i.jsx(r.UnstyledButton,p({onClick:function(){return e.onViewProfile&&e.onViewProfile(n)}},{children:i.jsxs(r.Group,p({spacing:"sm"},{children:[i.jsx(r.Avatar,{size:40,src:n.avatar,radius:40}),i.jsxs("div",{children:[i.jsx(r.Text,p({size:"sm",weight:500},{children:n.givenName&&n.familyName?"".concat(n.givenName," ").concat(n.familyName):n.email})),i.jsx(r.Text,p({size:"xs",color:"dimmed"},{children:n.email}))]})]}))}))}),i.jsx("td",{children:i.jsx(r.Select,{data:g([],L,!0).map((function(e){return n.readonly?p(p({},e),{disabled:e.value!==n.role}):e})),defaultValue:n.role,variant:"unstyled",onChange:function(i){return!n.readonly&&e.onChangeRole&&e.onChangeRole(n,i)}})}),i.jsx("td",{children:n.lastActivity?G(n.lastActivity):""}),i.jsx("td",{children:i.jsx(r.Group,p({noWrap:!0,spacing:0,position:"right"},{children:!n.readonly&&i.jsx(r.ActionIcon,p({color:"red"},{children:i.jsx(t.IconTrash,{onClick:function(){return t=n,m.openConfirmModal({title:'Delete "'.concat(t.givenName&&t.familyName?"".concat(t.givenName," ").concat(t.familyName):t.email,'"?'),centered:!0,children:i.jsx(r.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(t)}});var t},size:16,stroke:1.5})}))}))})]},n.email)}));return i.jsx(r.ScrollArea,{children:i.jsxs(r.Table,p({verticalSpacing:20,sx:{minWidth:700}},{children:[i.jsx("thead",{children:i.jsxs("tr",{children:[i.jsx("th",{children:"Member"}),i.jsx("th",{children:"Role"}),i.jsx("th",{children:"Last active"}),i.jsx("th",{})]})}),i.jsx("tbody",{children:n})]}))})}var O=r.createStyles((function(e){var n;return{title:(n={fontSize:34,fontWeight:900},n[e.fn.smallerThan("sm")]={fontSize:24},n),description:{maxWidth:600},wrapper:{position:"relative",marginBottom:30},dropzone:{borderWidth:1,paddingBottom:50},icon:{color:"dark"===e.colorScheme?e.colors.dark[3]:e.colors.gray[4]},control:{position:"absolute",width:250,left:"calc(50% - 125px)",bottom:-20}}})),P=function(e){var n=O(),o=n.classes,s=n.theme,a=u.useRef(null),c=u.useState(!1),d=c[0],m=c[1],h=u.useCallback((function(n){m(!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),m(!1),e.close()}})}))}),[]);return i.jsxs("div",p({className:o.wrapper},{children:[i.jsx(l.Dropzone,p({loading:d,openRef:a,onDrop:h,className:o.dropzone,radius:"md",accept:[l.MIME_TYPES.csv],maxSize:5*Math.pow(1024,2)},{children:i.jsxs("div",p({style:{pointerEvents:"none"}},{children:[i.jsxs(r.Group,p({position:"center"},{children:[i.jsx(l.Dropzone.Accept,{children:i.jsx(t.IconDownload,{size:50,color:s.colors[s.primaryColor][6],stroke:1.5})}),i.jsx(l.Dropzone.Reject,{children:i.jsx(t.IconX,{size:50,color:s.colors.red[6],stroke:1.5})}),i.jsx(l.Dropzone.Idle,{children:i.jsx(t.IconCloudUpload,{size:50,color:"dark"===s.colorScheme?s.colors.dark[0]:s.black,stroke:1.5})})]})),i.jsxs(r.Text,p({align:"center",weight:700,size:"lg",mt:"xl"},{children:[i.jsx(l.Dropzone.Accept,{children:"Drop files here"}),i.jsx(l.Dropzone.Reject,{children:"Csv file less than 5mb"}),i.jsx(l.Dropzone.Idle,{children:"Upload multiple"})]})),i.jsxs(r.Text,p({align:"center",size:"sm",mt:"xs",color:"dimmed"},{children:["Drag'n'drop files here to upload. We can accept only ",i.jsx("i",{children:".csv"})," files that are less than 5mb in size."]}))]}))})),i.jsx(r.Button,p({className:o.control,size:"md",radius:"xl",onClick:function(){var e;return null===(e=a.current)||void 0===e?void 0:e.call(a)}},{children:"Select file"}))]}))};function R(e){if(0===e.items.length)return i.jsx(j,{loading:e.loading,icon:"groups"});var n=e.items.map((function(n){return i.jsxs("tr",{children:[i.jsx("td",{children:i.jsx(r.Text,p({size:14},{children:n.name}))}),i.jsx("td",{children:i.jsx(r.Text,p({size:14},{children:n.description}))}),i.jsx("td",{children:i.jsxs(r.Group,p({noWrap:!0,spacing:0,position:"right"},{children:[i.jsx(r.ActionIcon,p({color:"blue",onClick:function(){return e.onClick(n)},variant:"subtle"},{children:i.jsx(t.IconUsers,{size:16,stroke:1.5})})),i.jsxs(r.Menu,p({transition:"pop",withArrow:!0,position:"bottom-end"},{children:[i.jsx(r.Menu.Target,{children:i.jsx(r.ActionIcon,{children:i.jsx(t.IconDots,{size:16,stroke:1.5})})}),i.jsx(r.Menu.Dropdown,{children:i.jsx(r.Menu.Item,p({onClick:function(){return t=n,m.openConfirmModal({title:'Delete "'.concat(t.name,'"?'),centered:!0,children:i.jsx(r.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(t)}});var t},icon:i.jsx(t.IconTrash,{size:16,stroke:1.5}),color:"red"},{children:"Delete"}))})]}))]}))})]},n.groupId)}));return i.jsx(r.ScrollArea.Autosize,p({maxHeight:300},{children:i.jsxs(r.Table,p({verticalSpacing:20,sx:{minWidth:700}},{children:[i.jsx("thead",{children:i.jsxs("tr",{children:[i.jsx("th",{children:"Name"}),i.jsx("th",{children:"Description"}),i.jsx("th",{})]})}),i.jsx("tbody",{children:n})]}))}))}var M=r.createStyles((function(e){var n;return{title:(n={fontSize:34,fontWeight:900},n[e.fn.smallerThan("sm")]={fontSize:24},n),description:{maxWidth:600}}})),W=r.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)}}})),F=function(e){var n=e.data,t=W().classes,o=n.map((function(e){return i.jsxs("div",p({className:t.stat},{children:[i.jsx(r.Text,p({className:t.count},{children:e.value.toLocaleString()})),i.jsx(r.Text,p({className:t.title},{children:e.title})),!!e.diff&&i.jsx(r.Text,p({className:t.description},{children:"".concat(e.diff,"% ").concat(e.diff<0?"decrease":"increase"," compared to last period")}))]}),e.title)}));return i.jsx("div",p({className:t.root},{children:o}))},U={BadgeCompleted:i.jsx(t.IconBadges,{size:12}),BadgeStarted:i.jsx(t.IconBadges,{size:12}),LessonCompleted:i.jsx(t.IconSchool,{size:12}),LessonStarted:i.jsx(t.IconSchool,{size:12}),ProblemSolved:i.jsx(t.IconActivityHeartbeat,{size:12})},H=function(e){var n,t=o.useRef(null),s=o.useState({x:0,y:0}),a=s[0],l=s[1];u.useEffect((function(){t.current&&a.y===t.current.scrollHeight-t.current.offsetHeight&&e.onScrollBottom&&e.onScrollBottom()}),[a.y]);var c=e.items.map((function(e){var t=e.name.split(/(?=[A-Z])/),o=t[0]===n?"dashed":"solid";n=t[0];var s=e.link?i.jsx(r.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 i.jsxs(r.Timeline.Item,p({bullet:V(e.name),lineVariant:o,title:s},{children:[i.jsx(r.Text,p({color:"dimmed",size:"sm"},{children:e.description})),i.jsx(r.Text,p({size:"xs",mt:4},{children:G(new Date(e.time))}))]}),e.key)}));return i.jsx(r.ScrollArea.Autosize,p({maxHeight:300,onScrollPositionChange:l,viewportRef:t},{children:i.jsx(r.Timeline,p({ml:"lg",active:1,bulletSize:24,lineWidth:2},{children:c}))}))},V=function(e){var n=U[e];return n||i.jsx(t.IconTimelineEvent,{size:12})},q=r.createStyles((function(e){var n;return{title:(n={fontSize:34,fontWeight:900,marginTop:16},n[e.fn.smallerThan("sm")]={fontSize:24},n),description:{maxWidth:600}}})),_=function(e){var n=q().classes,t=e.givenName?[e.givenName,e.familyName].join(" ").trim():e.email,o=e.givenName?e.givenName:"Me";return"compact"===e.variant?i.jsxs(i.Fragment,{children:[i.jsx(r.Title,p({className:n.title},{children:t})),i.jsx(r.Text,p({color:"dimmed",className:n.description,mt:"xs"},{children:e.quote}))]}):i.jsxs(i.Fragment,{children:[i.jsxs(r.Paper,p({radius:"md",withBorder:!0,p:"lg",sx:function(e){return{backgroundColor:"dark"===e.colorScheme?e.colors.dark[8]:e.white}}},{children:[i.jsx(r.Avatar,{src:e.avatar,size:135,radius:120,mx:"auto"}),i.jsx(r.Text,p({align:"center",size:"lg",weight:500,mt:"md"},{children:t})),i.jsxs(r.Text,p({align:"center",color:"dimmed",size:"sm"},{children:[e.email," • ",e.job]}))]})),i.jsx(r.Blockquote,p({mt:"xl",color:"blue",cite:"– ".concat(o)},{children:e.quote}))]})},X=r.createStyles((function(e){return{card:{height:240,backgroundSize:"cover",backgroundPosition:"center"},content:{position:"absolute",padding:e.spacing.xl,zIndex:1,top:0,bottom:0,right:0,left:0},action:{position:"absolute",bottom:e.spacing.xl,right:e.spacing.xl},title:{color:e.white,marginBottom:e.spacing.xs/2},description:{color:e.white,maxWidth:220}}})),Y=function(e){var n=e.title,t=e.description,o=e.image,s=e.action,a=e.style,l=e.className,c=function(e,n){var i={};for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&n.indexOf(t)<0&&(i[t]=e[t]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(t=Object.getOwnPropertySymbols(e);r<t.length;r++)n.indexOf(t[r])<0&&Object.prototype.propertyIsEnumerable.call(e,t[r])&&(i[t[r]]=e[t[r]])}return i}(e,["title","description","image","action","style","className"]),d=X(),m=d.classes,h=d.cx,u=d.theme;return i.jsxs(r.Card,p({radius:"md",style:p({backgroundImage:"url(".concat(o,")")},a),className:h(m.card,l)},c,{children:[i.jsx(r.Overlay,{gradient:"linear-gradient(105deg, ".concat(u.black," 20%, #312f2f 50%, ").concat(u.colors.gray[4]," 100%)"),opacity:.55,zIndex:0}),i.jsxs("div",p({className:m.content},{children:[i.jsx(r.Text,p({size:"lg",weight:700,className:m.title},{children:n})),i.jsx(r.Text,p({size:"sm",className:m.description},{children:t})),i.jsx(r.Button,p({className:m.action,variant:"white",color:"dark",component:"a",size:"xs",href:s.link,target:"_blank"},{children:s.label}))]}))]}))};function J(e){if(0===e.items.length)return i.jsx(j,{loading:e.loading,icon:"lessons"});var n=e.items.map((function(n){return i.jsxs("tr",{children:[i.jsx("td",{children:i.jsx(r.UnstyledButton,p({onClick:function(){return e.onClick&&e.onClick(n)}},{children:i.jsxs(r.Group,{children:[i.jsx(r.Avatar,{size:40,src:n.avatar,radius:40}),i.jsxs("div",{children:[i.jsx(r.Text,p({size:"sm",weight:500},{children:n.name})),i.jsx(r.Text,p({size:"xs",color:"dimmed"},{children:n.email}))]})]})}))}),i.jsxs("td",{children:[!!n.isComplete&&i.jsx(r.Badge,p({variant:"filled"},{children:"Complete"})),!n.isComplete&&!n.isStarted&&i.jsx(r.Badge,p({color:"red",variant:"filled"},{children:"Not started"})),!n.isComplete&&!!n.isStarted&&i.jsx(r.Badge,p({color:"violet",variant:"filled"},{children:"In progress"}))]})]},n.name)}));return i.jsx(r.ScrollArea.Autosize,p({maxHeight:500},{children:i.jsxs(r.Table,p({horizontalSpacing:0,verticalSpacing:"sm",sx:{minWidth:700}},{children:[i.jsx("thead",{children:i.jsxs("tr",{children:[i.jsx("th",{children:"Name"}),i.jsx("th",{children:"Status"})]})}),i.jsx("tbody",{children:n})]}))}))}var K=r.createStyles((function(e){var n;return{title:(n={fontSize:34,fontWeight:900},n[e.fn.smallerThan("sm")]={fontSize:24},n),description:{maxWidth:600}}}));function $(e){if(0===e.items.length)return i.jsx(j,{loading:e.loading,icon:"lessons"});var n=e.items.map((function(n){return i.jsx("tr",{children:i.jsx("td",{children:i.jsx(r.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(n)}},{children:i.jsx(r.Group,{children:i.jsxs("div",{children:[i.jsx(r.Text,p({size:"sm",weight:500},{children:n.name})),i.jsx(r.Text,p({size:"xs",color:"dimmed"},{children:n.description}))]})})}))})},n.lessonId)}));return i.jsx(r.ScrollArea.Autosize,p({maxHeight:500},{children:i.jsx(r.Table,p({horizontalSpacing:0,verticalSpacing:0,sx:{minWidth:700}},{children:i.jsx("tbody",{children:n})}))}))}var Q=r.createStyles((function(e){var n;return{title:(n={fontSize:34,fontWeight:900},n[e.fn.smallerThan("sm")]={fontSize:24},n),description:{maxWidth:600}}})),Z=r.createEmotionCache({key:"mantine",prepend:!1}),ee=function(e){var n=c.useForm({initialValues:{active:e.account}});return i.jsx(r.Modal,p({centered:!0,opened:e.opened,onClose:function(){return e.onClose&&e.onClose()},size:"sm",title:i.jsx(r.Title,p({size:"h5"},{children:"Accounts"}))},{children:i.jsxs("form",p({onSubmit:n.onSubmit((function(){e.onChange&&e.onChange(n.values.active)}))},{children:[i.jsx(r.Select,p({required:!0,placeholder:"Select an account",defaultValue:e.account,data:e.accounts.map((function(e){return{value:e.accountId,label:e.name}}))},n.getInputProps("active"))),i.jsx(r.Button,p({type:"submit",fullWidth:!0,mt:"xl"},{children:"Switch"}))]}))}))},ne=r.createStyles((function(e){return{link:{width:50,height:50,borderRadius:e.radius.md,display:"flex",alignItems:"center",justifyContent:"center",color:"dark"===e.colorScheme?e.colors.dark[0]:e.colors.gray[7],"&:hover":{backgroundColor:"dark"===e.colorScheme?e.colors.dark[5]:e.colors.gray[0]}},active:{"&, &:hover":{backgroundColor:e.fn.variant({variant:"light",color:e.primaryColor}).background,color:e.fn.variant({variant:"light",color:e.primaryColor}).color}}}})),ie=[{icon:t.IconHome2,label:"Home",href:"/home"},{icon:t.IconGauge,label:"Dashboard",href:"/dashboard"},{icon:t.IconCategory2,label:"Groups",href:"/groups"},{icon:t.IconAlbum,label:"Badges",href:"/badges"},{icon:t.IconLambda,label:"Lessons",href:"/lessons"}],te=function(e){var n,t=e.icon,o=e.label,s=e.active,a=e.onClick,l=ne(),c=l.classes,d=l.cx;return i.jsx(r.Tooltip,p({label:o,position:"right",transitionDuration:0},{children:i.jsx(r.UnstyledButton,p({onClick:a,className:d(c.link,(n={},n[c.active]=s,n))},{children:i.jsx(t,{stroke:1.5})}))}))},re=function(e){var n=ie.map((function(n){return i.jsx(te,{label:n.label,icon:n.icon,active:n.label===e.active,onClick:function(){return e.navigate(n.href)}},n.label)}));return i.jsxs(r.Navbar,p({width:{base:80},p:"md"},{children:[i.jsx(r.Center,{children:i.jsx(r.Avatar,p({color:"blue",radius:"sm"},{children:i.jsx("div",p({style:{width:15,marginLeft:"auto",marginRight:"auto"}},{children:i.jsx(r.Image,{fit:"contain",src:"https://cdn.localcivics.io/brand/l.png"})}))}))}),i.jsx(r.Navbar.Section,p({grow:!0,mt:50},{children:i.jsx(r.Stack,p({justify:"center",spacing:0},{children:n}))})),i.jsx(r.Navbar.Section,{children:i.jsxs(r.Stack,p({justify:"center",spacing:0},{children:[i.jsx(te,{icon:t.IconSwitchHorizontal,label:"Switch accounts",onClick:e.onSwitchAccounts}),i.jsx(te,{icon:t.IconLogout,label:"Logout",onClick:e.onLogout})]}))})]}))},oe=r.createStyles((function(e){var n,i,t,r,o,s;return{footer:{paddingTop:2*e.spacing.xl,paddingBottom:2*e.spacing.xl,paddingLeft:3*e.spacing.xl,backgroundColor:"dark"===e.colorScheme?e.colors.dark[6]:e.colors.gray[0],borderTop:"1px solid ".concat("dark"===e.colorScheme?e.colors.dark[5]:e.colors.gray[2])},logo:(n={maxWidth:200},n[e.fn.smallerThan("sm")]={display:"flex",flexDirection:"column",alignItems:"center"},n),description:(i={marginTop:5},i[e.fn.smallerThan("sm")]={marginTop:e.spacing.xs,textAlign:"center"},i),inner:(t={display:"flex",justifyContent:"space-between"},t[e.fn.smallerThan("sm")]={flexDirection:"column",alignItems:"center"},t),groups:(r={display:"flex",flexWrap:"wrap"},r[e.fn.smallerThan("sm")]={display:"none"},r),wrapper:{width:160},link:{display:"block",color:"dark"===e.colorScheme?e.colors.dark[1]:e.colors.gray[6],fontSize:e.fontSizes.sm,paddingTop:3,paddingBottom:3,"&:hover":{textDecoration:"underline"}},title:{fontSize:e.fontSizes.md,fontWeight:700,fontFamily:"Greycliff CF, ".concat(e.fontFamily),marginBottom:e.spacing.xs/2,color:"dark"===e.colorScheme?e.white:e.black},afterFooter:(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:(s={},s[e.fn.smallerThan("sm")]={marginTop:e.spacing.xs},s)}})),se=function(e,n,i){var t=JSON.stringify(n),r=o.useState(!1),s=r[0],a=r[1],l=o.useState(e),c=l[0],d=l[1];return u.useEffect((function(){d(e)}),[e,t]),{opened:s,account:c,accounts:n,setChangeModalOpen:a,onAccountChange:function(e){d(e),a(!1),i(e)}}};Object.defineProperty(e,"showNotification",{enumerable:!0,get:function(){return n.showNotification}}),Object.defineProperty(e,"updateNotification",{enumerable:!0,get:function(){return n.updateNotification}}),e.AdminProvider=function(e){return i.jsx(r.MantineProvider,p({withNormalizeCSS:!0,withGlobalStyles:!0,emotionCache:Z,theme:{loader:"bars"}},{children:i.jsx(n.NotificationsProvider,p({limit:e.notificationLimit||5},{children:i.jsx(m.ModalsProvider,{children:e.children})}))}))},e.App=function(e){var n=oe().classes,o=se(e.account,e.accounts,e.onAccountChange);return i.jsxs(r.AppShell,p({padding:"xs",navbar:i.jsx(re,{active:e.navbar.props.active,navigate:e.navbar.props.navigate,onLogout:e.navbar.props.onLogout,onSwitchAccounts:function(){return o.setChangeModalOpen(!0)}}),footer:i.jsx(i.Fragment,{children:!o.opened&&i.jsxs("footer",p({className:n.footer},{children:[i.jsxs(r.Container,p({className:n.inner},{children:[i.jsxs("div",p({className:n.logo},{children:[i.jsxs(r.Group,p({spacing:"xs"},{children:[i.jsx("div",p({style:{width:15}},{children:i.jsx(r.Image,{fit:"contain",src:"https://cdn.localcivics.io/brand/l.png"})})),i.jsx(r.Title,p({color:"dimmed",size:"h5"},{children:"Local Civics"}))]})),i.jsx(r.Text,p({size:"xs",color:"dimmed",className:n.description},{children:"We connect students to powerful civic learning experiences."}))]})),i.jsx("div",p({className:n.groups},{children:i.jsxs("div",p({className:n.wrapper},{children:[i.jsx(r.Text,p({className:n.link,component:"a",href:"https://www.localcivics.io",target:"_blank"},{children:"About"})),i.jsx(r.Text,p({className:n.link,component:"a",href:"https://www.localcivics.io/terms-of-service",target:"_blank"},{children:"Terms"})),i.jsx(r.Text,p({className:n.link,component:"a",href:"https://www.localcivics.io/privacy-policy",target:"_blank"},{children:"Privacy"})),i.jsx(r.Text,p({className:n.link,component:"a",href:"https://localcivics.notion.site/Help-Center-b52300f587b64fc0a61f512686e7626d",target:"_blank"},{children:"FAQ"}))]}))}))]})),i.jsxs(r.Container,p({className:n.afterFooter},{children:[i.jsxs(r.Text,p({color:"dimmed",size:"sm"},{children:["© ",(new Date).getFullYear()," Local Civics. All rights reserved."]})),i.jsxs(r.Group,p({spacing:0,className:n.social,position:"right",noWrap:!0},{children:[i.jsx(r.ActionIcon,p({component:"a",target:"_blank",href:"https://www.instagram.com/localcivics/",size:"lg"},{children:i.jsx(t.IconBrandInstagram,{size:18,stroke:1.5})})),i.jsx(r.ActionIcon,p({component:"a",target:"_blank",href:"https://www.linkedin.com/company/localcivics",size:"lg"},{children:i.jsx(t.IconBrandLinkedin,{size:18,stroke:1.5})})),i.jsx(r.ActionIcon,p({component:"a",target:"_blank",href:"https://www.facebook.com/localcivics/",size:"lg"},{children:i.jsx(t.IconBrandFacebook,{size:18,stroke:1.5})}))]}))]}))]}))}),styles:function(e){return{main:{backgroundColor:"dark"===e.colorScheme?e.colors.dark[8]:e.colors.gray[0]}}}},{children:[i.jsxs("div",p({style:{position:"relative"}},{children:[(e.loading||o.opened)&&i.jsx(r.Center,p({style:{height:400}},{children:i.jsx(r.Loader,{})})),!e.loading&&!o.opened&&e.page]})),i.jsx(ee,{opened:o.opened,account:o.account,accounts:o.accounts,onChange:o.onAccountChange,onClose:function(){return o.setChangeModalOpen(!1)}})]}))},e.Badge=function(e){var n=b().classes;return i.jsx(r.Container,p({size:"lg",py:"xl"},{children:i.jsxs(r.Stack,p({spacing:"md"},{children:[i.jsx(r.Grid,{children:i.jsxs(r.Grid.Col,p({sm:"auto"},{children:[i.jsx(r.Badge,p({variant:"filled",leftSection:i.jsx(r.ActionIcon,p({onClick:e.onBackClick,color:"blue",size:"xs",radius:"xl",variant:"filled"},{children:i.jsx(t.IconArrowLeft,{size:14})})),size:"lg"},{children:"Badges"})),i.jsxs(r.Group,{children:[i.jsxs(r.Stack,p({spacing:0},{children:[i.jsx(r.Title,p({order:2,className:n.title,mt:"md"},{children:e.displayName||"Badge"})),i.jsx(r.Text,p({color:"dimmed",className:n.description,mt:"sm"},{children:e.description||"No description"}))]})),i.jsxs(r.Stack,p({spacing:"xs",ml:"auto"},{children:[i.jsx(r.Button,p({variant:"gradient",onClick:e.onPreviewClick},{children:"Preview"})),i.jsx(r.Divider,{label:"or",labelPosition:"center",my:"xs",variant:"dashed"}),i.jsx(r.Select,{size:"sm",placeholder:"Select a group",nothingFound:"No options",value:e.groupId,onChange:e.onGroupChange,icon:i.jsx(t.IconCategory2,{}),data:e.groups.map((function(e){return{value:e.groupId,label:e.name}}))})]}))]})]}))}),i.jsx("div",{children:i.jsxs("div",p({style:{position:"relative"}},{children:[i.jsx(r.LoadingOverlay,{visible:e.loading,overlayBlur:2}),i.jsx(v,{loading:e.loading,items:e.users,onClick:e.onUserClick})]}))})]}))}))},e.Badges=function(e){var n=S().classes;return i.jsx(r.Container,p({size:"lg",py:"xl"},{children:i.jsxs(r.Stack,p({spacing:"md"},{children:[i.jsx(r.Grid,{children:i.jsxs(r.Grid.Col,p({sm:"auto"},{children:[i.jsx(r.Badge,p({variant:"filled",size:"lg"},{children:"Badges"})),i.jsx(r.Title,p({order:2,className:n.title,mt:"md"},{children:"Badges and micro-credentials"})),i.jsx(r.Text,p({color:"dimmed",className:n.description,mt:"sm"},{children:"Project-sized skills acquisition and standards alignment."}))]}))}),i.jsx(r.Autocomplete,{placeholder:"Search for a badge that fits your needs",data:e.badges.map((function(e){return e.name})),onChange:e.onAutocompleteChange}),i.jsxs("div",p({style:{position:"relative"}},{children:[i.jsx(r.LoadingOverlay,{visible:e.loading,overlayBlur:2}),i.jsx(y,{loading:e.loading,items:e.badges,onClick:e.onBadgeClick})]}))]}))}))},e.DataBreakdown=function(e){return e.loading||0===e.points.length?i.jsx(j,{loading:e.loading,icon:"dashboard"}):i.jsx(r.Paper,p({mih:150,p:"lg",withBorder:!0},{children:i.jsxs(r.Stack,{children:[i.jsx(r.Grid,{children:i.jsx(r.Grid.Col,p({sm:"auto"},{children:i.jsxs(r.Group,p({spacing:0},{children:[i.jsx(r.Title,p({size:"h5",mb:0},{children:"Performance History"})),i.jsx(r.Tooltip,p({label:"Shows group performance per person"},{children:i.jsx(r.ActionIcon,{children:i.jsx(t.IconInfoCircle,{color:"#3b82f6",size:14})})}))]}))}))}),i.jsx(r.Group,p({spacing:"sm"},{children:i.jsx(r.Select,{placeholder:"Select a metric",value:e.metric,onChange:e.onMetricChange,data:[{label:"PROBLEMS SOLVED",value:"PROBLEMS SOLVED"},{label:"LESSONS COMPLETED",value:"LESSONS COMPLETED"},{label:"BADGES EARNED",value:"BADGES EARNED"}]})})),i.jsx(k,{items:e.points})]})}))},e.DataDashboard=function(e){return i.jsx(r.Container,p({size:"lg",py:"xl"},{children:i.jsxs(r.Stack,{children:[i.jsxs(r.Grid,{children:[i.jsxs(r.Grid.Col,p({sm:"auto"},{children:[i.jsx(r.Title,p({size:"h3"},{children:"Dashboard"})),i.jsx(r.Text,p({color:"dimmed",size:"sm",mt:"md"},{children:"View core metrics on the state of your groups."}))]})),i.jsx(r.Grid.Col,p({sm:2.5},{children:i.jsx(r.Select,{placeholder:"Select a group",nothingFound:"No options",value:e.group,onChange:e.onGroupChange,icon:i.jsx(t.IconCategory2,{}),data:e.groups.map((function(e){return e.name}))})})),i.jsx(r.Grid.Col,p({sm:"auto"},{children:i.jsx(s.DateRangePicker,{placeholder:"Select a date",allowSingleDateInRange:!0,value:e.dateRange,onChange:e.onDateRangeChange,icon:i.jsx(t.IconCalendar,{size:16})})}))]}),i.jsxs(r.Stack,{children:[i.jsx(z,{data:T,value:e.tab,onChange:e.onTabChange}),i.jsxs("div",p({style:{position:"relative"}},{children:[i.jsx(r.LoadingOverlay,{visible:e.loading,overlayBlur:2}),e.body]}))]})]})}))},e.DataOverview=function(e){return e.loading||!e.problemsSolved?i.jsx(j,{loading:e.loading,icon:"dashboard"}):i.jsxs(i.Fragment,{children:[i.jsx(A,{data:[{title:"PROBLEMS SOLVED",value:e.problemsSolved,diff:e.problemsSolvedDiff},{title:"LESSONS COMPLETED",value:e.lessonsCompleted,diff:e.lessonsCompletedDiff},{title:"BADGES EARNED",value:e.badgesCompleted,diff:e.badgesCompletedDiff}]}),i.jsx(N,{metric:e.metric,points:e.points,onMetricChange:e.onMetricChange})]})},e.Group=function(e){var n=O().classes,s=c.useForm({initialValues:{groupId:"",userId:"",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"}}}),a=o.useState(!1),l=a[0],d=a[1];return i.jsxs(i.Fragment,{children:[i.jsx(r.Drawer,p({opened:l,onClose:function(){return d(!1)},title:i.jsx(r.Title,p({size:"h5"},{children:"Add people"})),padding:"xl",size:"xl"},{children:i.jsxs(r.Stack,p({spacing:"md"},{children:[i.jsx(P,p({},e,{close:function(){return d(!1)}})),i.jsx(r.Divider,{label:"or",labelPosition:"center",my:"md",variant:"dashed"}),i.jsx("form",p({onSubmit:s.onSubmit((function(){var n=s.values;s.reset(),d(!1),e.onCreateUsers&&e.onCreateUsers([n])}))},{children:i.jsxs(r.Stack,{children:[i.jsx(r.TextInput,p({withAsterisk:!0,label:"Email",placeholder:"Email"},s.getInputProps("email"))),i.jsxs(r.Group,p({grow:!0},{children:[i.jsx(r.TextInput,p({label:"Given name",placeholder:"Given name"},s.getInputProps("givenName"))),i.jsx(r.TextInput,p({label:"Family name",placeholder:"Family name"},s.getInputProps("familyName")))]})),i.jsx(r.Button,p({type:"submit",fullWidth:!0,mt:"md"},{children:"Submit"}))]})}))]}))})),i.jsx(r.Container,p({size:"lg",py:"xl"},{children:i.jsxs(r.Stack,p({spacing:"md"},{children:[i.jsxs(r.Grid,{children:[i.jsxs(r.Grid.Col,p({sm:"auto"},{children:[i.jsx(r.Badge,p({variant:"filled",leftSection:i.jsx(r.ActionIcon,p({onClick:e.onBackClick,color:"blue",size:"xs",radius:"xl",variant:"filled"},{children:i.jsx(t.IconArrowLeft,{size:14})})),size:"lg"},{children:"Groups"})),i.jsx(r.Title,p({order:2,className:n.title,mt:"md"},{children:e.displayName||"Group"})),i.jsx(r.Text,p({color:"dimmed",className:n.description,mt:"sm"},{children:e.description||"No description"}))]})),i.jsx(r.Grid.Col,p({sm:"content"},{children:!e.loading&&i.jsx(r.Button,p({onClick:function(){return d(!0)},leftIcon:i.jsx(t.IconPlaylistAdd,{size:14})},{children:"Add people"}))}))]}),i.jsxs("div",p({style:{position:"relative"}},{children:[i.jsx(r.LoadingOverlay,{visible:e.loading,overlayBlur:2}),i.jsx(E,{loading:e.loading,items:e.users,onDelete:e.onDeleteUser,onChangeRole:e.onRoleChange,onViewProfile:function(n){return e.onUserClick(n)}})]}))]}))}))]})},e.GroupUser=function(e){return i.jsx(r.Container,p({size:"lg",py:"xl"},{children:i.jsxs(r.Stack,p({spacing:"md"},{children:[i.jsx(r.Grid,{children:i.jsxs(r.Grid.Col,p({sm:"auto"},{children:[i.jsx(r.Badge,p({variant:"filled",leftSection:i.jsx(r.ActionIcon,p({onClick:e.onBackClick,color:"blue",size:"xs",radius:"xl",variant:"filled"},{children:i.jsx(t.IconArrowLeft,{size:14})})),size:"lg"},{children:"Users"})),i.jsx(_,{variant:"compact",givenName:e.givenName,familyName:e.familyName,avatar:e.avatarURL,email:e.email,quote:e.impactStatement,job:e.job})]}))}),i.jsxs("div",p({style:{position:"relative"}},{children:[i.jsx(r.LoadingOverlay,{visible:e.loading,overlayBlur:2}),i.jsxs(r.Stack,p({spacing:"lg"},{children:[i.jsx(F,{data:[{title:"PROBLEMS SOLVED",value:e.problemsSolved,diff:e.problemsSolvedDiff},{title:"LESSONS COMPLETED",value:e.lessonsCompleted,diff:e.lessonsCompletedDiff},{title:"BADGES EARNED",value:e.badgesCompleted,diff:e.badgesCompletedDiff}]}),i.jsx(H,{onScrollBottom:e.onScrollBottom,items:e.events})]}))]}))]}))}))},e.Groups=function(e){var n=M().classes,s=c.useForm({initialValues:{groupId:"",name:"",description:""},validate:{name:function(e){return e.length<=6?"Name should include at least 6 characters":null}}}),a=o.useState(!1),l=a[0],d=a[1];return i.jsxs(i.Fragment,{children:[i.jsx(r.Drawer,p({opened:l,onClose:function(){return d(!1)},title:i.jsxs(r.Group,p({spacing:0},{children:[i.jsx(r.Title,p({size:"h5"},{children:"Create a group"})),i.jsx(r.Tooltip,p({label:"Groups settings cannot be modified once created"},{children:i.jsx(r.ActionIcon,{children:i.jsx(t.IconInfoCircle,{color:"#3b82f6",size:14})})}))]})),padding:"xl",size:"xl"},{children:i.jsxs("form",p({onSubmit:s.onSubmit((function(){var n=s.values;s.reset(),d(!1),e.onCreateGroup&&e.onCreateGroup(n)}))},{children:[i.jsxs(r.Stack,{children:[i.jsx(r.TextInput,p({withAsterisk:!0,label:"Name",placeholder:"Group name"},s.getInputProps("name"))),i.jsx(r.TextInput,p({label:"Description",placeholder:"A group for my first period class"},s.getInputProps("description")))]}),i.jsx(r.Button,p({type:"submit",fullWidth:!0,mt:"md"},{children:"Submit"}))]}))})),i.jsx(r.Container,p({size:"lg",py:"xl"},{children:i.jsxs(r.Stack,p({spacing:"md"},{children:[i.jsxs(r.Grid,{children:[i.jsxs(r.Grid.Col,p({sm:"auto"},{children:[i.jsx(r.Badge,p({variant:"filled",size:"lg"},{children:"Groups"})),i.jsx(r.Title,p({order:2,className:n.title,mt:"md"},{children:"Organize people into groups"})),i.jsx(r.Text,p({color:"dimmed",className:n.description,mt:"sm"},{children:"A group can be a class, team, or other functioning organizations."}))]})),i.jsx(r.Grid.Col,p({sm:"content"},{children:!e.loading&&i.jsx(r.Button,p({onClick:function(){return d(!0)},leftIcon:i.jsx(t.IconPlaylistAdd,{size:14})},{children:"Create group"}))}))]}),i.jsxs("div",p({style:{position:"relative"}},{children:[i.jsx(r.LoadingOverlay,{visible:e.loading,overlayBlur:2}),i.jsx(R,{loading:e.loading,items:e.groups,onDeleteGroup:e.onDeleteGroup,onClick:e.onGroupClick})]}))]}))}))]})},e.Home=function(e){return i.jsx(r.Container,p({size:"lg"},{children:i.jsxs(r.Stack,p({spacing:"lg"},{children:[i.jsxs(r.Grid,p({gutter:"md"},{children:[i.jsx(r.Grid.Col,p({md:6},{children:i.jsx(_,{variant:"compact",givenName:e.givenName,familyName:e.familyName,avatar:e.avatarURL,email:e.email,quote:e.impactStatement,job:e.job})})),i.jsx(r.Grid.Col,p({md:6},{children:i.jsx(Y,{title:e.tenantName,description:e.tenantDescription,image:e.tenantImage,action:{label:"Visit website",link:e.tenantWebsite}})}))]})),i.jsx(F,{data:[{title:"PROBLEMS SOLVED",value:e.problemsSolved,diff:e.problemsSolvedDiff},{title:"LESSONS COMPLETED",value:e.lessonsCompleted,diff:e.lessonsCompletedDiff},{title:"BADGES EARNED",value:e.badgesCompleted,diff:e.badgesCompletedDiff}]}),i.jsx(H,{onScrollBottom:e.onScrollBottom,items:e.events})]}))}))},e.Lesson=function(e){var n=K().classes;return i.jsx(r.Container,p({size:"lg",py:"xl"},{children:i.jsxs(r.Stack,p({spacing:"md"},{children:[i.jsx(r.Grid,{children:i.jsxs(r.Grid.Col,p({sm:"auto"},{children:[i.jsx(r.Badge,p({variant:"filled",leftSection:i.jsx(r.ActionIcon,p({onClick:e.onBackClick,color:"blue",size:"xs",radius:"xl",variant:"filled"},{children:i.jsx(t.IconArrowLeft,{size:14})})),size:"lg"},{children:"Lessons"})),i.jsxs(r.Group,{children:[i.jsxs(r.Stack,p({spacing:0},{children:[i.jsx(r.Title,p({order:2,className:n.title,mt:"md"},{children:e.displayName||"Lesson"})),i.jsx(r.Text,p({color:"dimmed",className:n.description,mt:"sm"},{children:e.description||"No description"}))]})),i.jsxs(r.Stack,p({spacing:"xs",ml:"auto"},{children:[i.jsx(r.Button,p({variant:"gradient",onClick:e.onPreviewClick},{children:"Preview"})),i.jsx(r.Divider,{label:"or",labelPosition:"center",my:"xs",variant:"dashed"}),i.jsx(r.Select,{size:"sm",placeholder:"Select a group",nothingFound:"No options",value:e.groupId,onChange:e.onGroupChange,icon:i.jsx(t.IconCategory2,{}),data:e.groups.map((function(e){return{value:e.groupId,label:e.name}}))})]}))]})]}))}),i.jsx("div",{children:i.jsxs("div",p({style:{position:"relative"}},{children:[i.jsx(r.LoadingOverlay,{visible:e.loading,overlayBlur:2}),i.jsx(J,{loading:e.loading,items:e.users,onClick:e.onUserClick})]}))})]}))}))},e.Lessons=function(e){var n=Q().classes;return i.jsx(r.Container,p({size:"lg",py:"xl"},{children:i.jsxs(r.Stack,p({spacing:"md"},{children:[i.jsx(r.Grid,{children:i.jsxs(r.Grid.Col,p({sm:"auto"},{children:[i.jsx(r.Badge,p({variant:"filled",size:"lg"},{children:"Lessons"})),i.jsx(r.Title,p({order:2,className:n.title,mt:"md"},{children:"Lessons"})),i.jsx(r.Text,p({color:"dimmed",className:n.description,mt:"sm"},{children:"Well crafted units of instruction."}))]}))}),i.jsx(r.Autocomplete,{placeholder:"Search for a lesson that fits your needs",data:e.lessons.map((function(e){return e.name})),onChange:e.onAutocompleteChange}),i.jsxs("div",p({style:{position:"relative"}},{children:[i.jsx(r.LoadingOverlay,{visible:e.loading,overlayBlur:2}),i.jsx($,{loading:e.loading,items:e.lessons,onClick:e.onLessonClick})]}))]}))}))},e.Navbar=re,e.SwitchAccount=ee,Object.defineProperty(e,"__esModule",{value:!0})}));
|
|
1
|
+
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("@mantine/notifications"),require("react/jsx-runtime"),require("@tabler/icons"),require("@mantine/core"),require("react"),require("@mantine/dates"),require("recharts"),require("@mantine/dropzone"),require("@mantine/form"),require("papaparse"),require("@mantine/modals")):"function"==typeof define&&define.amd?define(["exports","@mantine/notifications","react/jsx-runtime","@tabler/icons","@mantine/core","react","@mantine/dates","recharts","@mantine/dropzone","@mantine/form","papaparse","@mantine/modals"],n):n((e="undefined"!=typeof globalThis?globalThis:e||self).components={},e.MantineNotifications,e.ReactJSXRuntime,e.TablerIcons,e.MantineCore,e.React,e.MantineDates,e.Recharts,e.MantineDropzone,e.MantineForm,e.Papaparse,e.MantineModals)}(this,(function(e,n,i,t,r,o,s,a,l,c,d,m){"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 t=Object.getOwnPropertyDescriptor(e,i);Object.defineProperty(n,i,t.get?t:{enumerable:!0,get:function(){return e[i]}})}})),n.default=e,Object.freeze(n)}var u=h(o),x=h(d),p=function(){return p=Object.assign||function(e){for(var n,i=1,t=arguments.length;i<t;i++)for(var r in n=arguments[i])Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r]);return e},p.apply(this,arguments)};function g(e,n,i){if(i||2===arguments.length)for(var t,r=0,o=n.length;r<o;r++)!t&&r in n||(t||(t=Array.prototype.slice.call(n,0,r)),t[r]=n[r]);return e.concat(t||Array.prototype.slice.call(n))}var f=r.createStyles((function(e){var n,i,t;return{wrapper:(n={display:"flex",alignItems:"center",padding:2*e.spacing.xl,borderRadius:e.radius.md,backgroundColor:"dark"===e.colorScheme?e.colors.dark[8]:e.white,border:"1px solid ".concat("dark"===e.colorScheme?e.colors.dark[8]:e.colors.gray[3])},n["@media (max-width: ".concat(e.breakpoints.sm,"px)")]={flexDirection:"column-reverse",padding:e.spacing.xl},n),image:(i={maxWidth:"40%"},i["@media (max-width: ".concat(e.breakpoints.sm,"px)")]={maxWidth:"100%"},i),body:(t={paddingRight:4*e.spacing.xl},t["@media (max-width: ".concat(e.breakpoints.sm,"px)")]={paddingRight:0,marginTop:e.spacing.xl},t),title:{color:"dark"===e.colorScheme?e.white:e.black,fontFamily:"Greycliff CF, ".concat(e.fontFamily),lineHeight:1,marginBottom:e.spacing.md},controls:{display:"flex",marginTop:e.spacing.xl},inputWrapper:{width:"100%",flex:"1"},input:{borderTopRightRadius:0,borderBottomRightRadius:0,borderRight:0},control:{borderTopLeftRadius:0,borderBottomLeftRadius:0}}})),j=function(e){var n=f().classes;return i.jsxs("div",p({className:n.wrapper},{children:[i.jsxs("div",p({className:n.body},{children:[i.jsx(r.Title,p({className:n.title},{children:e.loading?"Loading...":"Nothing to display"})),i.jsx(r.Text,p({size:"sm",color:"dimmed"},{children:e.loading?"Hold on, we're loading your data.":"We don't have anything to show you here just yet. Add data, check back later, or adjust your search."}))]})),i.jsx(r.Image,{src:"https://cdn.localcivics.io/illustrations/".concat(e.icon,".svg"),className:n.image})]}))};function v(e){if(0===e.items.length)return i.jsx(j,{loading:e.loading,icon:"badges"});var n=e.items.map((function(n){return i.jsxs("tr",{children:[i.jsx("td",{children:i.jsx(r.UnstyledButton,p({onClick:function(){return e.onClick&&e.onClick(n)}},{children:i.jsxs(r.Group,{children:[i.jsx(r.Avatar,{size:40,src:n.avatar,radius:40}),i.jsxs("div",{children:[i.jsx(r.Text,p({size:"sm",weight:500},{children:n.name})),i.jsx(r.Text,p({size:"xs",color:"dimmed"},{children:n.email}))]})]})}))}),i.jsxs("td",{children:[!!n.isComplete&&i.jsx(r.Badge,p({variant:"filled"},{children:"Complete"})),!n.isComplete&&i.jsx(r.Badge,p({color:"gray",variant:"filled"},{children:"Incomplete"}))]})]},n.name)}));return i.jsx(r.ScrollArea.Autosize,p({maxHeight:500},{children:i.jsxs(r.Table,p({horizontalSpacing:0,verticalSpacing:"sm",sx:{minWidth:700},highlightOnHover:!0,striped:!0},{children:[i.jsx("thead",{children:i.jsxs("tr",{children:[i.jsx("th",{children:"Name"}),i.jsx("th",{children:"Status"})]})}),i.jsx("tbody",{children:n})]}))}))}var b=r.createStyles((function(e){var n;return{title:(n={fontSize:34,fontWeight:900},n[e.fn.smallerThan("sm")]={fontSize:24},n),description:{maxWidth:600}}}));function y(e){if(0===e.items.length)return i.jsx(j,{loading:e.loading,icon:"badges"});var n=e.items.map((function(n){return i.jsx("tr",{children:i.jsx("td",{children:i.jsx(r.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(n)}},{children:i.jsx(r.Group,{children:i.jsxs("div",{children:[i.jsx(r.Text,p({size:"sm",weight:500},{children:n.name})),i.jsx(r.Text,p({size:"xs",color:"dimmed"},{children:n.description}))]})})}))})},n.badgeId)}));return i.jsx(r.ScrollArea.Autosize,p({maxHeight:500},{children:i.jsx(r.Table,p({horizontalSpacing:0,verticalSpacing:0,sx:{minWidth:700}},{children:i.jsx("tbody",{children:n})}))}))}var S=r.createStyles((function(e){var n;return{title:(n={fontSize:34,fontWeight:900},n[e.fn.smallerThan("sm")]={fontSize:24},n),description:{maxWidth:600}}})),C=r.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}}})),k=function(e){var n,t=C(),s=t.classes,a=t.cx,l=o.useState(!1),c=l[0],d=l[1],m=e.items.map((function(e){return e.value})),h=Math.round(m.reduce((function(e,n){return e+n}))/m.length),u=e.items.map((function(e){return i.jsxs("tr",{children:[i.jsx("td",{children:e.name}),i.jsx("td",{children:e.email}),i.jsx("td",{children:e.value}),i.jsx("td",{children:e.value>h?i.jsx(r.Badge,{children:"Above average"}):e.value===h?i.jsx(r.Badge,p({color:"gray"},{children:"Average"})):i.jsx(r.Badge,p({color:"red"},{children:"Below average"}))})]},e.name)}));return i.jsx(r.ScrollArea,p({sx:{height:500},onScrollPositionChange:function(e){var n=e.y;return d(0!==n)}},{children:i.jsxs(r.Table,p({verticalSpacing:"md",sx:{minWidth:700}},{children:[i.jsx("thead",p({className:a(s.header,(n={},n[s.scrolled]=c,n))},{children:i.jsxs("tr",{children:[i.jsx("th",{children:"Name"}),i.jsx("th",{children:"Email"}),i.jsx("th",{children:"Value"}),i.jsx("th",{children:"Status"})]})})),i.jsx("tbody",{children:u})]}))}))},z=function(e){var n,t=null===(n=e.data)||void 0===n?void 0:n.map((function(e){return i.jsx(r.Tabs.Tab,p({value:e.value},{children:e.label||e.value}),e.value)}));return i.jsx(r.Tabs,p({value:e.value,onTabChange:e.onChange},{children:i.jsx(r.Tabs.List,{children:t})}))},T=[{value:"Overview"},{value:"Breakdown"}],w=r.createStyles((function(e){return{axis:{fontSize:"12px",fontFamily:"Greycliff CF, ".concat(e.fontFamily)}}})),N=function(e){var n=w().theme;return i.jsx(r.Paper,p({p:"lg",withBorder:!0},{children:i.jsxs(r.Stack,{children:[i.jsxs(r.Grid,{children:[i.jsx(r.Grid.Col,p({sm:"auto"},{children:i.jsxs(r.Group,p({spacing:0},{children:[i.jsx(r.Title,p({size:"h5",mb:0},{children:"Performance History"})),i.jsx(r.Tooltip,p({label:"Shows daily increase or decrease across group"},{children:i.jsx(r.ActionIcon,{children:i.jsx(t.IconInfoCircle,{color:"#3b82f6",size:14})})}))]}))})),i.jsx(r.Grid.Col,p({sm:5},{children:i.jsx(r.Select,{placeholder:"Select a metric",value:e.metric,onChange:e.onMetricChange,data:[{label:"PROBLEMS SOLVED",value:"PROBLEMS SOLVED"},{label:"LESSONS COMPLETED",value:"LESSONS COMPLETED"},{label:"BADGES EARNED",value:"BADGES EARNED"}]})}))]}),i.jsx(a.ResponsiveContainer,p({width:"100%",height:400},{children:i.jsxs(a.AreaChart,p({width:730,height:250,data:e.points,margin:{top:10,right:30,left:0,bottom:0}},{children:[i.jsx("defs",{children:i.jsxs("linearGradient",p({id:"colorBlue",x1:"0",y1:"0",x2:"0",y2:"1"},{children:[i.jsx("stop",{offset:"5%",stopColor:"#3b82f6",stopOpacity:.4}),i.jsx("stop",{offset:"95%",stopColor:"#3b82f6",stopOpacity:0})]}))}),i.jsx(a.XAxis,{tick:{fontSize:12,fontFamily:n.fontFamily},dataKey:"name"}),i.jsx(a.YAxis,{tick:{fontSize:12,fontFamily:n.fontFamily}}),i.jsx(a.CartesianGrid,{strokeDasharray:"3 3",horizontal:!0,vertical:!1}),i.jsx(a.Tooltip,{contentStyle:{fontWeight:700,fontSize:12,fontFamily:n.fontFamily},labelStyle:{fontSize:12,fontFamily:n.fontFamily}}),i.jsx(a.Area,{type:"monotone",dataKey:"value",stroke:"#3b82f6",fillOpacity:1,fill:"url(#colorBlue)"})]}))}))]})}))},I=r.createStyles((function(e){return{root:{paddingTop:1.5*e.spacing.xl,paddingBottom:1.5*e.spacing.xl},label:{fontFamily:"Greycliff CF, ".concat(e.fontFamily)}}})),A=function(e){var n=e.data,o=I().classes,s=n.map((function(e){var n=e.diff>0?t.IconArrowUpRight:t.IconArrowDownRight;return i.jsxs(r.Paper,p({withBorder:!0,p:"md",radius:"md"},{children:[i.jsxs(r.Group,p({position:"apart"},{children:[i.jsxs("div",{children:[i.jsx(r.Text,p({color:"dimmed",transform:"uppercase",weight:700,size:"xs",className:o.label},{children:e.title})),i.jsx(r.Text,p({weight:700,size:"xl"},{children:e.value.toLocaleString()}))]}),!!e.diff&&i.jsx(r.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:i.jsx(n,{size:28,stroke:1.5})}))]})),!!e.diff&&i.jsxs(r.Text,p({color:"dimmed",size:"sm",mt:"md"},{children:[i.jsxs(r.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 i.jsx("div",p({className:o.root},{children:i.jsx(r.SimpleGrid,p({cols:3,breakpoints:[{maxWidth:"sm",cols:1}]},{children:s}))}))},B=[{unit:"year",ms:31536e6},{unit:"month",ms:2628e6},{unit:"day",ms:864e5},{unit:"hour",ms:36e5},{unit:"minute",ms:6e4},{unit:"second",ms:1e3}],D=new Intl.RelativeTimeFormat("en",{numeric:"auto"});function G(e,n){return void 0===n&&(n=new Date),e?function(e){for(var n=0,i=B;n<i.length;n++){var t=i[n],r=t.unit,o=t.ms;if(Math.abs(e)>=o||"second"===r)return D.format(Math.round(e/o),r)}return""}(e.getTime()-n.getTime()):""}var L=[{value:"Member",label:"Member"},{value:"Admin",label:"Admin"}];function E(e){if(0===e.items.length)return i.jsx(j,{loading:e.loading,icon:"groups"});var n=e.items.map((function(n){return i.jsxs("tr",{children:[i.jsx("td",{children:i.jsx(r.UnstyledButton,p({onClick:function(){return e.onViewProfile&&e.onViewProfile(n)}},{children:i.jsxs(r.Group,p({spacing:"sm"},{children:[i.jsx(r.Avatar,{size:40,src:n.avatar,radius:40}),i.jsxs("div",{children:[i.jsx(r.Text,p({size:"sm",weight:500},{children:n.givenName&&n.familyName?"".concat(n.givenName," ").concat(n.familyName):n.email})),i.jsx(r.Text,p({size:"xs",color:"dimmed"},{children:n.email}))]})]}))}))}),i.jsx("td",{children:i.jsx(r.Select,{data:g([],L,!0).map((function(e){return n.readonly?p(p({},e),{disabled:e.value!==n.role}):e})),defaultValue:n.role,variant:"unstyled",onChange:function(i){return!n.readonly&&e.onChangeRole&&e.onChangeRole(n,i)}})}),i.jsx("td",{children:n.lastActivity?G(n.lastActivity):""}),i.jsx("td",{children:i.jsx(r.Group,p({noWrap:!0,spacing:0,position:"right"},{children:!n.readonly&&i.jsx(r.ActionIcon,p({color:"red"},{children:i.jsx(t.IconTrash,{onClick:function(){return t=n,m.openConfirmModal({title:'Delete "'.concat(t.givenName&&t.familyName?"".concat(t.givenName," ").concat(t.familyName):t.email,'"?'),centered:!0,children:i.jsx(r.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(t)}});var t},size:16,stroke:1.5})}))}))})]},n.email)}));return i.jsx(r.ScrollArea,{children:i.jsxs(r.Table,p({verticalSpacing:20,sx:{minWidth:700}},{children:[i.jsx("thead",{children:i.jsxs("tr",{children:[i.jsx("th",{children:"Member"}),i.jsx("th",{children:"Role"}),i.jsx("th",{children:"Last active"}),i.jsx("th",{})]})}),i.jsx("tbody",{children:n})]}))})}var O=r.createStyles((function(e){var n;return{title:(n={fontSize:34,fontWeight:900},n[e.fn.smallerThan("sm")]={fontSize:24},n),description:{maxWidth:600},wrapper:{position:"relative",marginBottom:30},dropzone:{borderWidth:1,paddingBottom:50},icon:{color:"dark"===e.colorScheme?e.colors.dark[3]:e.colors.gray[4]},control:{position:"absolute",width:250,left:"calc(50% - 125px)",bottom:-20}}})),P=function(e){var n=O(),o=n.classes,s=n.theme,a=u.useRef(null),c=u.useState(!1),d=c[0],m=c[1],h=u.useCallback((function(n){m(!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),m(!1),e.close()}})}))}),[]);return i.jsxs("div",p({className:o.wrapper},{children:[i.jsx(l.Dropzone,p({loading:d,openRef:a,onDrop:h,className:o.dropzone,radius:"md",accept:[l.MIME_TYPES.csv],maxSize:5*Math.pow(1024,2)},{children:i.jsxs("div",p({style:{pointerEvents:"none"}},{children:[i.jsxs(r.Group,p({position:"center"},{children:[i.jsx(l.Dropzone.Accept,{children:i.jsx(t.IconDownload,{size:50,color:s.colors[s.primaryColor][6],stroke:1.5})}),i.jsx(l.Dropzone.Reject,{children:i.jsx(t.IconX,{size:50,color:s.colors.red[6],stroke:1.5})}),i.jsx(l.Dropzone.Idle,{children:i.jsx(t.IconCloudUpload,{size:50,color:"dark"===s.colorScheme?s.colors.dark[0]:s.black,stroke:1.5})})]})),i.jsxs(r.Text,p({align:"center",weight:700,size:"lg",mt:"xl"},{children:[i.jsx(l.Dropzone.Accept,{children:"Drop files here"}),i.jsx(l.Dropzone.Reject,{children:"Csv file less than 5mb"}),i.jsx(l.Dropzone.Idle,{children:"Upload multiple"})]})),i.jsxs(r.Text,p({align:"center",size:"sm",mt:"xs",color:"dimmed"},{children:["Drag'n'drop files here to upload. We can accept only ",i.jsx("i",{children:".csv"})," files that are less than 5mb in size."]}))]}))})),i.jsx(r.Button,p({className:o.control,size:"md",radius:"xl",onClick:function(){var e;return null===(e=a.current)||void 0===e?void 0:e.call(a)}},{children:"Select file"}))]}))};function R(e){if(0===e.items.length)return i.jsx(j,{loading:e.loading,icon:"groups"});var n=e.items.map((function(n){return i.jsxs("tr",{children:[i.jsx("td",{children:i.jsx(r.Text,p({size:14},{children:n.name}))}),i.jsx("td",{children:i.jsx(r.Text,p({size:14},{children:n.description}))}),i.jsx("td",{children:i.jsxs(r.Group,p({noWrap:!0,spacing:0,position:"right"},{children:[i.jsx(r.ActionIcon,p({color:"blue",onClick:function(){return e.onClick(n)},variant:"subtle"},{children:i.jsx(t.IconUsers,{size:16,stroke:1.5})})),i.jsxs(r.Menu,p({transition:"pop",withArrow:!0,position:"bottom-end"},{children:[i.jsx(r.Menu.Target,{children:i.jsx(r.ActionIcon,{children:i.jsx(t.IconDots,{size:16,stroke:1.5})})}),i.jsx(r.Menu.Dropdown,{children:i.jsx(r.Menu.Item,p({onClick:function(){return t=n,m.openConfirmModal({title:'Delete "'.concat(t.name,'"?'),centered:!0,children:i.jsx(r.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(t)}});var t},icon:i.jsx(t.IconTrash,{size:16,stroke:1.5}),color:"red"},{children:"Delete"}))})]}))]}))})]},n.groupId)}));return i.jsx(r.ScrollArea.Autosize,p({maxHeight:300},{children:i.jsxs(r.Table,p({verticalSpacing:20,sx:{minWidth:700}},{children:[i.jsx("thead",{children:i.jsxs("tr",{children:[i.jsx("th",{children:"Name"}),i.jsx("th",{children:"Description"}),i.jsx("th",{})]})}),i.jsx("tbody",{children:n})]}))}))}var M=r.createStyles((function(e){var n;return{title:(n={fontSize:34,fontWeight:900},n[e.fn.smallerThan("sm")]={fontSize:24},n),description:{maxWidth:600}}})),W=r.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)}}})),F=function(e){var n=e.data,t=W().classes,o=n.map((function(e){return i.jsxs("div",p({className:t.stat},{children:[i.jsx(r.Text,p({className:t.count},{children:e.value.toLocaleString()})),i.jsx(r.Text,p({className:t.title},{children:e.title})),!!e.diff&&i.jsx(r.Text,p({className:t.description},{children:"".concat(e.diff,"% ").concat(e.diff<0?"decrease":"increase"," compared to last period")}))]}),e.title)}));return i.jsx("div",p({className:t.root},{children:o}))},U={BadgeCompleted:i.jsx(t.IconBadges,{size:12}),BadgeStarted:i.jsx(t.IconBadges,{size:12}),LessonCompleted:i.jsx(t.IconSchool,{size:12}),LessonStarted:i.jsx(t.IconSchool,{size:12}),ProblemSolved:i.jsx(t.IconActivityHeartbeat,{size:12})},H=function(e){var n,t=o.useRef(null),s=o.useState({x:0,y:0}),a=s[0],l=s[1];u.useEffect((function(){t.current&&a.y===t.current.scrollHeight-t.current.offsetHeight&&e.onScrollBottom&&e.onScrollBottom()}),[a.y]);var c=e.items.map((function(e){var t=e.name.split(/(?=[A-Z])/),o=t[0]===n?"dashed":"solid";n=t[0];var s=e.link?i.jsx(r.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 i.jsxs(r.Timeline.Item,p({bullet:V(e.name),lineVariant:o,title:s},{children:[i.jsx(r.Text,p({color:"dimmed",size:"sm"},{children:e.description})),i.jsx(r.Text,p({size:"xs",mt:4},{children:G(new Date(e.time))}))]}),e.key)}));return i.jsx(r.ScrollArea.Autosize,p({maxHeight:300,onScrollPositionChange:l,viewportRef:t},{children:i.jsx(r.Timeline,p({ml:"lg",active:1,bulletSize:24,lineWidth:2},{children:c}))}))},V=function(e){var n=U[e];return n||i.jsx(t.IconTimelineEvent,{size:12})},q=r.createStyles((function(e){var n;return{title:(n={fontSize:34,fontWeight:900,marginTop:16},n[e.fn.smallerThan("sm")]={fontSize:24},n),description:{maxWidth:600}}})),_=function(e){var n=q().classes,t=e.givenName?[e.givenName,e.familyName].join(" ").trim():e.email,o=e.givenName?e.givenName:"Me";return"compact"===e.variant?i.jsxs(i.Fragment,{children:[i.jsx(r.Title,p({className:n.title},{children:t})),i.jsx(r.Text,p({color:"dimmed",className:n.description,mt:"xs"},{children:e.quote}))]}):i.jsxs(i.Fragment,{children:[i.jsxs(r.Paper,p({radius:"md",withBorder:!0,p:"lg",sx:function(e){return{backgroundColor:"dark"===e.colorScheme?e.colors.dark[8]:e.white}}},{children:[i.jsx(r.Avatar,{src:e.avatar,size:135,radius:120,mx:"auto"}),i.jsx(r.Text,p({align:"center",size:"lg",weight:500,mt:"md"},{children:t})),i.jsxs(r.Text,p({align:"center",color:"dimmed",size:"sm"},{children:[e.email," • ",e.job]}))]})),i.jsx(r.Blockquote,p({mt:"xl",color:"blue",cite:"– ".concat(o)},{children:e.quote}))]})},X=r.createStyles((function(e){return{card:{height:240,backgroundSize:"cover",backgroundPosition:"center"},content:{position:"absolute",padding:e.spacing.xl,zIndex:1,top:0,bottom:0,right:0,left:0},action:{position:"absolute",bottom:e.spacing.xl,right:e.spacing.xl},title:{color:e.white,marginBottom:e.spacing.xs/2},description:{color:e.white,maxWidth:220}}})),Y=function(e){var n=e.title,t=e.description,o=e.image,s=e.action,a=e.style,l=e.className,c=function(e,n){var i={};for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&n.indexOf(t)<0&&(i[t]=e[t]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(t=Object.getOwnPropertySymbols(e);r<t.length;r++)n.indexOf(t[r])<0&&Object.prototype.propertyIsEnumerable.call(e,t[r])&&(i[t[r]]=e[t[r]])}return i}(e,["title","description","image","action","style","className"]),d=X(),m=d.classes,h=d.cx,u=d.theme;return i.jsxs(r.Card,p({radius:"md",style:p({backgroundImage:"url(".concat(o,")")},a),className:h(m.card,l)},c,{children:[i.jsx(r.Overlay,{gradient:"linear-gradient(105deg, ".concat(u.black," 20%, #312f2f 50%, ").concat(u.colors.gray[4]," 100%)"),opacity:.55,zIndex:0}),i.jsxs("div",p({className:m.content},{children:[i.jsx(r.Text,p({size:"lg",weight:700,className:m.title},{children:n})),i.jsx(r.Text,p({size:"sm",className:m.description},{children:t})),i.jsx(r.Button,p({className:m.action,variant:"white",color:"dark",component:"a",size:"xs",href:s.link,target:"_blank"},{children:s.label}))]}))]}))};function J(e){if(0===e.items.length)return i.jsx(j,{loading:e.loading,icon:"lessons"});var n=e.items.map((function(n){return i.jsxs("tr",{children:[i.jsx("td",{children:i.jsx(r.UnstyledButton,p({onClick:function(){return e.onClick&&e.onClick(n)}},{children:i.jsxs(r.Group,{children:[i.jsx(r.Avatar,{size:40,src:n.avatar,radius:40}),i.jsxs("div",{children:[i.jsx(r.Text,p({size:"sm",weight:500},{children:n.name})),i.jsx(r.Text,p({size:"xs",color:"dimmed"},{children:n.email}))]})]})}))}),i.jsxs("td",{children:[!!n.isComplete&&i.jsx(r.Badge,p({variant:"filled"},{children:"Complete"})),!n.isComplete&&!n.isStarted&&i.jsx(r.Badge,p({color:"red",variant:"filled"},{children:"Not started"})),!n.isComplete&&!!n.isStarted&&i.jsx(r.Badge,p({color:"violet",variant:"filled"},{children:"In progress"}))]})]},n.name)}));return i.jsx(r.ScrollArea.Autosize,p({maxHeight:500},{children:i.jsxs(r.Table,p({horizontalSpacing:0,verticalSpacing:"sm",sx:{minWidth:700},highlightOnHover:!0,striped:!0},{children:[i.jsx("thead",{children:i.jsxs("tr",{children:[i.jsx("th",{children:"Name"}),i.jsx("th",{children:"Status"})]})}),i.jsx("tbody",{children:n})]}))}))}var K=r.createStyles((function(e){var n;return{title:(n={fontSize:34,fontWeight:900},n[e.fn.smallerThan("sm")]={fontSize:24},n),description:{maxWidth:600}}}));function $(e){if(0===e.items.length)return i.jsx(j,{loading:e.loading,icon:"lessons"});var n=e.items.map((function(n){return i.jsx("tr",{children:i.jsx("td",{children:i.jsx(r.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(n)}},{children:i.jsx(r.Group,{children:i.jsxs("div",{children:[i.jsx(r.Text,p({size:"sm",weight:500},{children:n.name})),i.jsx(r.Text,p({size:"xs",color:"dimmed"},{children:n.description}))]})})}))})},n.lessonId)}));return i.jsx(r.ScrollArea.Autosize,p({maxHeight:500},{children:i.jsx(r.Table,p({horizontalSpacing:0,verticalSpacing:0,sx:{minWidth:700}},{children:i.jsx("tbody",{children:n})}))}))}var Q=r.createStyles((function(e){var n;return{title:(n={fontSize:34,fontWeight:900},n[e.fn.smallerThan("sm")]={fontSize:24},n),description:{maxWidth:600}}})),Z=r.createEmotionCache({key:"mantine",prepend:!1}),ee=function(e){var n=c.useForm({initialValues:{active:e.account}});return i.jsx(r.Modal,p({centered:!0,opened:e.opened,onClose:function(){return e.onClose&&e.onClose()},size:"sm",title:i.jsx(r.Title,p({size:"h5"},{children:"Accounts"}))},{children:i.jsxs("form",p({onSubmit:n.onSubmit((function(){e.onChange&&e.onChange(n.values.active)}))},{children:[i.jsx(r.Select,p({required:!0,placeholder:"Select an account",defaultValue:e.account,data:e.accounts.map((function(e){return{value:e.accountId,label:e.name}}))},n.getInputProps("active"))),i.jsx(r.Button,p({type:"submit",fullWidth:!0,mt:"xl"},{children:"Switch"}))]}))}))},ne=r.createStyles((function(e){return{link:{width:50,height:50,borderRadius:e.radius.md,display:"flex",alignItems:"center",justifyContent:"center",color:"dark"===e.colorScheme?e.colors.dark[0]:e.colors.gray[7],"&:hover":{backgroundColor:"dark"===e.colorScheme?e.colors.dark[5]:e.colors.gray[0]}},active:{"&, &:hover":{backgroundColor:e.fn.variant({variant:"light",color:e.primaryColor}).background,color:e.fn.variant({variant:"light",color:e.primaryColor}).color}}}})),ie=[{icon:t.IconHome2,label:"Home",href:"/home"},{icon:t.IconGauge,label:"Dashboard",href:"/dashboard"},{icon:t.IconCategory2,label:"Groups",href:"/groups"},{icon:t.IconAlbum,label:"Badges",href:"/badges"},{icon:t.IconLambda,label:"Lessons",href:"/lessons"}],te=function(e){var n,t=e.icon,o=e.label,s=e.active,a=e.onClick,l=ne(),c=l.classes,d=l.cx;return i.jsx(r.Tooltip,p({label:o,position:"right",transitionDuration:0},{children:i.jsx(r.UnstyledButton,p({onClick:a,className:d(c.link,(n={},n[c.active]=s,n))},{children:i.jsx(t,{stroke:1.5})}))}))},re=function(e){var n=ie.map((function(n){return i.jsx(te,{label:n.label,icon:n.icon,active:n.label===e.active,onClick:function(){return e.navigate(n.href)}},n.label)}));return i.jsxs(r.Navbar,p({width:{base:80},p:"md"},{children:[i.jsx(r.Center,{children:i.jsx(r.Avatar,p({color:"blue",radius:"sm"},{children:i.jsx("div",p({style:{width:15,marginLeft:"auto",marginRight:"auto"}},{children:i.jsx(r.Image,{fit:"contain",src:"https://cdn.localcivics.io/brand/l.png"})}))}))}),i.jsx(r.Navbar.Section,p({grow:!0,mt:50},{children:i.jsx(r.Stack,p({justify:"center",spacing:0},{children:n}))})),i.jsx(r.Navbar.Section,{children:i.jsxs(r.Stack,p({justify:"center",spacing:0},{children:[i.jsx(te,{icon:t.IconSwitchHorizontal,label:"Switch accounts",onClick:e.onSwitchAccounts}),i.jsx(te,{icon:t.IconLogout,label:"Logout",onClick:e.onLogout})]}))})]}))},oe=r.createStyles((function(e){var n,i,t,r,o,s;return{footer:{paddingTop:2*e.spacing.xl,paddingBottom:2*e.spacing.xl,paddingLeft:3*e.spacing.xl,backgroundColor:"dark"===e.colorScheme?e.colors.dark[6]:e.colors.gray[0],borderTop:"1px solid ".concat("dark"===e.colorScheme?e.colors.dark[5]:e.colors.gray[2])},logo:(n={maxWidth:200},n[e.fn.smallerThan("sm")]={display:"flex",flexDirection:"column",alignItems:"center"},n),description:(i={marginTop:5},i[e.fn.smallerThan("sm")]={marginTop:e.spacing.xs,textAlign:"center"},i),inner:(t={display:"flex",justifyContent:"space-between"},t[e.fn.smallerThan("sm")]={flexDirection:"column",alignItems:"center"},t),groups:(r={display:"flex",flexWrap:"wrap"},r[e.fn.smallerThan("sm")]={display:"none"},r),wrapper:{width:160},link:{display:"block",color:"dark"===e.colorScheme?e.colors.dark[1]:e.colors.gray[6],fontSize:e.fontSizes.sm,paddingTop:3,paddingBottom:3,"&:hover":{textDecoration:"underline"}},title:{fontSize:e.fontSizes.md,fontWeight:700,fontFamily:"Greycliff CF, ".concat(e.fontFamily),marginBottom:e.spacing.xs/2,color:"dark"===e.colorScheme?e.white:e.black},afterFooter:(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:(s={},s[e.fn.smallerThan("sm")]={marginTop:e.spacing.xs},s)}})),se=function(e,n,i){var t=JSON.stringify(n),r=o.useState(!1),s=r[0],a=r[1],l=o.useState(e),c=l[0],d=l[1];return u.useEffect((function(){d(e)}),[e,t]),{opened:s,account:c,accounts:n,setChangeModalOpen:a,onAccountChange:function(e){d(e),a(!1),i(e)}}};Object.defineProperty(e,"showNotification",{enumerable:!0,get:function(){return n.showNotification}}),Object.defineProperty(e,"updateNotification",{enumerable:!0,get:function(){return n.updateNotification}}),e.AdminProvider=function(e){return i.jsx(r.MantineProvider,p({withNormalizeCSS:!0,withGlobalStyles:!0,emotionCache:Z,theme:{loader:"bars"}},{children:i.jsx(n.NotificationsProvider,p({limit:e.notificationLimit||5},{children:i.jsx(m.ModalsProvider,{children:e.children})}))}))},e.App=function(e){var n=oe().classes,o=se(e.account,e.accounts,e.onAccountChange);return i.jsxs(r.AppShell,p({padding:"xs",navbar:i.jsx(re,{active:e.navbar.props.active,navigate:e.navbar.props.navigate,onLogout:e.navbar.props.onLogout,onSwitchAccounts:function(){return o.setChangeModalOpen(!0)}}),footer:i.jsx(i.Fragment,{children:!o.opened&&i.jsxs("footer",p({className:n.footer},{children:[i.jsxs(r.Container,p({className:n.inner},{children:[i.jsxs("div",p({className:n.logo},{children:[i.jsxs(r.Group,p({spacing:"xs"},{children:[i.jsx("div",p({style:{width:15}},{children:i.jsx(r.Image,{fit:"contain",src:"https://cdn.localcivics.io/brand/l.png"})})),i.jsx(r.Title,p({color:"dimmed",size:"h5"},{children:"Local Civics"}))]})),i.jsx(r.Text,p({size:"xs",color:"dimmed",className:n.description},{children:"We connect students to powerful civic learning experiences."}))]})),i.jsx("div",p({className:n.groups},{children:i.jsxs("div",p({className:n.wrapper},{children:[i.jsx(r.Text,p({className:n.link,component:"a",href:"https://www.localcivics.io",target:"_blank"},{children:"About"})),i.jsx(r.Text,p({className:n.link,component:"a",href:"https://www.localcivics.io/terms-of-service",target:"_blank"},{children:"Terms"})),i.jsx(r.Text,p({className:n.link,component:"a",href:"https://www.localcivics.io/privacy-policy",target:"_blank"},{children:"Privacy"})),i.jsx(r.Text,p({className:n.link,component:"a",href:"https://localcivics.notion.site/Help-Center-b52300f587b64fc0a61f512686e7626d",target:"_blank"},{children:"FAQ"}))]}))}))]})),i.jsxs(r.Container,p({className:n.afterFooter},{children:[i.jsxs(r.Text,p({color:"dimmed",size:"sm"},{children:["© ",(new Date).getFullYear()," Local Civics. All rights reserved."]})),i.jsxs(r.Group,p({spacing:0,className:n.social,position:"right",noWrap:!0},{children:[i.jsx(r.ActionIcon,p({component:"a",target:"_blank",href:"https://www.instagram.com/localcivics/",size:"lg"},{children:i.jsx(t.IconBrandInstagram,{size:18,stroke:1.5})})),i.jsx(r.ActionIcon,p({component:"a",target:"_blank",href:"https://www.linkedin.com/company/localcivics",size:"lg"},{children:i.jsx(t.IconBrandLinkedin,{size:18,stroke:1.5})})),i.jsx(r.ActionIcon,p({component:"a",target:"_blank",href:"https://www.facebook.com/localcivics/",size:"lg"},{children:i.jsx(t.IconBrandFacebook,{size:18,stroke:1.5})}))]}))]}))]}))}),styles:function(e){return{main:{backgroundColor:"dark"===e.colorScheme?e.colors.dark[8]:e.colors.gray[0]}}}},{children:[i.jsxs("div",p({style:{position:"relative"}},{children:[(e.loading||o.opened)&&i.jsx(r.Center,p({style:{height:400}},{children:i.jsx(r.Loader,{})})),!e.loading&&!o.opened&&e.page]})),i.jsx(ee,{opened:o.opened,account:o.account,accounts:o.accounts,onChange:o.onAccountChange,onClose:function(){return o.setChangeModalOpen(!1)}})]}))},e.Badge=function(e){var n=b().classes;return i.jsx(r.Container,p({size:"lg",py:"xl"},{children:i.jsxs(r.Stack,p({spacing:"md"},{children:[i.jsx(r.Grid,{children:i.jsxs(r.Grid.Col,p({sm:"auto"},{children:[i.jsx(r.Badge,p({variant:"filled",leftSection:i.jsx(r.ActionIcon,p({onClick:e.onBackClick,color:"blue",size:"xs",radius:"xl",variant:"filled"},{children:i.jsx(t.IconArrowLeft,{size:14})})),size:"lg"},{children:"Badges"})),i.jsxs(r.Group,{children:[i.jsxs(r.Stack,p({spacing:0},{children:[i.jsx(r.Title,p({order:2,className:n.title,mt:"md"},{children:e.displayName||"Badge"})),i.jsx(r.Text,p({color:"dimmed",className:n.description,mt:"sm"},{children:e.description||"No description"}))]})),i.jsxs(r.Stack,p({spacing:"xs",ml:"auto"},{children:[i.jsx(r.Button,p({variant:"gradient",onClick:e.onPreviewClick},{children:"Preview"})),i.jsx(r.Divider,{label:"or",labelPosition:"center",my:"xs",variant:"dashed"}),i.jsx(r.Select,{size:"sm",placeholder:"Select a group",nothingFound:"No options",value:e.groupId,onChange:e.onGroupChange,icon:i.jsx(t.IconCategory2,{}),data:e.groups.map((function(e){return{value:e.groupId,label:e.name}}))})]}))]})]}))}),i.jsx("div",{children:i.jsxs("div",p({style:{position:"relative"}},{children:[i.jsx(r.LoadingOverlay,{visible:e.loading,overlayBlur:2}),i.jsx(v,{loading:e.loading,items:e.users,onClick:e.onUserClick})]}))})]}))}))},e.Badges=function(e){var n=S().classes;return i.jsx(r.Container,p({size:"lg",py:"xl"},{children:i.jsxs(r.Stack,p({spacing:"md"},{children:[i.jsx(r.Grid,{children:i.jsxs(r.Grid.Col,p({sm:"auto"},{children:[i.jsx(r.Badge,p({variant:"filled",size:"lg"},{children:"Badges"})),i.jsx(r.Title,p({order:2,className:n.title,mt:"md"},{children:"Badges and micro-credentials"})),i.jsx(r.Text,p({color:"dimmed",className:n.description,mt:"sm"},{children:"Project-sized skills acquisition and standards alignment."}))]}))}),i.jsx(r.Autocomplete,{placeholder:"Search for a badge that fits your needs",data:e.badges.map((function(e){return e.name})),onChange:e.onAutocompleteChange}),i.jsxs("div",p({style:{position:"relative"}},{children:[i.jsx(r.LoadingOverlay,{visible:e.loading,overlayBlur:2}),i.jsx(y,{loading:e.loading,items:e.badges,onClick:e.onBadgeClick})]}))]}))}))},e.DataBreakdown=function(e){return e.loading||0===e.points.length?i.jsx(j,{loading:e.loading,icon:"dashboard"}):i.jsx(r.Paper,p({mih:150,p:"lg",withBorder:!0},{children:i.jsxs(r.Stack,{children:[i.jsx(r.Grid,{children:i.jsx(r.Grid.Col,p({sm:"auto"},{children:i.jsxs(r.Group,p({spacing:0},{children:[i.jsx(r.Title,p({size:"h5",mb:0},{children:"Performance History"})),i.jsx(r.Tooltip,p({label:"Shows group performance per person"},{children:i.jsx(r.ActionIcon,{children:i.jsx(t.IconInfoCircle,{color:"#3b82f6",size:14})})}))]}))}))}),i.jsx(r.Group,p({spacing:"sm"},{children:i.jsx(r.Select,{placeholder:"Select a metric",value:e.metric,onChange:e.onMetricChange,data:[{label:"PROBLEMS SOLVED",value:"PROBLEMS SOLVED"},{label:"LESSONS COMPLETED",value:"LESSONS COMPLETED"},{label:"BADGES EARNED",value:"BADGES EARNED"}]})})),i.jsx(k,{items:e.points})]})}))},e.DataDashboard=function(e){return i.jsx(r.Container,p({size:"lg",py:"xl"},{children:i.jsxs(r.Stack,{children:[i.jsxs(r.Grid,{children:[i.jsxs(r.Grid.Col,p({sm:"auto"},{children:[i.jsx(r.Title,p({size:"h3"},{children:"Dashboard"})),i.jsx(r.Text,p({color:"dimmed",size:"sm",mt:"md"},{children:"View core metrics on the state of your groups."}))]})),i.jsx(r.Grid.Col,p({sm:2.5},{children:i.jsx(r.Select,{placeholder:"Select a group",nothingFound:"No options",value:e.group,onChange:e.onGroupChange,icon:i.jsx(t.IconCategory2,{}),data:e.groups.map((function(e){return e.name}))})})),i.jsx(r.Grid.Col,p({sm:"auto"},{children:i.jsx(s.DateRangePicker,{placeholder:"Select a date",allowSingleDateInRange:!0,value:e.dateRange,onChange:e.onDateRangeChange,icon:i.jsx(t.IconCalendar,{size:16})})}))]}),i.jsxs(r.Stack,{children:[i.jsx(z,{data:T,value:e.tab,onChange:e.onTabChange}),i.jsxs("div",p({style:{position:"relative"}},{children:[i.jsx(r.LoadingOverlay,{visible:e.loading,overlayBlur:2}),e.body]}))]})]})}))},e.DataOverview=function(e){return e.loading||!e.problemsSolved?i.jsx(j,{loading:e.loading,icon:"dashboard"}):i.jsxs(i.Fragment,{children:[i.jsx(A,{data:[{title:"PROBLEMS SOLVED",value:e.problemsSolved,diff:e.problemsSolvedDiff},{title:"LESSONS COMPLETED",value:e.lessonsCompleted,diff:e.lessonsCompletedDiff},{title:"BADGES EARNED",value:e.badgesCompleted,diff:e.badgesCompletedDiff}]}),i.jsx(N,{metric:e.metric,points:e.points,onMetricChange:e.onMetricChange})]})},e.Group=function(e){var n=O().classes,s=c.useForm({initialValues:{groupId:"",userId:"",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"}}}),a=o.useState(!1),l=a[0],d=a[1];return i.jsxs(i.Fragment,{children:[i.jsx(r.Drawer,p({opened:l,onClose:function(){return d(!1)},title:i.jsx(r.Title,p({size:"h5"},{children:"Add people"})),padding:"xl",size:"xl"},{children:i.jsxs(r.Stack,p({spacing:"md"},{children:[i.jsx(P,p({},e,{close:function(){return d(!1)}})),i.jsx(r.Divider,{label:"or",labelPosition:"center",my:"md",variant:"dashed"}),i.jsx("form",p({onSubmit:s.onSubmit((function(){var n=s.values;s.reset(),d(!1),e.onCreateUsers&&e.onCreateUsers([n])}))},{children:i.jsxs(r.Stack,{children:[i.jsx(r.TextInput,p({withAsterisk:!0,label:"Email",placeholder:"Email"},s.getInputProps("email"))),i.jsxs(r.Group,p({grow:!0},{children:[i.jsx(r.TextInput,p({label:"Given name",placeholder:"Given name"},s.getInputProps("givenName"))),i.jsx(r.TextInput,p({label:"Family name",placeholder:"Family name"},s.getInputProps("familyName")))]})),i.jsx(r.Button,p({type:"submit",fullWidth:!0,mt:"md"},{children:"Submit"}))]})}))]}))})),i.jsx(r.Container,p({size:"lg",py:"xl"},{children:i.jsxs(r.Stack,p({spacing:"md"},{children:[i.jsxs(r.Grid,{children:[i.jsxs(r.Grid.Col,p({sm:"auto"},{children:[i.jsx(r.Badge,p({variant:"filled",leftSection:i.jsx(r.ActionIcon,p({onClick:e.onBackClick,color:"blue",size:"xs",radius:"xl",variant:"filled"},{children:i.jsx(t.IconArrowLeft,{size:14})})),size:"lg"},{children:"Groups"})),i.jsx(r.Title,p({order:2,className:n.title,mt:"md"},{children:e.displayName||"Group"})),i.jsx(r.Text,p({color:"dimmed",className:n.description,mt:"sm"},{children:e.description||"No description"}))]})),i.jsx(r.Grid.Col,p({sm:"content"},{children:!e.loading&&i.jsx(r.Button,p({onClick:function(){return d(!0)},leftIcon:i.jsx(t.IconPlaylistAdd,{size:14})},{children:"Add people"}))}))]}),i.jsxs("div",p({style:{position:"relative"}},{children:[i.jsx(r.LoadingOverlay,{visible:e.loading,overlayBlur:2}),i.jsx(E,{loading:e.loading,items:e.users,onDelete:e.onDeleteUser,onChangeRole:e.onRoleChange,onViewProfile:function(n){return e.onUserClick(n)}})]}))]}))}))]})},e.GroupUser=function(e){return i.jsx(r.Container,p({size:"lg",py:"xl"},{children:i.jsxs(r.Stack,p({spacing:"md"},{children:[i.jsx(r.Grid,{children:i.jsxs(r.Grid.Col,p({sm:"auto"},{children:[i.jsx(r.Badge,p({variant:"filled",leftSection:i.jsx(r.ActionIcon,p({onClick:e.onBackClick,color:"blue",size:"xs",radius:"xl",variant:"filled"},{children:i.jsx(t.IconArrowLeft,{size:14})})),size:"lg"},{children:"Users"})),i.jsx(_,{variant:"compact",givenName:e.givenName,familyName:e.familyName,avatar:e.avatarURL,email:e.email,quote:e.impactStatement,job:e.job})]}))}),i.jsxs("div",p({style:{position:"relative"}},{children:[i.jsx(r.LoadingOverlay,{visible:e.loading,overlayBlur:2}),i.jsxs(r.Stack,p({spacing:"lg"},{children:[i.jsx(F,{data:[{title:"PROBLEMS SOLVED",value:e.problemsSolved,diff:e.problemsSolvedDiff},{title:"LESSONS COMPLETED",value:e.lessonsCompleted,diff:e.lessonsCompletedDiff},{title:"BADGES EARNED",value:e.badgesCompleted,diff:e.badgesCompletedDiff}]}),i.jsx(H,{onScrollBottom:e.onScrollBottom,items:e.events})]}))]}))]}))}))},e.Groups=function(e){var n=M().classes,s=c.useForm({initialValues:{groupId:"",name:"",description:""},validate:{name:function(e){return e.length<=6?"Name should include at least 6 characters":null}}}),a=o.useState(!1),l=a[0],d=a[1];return i.jsxs(i.Fragment,{children:[i.jsx(r.Drawer,p({opened:l,onClose:function(){return d(!1)},title:i.jsxs(r.Group,p({spacing:0},{children:[i.jsx(r.Title,p({size:"h5"},{children:"Create a group"})),i.jsx(r.Tooltip,p({label:"Groups settings cannot be modified once created"},{children:i.jsx(r.ActionIcon,{children:i.jsx(t.IconInfoCircle,{color:"#3b82f6",size:14})})}))]})),padding:"xl",size:"xl"},{children:i.jsxs("form",p({onSubmit:s.onSubmit((function(){var n=s.values;s.reset(),d(!1),e.onCreateGroup&&e.onCreateGroup(n)}))},{children:[i.jsxs(r.Stack,{children:[i.jsx(r.TextInput,p({withAsterisk:!0,label:"Name",placeholder:"Group name"},s.getInputProps("name"))),i.jsx(r.TextInput,p({label:"Description",placeholder:"A group for my first period class"},s.getInputProps("description")))]}),i.jsx(r.Button,p({type:"submit",fullWidth:!0,mt:"md"},{children:"Submit"}))]}))})),i.jsx(r.Container,p({size:"lg",py:"xl"},{children:i.jsxs(r.Stack,p({spacing:"md"},{children:[i.jsxs(r.Grid,{children:[i.jsxs(r.Grid.Col,p({sm:"auto"},{children:[i.jsx(r.Badge,p({variant:"filled",size:"lg"},{children:"Groups"})),i.jsx(r.Title,p({order:2,className:n.title,mt:"md"},{children:"Organize people into groups"})),i.jsx(r.Text,p({color:"dimmed",className:n.description,mt:"sm"},{children:"A group can be a class, team, or other functioning organizations."}))]})),i.jsx(r.Grid.Col,p({sm:"content"},{children:!e.loading&&i.jsx(r.Button,p({onClick:function(){return d(!0)},leftIcon:i.jsx(t.IconPlaylistAdd,{size:14})},{children:"Create group"}))}))]}),i.jsxs("div",p({style:{position:"relative"}},{children:[i.jsx(r.LoadingOverlay,{visible:e.loading,overlayBlur:2}),i.jsx(R,{loading:e.loading,items:e.groups,onDeleteGroup:e.onDeleteGroup,onClick:e.onGroupClick})]}))]}))}))]})},e.Home=function(e){return i.jsx(r.Container,p({size:"lg"},{children:i.jsxs(r.Stack,p({spacing:"lg"},{children:[i.jsxs(r.Grid,p({gutter:"md"},{children:[i.jsx(r.Grid.Col,p({md:6},{children:i.jsx(_,{variant:"compact",givenName:e.givenName,familyName:e.familyName,avatar:e.avatarURL,email:e.email,quote:e.impactStatement,job:e.job})})),i.jsx(r.Grid.Col,p({md:6},{children:i.jsx(Y,{title:e.tenantName,description:e.tenantDescription,image:e.tenantImage,action:{label:"Visit website",link:e.tenantWebsite}})}))]})),i.jsx(F,{data:[{title:"PROBLEMS SOLVED",value:e.problemsSolved,diff:e.problemsSolvedDiff},{title:"LESSONS COMPLETED",value:e.lessonsCompleted,diff:e.lessonsCompletedDiff},{title:"BADGES EARNED",value:e.badgesCompleted,diff:e.badgesCompletedDiff}]}),i.jsx(H,{onScrollBottom:e.onScrollBottom,items:e.events})]}))}))},e.Lesson=function(e){var n=K().classes;return i.jsx(r.Container,p({size:"lg",py:"xl"},{children:i.jsxs(r.Stack,p({spacing:"md"},{children:[i.jsx(r.Grid,{children:i.jsxs(r.Grid.Col,p({sm:"auto"},{children:[i.jsx(r.Badge,p({variant:"filled",leftSection:i.jsx(r.ActionIcon,p({onClick:e.onBackClick,color:"blue",size:"xs",radius:"xl",variant:"filled"},{children:i.jsx(t.IconArrowLeft,{size:14})})),size:"lg"},{children:"Lessons"})),i.jsxs(r.Group,{children:[i.jsxs(r.Stack,p({spacing:0},{children:[i.jsx(r.Title,p({order:2,className:n.title,mt:"md"},{children:e.displayName||"Lesson"})),i.jsx(r.Text,p({color:"dimmed",className:n.description,mt:"sm"},{children:e.description||"No description"}))]})),i.jsxs(r.Stack,p({spacing:"xs",ml:"auto"},{children:[i.jsx(r.Button,p({variant:"gradient",onClick:e.onPreviewClick},{children:"Preview"})),i.jsx(r.Divider,{label:"or",labelPosition:"center",my:"xs",variant:"dashed"}),i.jsx(r.Select,{size:"sm",placeholder:"Select a group",nothingFound:"No options",value:e.groupId,onChange:e.onGroupChange,icon:i.jsx(t.IconCategory2,{}),data:e.groups.map((function(e){return{value:e.groupId,label:e.name}}))})]}))]})]}))}),i.jsx("div",{children:i.jsxs("div",p({style:{position:"relative"}},{children:[i.jsx(r.LoadingOverlay,{visible:e.loading,overlayBlur:2}),i.jsx(J,{loading:e.loading,items:e.users,onClick:e.onUserClick})]}))})]}))}))},e.Lessons=function(e){var n=Q().classes;return i.jsx(r.Container,p({size:"lg",py:"xl"},{children:i.jsxs(r.Stack,p({spacing:"md"},{children:[i.jsx(r.Grid,{children:i.jsxs(r.Grid.Col,p({sm:"auto"},{children:[i.jsx(r.Badge,p({variant:"filled",size:"lg"},{children:"Lessons"})),i.jsx(r.Title,p({order:2,className:n.title,mt:"md"},{children:"Lessons"})),i.jsx(r.Text,p({color:"dimmed",className:n.description,mt:"sm"},{children:"Well crafted units of instruction."}))]}))}),i.jsx(r.Autocomplete,{placeholder:"Search for a lesson that fits your needs",data:e.lessons.map((function(e){return e.name})),onChange:e.onAutocompleteChange}),i.jsxs("div",p({style:{position:"relative"}},{children:[i.jsx(r.LoadingOverlay,{visible:e.loading,overlayBlur:2}),i.jsx($,{loading:e.loading,items:e.lessons,onClick:e.onLessonClick})]}))]}))}))},e.Navbar=re,e.SwitchAccount=ee,Object.defineProperty(e,"__esModule",{value:!0})}));
|