From d2471e2a020041f8df7aa18e17d5e5a0b8994299 Mon Sep 17 00:00:00 2001
From: mantikoros
Date: Sat, 17 Sep 2022 14:58:42 -0500
Subject: [PATCH] group selector dialog: loading indicator, tracking
---
.../onboarding/group-selector-dialog.tsx | 22 +++++++++++++------
1 file changed, 15 insertions(+), 7 deletions(-)
diff --git a/web/components/onboarding/group-selector-dialog.tsx b/web/components/onboarding/group-selector-dialog.tsx
index e109e356..0a246403 100644
--- a/web/components/onboarding/group-selector-dialog.tsx
+++ b/web/components/onboarding/group-selector-dialog.tsx
@@ -10,6 +10,8 @@ import { Modal } from 'web/components/layout/modal'
import { PillButton } from 'web/components/buttons/pill-button'
import { Button } from 'web/components/button'
import { Group } from 'common/group'
+import { LoadingIndicator } from '../loading-indicator'
+import { withTracking } from 'web/lib/service/analytics'
export default function GroupSelectorDialog(props: {
open: boolean
@@ -65,20 +67,26 @@ export default function GroupSelectorDialog(props: {
- {user &&
+ {!user || displayedGroups.length === 0 ? (
+
+ ) : (
displayedGroups.map((group) => (
- memberGroupIds.includes(group.id)
- ? leaveGroup(group, user.id)
- : joinGroup(group, user.id)
- }
+ onSelect={withTracking(
+ () =>
+ memberGroupIds.includes(group.id)
+ ? leaveGroup(group, user.id)
+ : joinGroup(group, user.id),
+ 'toggle group pill',
+ { group: group.slug }
+ )}
className="mr-1 mb-2 max-w-[12rem] truncate"
>
{group.name}
- ))}
+ ))
+ )}