From c595cbb44835108404afd115433ce0cd379c9f04 Mon Sep 17 00:00:00 2001 From: admin Date: Thu, 28 May 2026 21:45:31 +0200 Subject: [PATCH] feat: status dropdowns, difficulty badges, published=violet MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - STATUS_COLORS: published → violet, draft → gray - StatusSelect: shared dropdown component with status colors - Top bar: picture status dropdown (uploaded/published/blocked) - ObjectListPanel: per-object status dropdown, changeable inline - PairsPanel collapsed: difficulty badge (Leicht/Mittel) + status badge - EditPairForm: status dropdown at top of edit form Co-Authored-By: Claude Sonnet 4.6 --- src/lib/tables.js | 4 +- src/pages/ContentCreation.jsx | 78 ++++++++++++++++++++++++++++++----- 2 files changed, 69 insertions(+), 13 deletions(-) diff --git a/src/lib/tables.js b/src/lib/tables.js index 3e6f8d6..e119562 100644 --- a/src/lib/tables.js +++ b/src/lib/tables.js @@ -276,9 +276,9 @@ export const TABLES = { }; export const STATUS_COLORS = { - published: 'bg-green-100 text-green-800', + published: 'bg-violet-100 text-violet-800', blocked: 'bg-red-100 text-red-800', - draft: 'bg-gray-100 text-gray-700', + draft: 'bg-gray-100 text-gray-600', uploaded: 'bg-blue-100 text-blue-800', requested: 'bg-yellow-100 text-yellow-800', translated: 'bg-indigo-100 text-indigo-800', diff --git a/src/pages/ContentCreation.jsx b/src/pages/ContentCreation.jsx index c00f86b..eb36340 100644 --- a/src/pages/ContentCreation.jsx +++ b/src/pages/ContentCreation.jsx @@ -181,6 +181,27 @@ function WordTag({ word, onRemove }) { // ─── PairForm ───────────────────────────────────────────────────────────────── +// ─── Shared status helpers ──────────────────────────────────────────────────── + +const LEVEL_LABELS = { 1: 'Leicht', 2: 'Mittel' }; +const LEVEL_COLORS = { 1: 'bg-sky-50 text-sky-700', 2: 'bg-amber-50 text-amber-700' }; + +function StatusSelect({ value, options, onChange, saving, size = 'sm' }) { + const cls = STATUS_COLORS[value] || 'bg-gray-100 text-gray-600'; + const pad = size === 'xs' ? 'px-1.5 py-0.5 text-[10px]' : 'px-2 py-1 text-xs'; + return ( + + ); +} + const PAIR_TYPES = [ { value: 'text', label: 'Text', hint: 'Nur positives Statement' }, { value: 'yes_no', label: 'Ja / Nein', hint: 'Frage + Ja/Nein Antwort' }, @@ -448,6 +469,7 @@ function EditPairForm({ pair, allObjects, onSaved, onCancel, onDeleted }) { const [loading, setLoading] = useState(true); const [saving, setSaving] = useState(false); const [type, setType] = useState(pair.answer_type || ''); + const [pairStatus, setPairStatus] = useState(pair.status || 'draft'); const [question, setQuestion] = useState(''); const [positive, setPositive] = useState(''); const [negative, setNegative] = useState(''); @@ -597,6 +619,7 @@ function EditPairForm({ pair, allObjects, onSaved, onCancel, onDeleted }) { patchPair.negative_statement_id = s.id; } if (pair.answer_type !== type) patchPair.answer_type = type; + if (pair.status !== pairStatus) patchPair.status = pairStatus; if (Object.keys(patchPair).length) await apiPatch('/pairs', pair.id, patchPair); onSaved(); } catch (e) { alert('Fehler: ' + e.message); } @@ -609,6 +632,10 @@ function EditPairForm({ pair, allObjects, onSaved, onCancel, onDeleted }) { return (
+
+ + +