From 9bb89231d0b52ce84b5cd7233ce669ecc0e51cff Mon Sep 17 00:00:00 2001
From: Lars
Date: Sat, 12 Sep 2026 14:41:42 +0200
Subject: [PATCH] =?UTF-8?q?fix:=20BLS-Import=20mit=20einer=20Datei=20plus?=
=?UTF-8?q?=20Pr=C3=BCfen/Anwenden?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Zwei unbeschriftete File-Inputs pro Dateityp wirkten wie doppelte Auswahl.
Co-authored-by: Cursor
---
frontend/src/pages/AdminBlsImportPage.jsx | 41 +++++++++++++++++------
1 file changed, 30 insertions(+), 11 deletions(-)
diff --git a/frontend/src/pages/AdminBlsImportPage.jsx b/frontend/src/pages/AdminBlsImportPage.jsx
index 6caf568..4018841 100644
--- a/frontend/src/pages/AdminBlsImportPage.jsx
+++ b/frontend/src/pages/AdminBlsImportPage.jsx
@@ -1,10 +1,35 @@
import { useEffect, useState } from 'react'
import { api } from '../utils/api'
+function FileImportBlock({ label, kind, busy, onRun }) {
+ const [file, setFile] = useState(null)
+ return (
+
+
+
setFile(e.target.files?.[0] || null)}
+ />
+ {file &&
{file.name}
}
+
+
+
+
+
+ )
+}
+
export default function AdminBlsImportPage() {
const [status, setStatus] = useState(null)
const [msg, setMsg] = useState(null)
const [error, setError] = useState(null)
+ const [busy, setBusy] = useState(false)
const load = () => {
api.adminBlsStatus().then(setStatus).catch((e) => setError(e.message))
@@ -13,6 +38,7 @@ export default function AdminBlsImportPage() {
const run = async (kind, file, dry) => {
setError(null)
+ setBusy(true)
setMsg(dry ? 'Prüfe…' : 'Importiere…')
try {
const fn = kind === 'components' ? api.adminBlsImportComponents : api.adminBlsImportFoods
@@ -22,6 +48,8 @@ export default function AdminBlsImportPage() {
} catch (e) {
setError(e.message)
setMsg(null)
+ } finally {
+ setBusy(false)
}
}
@@ -39,17 +67,8 @@ export default function AdminBlsImportPage() {
)}
{error && {error}
}
-
-
- e.target.files[0] && run('components', e.target.files[0], true)} />
- e.target.files[0] && run('components', e.target.files[0], false)} />
-
- Erstes Feld = prüfen, zweites = anwenden.
-
-
- e.target.files[0] && run('foods', e.target.files[0], true)} />
- e.target.files[0] && run('foods', e.target.files[0], false)} />
-
+
+
{msg && {msg}}
)