Block users that don't have an org and don't have a domain match for an existing org (#45)

This commit is contained in:
Chris Estreich 2025-05-29 08:54:17 -07:00 committed by GitHub
parent ab92f7693e
commit 112c1796f6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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 (
<div className="flex flex-row items-center gap-2">
<LoaderCircle className="animate-spin" />
</div>
);
}
const isBlocked =
userMemberships.count === 0 &&
userInvitations.count === 0 &&
userSuggestions.count === 0;
if (isBlocked) {
return (
<div className="flex flex-row items-center gap-2">
<div className="flex flex-col gap-2 items-center">
<div>Roo Code Cloud is in closed beta.</div>
<div>
<Button asChild>
<Link href="https://roocode.com/enterprise#contact">
Request Early Access
</Link>
</Button>
</div>
</div>
</div>
);
}
return (
<OrganizationList
afterSelectOrganizationUrl={redirectUrl}