From d529d7456fdebaee18e7006f22fcc1bdf78c0b1d Mon Sep 17 00:00:00 2001 From: Peter Clement Date: Tue, 14 Jun 2022 14:57:34 +0100 Subject: [PATCH] add user groups UI --- .../bbui/src/IconPicker/IconPicker.svelte | 7 +- .../src/pages/builder/portal/_layout.svelte | 5 + .../builder/portal/manage/_layout.svelte | 6 +- .../portal/manage/groups/[groupId].svelte | 211 ++++++++++++++++++ .../groups/_components/UserGroupsRow.svelte | 92 ++++++++ .../manage/groups/_components/UserRow.svelte | 55 +++++ .../portal/manage/groups/_layout.svelte | 3 + .../builder/portal/manage/groups/index.svelte | 155 +++++++++++++ 8 files changed, 530 insertions(+), 4 deletions(-) create mode 100644 packages/builder/src/pages/builder/portal/manage/groups/[groupId].svelte create mode 100644 packages/builder/src/pages/builder/portal/manage/groups/_components/UserGroupsRow.svelte create mode 100644 packages/builder/src/pages/builder/portal/manage/groups/_components/UserRow.svelte create mode 100644 packages/builder/src/pages/builder/portal/manage/groups/_layout.svelte create mode 100644 packages/builder/src/pages/builder/portal/manage/groups/index.svelte diff --git a/packages/bbui/src/IconPicker/IconPicker.svelte b/packages/bbui/src/IconPicker/IconPicker.svelte index 995394adca..954145b42d 100644 --- a/packages/bbui/src/IconPicker/IconPicker.svelte +++ b/packages/bbui/src/IconPicker/IconPicker.svelte @@ -1,5 +1,5 @@
diff --git a/packages/builder/src/pages/builder/portal/_layout.svelte b/packages/builder/src/pages/builder/portal/_layout.svelte index ae0362af72..5da8b34700 100644 --- a/packages/builder/src/pages/builder/portal/_layout.svelte +++ b/packages/builder/src/pages/builder/portal/_layout.svelte @@ -52,6 +52,11 @@ href: "/builder/portal/manage/users", heading: "Manage", }, + { + title: "User Groups", + href: "/builder/portal/manage/groups", + }, + { title: "Auth", href: "/builder/portal/manage/auth" }, { title: "Email", href: "/builder/portal/manage/email" }, { diff --git a/packages/builder/src/pages/builder/portal/manage/_layout.svelte b/packages/builder/src/pages/builder/portal/manage/_layout.svelte index b4ffa4910c..47d9aaf59e 100644 --- a/packages/builder/src/pages/builder/portal/manage/_layout.svelte +++ b/packages/builder/src/pages/builder/portal/manage/_layout.svelte @@ -9,10 +9,14 @@ $redirect("../") } } + + $: wide = + $page.path.includes("email/:template") || + ($page.path.includes("groups") && !$page.path.includes(":groupId")) {#if $auth.isAdmin} - + {/if} diff --git a/packages/builder/src/pages/builder/portal/manage/groups/[groupId].svelte b/packages/builder/src/pages/builder/portal/manage/groups/[groupId].svelte new file mode 100644 index 0000000000..d33f144680 --- /dev/null +++ b/packages/builder/src/pages/builder/portal/manage/groups/[groupId].svelte @@ -0,0 +1,211 @@ + + + +
+ $goto("../groups")} size="S" icon="ArrowLeft"> + Back + +
+
+
+
+
+ +
+
+
+ {group.name} +
+
+
+ +
+ +
+ +
+
+ {filteredUsers.length} User{filteredUsers.length === 1 + ? "" + : "s"} +
+
+ Add all +
+
+ +
+ {#each filteredUsers as user} +
+
+ {user.email} +
+ + {#if selectedUsers.includes(user._id)} +
+ +
+ {/if} +
+ {/each} +
+
+
+
+ +
+ {#if groupUsers.length} + {#each groupUsers as user} +
+ +
+ {/each} + {:else} +
+
+ +
+ You have no users in this team +
+
+
+ {/if} +
+
+ + diff --git a/packages/builder/src/pages/builder/portal/manage/groups/_components/UserGroupsRow.svelte b/packages/builder/src/pages/builder/portal/manage/groups/_components/UserGroupsRow.svelte new file mode 100644 index 0000000000..c4f38f080b --- /dev/null +++ b/packages/builder/src/pages/builder/portal/manage/groups/_components/UserGroupsRow.svelte @@ -0,0 +1,92 @@ + + +
+
+
+
+ +
+
+
{name}
+
+
+
+ +
+ {parseInt(userCount)} app{parseInt(userCount) === 1 ? "" : "s"} +
+
+
+ + +
+ {parseInt(appCount)} app{parseInt(appCount) === 1 ? "" : "s"} +
+
+
+
+
+ +
+
+
+ + diff --git a/packages/builder/src/pages/builder/portal/manage/groups/_components/UserRow.svelte b/packages/builder/src/pages/builder/portal/manage/groups/_components/UserRow.svelte new file mode 100644 index 0000000000..873b45e151 --- /dev/null +++ b/packages/builder/src/pages/builder/portal/manage/groups/_components/UserRow.svelte @@ -0,0 +1,55 @@ + + +
+
+
+ +
+
+
+
+
+ {user.email} +
+ {user.access} +
+
+
+
+
+ + diff --git a/packages/builder/src/pages/builder/portal/manage/groups/_layout.svelte b/packages/builder/src/pages/builder/portal/manage/groups/_layout.svelte new file mode 100644 index 0000000000..a13211a9bb --- /dev/null +++ b/packages/builder/src/pages/builder/portal/manage/groups/_layout.svelte @@ -0,0 +1,3 @@ +
+ +
diff --git a/packages/builder/src/pages/builder/portal/manage/groups/index.svelte b/packages/builder/src/pages/builder/portal/manage/groups/index.svelte new file mode 100644 index 0000000000..63fcd105f3 --- /dev/null +++ b/packages/builder/src/pages/builder/portal/manage/groups/index.svelte @@ -0,0 +1,155 @@ + + + + +
+ User groups + {#if !proPlan} + +
+
+ Pro plan +
+
+
+ {/if} +
+ Easily assign and manage your users access with User Groups +
+
+ + {#if !proPlan} + + {/if} +
+ +
+ {#each userGroupData as group} +
+ +
+ {/each} +
+
+ + + + + + + + +