diff --git a/src/app/page.tsx b/src/app/page.tsx index 4e4a491..c0724f1 100644 --- a/src/app/page.tsx +++ b/src/app/page.tsx @@ -25,16 +25,27 @@ import { User, Users, Zap, + ChefHat, + Flame, + Music, + Settings, + LogOut, } from "lucide-react"; export default function LandingPage() { const [isAuthenticated, setIsAuthenticated] = useState(false); const [showOnboarding, setShowOnboarding] = useState(false); + const [ingredients, setIngredients] = useState([]); + const [currentInput, setCurrentInput] = useState(""); + const [recipes, setRecipes] = useState([]); + const [selectedRecipe, setSelectedRecipe] = useState(null); + const [showDashboard, setShowDashboard] = useState(false); const handleCompleteOnboarding = () => { try { localStorage.setItem("hasCompletedOnboarding", "true"); setShowOnboarding(false); + setShowDashboard(true); } catch (error) { console.error("Onboarding completion error:", error); } @@ -47,6 +58,10 @@ export default function LandingPage() { localStorage.removeItem("hasCompletedOnboarding"); setIsAuthenticated(false); setShowOnboarding(false); + setShowDashboard(false); + setIngredients([]); + setRecipes([]); + setSelectedRecipe(null); } catch (error) { console.error("Sign out error:", error); } @@ -57,7 +72,34 @@ export default function LandingPage() { setShowOnboarding(true); }; - if (isAuthenticated && showOnboarding) { + const addIngredient = () => { + if (currentInput.trim()) { + setIngredients([...ingredients, currentInput.trim()]); + setCurrentInput(""); + } + }; + + const removeIngredient = (index: number) => { + setIngredients(ingredients.filter((_, i) => i !== index)); + }; + + const generateRecipes = () => { + if (ingredients.length === 0) return; + + // Simulated recipe generation based on ingredients + const mockRecipes = [ + { + id: "recipe1", name: "Classic Pasta Dish", cookTime: "20 min", difficulty: "Beginner", calories: "450 cal", cuisine: "Italian", instructions: "1. Boil water and add pasta\n2. Cook until al dente\n3. Add sauce and mix\n4. Serve hot", imageSrc: "https://webuild-dev.s3.eu-north-1.amazonaws.com/users/user_3AUcMfqJIbBXtBhmBEoWXMLyB4X/beautiful-recipe-result-cards-with-glass-1772651576068-e357f495.png"}, + { + id: "recipe2", name: "Stir-Fry Vegetables", cookTime: "15 min", difficulty: "Intermediate", calories: "320 cal", cuisine: "Asian", instructions: "1. Heat oil in wok\n2. Add vegetables\n3. Stir frequently\n4. Season and serve", imageSrc: "https://webuild-dev.s3.eu-north-1.amazonaws.com/users/user_3AUcMfqJIbBXtBhmBEoWXMLyB4X/beautiful-recipe-result-cards-with-glass-1772651576068-e357f495.png"}, + { + id: "recipe3", name: "Garden Fresh Salad", cookTime: "10 min", difficulty: "Beginner", calories: "180 cal", cuisine: "Mediterranean", instructions: "1. Wash vegetables\n2. Chop finely\n3. Mix with dressing\n4. Serve immediately", imageSrc: "https://webuild-dev.s3.eu-north-1.amazonaws.com/users/user_3AUcMfqJIbBXtBhmBEoWXMLyB4X/beautiful-recipe-result-cards-with-glass-1772651576068-e357f495.png"}, + ]; + + setRecipes(mockRecipes); + }; + + if (isAuthenticated && showOnboarding && !showDashboard) { return ( + + +
+ {!selectedRecipe ? ( + <> + {/* Ingredient Input Section */} +
+
+
+
+ +

What ingredients do you have?

+
+

Enter your available ingredients and we'll generate personalized recipes for you.

+ + {/* Input Field */} +
+ setCurrentInput(e.target.value)} + onKeyPress={(e) => e.key === "Enter" && addIngredient()} + placeholder="Add an ingredient (e.g., chicken, tomato, garlic)" + className="flex-1 px-4 py-3 rounded-lg border border-gray-300 focus:outline-none focus:ring-2 focus:ring-indigo-500 bg-white/50 backdrop-blur-sm" + /> + +
+ + {/* Ingredient Bubbles */} + {ingredients.length > 0 && ( +
+

Your ingredients:

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

Your Generated Recipes

+
+ {recipes.map((recipe) => ( +
setSelectedRecipe(recipe)} + className="bg-white/80 backdrop-blur-md rounded-xl shadow-lg overflow-hidden border border-white/20 hover:shadow-2xl transition-all cursor-pointer group" + > +
+ {recipe.name} +
+
+
+

{recipe.name}

+
+ + {recipe.cookTime} + + + {recipe.difficulty} + + + {recipe.calories} + +
+

{recipe.cuisine} Cuisine

+ +
+
+ ))} +
+
+
+ )} + + {/* Empty State */} + {recipes.length === 0 && ingredients.length === 0 && ( +
+
+ +

Start Your Culinary Journey

+

Add ingredients above to discover delicious recipes powered by AI

+
+
+ )} + + ) : ( + /* Recipe Detail View */ +
+
+ + +
+
+ {selectedRecipe.name} +
+
+

{selectedRecipe.name}

+

{selectedRecipe.cuisine} Cuisine

+
+
+ +
+
+
+

Cooking Time

+

{selectedRecipe.cookTime}

+
+
+

Difficulty

+

{selectedRecipe.difficulty}

+
+
+

Calories

+

{selectedRecipe.calories}

+
+
+ +
+

Instructions

+
+ {selectedRecipe.instructions.split("\n").map((instruction, idx) => ( +

+ {instruction} +

+ ))} +
+
+
+
+
+
+ )} +
+ + ); + } + return (
- ) : ( -
-
-

Welcome to EasyRecipes

-

- Dashboard content coming soon -

- -
-
- )} + ) : null}