import { useState } from 'react' import { appAuthSetup } from '../api' import { useAuth } from '../AuthContext' export default function AppSetup() { const { login } = useAuth() const [username, setUsername] = useState('') const [password, setPassword] = useState('') const [confirmPassword, setConfirmPassword] = useState('') const [error, setError] = useState('') const [loading, setLoading] = useState(false) const handleSubmit = async (e) => { e.preventDefault() setError('') if (password !== confirmPassword) { setError('Passwords do not match') return } if (password.length < 4) { setError('Password must be at least 4 characters') return } setLoading(true) const data = await appAuthSetup(username, password) setLoading(false) if (data.error) { setError(data.error) } else if (data.user) { login(data.user) } } return (

OFApp

Welcome! Create your admin account to get started.

{error && (
{error}
)}
setUsername(e.target.value)} className="w-full bg-[#1a1a1a] border border-[#333] rounded-lg px-3 py-2.5 text-white placeholder-gray-600 focus:outline-none focus:border-[#0095f6] transition-colors" placeholder="Choose a username" autoFocus autoComplete="username" />
setPassword(e.target.value)} className="w-full bg-[#1a1a1a] border border-[#333] rounded-lg px-3 py-2.5 text-white placeholder-gray-600 focus:outline-none focus:border-[#0095f6] transition-colors" placeholder="Choose a password" autoComplete="new-password" />
setConfirmPassword(e.target.value)} className="w-full bg-[#1a1a1a] border border-[#333] rounded-lg px-3 py-2.5 text-white placeholder-gray-600 focus:outline-none focus:border-[#0095f6] transition-colors" placeholder="Confirm password" autoComplete="new-password" />
) }