Skip to content

Commit

Permalink
Add waitlist promotion structure
Browse files Browse the repository at this point in the history
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
lovable-dev[bot] committed Dec 27, 2024
1 parent 54b8936 commit a3d79ed
Show file tree
Hide file tree
Showing 4 changed files with 143 additions and 13 deletions.
22 changes: 11 additions & 11 deletions src/components/landing/HeroSection.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import React from 'react';
import { ArrowRight } from 'lucide-react';
import { Button } from '../ui/button';
import { LoginForm } from './LoginForm';
import { Dialog, DialogContent } from '../ui/dialog';
import { DynamicText } from './DynamicText';
import React from 'react'
import { ArrowRight } from 'lucide-react'
import { Button } from '../ui/button'
import { Dialog, DialogContent } from '../ui/dialog'
import { WaitlistForm } from './WaitlistForm'
import { DynamicText } from './DynamicText'

export function HeroSection() {
const [showLoginForm, setShowLoginForm] = React.useState(false);
const [showWaitlistForm, setShowWaitlistForm] = React.useState(false)

return (
<section className="relative py-20 overflow-hidden">
Expand All @@ -19,7 +19,7 @@ export function HeroSection() {
</h1>
<Button
size="lg"
onClick={() => setShowLoginForm(true)}
onClick={() => setShowWaitlistForm(true)}
className="bg-primary text-white hover:bg-primary/90 transition-all duration-200 text-lg px-8 py-6 rounded-xl shadow-premium hover:shadow-premium-lg transform hover:scale-105 mb-6"
>
Je m'inscris maintenant
Expand All @@ -30,11 +30,11 @@ export function HeroSection() {
</p>
</div>
</div>
<Dialog open={showLoginForm} onOpenChange={setShowLoginForm}>
<Dialog open={showWaitlistForm} onOpenChange={setShowWaitlistForm}>
<DialogContent className="sm:max-w-[425px]">
<LoginForm />
<WaitlistForm />
</DialogContent>
</Dialog>
</section>
);
)
}
103 changes: 103 additions & 0 deletions src/components/landing/WaitlistForm.tsx
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>
)
}
24 changes: 24 additions & 0 deletions src/integrations/supabase/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,30 @@ export type Database = {
}
Relationships: []
}
waitlist: {
Row: {
created_at: string
email: string
first_name: string
id: string
teaching_level: string
}
Insert: {
created_at?: string
email: string
first_name: string
id?: string
teaching_level: string
}
Update: {
created_at?: string
email?: string
first_name?: string
id?: string
teaching_level?: string
}
Relationships: []
}
}
Views: {
conversation_analytics: {
Expand Down
7 changes: 5 additions & 2 deletions src/pages/Landing.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,15 @@ import { HowItWorksSection } from "@/components/landing/HowItWorksSection"
import { TestimonialsSection } from "@/components/landing/TestimonialsSection"
import { FAQSection } from "@/components/landing/FAQSection"
import { CTASection } from "@/components/landing/CTASection"
import { Header } from "@/components/landing/Header"
import { SEO } from "@/components/SEO"

const Landing = () => {
return (
<div className="min-h-screen">
<Header />
<SEO
title="PedagoIA - Assistant pédagogique intelligent"
description="Votre assistant pédagogique qui vous aide à adapter vos cours, effectuer vos tâches administratives et préparer vos cours plus efficacement."
/>
<HeroSection />
<ChallengesSection />
<MetricsSection />
Expand Down

0 comments on commit a3d79ed

Please sign in to comment.