diff --git a/app/api/contact-send/route.js b/app/api/contact-send/route.js index f4a7189..f221554 100644 --- a/app/api/contact-send/route.js +++ b/app/api/contact-send/route.js @@ -1,47 +1,35 @@ import { EmailTemplate } from "@/components/custom/ContactSender"; -import { Resend } from "resend"; - -const resend = new Resend(process.env.RESEND_API_KEY); +import { supabase } from "@/lib/supabase"; export async function POST(request) { - try { - const formData = await request.json(); + try { + const formData = await request.json(); - // Send email using Resend - const { data: resendData, error: resendError } = await resend.emails.send({ - from: "support@rankrunners.net", - to: ["sales@rankrunners.net"], - subject: "New Quotes From /contact", - react: EmailTemplate({ - name: formData.name, - emailAddress: formData.emailAddress, - phoneNumber: formData.phoneNumber, - subject: formData.subject, - message: formData.message, - }), - }); + // Store form data in Supabase + const { data: supabaseData, error: supabaseError } = await supabase + .from("rankrunners-submission") + .insert([ + { + name: formData.name, + email: formData.emailAddress, + phone: formData.phoneNumber, + subject: formData.subject, + message: formData.message, + }, + ]) + .select(); - if (resendError) { - return Response.json({ error: resendError }, { status: 500 }); - } - - const response = await fetch("https://cryagent.pythonanywhere.com/submitrankrunnerscontact", { - method: "POST", - headers: { - "Content-Type": "application/json", - }, - body: JSON.stringify({ email: formData.emailAddress }), - }); - - if (!response.ok) { - throw new Error("Failed to submit to cryagent.pythonanywhere.com"); - } - - const pythonAnywhereData = await response.json(); - - return Response.json({ resendData, pythonAnywhereData }); - } catch (error) { - console.error("Error:", error); - return Response.json({ error: error.message }, { status: 500 }); + if (supabaseError) { + console.log("err", supabaseError); + return Response.json({ error: supabaseError }, { status: 500 }); } + + return Response.json({ + supabaseData, + message: "Form submitted successfully", + }); + } catch (error) { + console.log("Error:", error); + return Response.json({ error: error.message }, { status: 500 }); + } } diff --git a/app/api/schedule-send/(backup).js b/app/api/schedule-send/(backup).js new file mode 100644 index 0000000..7eb6da1 --- /dev/null +++ b/app/api/schedule-send/(backup).js @@ -0,0 +1,53 @@ +// import { EmailTemplate } from "@/components/custom/ScheduleSender"; +// import { Resend } from "resend"; + +// const resend = new Resend(process.env.RESEND_API_KEY); + +// export async function POST(request) { +// try { +// const formData = await request.json(); + +// const { data: resendData, error: resendError } = await resend.emails.send({ +// from: "support@rankrunners.net", +// to: ["sales@rankrunners.net"], +// subject: "New Quotes From /schedule", +// react: EmailTemplate({ +// firstName: formData.firstName, +// lastName: formData.lastName, +// emailAddress: formData.emailAddress, +// phoneNumber: formData.phoneNumber, +// companyName: formData.companyName, +// websiteUrl: formData.websiteUrl, +// annualRevenue: formData.annualRevenue, +// learnFrom: formData.learnFrom, +// additionalInfo: formData.additionalInfo, +// }), +// }); + +// if (resendError) { +// return Response.json({ error: resendError }, { status: 500 }); +// } + +// const response = await fetch( +// "https://cryagent.pythonanywhere.com/submitrankrunnersschedule", +// { +// method: "POST", +// headers: { +// "Content-Type": "application/json", +// }, +// body: JSON.stringify({ email: formData.emailAddress }), +// } +// ); + +// if (!response.ok) { +// throw new Error("Failed to submit to cryagent.pythonanywhere.com"); +// } + +// const pythonAnywhereData = await response.json(); + +// return Response.json({ resendData, pythonAnywhereData }); +// } catch (error) { +// console.error("Error:", error); +// return Response.json({ error: error.message }, { status: 500 }); +// } +// } \ No newline at end of file diff --git a/app/api/schedule-send/route.js b/app/api/schedule-send/route.js index 1ad9a84..a5e37b0 100644 --- a/app/api/schedule-send/route.js +++ b/app/api/schedule-send/route.js @@ -1,50 +1,38 @@ -import { EmailTemplate } from "@/components/custom/ScheduleSender"; -import { Resend } from "resend"; - -const resend = new Resend(process.env.RESEND_API_KEY); +import { supabase } from "@/lib/supabase"; export async function POST(request) { - try { - const formData = await request.json(); + try { + const formData = await request.json(); - const { data: resendData, error: resendError } = await resend.emails.send({ - from: "support@rankrunners.net", - to: ["sales@rankrunners.net"], - subject: "New Quotes From /schedule", - react: EmailTemplate({ - firstName: formData.firstName, - lastName: formData.lastName, - emailAddress: formData.emailAddress, - phoneNumber: formData.phoneNumber, - companyName: formData.companyName, - websiteUrl: formData.websiteUrl, - annualRevenue: formData.annualRevenue, - learnFrom: formData.learnFrom, - additionalInfo: formData.additionalInfo, - }), - }); + // Store form data in Supabase + const { data: supabaseData, error: supabaseError } = await supabase + .from("rankrunners-schedules") + .insert([ + { + first_name: formData.firstName, + last_name: formData.lastName, + email: formData.emailAddress, + phone: formData.phoneNumber, + company_name: formData.companyName, + web_url: formData.websiteUrl, + revenue: formData.annualRevenue, + learn_option: formData.learnFrom, + additional_info: formData.additionalInfo, + }, + ]) + .select(); - if (resendError) { - return Response.json({ error: resendError }, { status: 500 }); - } - - const response = await fetch("https://cryagent.pythonanywhere.com/submitrankrunnersschedule", { - method: "POST", - headers: { - "Content-Type": "application/json", - }, - body: JSON.stringify({ email: formData.emailAddress }), - }); - - if (!response.ok) { - throw new Error("Failed to submit to cryagent.pythonanywhere.com"); - } - - const pythonAnywhereData = await response.json(); - - return Response.json({ resendData, pythonAnywhereData }); - } catch (error) { - console.error("Error:", error); - return Response.json({ error: error.message }, { status: 500 }); + if (supabaseError) { + console.log("err", supabaseError); + return Response.json({ error: supabaseError }, { status: 500 }); } + + return Response.json({ + supabaseData, + message: "Appointment Scheduled Successfully!", + }); + } catch (error) { + console.log("Error:", error); + return Response.json({ error: error.message }, { status: 500 }); + } } diff --git a/app/contact/page.js b/app/contact/page.js index 43d160f..96c3887 100644 --- a/app/contact/page.js +++ b/app/contact/page.js @@ -3,73 +3,74 @@ import Link from "next/link"; import Contacting from "@/components/custom/Contact"; export const metadata = { - title: "Contact | RankRunners - SEO, Web Design & Digital Marketing Agency", - description: - "RankRunners provides enterprise level SEO, Web Design/Development, Digital Marketing and IT Management services for companies across all industries, regardless of scope or size. Contact support@rankrunners.net to get started today!", + title: "Contact | RankRunners - SEO, Web Design & Digital Marketing Agency", + description: + "RankRunners provides enterprise level SEO, Web Design/Development, Digital Marketing and IT Management services for companies across all industries, regardless of scope or size. Contact support@rankrunners.net to get started today!", }; export default function Contact() { - return ( - <> - -
-
-
-
-
-
-
- - GET IN TOUCH - -

Let's Talk

-

- Have a question about a service, pricing, or case study? Send us a - message and we'll provide all the answers you need! -

-
-
-
    -
  • -
    - -
    -
    -

    Address

    -

    - - Suite B, 1934 N. Druid Hills Rd, Brookhaven, GA 30319, - USA - -

    -
    -
  • -
  • -
    - -
    -
    -

    Phone

    - (470) 260-4117 -
    -
  • -
  • -
    - -
    -
    -

    Email

    - - support@rankrunners.net - -
    -
  • -
-
- {/*
+ return ( + <> + +
+
+
+
+
+
+
+ + GET IN TOUCH + +

Let's Talk

+

+ Have a question about a service, pricing, or case study? + Send us a message and we'll provide all the answers you + need! +

+
+
+
    +
  • +
    + +
    +
    +

    Address

    +

    + + Suite B, 1934 N. Druid Hills Rd, Brookhaven, GA + 30319, USA + +

    +
    +
  • +
  • +
    + +
    +
    +

    Phone

    + (470) 260-4117 +
    +
  • +
  • +
    + +
    +
    +

    Email

    + + support@rankrunners.net + +
    +
  • +
+
+ {/*
  • We'll increase your company website's organic search ranking and @@ -88,27 +89,27 @@ export default function Contact() {

    Are you ready to outrun your competitors?

    */} -
-
-
- -
-
-
-
-
-