diff --git a/apps/api/src/routes/recipes.ts b/apps/api/src/routes/recipes.ts index 96a26d5..9ae07fb 100644 --- a/apps/api/src/routes/recipes.ts +++ b/apps/api/src/routes/recipes.ts @@ -261,7 +261,13 @@ export async function recipeRoutes(app: FastifyInstance) { }), safety, variants, - coverage, + coverage: coverage && { + ...coverage, + missing: coverage.missing.map((m) => ({ + ...m, + displayName: ingredientNames.get(m.canonicalIngredientId) ?? m.displayNameSv, + })), + }, myRating: myRating ?? null, isFavorite: Boolean(favorite), }; diff --git a/apps/mobile/src/app/_layout.tsx b/apps/mobile/src/app/_layout.tsx index 131c45b..49b52e6 100644 --- a/apps/mobile/src/app/_layout.tsx +++ b/apps/mobile/src/app/_layout.tsx @@ -29,7 +29,7 @@ const queryClient = new QueryClient({ const persister = createAsyncStoragePersister({ storage: AsyncStorage, - key: `${BRAND.slug}-query-cache`, + key: `${BRAND.slug}-query-cache-v2`, }); export default function RootLayout() { diff --git a/apps/mobile/src/app/cooking/[id].tsx b/apps/mobile/src/app/cooking/[id].tsx index 4c60ba5..6fb60c6 100644 --- a/apps/mobile/src/app/cooking/[id].tsx +++ b/apps/mobile/src/app/cooking/[id].tsx @@ -34,6 +34,7 @@ interface RecipeForCooking { id: string; stepNumber: number; instructionSv: string; + instruction?: string; timerSeconds: number | null; temperatureC: number | null; tip: string | null; @@ -246,7 +247,7 @@ export default function CookingScreen() { {t("cooking.step", { current: stepIndex + 1, total: recipe.steps.length })} - {step?.instructionSv} + {step?.instruction ?? step?.instructionSv} {step?.temperatureC ? ` (${step.temperatureC} °C)` : ""} {step?.tip && 💡 {step.tip}} diff --git a/apps/mobile/src/app/recipe/[id].tsx b/apps/mobile/src/app/recipe/[id].tsx index f144360..3b96825 100644 --- a/apps/mobile/src/app/recipe/[id].tsx +++ b/apps/mobile/src/app/recipe/[id].tsx @@ -61,6 +61,7 @@ interface RecipeDetail { missing: Array<{ canonicalIngredientId: string; displayNameSv: string; + displayName?: string; quantity: number; unit: string; }>; @@ -181,8 +182,8 @@ export default function RecipeScreen() { onSuccess: (count) => { void queryClient.invalidateQueries({ queryKey: ["shopping-lists"] }); Alert.alert( - "Tillagt i inköpslistan", - `${count} ${count === 1 ? "vara" : "varor"} lades till.`, + t("recipe.coverage.added"), + t("recipe.coverage.addedBody", { count }), ); }, onError: (err) => { @@ -263,21 +264,25 @@ export default function RecipeScreen() { {recipe.coverage && ( - Du har {recipe.coverage.percent}% hemma + {t("recipe.coverage.have", { percent: recipe.coverage.percent })} {recipe.coverage.missing.length > 0 && ( - + )} {recipe.coverage.missing.length === 0 ? ( - Du har allt som behövs. + {t("recipe.coverage.haveAll")} ) : ( <> - Du saknar: {recipe.coverage.missing.map((m) => m.displayNameSv).join(", ")} + {t("recipe.coverage.youAreMissing", { + names: recipe.coverage.missing + .map((m) => m.displayName ?? m.displayNameSv) + .join(", "), + })}