'use client' import { useAuth } from '@thedaviddias/auth' import { Button } from '@thedaviddias/design-system/button' import { Github, Mail } from 'lucide-react' import Link from 'next/link' import type React from 'react' import { AuthTierIndicator } from '@/components/auth/auth-tier-indicator' import { Card } from '@/components/ui/card' import { UserMessageBanner } from '@/components/ui/user-message-banner' interface AuthCheckProps { children: React.ReactNode requireGitHub?: boolean fallbackContent?: React.ReactNode } /** * Renders children only when auth requirements are met, showing sign-in prompts otherwise */ export function AuthCheck({ children, requireGitHub = false, fallbackContent }: AuthCheckProps) { const { user, signIn } = useAuth() // Check if user has GitHub integration const hasGitHubAuth = user && (user.user_metadata?.github_username || user.user_metadata?.user_name) // Determine if user meets requirements const meetsRequirements = requireGitHub ? hasGitHubAuth : user if (!meetsRequirements) { if (fallbackContent) { return <>{fallbackContent} } return (
{requireGitHub && user && !hasGitHubAuth ? ( // User has email account but needs GitHub for this feature <>

Connect GitHub to Continue

You're signed in with an email account. Connect your GitHub account to unlock direct project submissions and contributor features.

Alternatively, you can{' '} submit directly to the GitHub repository .

) : ( // No account at all

{requireGitHub ? 'Sign in to submit your llms.txt' : 'Join the Community'}

{requireGitHub ? "Choose how you'd like to get started with the llms.txt hub." : 'Create an account to unlock all features and join our growing community.'}

{/* Primary CTA based on requirement */} {requireGitHub ? ( <>
Just want to browse?
) : ( <> )}
{requireGitHub && (

Don't want to sign in? You can always{' '} submit directly to the GitHub repository .

)} {/* Auth tier comparison */}
)}
) } return <>{children} }