@local-civics/mgmt-ui 0.1.161 → 0.1.163

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -1,9 +1,9 @@
1
1
  import * as React from 'react';
2
2
  import { useState } from 'react';
3
- import { createStyles, Group, Avatar, Text, Box, Badge as Badge$1, ThemeIcon, Collapse, Navbar as Navbar$1, Center, Image, Code, Burger, ScrollArea, Modal, Loader, Container, Button, Title, UnstyledButton, Card, SimpleGrid, Tabs as Tabs$1, Menu, ActionIcon, Grid, Table as Table$k, Stack as Stack$4, LoadingOverlay, Select, Autocomplete, Drawer, Divider, TextInput, Tooltip, Paper, Overlay, Anchor, Checkbox, createEmotionCache, MantineProvider, AppShell } from '@mantine/core';
4
- import { IconChevronRight, IconChevronLeft, IconVideo, IconSwitchHorizontal, IconLogout, IconHome2, IconGauge, IconCategory2, IconRoute, IconAlbum, IconLambda, IconBuilding, IconBatteryEco, IconBooks, IconBackpack, IconChevronDown, IconClipboardCopy, IconTableExport, IconArrowLeft, IconPlaylistAdd, IconCheck, IconTrash, IconDownload, IconX, IconCloudUpload, IconInfoCircle, IconColorSwatch, IconPointer, IconScribble, IconSchool, IconPodium, IconBriefcase, IconPresentation, IconNews, IconTools, IconBrandInstagram, IconBrandLinkedin, IconBrandFacebook } from '@tabler/icons';
3
+ import { createStyles, Group, Avatar, Text, Box, Badge as Badge$1, ThemeIcon, Collapse, Navbar as Navbar$1, Center, Image, Code, Burger, ScrollArea, Modal, Loader, Container, Button, Title, UnstyledButton, Card, SimpleGrid, Tabs as Tabs$1, Grid, Table as Table$k, Stack as Stack$4, ActionIcon, LoadingOverlay, Select, Autocomplete, Drawer, Divider, TextInput, Tooltip, Paper, Overlay, Anchor, Menu, Checkbox, createEmotionCache, MantineProvider, AppShell } from '@mantine/core';
4
+ import { IconChevronRight, IconChevronLeft, IconVideo, IconSwitchHorizontal, IconLogout, IconHome2, IconGauge, IconCategory2, IconRoute, IconAlbum, IconLambda, IconBuilding, IconBatteryEco, IconBooks, IconBackpack, IconClipboardCopy, IconTableExport, IconArrowLeft, IconPlaylistAdd, IconCheck, IconTrash, IconDownload, IconX, IconCloudUpload, IconInfoCircle, IconColorSwatch, IconPointer, IconChevronDown, IconScribble, IconSchool, IconPodium, IconBriefcase, IconPresentation, IconNews, IconTools, IconBrandInstagram, IconBrandLinkedin, IconBrandFacebook } from '@tabler/icons';
5
5
  import { Link } from 'react-router-dom';
6
- import { NotificationsProvider } from '@mantine/notifications';
6
+ import { showNotification, NotificationsProvider } from '@mantine/notifications';
7
7
  export { showNotification, updateNotification } from '@mantine/notifications';
8
8
  import { DataTable } from 'mantine-datatable';
9
9
  import { Dropzone, MIME_TYPES } from '@mantine/dropzone';
@@ -512,7 +512,7 @@ const useStyles$n = createStyles((theme) => ({
512
512
  }));
513
513
  const SplitButton$4 = (props) => {
514
514
  const { classes, theme } = useStyles$n();
515
- const menuIconColor = theme.colors[theme.primaryColor][theme.colorScheme === "dark" ? 5 : 6];
515
+ theme.colors[theme.primaryColor][theme.colorScheme === "dark" ? 5 : 6];
516
516
  return /* @__PURE__ */ React.createElement(Group, { noWrap: true, spacing: 0 }, /* @__PURE__ */ React.createElement(
517
517
  Button,
518
518
  {
@@ -522,30 +522,21 @@ const SplitButton$4 = (props) => {
522
522
  variant: "gradient"
523
523
  },
524
524
  "Preview"
525
- ), /* @__PURE__ */ React.createElement(Menu, { transition: "pop", position: "bottom-end" }, /* @__PURE__ */ React.createElement(Menu.Target, null, /* @__PURE__ */ React.createElement(
526
- ActionIcon,
527
- {
528
- variant: "gradient",
529
- color: theme.primaryColor,
530
- size: 36,
531
- className: classes.menuControl
532
- },
533
- /* @__PURE__ */ React.createElement(IconChevronDown, { size: 16, stroke: 1.5 })
534
- )), /* @__PURE__ */ React.createElement(Menu.Dropdown, null, /* @__PURE__ */ React.createElement(
535
- Menu.Item,
525
+ ), /* @__PURE__ */ React.createElement(
526
+ Button,
536
527
  {
537
- icon: /* @__PURE__ */ React.createElement(IconClipboardCopy, { size: 16, stroke: 1.5, color: menuIconColor }),
528
+ leftIcon: /* @__PURE__ */ React.createElement(IconClipboardCopy, { size: 14 }),
538
529
  onClick: props.onCopyLinkClick
539
530
  },
540
- "Copy link"
531
+ "Copy class link"
541
532
  ), /* @__PURE__ */ React.createElement(
542
- Menu.Item,
533
+ Button,
543
534
  {
544
- icon: /* @__PURE__ */ React.createElement(IconTableExport, { size: 16, stroke: 1.5, color: menuIconColor }),
535
+ leftIcon: /* @__PURE__ */ React.createElement(IconTableExport, { size: 14 }),
545
536
  onClick: props.onExportDataClick
546
537
  },
547
538
  "Export data (.csv)"
548
- ))));
539
+ ));
549
540
  };
