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