diff --git a/backend/instance/mydatabase.db b/backend/instance/mydatabase.db index 98fc18b..ba80e2a 100644 Binary files a/backend/instance/mydatabase.db and b/backend/instance/mydatabase.db differ diff --git a/backend/main.py b/backend/main.py index 1b323dd..9585b2c 100644 --- a/backend/main.py +++ b/backend/main.py @@ -100,7 +100,7 @@ def upload(): @app.route("/mail", methods=["POST"]) def mail(): - email = request.json["email"] + email = request.json["senderEmail"] password = request.json["password"] order = request.json["order"] @@ -130,7 +130,7 @@ def serve_image(filename): # New Orders @app.route("/new-order", methods=["POST"]) def register_user(): - email = request.json["email"] + email = request.json["senderEmail"] order = request.json["order"] new_order= Orders(email=email, order=order) diff --git a/frontend/public/batch1/Mockup 113.jpg b/frontend/public/batch1/Mockup 113.jpg deleted file mode 100644 index a4daba6..0000000 Binary files a/frontend/public/batch1/Mockup 113.jpg and /dev/null differ diff --git a/frontend/public/batch1/files_list.json b/frontend/public/batch1/files_list.json index 6ef1706..b907f20 100644 --- a/frontend/public/batch1/files_list.json +++ b/frontend/public/batch1/files_list.json @@ -29,16 +29,6 @@ "favorite": "no", "description": "It's not an option.." }, - { - "id": 4, - "name": "Mockup 113", - "photo": "batch1/Mockup 113.jpg", - "price": 25, - "size": "Youth-S/M/L/2XL | Adult-S/M/L/2XL", - "inStock": "yes", - "favorite": "no", - "description": "It's not an option.." - }, { "id": 5, "name": "design 6 update-01", diff --git a/frontend/src/app/actions/sendEmail.ts b/frontend/src/app/actions/sendEmail.ts index 47cac1c..9783b06 100644 --- a/frontend/src/app/actions/sendEmail.ts +++ b/frontend/src/app/actions/sendEmail.ts @@ -2,7 +2,7 @@ import { Resend } from "resend" import { validateString } from "@/lib/utils"; -import OrderFormEmail from "../emailTemplates/order-form-email"; +import OrderFormEmailClient from "../emailTemplates/order-form-email-client"; import React from "react"; import 'dotenv/config'; @@ -32,11 +32,12 @@ export const sendEmail = async (formData: FormData) => { try { await resend.emails.send({ from:"Order Form ", - to:"arcjcb11@gmail.com", + // to:"arcjcb11@gmail.com", + to: senderEmail as string, subject: "New Order", - reply_to: senderEmail as string, + // reply_to: senderEmail as string, // text: message as string, - react: React.createElement(OrderFormEmail, {order: order as string, senderEmail: senderEmail as string}), + react: React.createElement(OrderFormEmailClient, {order: order as string, senderEmail: senderEmail as string}), }); } catch (error: unknown){ return console.log(error) diff --git a/frontend/src/app/api/emails/route.ts b/frontend/src/app/api/emails/route.ts index 52c4641..cbcb0bb 100644 --- a/frontend/src/app/api/emails/route.ts +++ b/frontend/src/app/api/emails/route.ts @@ -2,20 +2,20 @@ import { sendEmail } from "@/lib/mail.utils" export async function POST() { const sender = { - name: 'My App', + name: 'Kevos Official', address: 'no-reply@kevosattire.com', } const recipients = [{ - name: 'John Doe', - address: 'fernando.delgado@kevosattire.com', + name: 'Fernando Delgado', + address: 'arcjcb11@gmail.com', }] try{ const result = await sendEmail({ sender, recipients, - subject: "Thank you for placing an order with us!", + subject: "New Email!", message: "We will follow up with a Paypal invoice soon!" }) diff --git a/frontend/src/app/emailTemplates/order-form-email-client.tsx b/frontend/src/app/emailTemplates/order-form-email-client.tsx new file mode 100644 index 0000000..7aec10f --- /dev/null +++ b/frontend/src/app/emailTemplates/order-form-email-client.tsx @@ -0,0 +1,38 @@ +import React from "react"; +import { + Html, + Body, + Head, + Heading, + Hr, + Container, + Preview, + Section, + Text, +} from "@react-email/components"; +import { Tailwind } from "@react-email/tailwind"; + +type OrderFormEmailProps = { + order: string; + senderEmail: string; +}; + +export default function OrderFormEmailClient({ order, senderEmail }: OrderFormEmailProps) { + return ( + + + New order from kevo's attire. + + + +
+ Thank you for ordering with us! We will be sending a PayPal invoice shortly in order to process your order. + {order} +
+
+
+ +
+ + ); +} diff --git a/frontend/src/app/page.tsx b/frontend/src/app/page.tsx index e1c7f46..8eecb61 100644 --- a/frontend/src/app/page.tsx +++ b/frontend/src/app/page.tsx @@ -9,7 +9,7 @@ import ClientPortal from "@/components/ClientPortal/ClientPortal"; import styles from "@/styles/Home.module.css"; import { Poppins } from "next/font/google"; import { sendEmail } from "./actions/sendEmail"; -import { createEmptyCacheNode } from "next/dist/client/components/app-router"; +import { selfEmail } from "./api/emails/route"; const Popp = Poppins({ weight: "400", subsets: ["latin"] }); @@ -32,6 +32,13 @@ export default function Home() { // console.log(JSON.stringify(payload)) // console.log({email:formData.get("email"), order:formData.get("order")}) + // Send client email + // await sendEmail(formData); + + // Send new order email to self + // await selfEmail(formData); + + // const response = await fetch("http://192.168.50.107:5580/new-order", { const response = await fetch("http://localhost:5080/new-order", { method: "POST", @@ -41,9 +48,9 @@ export default function Home() { body: JSON.stringify(payload), }) .then((response) => response.json()) - .then((data) => { - console.log(data); - }) + // .then((data) => { + // console.log(data); + // }) .catch((error) => { console.error(error); }); @@ -53,6 +60,7 @@ export default function Home() { emails: "", orders: "", }); + alert("Order Placed! Please check your email.") } return ( @@ -61,7 +69,10 @@ export default function Home() {
Kevo's Attire
- All sizes - $25 +

All sizes - $25

+
+
+

Youth-S/M/L/2XL - Adult-S/M/L/2XL

@@ -89,8 +100,8 @@ export default function Home() { required maxLength={500} placeholder="Your email" - // name="senderEmail" - name="email" + name="senderEmail" + // name="email" />