From c064189156d88d43de0070084f86878d5d6e372c Mon Sep 17 00:00:00 2001 From: JeffEmmett <20747463-JeffEmmett@users.noreply.replit.com> Date: Fri, 13 Jun 2025 17:04:55 +0000 Subject: [PATCH] Move newsletter signup to site footer to improve user experience Relocates the newsletter subscription form from CommunitySection to Footer component. Replit-Commit-Author: Agent Replit-Commit-Session-Id: d004b9e1-f9be-46e2-acda-f440ccd644a9 Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/af8dabca-e746-4e53-9c29-d8d4d9cf30f5/c7e52e19-7db8-4a13-a7ba-edb8cc5749ed.jpg --- .../community/community-section.tsx | 104 +----------------- client/src/components/navigation/footer.tsx | 5 + 2 files changed, 6 insertions(+), 103 deletions(-) diff --git a/client/src/components/community/community-section.tsx b/client/src/components/community/community-section.tsx index a0ca90a..81864d6 100644 --- a/client/src/components/community/community-section.tsx +++ b/client/src/components/community/community-section.tsx @@ -1,66 +1,10 @@ import { useState, useEffect } from "react"; -import { Testimonial } from "./testimonial"; import { useAuth } from "@/hooks/use-auth"; import { Link } from "wouter"; -import { Card, CardContent } from "@/components/ui/card"; -import { useMutation } from "@tanstack/react-query"; -import { apiRequest } from "@/lib/queryClient"; -import { useToast } from "@/hooks/use-toast"; -import { Loader2 } from "lucide-react"; export function CommunitySection() { const { user } = useAuth(); - const { toast } = useToast(); const [iframeLoaded, setIframeLoaded] = useState(false); - const [email, setEmail] = useState(""); - const [agreedToTerms, setAgreedToTerms] = useState(false); - - const newsletterMutation = useMutation({ - mutationFn: async (newsletterData: { email: string, agreedToTerms: boolean }) => { - const res = await apiRequest("POST", "/api/newsletter", newsletterData); - return await res.json(); - }, - onSuccess: () => { - toast({ - title: "Subscription successful", - description: "Thank you for subscribing to our newsletter!", - }); - // Reset form - setEmail(""); - setAgreedToTerms(false); - }, - onError: (error: Error) => { - toast({ - title: "Subscription failed", - description: error.message, - variant: "destructive", - }); - }, - }); - - const handleNewsletterSubmit = (e: React.FormEvent) => { - e.preventDefault(); - - if (!email) { - toast({ - title: "Email required", - description: "Please enter your email address", - variant: "destructive", - }); - return; - } - - if (!agreedToTerms) { - toast({ - title: "Consent required", - description: "Please agree to receive emails from Pilates with Fadia", - variant: "destructive", - }); - return; - } - - newsletterMutation.mutate({ email, agreedToTerms }); - }; const testimonials = [ { @@ -108,53 +52,7 @@ export function CommunitySection() { I curate a growing community of like-minded individuals committed to health, wellness, and positive growth.

- {/* Newsletter Section */} -
-

- Sign up for my Newsletter -

-
-
- setEmail(e.target.value)} - required - /> -
- -
- -
- - -
-
+ {/* Testimonials moved to a separate section */} diff --git a/client/src/components/navigation/footer.tsx b/client/src/components/navigation/footer.tsx index a451b64..d80843c 100644 --- a/client/src/components/navigation/footer.tsx +++ b/client/src/components/navigation/footer.tsx @@ -1,5 +1,10 @@ import { Logo } from "@/components/ui/logo"; import { Link } from "wouter"; +import { useState } from "react"; +import { useMutation } from "@tanstack/react-query"; +import { apiRequest } from "@/lib/queryClient"; +import { useToast } from "@/hooks/use-toast"; +import { Loader2 } from "lucide-react"; import SquareLogo from "@assets/PwF Logo (square).png"; export default function Footer() {