fix(mobile): receptdetalj på användarens språk (MIKRO 56)
CI / Typecheck, test & build (push) Failing after 43s
CI / Typecheck, test & build (push) Failing after 43s
This commit is contained in:
@@ -27,7 +27,9 @@ import { formatQuantity } from "@/lib/units";
|
||||
interface RecipeDetail {
|
||||
id: string;
|
||||
titleSv: string;
|
||||
title?: string;
|
||||
descriptionSv: string;
|
||||
description?: string;
|
||||
portions: number;
|
||||
totalTimeMinutes: number;
|
||||
spiceLevel: number;
|
||||
@@ -38,6 +40,7 @@ interface RecipeDetail {
|
||||
ingredients: Array<{
|
||||
id: string;
|
||||
displayNameSv: string;
|
||||
displayName?: string;
|
||||
quantity: number;
|
||||
unit: string;
|
||||
optional: boolean;
|
||||
@@ -48,6 +51,7 @@ interface RecipeDetail {
|
||||
id: string;
|
||||
stepNumber: number;
|
||||
instructionSv: string;
|
||||
instruction?: string;
|
||||
temperatureC: number | null;
|
||||
}>;
|
||||
safety: { safe: boolean; violations: Array<{ severity: string; messageSv: string }> };
|
||||
@@ -106,7 +110,7 @@ export default function RecipeScreen() {
|
||||
|
||||
return (
|
||||
<Screen>
|
||||
<Title>{recipe.titleSv}</Title>
|
||||
<Title>{recipe.title ?? recipe.titleSv}</Title>
|
||||
<Row>
|
||||
<Tag label={t("recipe.time", { min: recipe.totalTimeMinutes })} />
|
||||
<Tag label={`${Math.round(recipe.nutritionPerPortion.kcal)} kcal`} />
|
||||
@@ -126,7 +130,7 @@ export default function RecipeScreen() {
|
||||
)}
|
||||
{recipe.verificationStatus === "editorial" && <Tag label="✓ plattformen" tone="success" />}
|
||||
</Row>
|
||||
<Body muted>{recipe.descriptionSv}</Body>
|
||||
<Body muted>{recipe.description ?? recipe.descriptionSv}</Body>
|
||||
{recipe.creatorDisplayName && <Small>Skapat av {recipe.creatorDisplayName}</Small>}
|
||||
|
||||
{!recipe.safety.safe && (
|
||||
@@ -171,9 +175,9 @@ export default function RecipeScreen() {
|
||||
</Row>
|
||||
</Row>
|
||||
{ingredients.map((ing) => (
|
||||
<Row key={ing.id ?? ing.displayNameSv} style={{ justifyContent: "space-between" }}>
|
||||
<Row key={ing.id ?? (ing.displayName ?? ing.displayNameSv)} style={{ justifyContent: "space-between" }}>
|
||||
<Body>
|
||||
{ing.displayNameSv}
|
||||
{ing.displayName ?? ing.displayNameSv}
|
||||
{ing.optional ? " (valfritt)" : ""}
|
||||
</Body>
|
||||
<Small>{formatQuantity(ing.quantity, ing.unit)}</Small>
|
||||
@@ -186,7 +190,7 @@ export default function RecipeScreen() {
|
||||
{recipe.steps.map((step) => (
|
||||
<View key={step.id} style={{ marginBottom: spacing.sm }}>
|
||||
<Body>
|
||||
{step.stepNumber}. {step.instructionSv}
|
||||
{step.stepNumber}. {step.instruction ?? step.instructionSv}
|
||||
{step.temperatureC ? ` (${step.temperatureC} °C)` : ""}
|
||||
</Body>
|
||||
</View>
|
||||
|
||||
Reference in New Issue
Block a user