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(" · ")} + + + )) + )} + + ); +}