diff --git a/app/blog-single/page.tsx b/app/blog-single/page.tsx index 2287774..ec29ab0 100644 --- a/app/blog-single/page.tsx +++ b/app/blog-single/page.tsx @@ -1,13 +1,18 @@ 'use client' import { useState } from 'react' +import { useSearchParams } from 'next/navigation' import ModalVideo from 'react-modal-video' import "@/node_modules/react-modal-video/css/modal-video.css" import Countdown from '@/components/elements/Countdown' import Layout from "@/components/layout/Layout" +import { recipesList } from "@/utility/constant.utils"; import Link from "next/link" export default function BlogSingle() { const [isOpen, setOpen] = useState(false) + + const searchParams = useSearchParams(); + const currentSlug = searchParams.get('slug'); return ( <> @@ -199,78 +204,37 @@ export default function BlogSingle() {
-
-
-
- -
-
-
    -
  • - 26 Jan 2025 | -
  • -
  • - Beverly -
  • -
-
- Eventify 2024: Unlock the Future of Business -
- read more -
- + {recipesList + .filter(post => post.slug !== currentSlug) + .slice(0, 3) + .map((post) => ( + +
+
+
+ {post.title} +
+
+
    +
  • + {post.date} | +
  • +
  • + {post.user} +
  • +
+
+ {post.title.length > 40 ? `${post.title.slice(0, 40)}...` : post?.title} +
+ read more +
+ +
+
-
-
-
-
-
- -
-
-
    -
  • - 26 Jan 2025 | -
  • -
  • - Gisselle -
  • -
-
- Where Vision Meetup Connect: Eventify 2024 -
- read more -
- -
-
-
-
-
-
-
- -
-
-
    -
  • - 26 Jan 2025 | -
  • -
  • - Mertie -
  • -
-
- Fuel Your Business Growth at Eventify -
- read more -
- -
-
-
-
+ )) + }
@@ -282,7 +246,7 @@ export default function BlogSingle() {
- +
Buy Ticket
@@ -308,7 +272,7 @@ export default function BlogSingle() {
- +
Buy Ticket
diff --git a/app/community/recipes/page.tsx b/app/community/recipes/page.tsx index 810fb0e..9257450 100644 --- a/app/community/recipes/page.tsx +++ b/app/community/recipes/page.tsx @@ -47,9 +47,9 @@ export default function Recipes() {
{post.title.length > 40 ? `${post.title.slice(0, 40)}...` : post?.title}
- read more + read more
- +
diff --git a/app/community/single-recipes/page.tsx b/app/community/single-recipes/page.tsx index 5f387f3..eb46add 100644 --- a/app/community/single-recipes/page.tsx +++ b/app/community/single-recipes/page.tsx @@ -9,8 +9,8 @@ import { Suspense } from "react"; const Page = () => { // const { slug } = params; - const searchParams = useSearchParams(); - const slug = searchParams.get('slug'); + const searchParams = useSearchParams(); + const slug = searchParams.get('slug'); console.log("slug", slug) const post = recipesList.find((post) => post.slug === slug); const [mounted, setMounted] = useState(false); @@ -87,31 +87,36 @@ const Page = () => {
-
-
-
- -
-
-
    -
  • - 26 Jan 2025 | -
  • -
  • - Beverly -
  • -
-
- Eventify 2024: Unlock the Future of Business -
- read more -
- + {recipesList + .filter(p => p.slug !== slug) + .slice(0, 3) + .map((relatedPost) => ( +
+
+
+ {relatedPost.title} +
+
+
    +
  • + {relatedPost.date} | +
  • +
  • + {relatedPost.user} +
  • +
+
+ {relatedPost.title.length > 40 ? `${relatedPost.title.slice(0, 40)}...` : relatedPost?.title} +
+ read more +
+ +
+
-
-
-
+ ))} + {/*
@@ -126,11 +131,11 @@ const Page = () => {
- Where Vision Meetup Connect: Eventify 2024 + Where Vision Meetup Connect: Eventify 2024
- read more + read more
- +
@@ -150,15 +155,15 @@ const Page = () => {
- Fuel Your Business Growth at Eventify + Fuel Your Business Growth at Eventify
- read more + read more
- +
-
+
*/}
@@ -171,14 +176,14 @@ const Page = () => { } const RecipePage = (() => { - return ( - - - }> - - - - ) + return ( + + + }> + + + + ) }) export default RecipePage; \ No newline at end of file diff --git a/app/contact/page.tsx b/app/contact/page.tsx index 483405b..793cb24 100644 --- a/app/contact/page.tsx +++ b/app/contact/page.tsx @@ -1,107 +1,216 @@ +"use client"; +import Countdown from '@/components/elements/Countdown'; +import Layout from "@/components/layout/Layout"; +import Link from "next/link"; +import { useState, useEffect, ChangeEvent, FormEvent } from "react"; +import ReCAPTCHA from "react-google-recaptcha"; +import axios from "axios"; + +interface FormData { + name: string; + phone: string; + email: string; + subject: string; + message: string; +} + +interface FormErrors { + name?: string; + phone?: string; + email?: string; + subject?: string; + message?: string; + captcha?: string; +} -import Countdown from '@/components/elements/Countdown' -import Layout from "@/components/layout/Layout" -import Link from "next/link" export default function Contact() { + const [formData, setFormData] = useState({ + name: "", + phone: "", + email: "", + subject: "", + message: "", + }); + + const [captchaToken, setCaptchaToken] = useState(null); + const [formErrors, setFormErrors] = useState({}); + const [alert, setAlert] = useState<{ show: boolean; type: string; message: string }>({ + show: false, + type: "", + message: "", + }); + + const handleChange = (e: ChangeEvent) => { + const { name, value } = e.target; + setFormData((prev) => ({ ...prev, [name]: value })); + }; + + const handleCaptchaChange = (token: string | null) => { + setCaptchaToken(token); + }; + + const handleSubmit = async (e: FormEvent) => { + e.preventDefault(); + + const errors: FormErrors = {}; + if (!formData.name.trim()) errors.name = "Name is required."; + if (!formData.phone.trim()) errors.phone = "Phone number is required."; + if (!formData.email.trim()) errors.email = "Email is required."; + if (!formData.subject.trim()) errors.subject = "Subject is required."; + if (!formData.message.trim()) errors.message = "Message is required."; + if (!captchaToken) errors.captcha = "Please verify the CAPTCHA."; + + setFormErrors(errors); + if (Object.keys(errors).length > 0) return; + + const emailData = { + ...formData, + message: `Subject: ${formData.subject}

Message: ${formData.message}`, + to: "alaguraj259@gmail.com", + senderName: "Tamil Culture Waterloo Contact Page", + recaptchaToken: captchaToken, + }; + + try { + const res = await axios.post("https://mailserver.metatronnest.com/send", emailData, { + headers: { "Content-Type": "application/json" }, + }); + + setAlert({ + show: true, + type: "success", + message: res?.data?.message || "Message sent successfully!", + }); + + setFormData({ name: "", phone: "", email: "", subject: "", message: "" }); + setCaptchaToken(null); + setFormErrors({}); + } catch { + setAlert({ + show: true, + type: "danger", + message: "Failed to send message. Please try again later.", + }); + } + }; + + useEffect(() => { + if (alert.show) { + const timer = setTimeout(() => setAlert({ ...alert, show: false }), 5000); + return () => clearTimeout(timer); + } + }, [alert.show]); return ( - <> + +
+
+
+
+
+
+

Contact Us

+
+ Home Contact Us +
+
+
+
+
- -
-
-
-
-
-
-

Contact Us

-
- Home Contact Us +
+
+
+
+
+
+
+ +
+
+
Email
+
+ mail@tamilculturewaterloo.org +
+
+
+
+
+
+ +
+
+
Location
+
+ P.O. Box No:25068, Kitchener, Ontario, N2A 4A5, Canada. +
+
+
+
+
+
+ +
+
+
Call Us
+
+ +1 123 456 7890
- {/*===== HERO AREA ENDS =======*/} - {/*===== CONTACT AREA STARTS =======*/} -
-
-
-
-
-
-
- -
-
-
Email
-
- mail@tamilculturewaterloo.org -
-
-
-
-
-
- -
-
-
Location
-
- P.O. Box No:25068, Kitchener, Ontario, N2A 4A5, Canada. -
-
-
-
-
-
- -
-
-
Call Us
-
- +1 123 456 7890 -
-
-
-
-
-
- {/*===== CONTACT AREA ENDS =======*/} - {/*===== CONTACT AREA STARTS =======*/} -
-
-
-
-
-

Get In Touch Now

-
+
+ +
+
+
+
+
+

Get In Touch Now

+
+
+ {alert.show && ( +
{alert.message}
+ )}
- + + {formErrors.name && {formErrors.name}}
- + + {formErrors.phone && {formErrors.phone}}
- + + {formErrors.email && {formErrors.email}}
- + + {formErrors.subject && {formErrors.subject}}
-