import { Lock, FormInput, Users, Circle } from 'lucide-react'; import { Handle, Position } from '@xyflow/react'; import { AuthMetadataSchema } from '@insforge/shared-schemas'; import { cn } from '@/lib/utils/utils'; import { useOAuthConfig } from '@/features/auth/hooks/useOAuthConfig'; import { oauthProviders } from '@/features/auth/helpers'; interface AuthNodeProps { data: { authMetadata: AuthMetadataSchema; userCount?: number; isReferenced?: boolean; // Whether any tables have foreign keys to users.id }; } export function AuthNode({ data }: AuthNodeProps) { const { authMetadata, userCount, isReferenced = false } = data; const { isProviderConfigured } = useOAuthConfig(); const enabledCount = authMetadata.oauths.length + 1; return (
{/* Auth Header */}

Authentication

{enabledCount} provider{enabledCount !== 1 ? 's' : ''} enabled

{/*
*/}
{/* Auth Providers */}
{/* Email/Password */}
Email/Password
Enabled
{/* OAuth Providers */} {oauthProviders.map((provider) => { const isEnabled = isProviderConfigured(provider.id); return (
{provider.icon}
{provider.name}
{isEnabled ? 'Enabled' : 'Disabled'}
); })}
{/* Users Section */}
{/* Target handle for auth.id references - positioned at right bottom corner */}
Users {userCount ?? 0}
{isReferenced ? (
) : ( )}
); }