diff --git a/src/app/contact/page.tsx b/src/app/contact/page.tsx index 11f4ecf..3817c69 100644 --- a/src/app/contact/page.tsx +++ b/src/app/contact/page.tsx @@ -28,6 +28,7 @@ export default function ContactPage() { { name: "Home", id: "/" }, { name: "Features", id: "/features" }, { name: "Download", id: "/download" }, + { name: "Generate", id: "/generate" }, { name: "Contact", id: "/contact" } ]} button={{ text: "Get Started", href: "/download" }} @@ -84,13 +85,13 @@ export default function ContactPage() { title: "Product", items: [ { label: "Features", href: "/features" }, { label: "Download", href: "/download" }, - { label: "Pricing", href: "#pricing" }, + { label: "Pricing", href: "/" }, { label: "Help Center", href: "#" } ] }, { title: "Company", items: [ - { label: "About Us", href: "#about" }, + { label: "About Us", href: "/" }, { label: "Careers", href: "#" }, { label: "Blog", href: "#" }, { label: "Press", href: "#" } diff --git a/src/app/download/page.tsx b/src/app/download/page.tsx index 63afa26..83eb7c0 100644 --- a/src/app/download/page.tsx +++ b/src/app/download/page.tsx @@ -29,6 +29,7 @@ export default function DownloadPage() { { name: "Home", id: "/" }, { name: "Features", id: "/features" }, { name: "Download", id: "/download" }, + { name: "Generate", id: "/generate" }, { name: "Contact", id: "/contact" } ]} button={{ text: "Get Started", href: "/download" }} @@ -84,13 +85,13 @@ export default function DownloadPage() { title: "Product", items: [ { label: "Features", href: "/features" }, { label: "Download", href: "/download" }, - { label: "Pricing", href: "#pricing" }, + { label: "Pricing", href: "/" }, { label: "Help Center", href: "#" } ] }, { title: "Company", items: [ - { label: "About Us", href: "#about" }, + { label: "About Us", href: "/" }, { label: "Careers", href: "#" }, { label: "Blog", href: "#" }, { label: "Press", href: "#" } diff --git a/src/app/features/page.tsx b/src/app/features/page.tsx index f629283..549458a 100644 --- a/src/app/features/page.tsx +++ b/src/app/features/page.tsx @@ -29,6 +29,7 @@ export default function FeaturesPage() { { name: "Home", id: "/" }, { name: "Features", id: "/features" }, { name: "Download", id: "/download" }, + { name: "Generate", id: "/generate" }, { name: "Contact", id: "/contact" } ]} button={{ text: "Get Started", href: "/download" }} @@ -113,13 +114,13 @@ export default function FeaturesPage() { title: "Product", items: [ { label: "Features", href: "/features" }, { label: "Download", href: "/download" }, - { label: "Pricing", href: "#pricing" }, + { label: "Pricing", href: "/" }, { label: "Help Center", href: "#" } ] }, { title: "Company", items: [ - { label: "About Us", href: "#about" }, + { label: "About Us", href: "/" }, { label: "Careers", href: "#" }, { label: "Blog", href: "#" }, { label: "Press", href: "#" } diff --git a/src/app/generate/page.tsx b/src/app/generate/page.tsx new file mode 100644 index 0000000..ade45b8 --- /dev/null +++ b/src/app/generate/page.tsx @@ -0,0 +1,263 @@ +"use client"; + +import { ThemeProvider } from "@/providers/themeProvider/ThemeProvider"; +import NavbarLayoutFloatingInline from '@/components/navbar/NavbarLayoutFloatingInline'; +import HeroCentered from '@/components/sections/hero/HeroCentered'; +import FooterBaseReveal from '@/components/sections/footer/FooterBaseReveal'; +import { Sparkles, Mail, LogIn } from "lucide-react"; +import { useState } from "react"; + +export default function GeneratePage() { + const [ingredients, setIngredients] = useState([]); + const [currentInput, setCurrentInput] = useState(""); + const [recipes, setRecipes] = useState([]); + const [loading, setLoading] = useState(false); + const [isLoggedIn, setIsLoggedIn] = useState(false); + const [userEmail, setUserEmail] = useState(""); + + const handleGmailLogin = async () => { + try { + // Simulate Gmail OAuth flow + const response = await fetch("/api/auth/gmail", { + method: "POST"}); + if (response.ok) { + const data = await response.json(); + setUserEmail(data.email); + setIsLoggedIn(true); + } + } catch (error) { + console.error("Gmail login failed:", error); + } + }; + + const addIngredient = () => { + if (currentInput.trim()) { + setIngredients([...ingredients, currentInput.trim()]); + setCurrentInput(""); + } + }; + + const removeIngredient = (index: number) => { + setIngredients(ingredients.filter((_, i) => i !== index)); + }; + + const handleKeyPress = (e: React.KeyboardEvent) => { + if (e.key === "Enter") { + e.preventDefault(); + addIngredient(); + } + }; + + const generateRecipes = async () => { + if (ingredients.length === 0) { + alert("Please add at least one ingredient"); + return; + } + + setLoading(true); + try { + const response = await fetch("/api/recipes/generate", { + method: "POST", headers: { "Content-Type": "application/json" }, + body: JSON.stringify({ ingredients }), + }); + + if (response.ok) { + const data = await response.json(); + setRecipes(data.recipes || []); + } + } catch (error) { + console.error("Recipe generation failed:", error); + } finally { + setLoading(false); + } + }; + + return ( + + + +
+ +
+ +
+
+ {/* Login Section */} + {!isLoggedIn && ( +
+

Sign in to Get Started

+ +
+ )} + + {/* Generator Section */} + {isLoggedIn && ( +
+
+

Logged in as: {userEmail}

+
+ + {/* Ingredient Input */} +
+

Add Your Ingredients

+
+ setCurrentInput(e.target.value)} + onKeyPress={handleKeyPress} + placeholder="e.g., chicken, tomatoes, garlic" + className="flex-1 px-4 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:border-gray-600 dark:text-white" + /> + +
+ + {/* Ingredients List */} + {ingredients.length > 0 && ( +
+

Your Ingredients:

+
+ {ingredients.map((ingredient, index) => ( +
+ {ingredient} + +
+ ))} +
+
+ )} + + {/* Generate Button */} + +
+ + {/* Recipes Results */} + {recipes.length > 0 && ( +
+

AI-Generated Recipes

+ {recipes.map((recipe, index) => ( +
+

{recipe.name}

+

+ {recipe.description} +

+
+
Ingredients:
+
    + {recipe.ingredients?.map((ing: string, i: number) => ( +
  • {ing}
  • + ))} +
+
+
+
Instructions:
+

+ {recipe.instructions} +

+
+
+ ⏱ {recipe.cookTime} mins + 👥 Serves {recipe.servings} +
+
+ ))} +
+ )} +
+ )} +
+
+ + +
+ ); +} diff --git a/src/app/page.tsx b/src/app/page.tsx index a82c3b9..11ea466 100644 --- a/src/app/page.tsx +++ b/src/app/page.tsx @@ -33,6 +33,7 @@ export default function LandingPage() { { name: "Home", id: "/" }, { name: "Features", id: "/features" }, { name: "Download", id: "/download" }, + { name: "Generate", id: "/generate" }, { name: "Contact", id: "/contact" } ]} button={{ text: "Get Started", href: "/download" }} @@ -209,7 +210,7 @@ export default function LandingPage() { background={{ variant: "radial-gradient" }} buttons={[ { text: "Download App", href: "/download" }, - { text: "Contact Support", href: "#" } + { text: "Contact Support", href: "/contact" } ]} useInvertedBackground={false} /> @@ -222,13 +223,13 @@ export default function LandingPage() { title: "Product", items: [ { label: "Features", href: "/features" }, { label: "Download", href: "/download" }, - { label: "Pricing", href: "#pricing" }, + { label: "Pricing", href: "/" }, { label: "Help Center", href: "#" } ] }, { title: "Company", items: [ - { label: "About Us", href: "#about" }, + { label: "About Us", href: "/" }, { label: "Careers", href: "#" }, { label: "Blog", href: "#" }, { label: "Press", href: "#" }