import React, { useState } from "react"; import { SimpleSignUp } from "./SimpleSignUp"; // if default export, use: import SimpleSignUp from "./SimpleSignUp"; import { Turnstile } from "react-turnstile"; export default function SignUpUI() { const [handle, setHandle] = useState(""); const [email, setEmail] = useState(""); const [password, setPassword] = useState(""); const [status, setStatus] = useState(""); const [isSignedUp, setIsSignedUp] = useState(false); const [turnstileToken, setTurnstileToken] = useState(null); const handleSubmit = async (e) => { e.preventDefault(); const handleRegex = /^([a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?$/; if (!handleRegex.test(handle + ".tophhie.social")) { setStatus("Invalid username. Only letters, numbers, and hyphens are allowed."); return; } if (!turnstileToken) { setStatus("Please complete the CAPTCHA to continue."); return; } try { const signUp = new SimpleSignUp(); // pass the Turnstile token as an optional parameter; server-side verification is required await signUp.signUp(handle.toLowerCase(), email, password, turnstileToken, setStatus); setIsSignedUp(true); } catch (err) { console.error(err); setStatus(`Sign-up failed. Please try again. ${err}`); setIsSignedUp(false); } }; return (
Tophhie Cloud

Sign up to Tophhie Social

Create your atproto (Bluesky) account on the Tophhie Social server!

{isSignedUp ? (

Account created successfully! You can now log in.


When logging into Bluesky (or any atproto app), make sure the server is set to https://tophhie.social.

) : ( <>
{/* Username + suffix */}
setHandle(e.target.value)} className="flex-1 min-w-0 px-4 py-2 focus:outline-none focus:ring-2 focus:ring-blue-500 text-[16px]" // prevent iOS zoom required /> .tophhie.social
{/* Email */}
setEmail(e.target.value)} className="flex-1 px-4 py-2 bg-white rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500" required />
{/* Password */}
setPassword(e.target.value)} className="flex-1 px-4 py-2 bg-white rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500" required />
By signing up, you agree to the{" "} Terms of Service {" "} and{" "} Privacy Policy .
{ setTurnstileToken(token); setStatus(""); }} onExpire={() => setTurnstileToken(null)} />
{status && (
{status}
)} )}
); }