From 112c1796f6c37f34528e6c7a12944504dab72a21 Mon Sep 17 00:00:00 2001 From: Chris Estreich Date: Thu, 29 May 2025 08:54:17 -0700 Subject: [PATCH] Block users that don't have an org and don't have a domain match for an existing org (#45) --- .../select-org/[[...state]]/SelectOrg.tsx | 51 ++++++++++++++++++- 1 file changed, 50 insertions(+), 1 deletion(-) diff --git a/src/app/(centered)/select-org/[[...state]]/SelectOrg.tsx b/src/app/(centered)/select-org/[[...state]]/SelectOrg.tsx index 39c8cac855..e72a10b965 100644 --- a/src/app/(centered)/select-org/[[...state]]/SelectOrg.tsx +++ b/src/app/(centered)/select-org/[[...state]]/SelectOrg.tsx @@ -1,10 +1,59 @@ -import { OrganizationList } from '@clerk/nextjs'; +'use client'; + +import Link from 'next/link'; +import { OrganizationList, useOrganizationList } from '@clerk/nextjs'; +import { LoaderCircle } from 'lucide-react'; + +import { Button } from '@/components/ui'; export const SelectOrg = ({ state }: { state?: string }) => { + const { isLoaded, userMemberships, userSuggestions, userInvitations } = + useOrganizationList({ + userMemberships: true, + userInvitations: true, + userSuggestions: true, + }); + const redirectUrl = state ? `/extension/sign-in?state=${state}` : '/dashboard'; + const isLoading = + !isLoaded || + userMemberships.isLoading || + userInvitations.isLoading || + userSuggestions.isLoading; + + if (isLoading) { + return ( +
+ +
+ ); + } + + const isBlocked = + userMemberships.count === 0 && + userInvitations.count === 0 && + userSuggestions.count === 0; + + if (isBlocked) { + return ( +
+
+
Roo Code Cloud is in closed beta.
+
+ +
+
+
+ ); + } + return (