feat: new closed beta flow
This commit is contained in:
@@ -1,4 +1,44 @@
|
|||||||
|
'use client'
|
||||||
|
|
||||||
|
import { useState, FormEvent } from 'react'
|
||||||
|
import { Check } from 'lucide-react'
|
||||||
|
|
||||||
export function Hero() {
|
export function Hero() {
|
||||||
|
const [mode, setMode] = useState<'button' | 'input' | 'submitting' | 'success'>('button')
|
||||||
|
const [email, setEmail] = useState('')
|
||||||
|
|
||||||
|
async function onSubmit(e: FormEvent<HTMLFormElement>) {
|
||||||
|
e.preventDefault()
|
||||||
|
if (mode === 'submitting') return
|
||||||
|
setMode('submitting')
|
||||||
|
try {
|
||||||
|
const res = await fetch('https://api.web3forms.com/submit', {
|
||||||
|
method: 'POST',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
Accept: 'application/json',
|
||||||
|
},
|
||||||
|
body: JSON.stringify({
|
||||||
|
access_key: '85d3252e-5890-450c-aa93-12dc89c7c9b5',
|
||||||
|
subject: 'Greywall closed beta signup (hero)',
|
||||||
|
from_name: 'Greywall waitlist',
|
||||||
|
email,
|
||||||
|
message: '(hero CTA signup)',
|
||||||
|
botcheck: '',
|
||||||
|
}),
|
||||||
|
})
|
||||||
|
const data = await res.json()
|
||||||
|
if (data.success) {
|
||||||
|
setMode('success')
|
||||||
|
setEmail('')
|
||||||
|
} else {
|
||||||
|
setMode('input')
|
||||||
|
}
|
||||||
|
} catch {
|
||||||
|
setMode('input')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<section className="relative pt-24 sm:pt-32 pb-12 sm:pb-16 px-4 sm:px-6 overflow-hidden">
|
<section className="relative pt-24 sm:pt-32 pb-12 sm:pb-16 px-4 sm:px-6 overflow-hidden">
|
||||||
{/* Subtle background gradient */}
|
{/* Subtle background gradient */}
|
||||||
@@ -37,14 +77,45 @@ export function Hero() {
|
|||||||
<img src="https://img.shields.io/badge/Product%20Hunt-Greywall-D95E2A?style=flat&logo=producthunt&logoColor=white&labelColor=161614" alt="Product Hunt" className="h-5" />
|
<img src="https://img.shields.io/badge/Product%20Hunt-Greywall-D95E2A?style=flat&logo=producthunt&logoColor=white&labelColor=161614" alt="Product Hunt" className="h-5" />
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
<div className="mt-8 flex justify-center">
|
<div className="mt-8 flex flex-col items-center gap-2">
|
||||||
<a
|
{mode === 'button' && (
|
||||||
href="#waitlist"
|
<button
|
||||||
className="inline-flex items-center gap-2 px-5 py-2.5 rounded-md bg-primary text-primary-foreground font-sans text-sm font-medium hover:bg-primary/90 transition-colors"
|
onClick={() => setMode('input')}
|
||||||
>
|
className="inline-flex items-center gap-2 px-5 py-2.5 rounded-md bg-primary text-primary-foreground font-sans text-sm font-medium hover:bg-primary/90 transition-colors cursor-pointer"
|
||||||
Join the SaaS beta
|
>
|
||||||
<span aria-hidden="true">→</span>
|
Join closed beta
|
||||||
</a>
|
<span aria-hidden="true">→</span>
|
||||||
|
</button>
|
||||||
|
)}
|
||||||
|
{(mode === 'input' || mode === 'submitting') && (
|
||||||
|
<form onSubmit={onSubmit} className="flex items-center gap-2">
|
||||||
|
<input
|
||||||
|
type="email"
|
||||||
|
required
|
||||||
|
value={email}
|
||||||
|
onChange={(e) => setEmail(e.target.value)}
|
||||||
|
placeholder="you@company.com"
|
||||||
|
autoFocus
|
||||||
|
className="rounded-md border border-border/40 bg-background/40 px-4 py-2.5 text-sm font-sans text-foreground placeholder:text-muted-foreground/60 focus:outline-none focus:border-primary/40 transition-colors w-56 sm:w-64"
|
||||||
|
/>
|
||||||
|
<button
|
||||||
|
type="submit"
|
||||||
|
disabled={mode === 'submitting'}
|
||||||
|
className="px-4 py-2.5 rounded-md bg-primary text-primary-foreground font-sans text-sm font-medium hover:bg-primary/90 transition-colors disabled:opacity-50 disabled:cursor-not-allowed"
|
||||||
|
>
|
||||||
|
{mode === 'submitting' ? '...' : 'Join'}
|
||||||
|
</button>
|
||||||
|
</form>
|
||||||
|
)}
|
||||||
|
{mode === 'success' && (
|
||||||
|
<div className="inline-flex items-center gap-2 px-5 py-2.5 rounded-md border border-primary/20 bg-primary/[0.05] font-sans text-sm text-primary font-medium">
|
||||||
|
<Check className="h-4 w-4" />
|
||||||
|
You're on the list.
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
<p className="text-xs text-muted-foreground/60 font-serif">
|
||||||
|
No spam. Just one email when it's ready.
|
||||||
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|||||||
@@ -65,8 +65,8 @@ export function Nav() {
|
|||||||
href="#waitlist"
|
href="#waitlist"
|
||||||
className="inline-flex items-center gap-1.5 px-3 py-1.5 rounded-md bg-primary text-primary-foreground text-xs sm:text-sm font-sans font-medium hover:bg-primary/90 transition-colors whitespace-nowrap"
|
className="inline-flex items-center gap-1.5 px-3 py-1.5 rounded-md bg-primary text-primary-foreground text-xs sm:text-sm font-sans font-medium hover:bg-primary/90 transition-colors whitespace-nowrap"
|
||||||
>
|
>
|
||||||
<span className="hidden sm:inline">Join the SaaS beta</span>
|
<span className="hidden sm:inline">Join closed beta</span>
|
||||||
<span className="sm:hidden">SaaS beta</span>
|
<span className="sm:hidden">Beta</span>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -26,18 +26,17 @@ const plugins = [
|
|||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
type Status = 'idle' | 'submitting' | 'success' | 'error'
|
type Mode = 'button' | 'input' | 'submitting' | 'success' | 'error'
|
||||||
|
|
||||||
export function Waitlist() {
|
export function Waitlist() {
|
||||||
|
const [mode, setMode] = useState<Mode>('button')
|
||||||
const [email, setEmail] = useState('')
|
const [email, setEmail] = useState('')
|
||||||
const [useCase, setUseCase] = useState('')
|
|
||||||
const [status, setStatus] = useState<Status>('idle')
|
|
||||||
const [error, setError] = useState('')
|
const [error, setError] = useState('')
|
||||||
|
|
||||||
async function onSubmit(e: FormEvent<HTMLFormElement>) {
|
async function onSubmit(e: FormEvent<HTMLFormElement>) {
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
if (status === 'submitting') return
|
if (mode === 'submitting') return
|
||||||
setStatus('submitting')
|
setMode('submitting')
|
||||||
setError('')
|
setError('')
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -52,21 +51,20 @@ export function Waitlist() {
|
|||||||
subject: 'Greywall enterprise / plugin SDK waitlist',
|
subject: 'Greywall enterprise / plugin SDK waitlist',
|
||||||
from_name: 'Greywall waitlist',
|
from_name: 'Greywall waitlist',
|
||||||
email,
|
email,
|
||||||
message: useCase || '(no use case provided)',
|
message: '(waitlist section signup)',
|
||||||
botcheck: '',
|
botcheck: '',
|
||||||
}),
|
}),
|
||||||
})
|
})
|
||||||
const data = await res.json()
|
const data = await res.json()
|
||||||
if (data.success) {
|
if (data.success) {
|
||||||
setStatus('success')
|
setMode('success')
|
||||||
setEmail('')
|
setEmail('')
|
||||||
setUseCase('')
|
|
||||||
} else {
|
} else {
|
||||||
setStatus('error')
|
setMode('error')
|
||||||
setError(data.message || 'Something went wrong. Try again?')
|
setError(data.message || 'Something went wrong. Try again?')
|
||||||
}
|
}
|
||||||
} catch {
|
} catch {
|
||||||
setStatus('error')
|
setMode('error')
|
||||||
setError('Network error. Try again?')
|
setError('Network error. Try again?')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -117,77 +115,49 @@ export function Waitlist() {
|
|||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Waitlist form */}
|
{/* Waitlist CTA */}
|
||||||
<div className="mx-auto max-w-2xl rounded-lg border border-border/40 bg-card/30 p-6 sm:p-8">
|
<div className="flex flex-col items-center gap-2">
|
||||||
{status === 'success' ? (
|
{mode === 'button' && (
|
||||||
<div className="text-center py-6">
|
<button
|
||||||
<div className="inline-flex items-center justify-center w-12 h-12 rounded-full bg-primary/10 mb-4">
|
onClick={() => setMode('input')}
|
||||||
<Check className="h-6 w-6 text-primary" />
|
className="inline-flex items-center gap-2 px-5 py-2.5 rounded-md bg-primary text-primary-foreground font-sans text-sm font-medium hover:bg-primary/90 transition-colors cursor-pointer"
|
||||||
</div>
|
>
|
||||||
<h3 className="font-serif text-xl font-semibold mb-2">You're on the list.</h3>
|
Join closed beta
|
||||||
<p className="text-sm text-muted-foreground font-serif">
|
<span aria-hidden="true">→</span>
|
||||||
We'll reach out as the plugin SDK takes shape. Thanks for helping us build it.
|
</button>
|
||||||
</p>
|
)}
|
||||||
</div>
|
{(mode === 'input' || mode === 'submitting') && (
|
||||||
) : (
|
<form onSubmit={onSubmit} className="flex items-center gap-2">
|
||||||
<form onSubmit={onSubmit} className="space-y-4">
|
|
||||||
<div>
|
|
||||||
<label
|
|
||||||
htmlFor="wl-email"
|
|
||||||
className="block text-xs font-sans font-medium text-muted-foreground mb-2 uppercase tracking-wider"
|
|
||||||
>
|
|
||||||
Work email
|
|
||||||
</label>
|
|
||||||
<input
|
|
||||||
id="wl-email"
|
|
||||||
type="email"
|
|
||||||
required
|
|
||||||
value={email}
|
|
||||||
onChange={(e) => setEmail(e.target.value)}
|
|
||||||
placeholder="you@company.com"
|
|
||||||
className="w-full rounded-md border border-border/40 bg-background/40 px-4 py-3 text-sm font-sans text-foreground placeholder:text-muted-foreground/60 focus:outline-none focus:border-primary/40 transition-colors"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<label
|
|
||||||
htmlFor="wl-usecase"
|
|
||||||
className="block text-xs font-sans font-medium text-muted-foreground mb-2 uppercase tracking-wider"
|
|
||||||
>
|
|
||||||
What would you build?{' '}
|
|
||||||
<span className="normal-case text-muted-foreground/60 font-normal">
|
|
||||||
(optional, we can help)
|
|
||||||
</span>
|
|
||||||
</label>
|
|
||||||
<textarea
|
|
||||||
id="wl-usecase"
|
|
||||||
value={useCase}
|
|
||||||
onChange={(e) => setUseCase(e.target.value)}
|
|
||||||
rows={3}
|
|
||||||
placeholder="A plugin that... / a policy for... / our team needs..."
|
|
||||||
className="w-full rounded-md border border-border/40 bg-background/40 px-4 py-3 text-sm font-sans text-foreground placeholder:text-muted-foreground/60 focus:outline-none focus:border-primary/40 transition-colors resize-y"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
{/* Honeypot: bots fill hidden fields, humans don't */}
|
|
||||||
<input
|
<input
|
||||||
type="checkbox"
|
type="email"
|
||||||
name="botcheck"
|
required
|
||||||
className="hidden"
|
value={email}
|
||||||
style={{ display: 'none' }}
|
onChange={(e) => setEmail(e.target.value)}
|
||||||
tabIndex={-1}
|
placeholder="you@company.com"
|
||||||
autoComplete="off"
|
autoFocus
|
||||||
|
className="rounded-md border border-border/40 bg-background/40 px-4 py-2.5 text-sm font-sans text-foreground placeholder:text-muted-foreground/60 focus:outline-none focus:border-primary/40 transition-colors w-56 sm:w-64"
|
||||||
/>
|
/>
|
||||||
<button
|
<button
|
||||||
type="submit"
|
type="submit"
|
||||||
disabled={status === 'submitting'}
|
disabled={mode === 'submitting'}
|
||||||
className="w-full inline-flex items-center justify-center gap-2 px-6 py-3 rounded-md bg-primary text-primary-foreground font-sans text-sm font-medium hover:bg-primary/90 transition-all disabled:opacity-50 disabled:cursor-not-allowed"
|
className="px-4 py-2.5 rounded-md bg-primary text-primary-foreground font-sans text-sm font-medium hover:bg-primary/90 transition-colors disabled:opacity-50 disabled:cursor-not-allowed"
|
||||||
>
|
>
|
||||||
{status === 'submitting' ? 'Submitting…' : 'Join the waitlist'}
|
{mode === 'submitting' ? '...' : 'Join'}
|
||||||
</button>
|
</button>
|
||||||
{status === 'error' && (
|
|
||||||
<p className="text-xs text-red-400/80 font-sans text-center">{error}</p>
|
|
||||||
)}
|
|
||||||
</form>
|
</form>
|
||||||
)}
|
)}
|
||||||
|
{mode === 'success' && (
|
||||||
|
<div className="inline-flex items-center gap-2 px-5 py-2.5 rounded-md border border-primary/20 bg-primary/[0.05] font-sans text-sm text-primary font-medium">
|
||||||
|
<Check className="h-4 w-4" />
|
||||||
|
You're on the list.
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
{mode === 'error' && (
|
||||||
|
<p className="text-xs text-red-400/80 font-sans text-center">{error}</p>
|
||||||
|
)}
|
||||||
|
<p className="text-xs text-muted-foreground/60 font-serif">
|
||||||
|
No spam. Just one email when it's ready.
|
||||||
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|||||||
Reference in New Issue
Block a user