'use client'; import { useState, useEffect, useTransition } from 'react'; import { useRouter } from 'next/navigation'; import { useAuthFetch } from '../../../lib/use-auth-fetch'; import type { Recipe, Product, RecipeInventoryPreview, } from '../../../features/inventory/types'; import { fetchJson } from '../../../lib/api'; import { parseErrorResponse } from '../../../lib/error-handler'; import { UNIT_OPTIONS } from '../../../lib/units'; // ────────────────────────────────────────────── // Hjälpfunktioner // ────────────────────────────────────────────── function SimpleMarkdownPreview({ text }: { text: string }) { return (
{error}
} {recipe.description && ({recipe.description}
)} {/* Ingredienser */}{previewError}
} {preview && ( <> {/* Summerbanner */} {preview.summary.canCookExactly ? (* Endast ingredienser med viktenhet (g/kg) och registrerade näringsvärden inkluderas.
{error}
}