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