From 271b274b2716dd30814cfe64fcd588fb77aef243 Mon Sep 17 00:00:00 2001 From: Peter Clement Date: Fri, 24 Jun 2022 11:16:26 +0100 Subject: [PATCH] users table renderer --- packages/bbui/src/Table/Table.svelte | 2 + .../groups/_components/UserGroupsRow.svelte | 5 ++- .../manage/groups/_components/UserRow.svelte | 15 +++++-- .../_components/AppsTableRenderer.svelte | 29 ++++++++++++ .../_components/GroupsTableRenderer.svelte | 29 ++++++++++++ .../_components/NameTableRenderer.svelte | 29 ++++++++++++ .../builder/portal/manage/users/index.svelte | 44 +++++++------------ 7 files changed, 121 insertions(+), 32 deletions(-) create mode 100644 packages/builder/src/pages/builder/portal/manage/users/_components/AppsTableRenderer.svelte create mode 100644 packages/builder/src/pages/builder/portal/manage/users/_components/GroupsTableRenderer.svelte create mode 100644 packages/builder/src/pages/builder/portal/manage/users/_components/NameTableRenderer.svelte diff --git a/packages/bbui/src/Table/Table.svelte b/packages/bbui/src/Table/Table.svelte index e78437ee4a..fbfcb8a020 100644 --- a/packages/bbui/src/Table/Table.svelte +++ b/packages/bbui/src/Table/Table.svelte @@ -285,6 +285,7 @@
{#if showEditColumn}
{#if allowSelectRows} @@ -352,6 +353,7 @@ > {#if showEditColumn}
{ toggleSelectRow(row) 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 index ff3519516f..a720750d46 100644 --- a/packages/builder/src/pages/builder/portal/manage/groups/_components/UserGroupsRow.svelte +++ b/packages/builder/src/pages/builder/portal/manage/groups/_components/UserGroupsRow.svelte @@ -14,7 +14,6 @@ export let deleteGroup export let saveGroup let modal - function editGroup() { modal.show() } @@ -35,7 +34,9 @@
- {parseInt(group.userCount) || 0} user{parseInt(group.userCount) === 1 + {parseInt(group?.users?.length) || 0} user{parseInt( + group?.users?.length + ) === 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 index 65c40006af..f067260448 100644 --- a/packages/builder/src/pages/builder/portal/manage/groups/_components/UserRow.svelte +++ b/packages/builder/src/pages/builder/portal/manage/groups/_components/UserRow.svelte @@ -3,7 +3,6 @@ export let user export let removeUser - $: console.log(user)
@@ -14,9 +13,9 @@
-
+
{user.email} -
+
{user.access}
@@ -33,6 +32,16 @@ align-items: center; } + .text { + opacity: 0.5; + margin: var(--spacing-xs) 0 0 var(--spacing-m); + } + + .align-email { + display: flex; + align-items: center; + } + .name { text-decoration: none; overflow: hidden; diff --git a/packages/builder/src/pages/builder/portal/manage/users/_components/AppsTableRenderer.svelte b/packages/builder/src/pages/builder/portal/manage/users/_components/AppsTableRenderer.svelte new file mode 100644 index 0000000000..b007972a39 --- /dev/null +++ b/packages/builder/src/pages/builder/portal/manage/users/_components/AppsTableRenderer.svelte @@ -0,0 +1,29 @@ + + +
+
+ +
+ {#if value?.apps?.length === 0} +
+
No groups
+
+ {:else if value?.apps?.length === 1} + {value?.groups[0]?.name} + {:else} + {parseInt(value?.apps?.length) || 0} + {/if} +
+ + diff --git a/packages/builder/src/pages/builder/portal/manage/users/_components/GroupsTableRenderer.svelte b/packages/builder/src/pages/builder/portal/manage/users/_components/GroupsTableRenderer.svelte new file mode 100644 index 0000000000..57bd834803 --- /dev/null +++ b/packages/builder/src/pages/builder/portal/manage/users/_components/GroupsTableRenderer.svelte @@ -0,0 +1,29 @@ + + +
+
+ +
+ {#if value?.groups?.length === 0} +
+
No groups
+
+ {:else if value?.groups?.length === 1} + {value.groups[0]?.name} + {:else} + {parseInt(value?.groups?.length) || 0} + {/if} +
+ + diff --git a/packages/builder/src/pages/builder/portal/manage/users/_components/NameTableRenderer.svelte b/packages/builder/src/pages/builder/portal/manage/users/_components/NameTableRenderer.svelte new file mode 100644 index 0000000000..c80bead9f8 --- /dev/null +++ b/packages/builder/src/pages/builder/portal/manage/users/_components/NameTableRenderer.svelte @@ -0,0 +1,29 @@ + + +
+ {#if value?.name} +
+ +
+ {value.name} + {:else} +
Invite pending...
+ {/if} +
+ + diff --git a/packages/builder/src/pages/builder/portal/manage/users/index.svelte b/packages/builder/src/pages/builder/portal/manage/users/index.svelte index 50d4031af4..669b82e48d 100644 --- a/packages/builder/src/pages/builder/portal/manage/users/index.svelte +++ b/packages/builder/src/pages/builder/portal/manage/users/index.svelte @@ -1,12 +1,9 @@