diff --git a/frontend/src/App.jsx b/frontend/src/App.jsx index 73d4c04..27c59cf 100644 --- a/frontend/src/App.jsx +++ b/frontend/src/App.jsx @@ -1257,18 +1257,29 @@ function PushScheduler({ toast }) { // ── Changelog Modal ─────────────────────────────────────────────────────────── function ChangelogModal({ user, toast, onClose, onRead }) { const isAdmin = user?.role === 'admin'; - const [entries, setEntries] = useState([]); - const [form, setForm] = useState({ version:'', title:'', body:'' }); - const [busy, setBusy] = useState(false); + const [entries, setEntries] = useState([]); + const [form, setForm] = useState({ version:'', title:'', body:'' }); + const [busy, setBusy] = useState(false); + const [boardItems, setBoardItems] = useState([]); + const [toDelete, setToDelete] = useState(new Set()); // ids to delete on submit const isMobile = window.innerWidth < 768; useEffect(()=>{ api('/dashboard/changelog').then(setEntries).catch(()=>{}); api('/dashboard/changelog/read',{method:'POST'}).then(()=>{ if(onRead) onRead(); }).catch(()=>{}); + if (user?.role==='admin') { + api('/dashboard/board').then(d=>setBoardItems(d.items||[])).catch(()=>{}); + } },[]); + const toggleDelete = id => setToDelete(p => { + const n = new Set(p); + n.has(id) ? n.delete(id) : n.add(id); + return n; + }); + const add = async () => { - if (!form.version.trim() || !form.title.trim()) { toast('Version und Titel erforderlich','error'); return; } + if (!form.version.trim() || !form.title.trim()) { toast('Stichwort und Titel erforderlich','error'); return; } setBusy(true); try { const r = await api('/dashboard/changelog',{body:{ @@ -1276,6 +1287,12 @@ function ChangelogModal({ user, toast, onClose, onRead }) { build_time: typeof __BUILD_TIME__ !== 'undefined' ? __BUILD_TIME__ : null, }}); setEntries(p=>[r,...p]); + // Markierte Board-Items löschen + if (toDelete.size > 0) { + await Promise.all([...toDelete].map(id => api(`/dashboard/board/${id}`,{method:'DELETE'}).catch(()=>{}))); + setBoardItems(p => p.filter(i => !toDelete.has(i.id))); + setToDelete(new Set()); + } setForm({version:'',title:'',body:''}); toast('Eintrag hinzugefügt ✓'); } catch(e){ toast(e.message,'error'); } @@ -1289,13 +1306,17 @@ function ChangelogModal({ user, toast, onClose, onRead }) { const fmtDate = s => { if (!s) return ''; const d = new Date(s.replace(' ','T')); return isNaN(d)?'':d.toLocaleString('de-DE',{day:'2-digit',month:'2-digit',year:'numeric',hour:'2-digit',minute:'2-digit'}); }; + const roadmap = boardItems.filter(i=>i.type==='roadmap'); + const wishes = boardItems.filter(i=>i.type==='wish'); + return (
e.target===e.currentTarget&&onClose()}> -
+ maxHeight:isMobile?'92vh':'84vh',overflow:'hidden'}}> {/* Header */}
-
- {/* Admin-Formular */} - {isAdmin && ( -
-
NEUER EINTRAG
-
- setForm(p=>({...p,version:e.target.value}))} - placeholder="Stichwort (z.B. Nachrichten)" style={{...S.inp,fontSize:12}}/> - setForm(p=>({...p,title:e.target.value}))} - placeholder="Kurztitel" style={{...S.inp,fontSize:12}}/> -
-