-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement a structured layout for the landing page to promote the waitlist, including sections for the Hero, Challenges, Solutions, Benefits, Call to Action, Process, Testimonials, and FAQ. Each section includes visual recommendations to enhance relevance and conversion rates. [skip gpt_engineer]
- Loading branch information
1 parent
54b8936
commit a3d79ed
Showing
4 changed files
with
143 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
import { useState } from "react" | ||
import { useForm } from "react-hook-form" | ||
import { Button } from "@/components/ui/button" | ||
import { Input } from "@/components/ui/input" | ||
import { Textarea } from "@/components/ui/textarea" | ||
import { supabase } from "@/integrations/supabase/client" | ||
import { useToast } from "@/hooks/use-toast" | ||
|
||
interface WaitlistFormData { | ||
email: string | ||
firstName: string | ||
teachingLevel: string | ||
} | ||
|
||
export const WaitlistForm = () => { | ||
const [isLoading, setIsLoading] = useState(false) | ||
const { toast } = useToast() | ||
const { register, handleSubmit, reset, formState: { errors } } = useForm<WaitlistFormData>() | ||
|
||
const onSubmit = async (data: WaitlistFormData) => { | ||
setIsLoading(true) | ||
try { | ||
const { error } = await supabase | ||
.from('waitlist') | ||
.insert([ | ||
{ | ||
email: data.email, | ||
first_name: data.firstName, | ||
teaching_level: data.teachingLevel | ||
} | ||
]) | ||
|
||
if (error) throw error | ||
|
||
toast({ | ||
title: "Inscription réussie !", | ||
description: "Nous vous contacterons dès que la plateforme sera disponible.", | ||
}) | ||
reset() | ||
} catch (error) { | ||
console.error('Error:', error) | ||
toast({ | ||
variant: "destructive", | ||
title: "Erreur", | ||
description: "Une erreur est survenue lors de l'inscription. Veuillez réessayer.", | ||
}) | ||
} finally { | ||
setIsLoading(false) | ||
} | ||
} | ||
|
||
return ( | ||
<form onSubmit={handleSubmit(onSubmit)} className="space-y-4 w-full max-w-md mx-auto"> | ||
<div> | ||
<Input | ||
placeholder="Votre prénom" | ||
{...register("firstName", { required: "Le prénom est requis" })} | ||
className="w-full" | ||
/> | ||
{errors.firstName && ( | ||
<p className="text-sm text-red-500 mt-1">{errors.firstName.message}</p> | ||
)} | ||
</div> | ||
|
||
<div> | ||
<Input | ||
type="email" | ||
placeholder="Votre email" | ||
{...register("email", { | ||
required: "L'email est requis", | ||
pattern: { | ||
value: /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}$/i, | ||
message: "Email invalide" | ||
} | ||
})} | ||
className="w-full" | ||
/> | ||
{errors.email && ( | ||
<p className="text-sm text-red-500 mt-1">{errors.email.message}</p> | ||
)} | ||
</div> | ||
|
||
<div> | ||
<Textarea | ||
placeholder="Votre niveau d'enseignement" | ||
{...register("teachingLevel", { required: "Le niveau d'enseignement est requis" })} | ||
className="w-full" | ||
/> | ||
{errors.teachingLevel && ( | ||
<p className="text-sm text-red-500 mt-1">{errors.teachingLevel.message}</p> | ||
)} | ||
</div> | ||
|
||
<Button | ||
type="submit" | ||
className="w-full bg-primary hover:bg-primary/90 text-white" | ||
disabled={isLoading} | ||
> | ||
{isLoading ? "Inscription en cours..." : "Je m'inscris à la liste d'attente"} | ||
</Button> | ||
</form> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters