'use client' import { useState, useEffect, Suspense } from 'react' import { useRouter, useSearchParams } from 'next/navigation' import Link from 'next/link' import Image from 'next/image' import { useStore } from '@/lib/store' import { api } from '@/lib/api' import { Loader2, ArrowRight, Check, Eye, EyeOff, Mail } from 'lucide-react' // Logo Component function Logo() { return ( ) } // OAuth Icons function GoogleIcon({ className }: { className?: string }) { return ( ) } function GitHubIcon({ className }: { className?: string }) { return ( ) } const benefits = [ 'Track up to 5 domains. Free.', 'Daily scans. You never miss a drop.', 'Instant alerts. Know first.', 'Expiry intel. Plan your move.', ] function RegisterForm() { const router = useRouter() const searchParams = useSearchParams() const { register } = useStore() const [email, setEmail] = useState('') const [password, setPassword] = useState('') const [showPassword, setShowPassword] = useState(false) const [error, setError] = useState(null) const [loading, setLoading] = useState(false) const [oauthProviders, setOauthProviders] = useState({ google_enabled: false, github_enabled: false }) const [registered, setRegistered] = useState(false) // Get redirect URL from query params const redirectTo = searchParams.get('redirect') || '/terminal/dashboard' // Load OAuth providers useEffect(() => { api.getOAuthProviders().then(setOauthProviders).catch(() => {}) }, []) const handleSubmit = async (e: React.FormEvent) => { e.preventDefault() setError(null) setLoading(true) try { await register(email, password) // Store redirect URL for after email verification // This will be picked up by the login page after verification if (redirectTo !== '/terminal/dashboard') { localStorage.setItem('pounce_redirect_after_login', redirectTo) } // Show verification message setRegistered(true) } catch (err) { setError(err instanceof Error ? err.message : 'Registration failed') } finally { setLoading(false) } } // Generate login link with redirect preserved const loginLink = redirectTo !== '/terminal/dashboard' ? `/login?redirect=${encodeURIComponent(redirectTo)}` : '/login' // Show verification message after registration if (registered) { return ( Check your inbox We've sent a verification link to {email} Click the link in the email to verify your account and start hunting domains. Go to Login Resend Verification Email ) } return ( {/* Ambient glow */} {/* Left Panel - Form */} {/* Logo */} {/* Header */} Join the hunt. Start tracking domains in under a minute {/* Form */} {error && ( {error} )} setEmail(e.target.value)} placeholder="Email address" required autoComplete="email" className="input-elegant text-body-sm sm:text-body" /> setPassword(e.target.value)} placeholder="Create password (min. 8 characters)" required minLength={8} autoComplete="new-password" className="input-elegant text-body-sm sm:text-body pr-12" /> setShowPassword(!showPassword)} className="absolute right-3 sm:right-4 top-1/2 -translate-y-1/2 text-foreground-muted hover:text-foreground transition-colors duration-200" aria-label={showPassword ? 'Hide password' : 'Show password'} > {showPassword ? ( ) : ( )} {loading ? ( ) : ( <> Start Hunting > )} {/* OAuth Buttons */} {(oauthProviders.google_enabled || oauthProviders.github_enabled) && ( {/* Divider */} or continue with {oauthProviders.google_enabled && ( Sign up with Google )} {oauthProviders.github_enabled && ( Sign up with GitHub )} )} {/* Login Link */} Already have an account?{' '} Sign in {/* Right Panel - Benefits */} Free Forever Your hunting gear. Ready to go. {benefits.map((item) => ( {item} ))} No credit card required. Upgrade anytime. ) } export default function RegisterPage() { return ( }> ) }
We've sent a verification link to {email}
Click the link in the email to verify your account and start hunting domains.
Start tracking domains in under a minute
{error}
Already have an account?{' '} Sign in
No credit card required. Upgrade anytime.