@@ -76,61 +27,6 @@ export default function RecipeFinder() {
if (!user) return null;
- const handleLogout = () => {
- logout();
- router.replace("/");
- }
- const handleProfil = () => {
- setOpen(false);
- console.log("Profil ansehen");
- router.push("/profile");
- };
-
- const handleAdd = (ingredient: IngredientInput) => {
- setIngredients(prev => [...prev, ingredient]);
- };
-
- const handleRemoveIngredient = (name: string) => {
- setIngredients(prev => prev.filter(z => z.name !== name));
- }
-
- const handleEditSave = (name: string) => {
- const amountNum = parseFloat(editAmount);
- if (!editAmount || isNaN(amountNum) || amountNum <= 0) return;
- setIngredients(prev => prev.map(i =>
- i.name === name ? { ...i, amount: amountNum, unit: editUnit } : i
- ));
- setEditingIngredient(null);
- };
-
- const handleEditStart = (i: IngredientInput) => {
- setEditingIngredient(i.name);
- setEditAmount(String(i.amount));
- setEditUnit(i.unit);
- };
-
- const handleSearch = async () => {
- if (ingredients.length === 0) {
- setSearchError("Bitte mindestens eine Zutat hinzufügen.");
- return;
- }
- setSearchError("");
- setSearching(true);
- try {
- const res = await fetchWithAuth('/recipes/search', {
- method: "POST",
- headers: {"Content-Type": "application/json"},
- body: JSON.stringify({zutaten: ingredients, servings}),
- });
- const data = await res.json();
- setResults(data.rezepte ?? []);
- } catch {
- setSearchError("Suche fehlgeschlagen.");
- } finally {
- setSearching(false);
- }
- };
-
return (
{/* Navbar */}
@@ -142,146 +38,41 @@ export default function RecipeFinder() {
-
-
-
- {open && (
-
-
-
-
- )}
-
+
Hallo, {user.name}
+
-