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