diff --git a/apps/mobile/src/app/(tabs)/home.tsx b/apps/mobile/src/app/(tabs)/home.tsx index 2d9092e..0bc2492 100644 --- a/apps/mobile/src/app/(tabs)/home.tsx +++ b/apps/mobile/src/app/(tabs)/home.tsx @@ -125,9 +125,18 @@ export default function HomeScreen() { router.push("/profile")} /> - router.push("/saved-recipes")}> - ⭐ Dina sparade recept - + + + router.push("/recipes")}> + 📖 Bläddra bland recept + + + + router.push("/saved-recipes")}> + ⭐ Sparade recept + + + {/* Matlager – städat, öppnas per plats eller som helhet (spec §8). */} diff --git a/apps/mobile/src/app/_layout.tsx b/apps/mobile/src/app/_layout.tsx index 3835b19..d13cf2c 100644 --- a/apps/mobile/src/app/_layout.tsx +++ b/apps/mobile/src/app/_layout.tsx @@ -86,6 +86,7 @@ export default function RootLayout() { + ("all"); + const [search, setSearch] = useState(""); + const term = search.trim(); + + const query = useQuery({ + queryKey: ["browse-recipes", category, term], + queryFn: () => { + // Bygg query-strängen som resten av appen (template + encodeURIComponent). + let path = "/v1/recipes?limit=50"; + if (category !== "all") path += `&mealType=${category}`; + if (term) path += `&search=${encodeURIComponent(term)}`; + return api<{ recipes: BrowseRecipe[] }>(path); + }, + // Behåll föregående lista medan en ny kategori/sökning laddar – ingen blink. + placeholderData: keepPreviousData, + }); + + const recipes = query.data?.recipes ?? []; + + return ( + + + + + {CATEGORIES.map((c) => ( +