'use client' import { cn } from '@/lib/utils' import { createClient } from '@/registry/default/clients/nextjs/lib/supabase/client' import { Button } from '@/registry/default/components/ui/button' import { Card, CardContent, CardDescription, CardHeader, CardTitle, } from '@/registry/default/components/ui/card' import { useState } from 'react' export function LoginForm({ className, ...props }: React.ComponentPropsWithoutRef<'div'>) { const [error, setError] = useState(null) const [isLoading, setIsLoading] = useState(false) const handleSocialLogin = async (e: React.FormEvent) => { e.preventDefault() const supabase = createClient() setIsLoading(true) setError(null) try { const { error } = await supabase.auth.signInWithOAuth({ provider: 'github', }) if (error) throw error location.href = '/protected' } catch (error: unknown) { setError(error instanceof Error ? error.message : 'An error occurred') setIsLoading(false) } } return (
Welcome! Sign in to your account to continue
{error &&

{error}

}
) }