550
541
 
551
542
  const useStyles$m = createStyles((theme) => ({
@@ -1627,6 +1618,10 @@ const useStyles$f = createStyles((theme) => ({
1627
1618
  description: {
1628
1619
  color: theme.white,
1629
1620
  maxWidth: 220
1621
+ },
1622
+ code: {
1623
+ color: theme.white,
1624
+ maxWidth: 220
1630
1625
  }
1631
1626
  }));
1632
1627
  const TenantBanner = (_a) => {
@@ -1635,15 +1630,31 @@ const TenantBanner = (_a) => {
1635
1630
  description,
1636
1631
  image,
1637
1632
  style,
1638
- className
1633
+ className,
1634
+ code
1639
1635
  } = _b, others = __objRest$1(_b, [
1640
1636
  "title",
1641
1637
  "description",
1642
1638
  "image",
1643
1639
  "style",
1644
- "className"
1640
+ "className",
1641
+ "code"
1645
1642
  ]);
1646
1643
  const { classes, cx, theme } = useStyles$f();
1644
+ const handleCopy = async () => {
1645
+ if (!code)
1646
+ return;
1647
+ try {
1648
+ await navigator.clipboard.writeText(code);
1649
+ showNotification({
1650
+ title: "Copied!",
1651
+ message: "Community code copied to clipboard.",
1652
+ autoClose: 3e3
1653
+ });
1654
+ } catch (err) {
1655
+ console.error("Failed to copy code", err);
1656
+ }
1657
+ };
1647
1658
  return /* @__PURE__ */ React.createElement(
1648
1659
  Card,
1649
1660
  __spreadValues$5({
@@ -1659,7 +1670,20 @@ const TenantBanner = (_a) => {
1659
1670
  zIndex: 0
1660
1671
  }
1661
1672
  ),
1662
- /* @__PURE__ */ React.createElement("div", { className: classes.content }, /* @__PURE__ */ React.createElement(Text, { size: "lg", weight: 700, className: classes.title }, title), /* @__PURE__ */ React.createElement(Text, { size: "sm", className: classes.description }, description))
1673
+ /* @__PURE__ */ React.createElement("div", { className: classes.content }, /* @__PURE__ */ React.createElement(Text, { size: "lg", weight: 700, className: classes.title }, title), /* @__PURE__ */ React.createElement(Text, { size: "sm", className: classes.description }, description), /* @__PURE__ */ React.createElement(Group, { mt: "sm", spacing: "xs" }, /* @__PURE__ */ React.createElement(Text, { size: "sm", className: classes.code }, "Community Code: ", code || "\u2014"), code && /* @__PURE__ */ React.createElement(
1674
+ Button,
1675
+ {
1676
+ size: "xs",
1677
+ variant: "white",
1678
+ onClick: handleCopy,
1679
+ styles: {
1680
+ root: {
1681
+ backgroundColor: "rgba(255,255,255,0.9)"
1682
+ }
1683
+ }
1684
+ },
1685
+ "Copy"
1686
+ )))
1663
1687
  );
1664
1688
  };
1665
1689
 
@@ -1676,7 +1700,8 @@ const Home = (props) => {
1676
1700
  {
1677
1701
  title: props.organization.name,
1678
1702
  description: props.organization.description,
1679
- image: props.organization.image
1703
+ image: props.organization.image,
1704
+ code: props.organization.accessCode
1680
1705
  }
1681
1706
  ))), /* @__PURE__ */ React.createElement(Grid, { gutter: "md" }, /* @__PURE__ */ React.createElement(Grid.Col, null, /* @__PURE__ */ React.createElement(
1682
1707
  CardGradient,
@@ -1748,7 +1773,7 @@ const useStyles$e = createStyles((theme) => ({
1748
1773
  }));
1749
1774
  const SplitButton$2 = (props) => {
1750
1775
  const { classes, theme } = useStyles$e();
1751
- const menuIconColor = theme.colors[theme.primaryColor][theme.colorScheme === "dark" ? 5 : 6];
1776
+ theme.colors[theme.primaryColor][theme.colorScheme === "dark" ? 5 : 6];
1752
1777
  return /* @__PURE__ */ React.createElement(Stack$4, { spacing: "sm" }, /* @__PURE__ */ React.createElement(
1753
1778
  Button,
1754
1779
  {
@@ -1766,23 +1791,21 @@ const SplitButton$2 = (props) => {
1766
1791
  variant: "gradient"
1767
1792
  },
1768
1793
  "Preview"
1769
- ), /* @__PURE__ */ React.createElement(Menu, { transition: "pop", position: "bottom-end" }, /* @__PURE__ */ React.createElement(Menu.Target, null, /* @__PURE__ */ React.createElement(
1770
- ActionIcon,
1794
+ ), /* @__PURE__ */ React.createElement(
1795
+ Button,
1771
1796
  {
1772
- variant: "gradient",
1773
- color: theme.primaryColor,
1774
- size: 36,
1775
- className: classes.menuControl
1797
+ leftIcon: /* @__PURE__ */ React.createElement(IconClipboardCopy, { size: 14 }),
1798
+ onClick: props.onCopyLinkClick
1776
1799
  },
1777
- /* @__PURE__ */ React.createElement(IconChevronDown, { size: 16, stroke: 1.5 })
1778
- )), /* @__PURE__ */ React.createElement(Menu.Dropdown, null, !props.noExport && /* @__PURE__ */ React.createElement(
1779
- Menu.Item,
1800
+ "Copy class link"
1801
+ ), /* @__PURE__ */ React.createElement(
1802
+ Button,
1780
1803
  {
1781
- icon: /* @__PURE__ */ React.createElement(IconTableExport, { size: 16, stroke: 1.5, color: menuIconColor }),
1804
+ leftIcon: /* @__PURE__ */ React.createElement(IconTableExport, { size: 14 }),
1782
1805
  onClick: props.onExportDataClick
1783
1806
  },
1784
1807
  "Export data (.csv)"
1785
- )))));
1808
+ )));
1786
1809
  };
1787
1810
 
1788
1811
  function Stack$2(props) {
@@ -3199,7 +3222,7 @@ const useStyles$1 = createStyles((theme) => ({
3199
3222
  }));
3200
3223
  const SplitButton = (props) => {
3201
3224
  const { classes, theme } = useStyles$1();
3202
- const menuIconColor = theme.colors[theme.primaryColor][theme.colorScheme === "dark" ? 5 : 6];
3225
+ theme.colors[theme.primaryColor][theme.colorScheme === "dark" ? 5 : 6];
3203
3226
  return /* @__PURE__ */ React.createElement(Group, { noWrap: true, spacing: 0 }, /* @__PURE__ */ React.createElement(
3204
3227
  Button,
3205
3228
  {
@@ -3209,30 +3232,21 @@ const SplitButton = (props) => {
3209
3232
  variant: "gradient"
3210
3233
  },
3211
3234
  "Preview"
3212
- ), /* @__PURE__ */ React.createElement(Menu, { transition: "pop", position: "bottom-end" }, /* @__PURE__ */ React.createElement(Menu.Target, null, /* @__PURE__ */ React.createElement(
3213
- ActionIcon,
3214
- {
3215
- variant: "gradient",
3216
- color: theme.primaryColor,
3217
- size: 36,
3218
- className: classes.menuControl
3219
- },
3220
- /* @__PURE__ */ React.createElement(IconChevronDown, { size: 16, stroke: 1.5 })
3221
- )), /* @__PURE__ */ React.createElement(Menu.Dropdown, null, /* @__PURE__ */ React.createElement(
3222
- Menu.Item,
3235
+ ), /* @__PURE__ */ React.createElement(
3236
+ Button,
3223
3237
  {
3224
- icon: /* @__PURE__ */ React.createElement(IconClipboardCopy, { size: 16, stroke: 1.5, color: menuIconColor }),
3238
+ leftIcon: /* @__PURE__ */ React.createElement(IconClipboardCopy, { size: 14 }),
3225
3239
  onClick: props.onCopyLinkClick
3226
3240
  },
3227
- "Copy link"
3241
+ "Copy class link"
3228
3242
  ), /* @__PURE__ */ React.createElement(
3229
- Menu.Item,
3243
+ Button,
3230
3244
  {
3231
- icon: /* @__PURE__ */ React.createElement(IconTableExport, { size: 16, stroke: 1.5, color: menuIconColor }),
3245
+ leftIcon: /* @__PURE__ */ React.createElement(IconTableExport, { size: 14 }),
3232
3246
  onClick: props.onExportDataClick
3233
3247
  },
3234
3248
  "Export data (.csv)"
3235
- ))));
3249
+ ));
3236
3250
  };
3237
3251
 
3238
3252
  function Stack(props) {