diff --git a/alimento-nextjs/app/(PublicRoutes)/Auth/Customer/SignIn/page.tsx b/alimento-nextjs/app/(PublicRoutes)/Auth/Customer/SignIn/page.tsx new file mode 100644 index 0000000..0915ac9 --- /dev/null +++ b/alimento-nextjs/app/(PublicRoutes)/Auth/Customer/SignIn/page.tsx @@ -0,0 +1,112 @@ +"use client"; +import { useState, FormEvent } from "react"; +import { ToastContainer, toast } from "react-toastify"; +import "react-toastify/dist/ReactToastify.css"; +import Image from "next/image"; +import signinImage from "../../../../../public/signin.png"; + +const SignInPage: React.FC = () => { + const [email, setEmail] = useState(""); + const [isSignUp, setIsSignUp] = useState(false); + + const handleSendOTP = (e: FormEvent) => { + e.preventDefault(); + + const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/; + if (!emailRegex.test(email)) { + toast.error("Please enter a valid email address."); + return; + } + + console.log("OTP sent to:", email); + toast.success("OTP sent to your email!"); + }; + + return ( +
+ +
+
+ Signup Illustration +
+
+

+ {isSignUp ? "Sign Up" : "Sign In"} +

+

+ Enter your email to{" "} + {isSignUp ? "create an account" : "receive an OTP"} +

+
+
+ + setEmail(e.target.value)} + className="w-full px-4 py-2 rounded-md bg-blue-50 border border-blue-200 text-blue-900 focus:ring-2 focus:ring-blue-400" + required + /> +
+ +
+ +
+
+ +
+
+
+ ); +}; + +export default SignInPage; diff --git a/alimento-nextjs/app/(PublicRoutes)/Auth/Customer/SignUp/page.tsx b/alimento-nextjs/app/(PublicRoutes)/Auth/Customer/SignUp/page.tsx new file mode 100644 index 0000000..3302c5f --- /dev/null +++ b/alimento-nextjs/app/(PublicRoutes)/Auth/Customer/SignUp/page.tsx @@ -0,0 +1,143 @@ +"use client"; // This should be the first line + +import { useState } from "react"; +import { useRouter } from "next/navigation"; // Use the correct import based on your Next.js version +import { toast, ToastContainer } from "react-toastify"; +import Image from "next/image"; +import signinImage from "../../../../../public/signin.png"; + +const SignUpPage: React.FC = () => { + const router = useRouter(); // Safe to call useRouter here + const [email, setEmail] = useState(""); + const [firstName, setFirstName] = useState(""); + const [otp, setOTP] = useState(""); + + const handleSignUp = (e: React.FormEvent) => { + e.preventDefault(); + + if (!firstName || !email || !otp) { + toast.error("All fields are required."); + return; + } + + const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/; + if (!emailRegex.test(email)) { + toast.error("Please enter a valid email address."); + return; + } + + console.log("User Data:", { firstName, email, otp }); + toast.success("Form submitted successfully!"); + + router.push("/verify-email"); + }; + + return ( +
+ +
+
+

+ Join Us Today! +

+

+ Create your account to get started +

+
+
+ + setFirstName(e.target.value)} + className="w-full px-4 py-2 mt-1 rounded-md bg-blue-100 text-blue-800 focus:ring focus:ring-blue-400" + required + /> +
+
+ + setEmail(e.target.value)} + className="w-full px-4 py-2 mt-1 rounded-md bg-blue-100 text-blue-800 focus:ring focus:ring-blue-400" + required + /> +
+
+ + setOTP(e.target.value)} + className="w-full px-4 py-2 mt-1 rounded-md bg-blue-100 text-blue-800 focus:ring focus:ring-blue-400" + required + /> +
+
+ +
+
+

+ Already have an account?{" "} + + Log In + +

+
+
+ Signup Illustration +
+
+
+ ); +}; + +export default SignUpPage; diff --git a/alimento-nextjs/package.json b/alimento-nextjs/package.json index 0d05b25..a933e96 100644 --- a/alimento-nextjs/package.json +++ b/alimento-nextjs/package.json @@ -24,6 +24,7 @@ "react-dom": "^18.3.1", "react-hook-form": "^7.53.1", "react-hot-toast": "^2.4.1", + "react-toastify": "^10.0.6", "tailwind-merge": "^2.5.4", "tailwindcss-animate": "^1.0.7", "zod": "^3.23.8" diff --git a/alimento-nextjs/public/signin.png b/alimento-nextjs/public/signin.png new file mode 100644 index 0000000..bba8050 Binary files /dev/null and b/alimento-nextjs/public/signin.png differ