+ Kunde inte ladda produkter. Kontrollera API:et.
+
+
+
@@ -276,9 +479,19 @@ export default function EditRecipePage() {
setIsDeleting(false);
}
}}
- style={{ padding: '0.5rem 1rem', background: '#c0392b', color: 'white', border: 'none', borderRadius: '4px', cursor: 'pointer' }}
+ style={{
+ padding: '0.75rem 1.5rem',
+ background: '#c0392b',
+ color: 'white',
+ border: 'none',
+ borderRadius: '4px',
+ cursor: 'pointer',
+ fontSize: '1rem',
+ minHeight: '44px',
+ fontWeight: 600,
+ }}
>
- {isDeleting ? 'Raderar...' : 'Radera recept'}
+ {isDeleting ? '⏳ Raderar...' : '🗑 Radera recept'}
diff --git a/frontend/app/recipes/create/CreateRecipePage.tsx b/frontend/app/recipes/create/CreateRecipePage.tsx
index 9d767e9f..2a202df8 100644
--- a/frontend/app/recipes/create/CreateRecipePage.tsx
+++ b/frontend/app/recipes/create/CreateRecipePage.tsx
@@ -6,6 +6,39 @@ import { fetchJson } from '../../../lib/api';
import { parseErrorResponse } from '../../../lib/error-handler';
import type { Product } from '../../../features/inventory/types';
+const MARKDOWN_HELP = `
+**Fetstil:** **text** eller __text__
+*Kursiv:* *text* eller _text_
+• Punktlista: - punkt eller * punkt
+# Rubrik 1
+## Rubrik 2
+### Rubrik 3
+`;
+
+function SimpleMarkdownPreview({ text }: { text: string }) {
+ const lines = text.split('\n');
+
+ return (
+
+ {lines.map((line, i) => {
+ if (line.startsWith('# ')) {
+ return
{line.slice(2)}
;
+ }
+ if (line.startsWith('## ')) {
+ return
{line.slice(3)}
;
+ }
+ if (line.startsWith('- ') || line.startsWith('* ')) {
+ return
• {line.slice(2)}
;
+ }
+ if (line.trim() === '') {
+ return
;
+ }
+ return
{line}
;
+ })}
+
+ );
+}
+
export default function CreateRecipePage() {
const router = useRouter();
const [recipe, setRecipe] = useState({
@@ -17,6 +50,7 @@ export default function CreateRecipePage() {
const [products, setProducts] = useState
([]);
const [isLoading, setIsLoading] = useState(false);
const [error, setError] = useState(null);
+ const [showPreview, setShowPreview] = useState(false);
useEffect(() => {
fetchJson('/api/products')
@@ -100,108 +134,281 @@ export default function CreateRecipePage() {
];
return (
-
- Lägg till nytt recept
+
+ Lägg till nytt recept
- {error && {error}
}
+ {error && {error}
}
-