From d098bf705ecf6221a2b40e8c199c7c329fdae14e Mon Sep 17 00:00:00 2001 From: "Sven (AAMOS AI)" Date: Sun, 16 Aug 2026 00:55:32 +0700 Subject: [PATCH] =?UTF-8?q?feat(mobile):=20Sparade=20recept-sida=20(s?= =?UTF-8?q?=C3=B6kbar=20favoritlista)=20+=20l=C3=A4nk=20p=C3=A5=20hemma=20?= =?UTF-8?q?(SAVED-1)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/mobile/src/app/(tabs)/home.tsx | 4 ++ apps/mobile/src/app/_layout.tsx | 1 + apps/mobile/src/app/saved-recipes.tsx | 65 +++++++++++++++++++++++++++ 3 files changed, 70 insertions(+) create mode 100644 apps/mobile/src/app/saved-recipes.tsx diff --git a/apps/mobile/src/app/(tabs)/home.tsx b/apps/mobile/src/app/(tabs)/home.tsx index d3dfd57..946c779 100644 --- a/apps/mobile/src/app/(tabs)/home.tsx +++ b/apps/mobile/src/app/(tabs)/home.tsx @@ -114,6 +114,10 @@ export default function HomeScreen() { router.push("/profile")} /> + router.push("/saved-recipes")}> + ⭐ Dina sparade recept + + {budget.data && ( {t("home.budget")} diff --git a/apps/mobile/src/app/_layout.tsx b/apps/mobile/src/app/_layout.tsx index a68e489..5ee9f7a 100644 --- a/apps/mobile/src/app/_layout.tsx +++ b/apps/mobile/src/app/_layout.tsx @@ -84,6 +84,7 @@ export default function RootLayout() { + ({ + queryKey: ["favorites-mine"], + queryFn: () => api("/v1/recipes/favorites/mine"), + }); + + if (favs.isLoading) return ; + if (favs.isError) return void favs.refetch()} />; + + const all = favs.data?.recipes ?? []; + const q = query.trim().toLowerCase(); + const filtered = q ? all.filter((r) => r.titleSv.toLowerCase().includes(q)) : all; + + return ( + + + {all.length === 0 ? ( + + ) : filtered.length === 0 ? ( + + ) : ( + filtered.map((r) => ( + router.push(`/recipe/${r.id}`)} style={{ gap: spacing.xs }}> + {r.titleSv} + + {[ + r.totalTimeMinutes != null ? `${r.totalTimeMinutes} min` : null, + r.nutritionPerPortion?.kcal != null + ? `${Math.round(r.nutritionPerPortion.kcal)} kcal` + : null, + ] + .filter(Boolean) + .join(" · ")} + + + )) + )} + + ); +}