Loading data from network...
import { useEffect, useState } from 'react'
import { useNavigate } from 'react-router-dom'
import { usePrivy } from '@privy-io/react-auth'
import useProfile from '../hooks/useProfile.js'
const faces = [
'https://images.pexels.com/photos/1239291/pexels-photo-1239291.jpeg?auto=compress&cs=tinysrgb&w=200',
'https://images.pexels.com/photos/1181686/pexels-photo-1181686.jpeg?auto=compress&cs=tinysrgb&w=200',
'https://images.pexels.com/photos/3621646/pexels-photo-3621646.jpeg?auto=compress&cs=tinysrgb&w=200',
'https://images.pexels.com/photos/2379004/pexels-photo-2379004.jpeg?auto=compress&cs=tinysrgb&w=200'
]
export default function Welcome() {
const { authenticated, login, ready } = usePrivy()
const navigate = useNavigate()
const { fullName, username, setProfile } = useProfile()
const [name, setName] = useState(fullName)
const [handle, setHandle] = useState(username)
const [nationality, setNationality] = useState('')
useEffect(() => {
if (authenticated) {
navigate('/dashboard', { replace: true })
}
}, [authenticated, navigate])
const handleContinue = () => {
setProfile({ fullName: name.trim(), username: handle.trim() })
login()
}
return (
<div className="min-h-[80vh] w-full">
<div className="grid min-h-[80vh] w-full grid-cols-1 overflow-hidden rounded-[32px] border border-ink/10 bg-[#f6f4ff] lg:grid-cols-[1fr,1.05fr]">
<div
className="relative flex flex-col items-center justify-center gap-6 px-8 py-12 text-white"
style={{
backgroundImage:
'radial-gradient(circle at 0 0, rgba(255,255,255,0.12) 0, transparent 45%), radial-gradient(circle at 100% 100%, rgba(255,255,255,0.12) 0, transparent 45%), repeating-linear-gradient(135deg, rgba(255,255,255,0.08) 0 1px, transparent 1px 14px)',
backgroundColor: '#6b3df5'
}}
>
<div className="absolute -bottom-24 -right-24 h-64 w-64 rounded-full bg-[#8c6bff] opacity-40 blur-3xl" />
<div className="relative z-10 max-w-md space-y-4 text-center">
<h2 className="text-3xl font-display">Rotating Savings Circles</h2>
<p className="text-sm text-white/80">
A digital rotating group contribution platform to save in groups and take turns to collect.
</p>
</div>
<div className="relative z-10 mt-6 flex w-full max-w-sm items-center justify-center">
<div className="relative h-56 w-56 rounded-full border-[12px] border-[#ff9a6a]/40">
<div className="absolute -left-10 top-12 h-16 w-16 overflow-hidden rounded-full border-4 border-white">
<img src={faces[0]} alt="Member" className="h-full w-full object-cover" />
</div>
<div className="absolute -right-8 top-10 h-16 w-16 overflow-hidden rounded-full border-4 border-white">
<img src={faces[1]} alt="Member" className="h-full w-full object-cover" />
</div>
<div className="absolute left-10 bottom-0 h-16 w-16 overflow-hidden rounded-full border-4 border-white">
<img src={faces[2]} alt="Member" className="h-full w-full object-cover" />
</div>
<div className="absolute right-12 bottom-6 h-16 w-16 overflow-hidden rounded-full border-4 border-white">
<img src={faces[3]} alt="Member" className="h-full w-full object-cover" />
</div>
<div className="absolute inset-0 -rotate-12 rounded-full border-[10px] border-[#ff9a6a]/70" />
</div>
</div>
</div>
<div className="flex flex-col items-center justify-center gap-6 px-8 py-12">
<div className="text-center">
<div className="mx-auto mb-3 flex h-10 w-10 items-center justify-center rounded-full bg-ink text-white">
C
</div>
<p className="text-sm font-semibold text-ink/60">Cosave</p>
</div>
<div className="w-full max-w-md rounded-[24px] bg-white p-8 shadow-xl">
<div className="text-center">
<h3 className="text-xl font-semibold text-ink">Create an account</h3>
<p className="mt-2 text-xs text-ink/50">
Set up your profile so your savings circles can recognize you.
</p>
</div>
<div className="mt-6 space-y-4 text-sm text-ink/70">
<label className="block">
Full name
<input
className="mt-2 w-full rounded-2xl border border-ink/10 bg-white/90 px-4 py-3"
placeholder="Ada Lovelace"
value={name}
onChange={(event) => setName(event.target.value)}
/>
</label>
<label className="block">
Username
<input
className="mt-2 w-full rounded-2xl border border-ink/10 bg-white/90 px-4 py-3"
placeholder="adaloves"
value={handle}
onChange={(event) => setHandle(event.target.value)}
/>
</label>
<label className="block">
Nationality
<select
className="mt-2 w-full rounded-2xl border border-ink/10 bg-white/90 px-4 py-3"
value={nationality}
onChange={(event) => setNationality(event.target.value)}
>
<option value="">Select country of origin</option>
<option value="ng">Nigeria</option>
<option value="gh">Ghana</option>
<option value="ke">Kenya</option>
<option value="za">South Africa</option>
</select>
</label>
</div>
<button
className="mt-6 w-full rounded-full bg-[#8f6cf6] py-3 text-sm font-semibold text-white"
type="button"
onClick={handleContinue}
disabled={!ready}
>
Continue
</button>
</div>
<p className="text-xs text-ink/60">
Already have an account?{' '}
<button className="font-semibold text-[#8f6cf6]" onClick={() => login()} type="button">
Sign in
</button>
</p>
</div>
</div>
</div>
)
}