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