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 {
|
interface RecipeDetail {
|
||||||
id: string;
|
id: string;
|
||||||
titleSv: string;
|
titleSv: string;
|
||||||
|
title?: string;
|
||||||
descriptionSv: string;
|
descriptionSv: string;
|
||||||
|
description?: string;
|
||||||
portions: number;
|
portions: number;
|
||||||
totalTimeMinutes: number;
|
totalTimeMinutes: number;
|
||||||
spiceLevel: number;
|
spiceLevel: number;
|
||||||
@@ -38,6 +40,7 @@ interface RecipeDetail {
|
|||||||
ingredients: Array<{
|
ingredients: Array<{
|
||||||
id: string;
|
id: string;
|
||||||
displayNameSv: string;
|
displayNameSv: string;
|
||||||
|
displayName?: string;
|
||||||
quantity: number;
|
quantity: number;
|
||||||
unit: string;
|
unit: string;
|
||||||
optional: boolean;
|
optional: boolean;
|
||||||
@@ -48,6 +51,7 @@ interface RecipeDetail {
|
|||||||
id: string;
|
id: string;
|
||||||
stepNumber: number;
|
stepNumber: number;
|
||||||
instructionSv: string;
|
instructionSv: string;
|
||||||
|
instruction?: string;
|
||||||
temperatureC: number | null;
|
temperatureC: number | null;
|
||||||
}>;
|
}>;
|
||||||
safety: { safe: boolean; violations: Array<{ severity: string; messageSv: string }> };
|
safety: { safe: boolean; violations: Array<{ severity: string; messageSv: string }> };
|
||||||
@@ -106,7 +110,7 @@ export default function RecipeScreen() {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<Screen>
|
<Screen>
|
||||||
<Title>{recipe.titleSv}</Title>
|
<Title>{recipe.title ?? recipe.titleSv}</Title>
|
||||||
<Row>
|
<Row>
|
||||||
<Tag label={t("recipe.time", { min: recipe.totalTimeMinutes })} />
|
<Tag label={t("recipe.time", { min: recipe.totalTimeMinutes })} />
|
||||||
<Tag label={`${Math.round(recipe.nutritionPerPortion.kcal)} kcal`} />
|
<Tag label={`${Math.round(recipe.nutritionPerPortion.kcal)} kcal`} />
|
||||||
@@ -126,7 +130,7 @@ export default function RecipeScreen() {
|
|||||||
)}
|
)}
|
||||||
{recipe.verificationStatus === "editorial" && <Tag label="✓ plattformen" tone="success" />}
|
{recipe.verificationStatus === "editorial" && <Tag label="✓ plattformen" tone="success" />}
|
||||||
</Row>
|
</Row>
|
||||||
<Body muted>{recipe.descriptionSv}</Body>
|
<Body muted>{recipe.description ?? recipe.descriptionSv}</Body>
|
||||||
{recipe.creatorDisplayName && <Small>Skapat av {recipe.creatorDisplayName}</Small>}
|
{recipe.creatorDisplayName && <Small>Skapat av {recipe.creatorDisplayName}</Small>}
|
||||||
|
|
||||||
{!recipe.safety.safe && (
|
{!recipe.safety.safe && (
|
||||||
@@ -171,9 +175,9 @@ export default function RecipeScreen() {
|
|||||||
</Row>
|
</Row>
|
||||||
</Row>
|
</Row>
|
||||||
{ingredients.map((ing) => (
|
{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>
|
<Body>
|
||||||
{ing.displayNameSv}
|
{ing.displayName ?? ing.displayNameSv}
|
||||||
{ing.optional ? " (valfritt)" : ""}
|
{ing.optional ? " (valfritt)" : ""}
|
||||||
</Body>
|
</Body>
|
||||||
<Small>{formatQuantity(ing.quantity, ing.unit)}</Small>
|
<Small>{formatQuantity(ing.quantity, ing.unit)}</Small>
|
||||||
@@ -186,7 +190,7 @@ export default function RecipeScreen() {
|
|||||||
{recipe.steps.map((step) => (
|
{recipe.steps.map((step) => (
|
||||||
<View key={step.id} style={{ marginBottom: spacing.sm }}>
|
<View key={step.id} style={{ marginBottom: spacing.sm }}>
|
||||||
<Body>
|
<Body>
|
||||||
{step.stepNumber}. {step.instructionSv}
|
{step.stepNumber}. {step.instruction ?? step.instructionSv}
|
||||||
{step.temperatureC ? ` (${step.temperatureC} °C)` : ""}
|
{step.temperatureC ? ` (${step.temperatureC} °C)` : ""}
|
||||||
</Body>
|
</Body>
|
||||||
</View>
|
</View>
|
||||||
|
|||||||
Reference in New Issue
Block a user