Whiteboard: Name beim Erstellen eingeben, Pushover bei neuen Berechtigungen

This commit is contained in:
2026-06-25 20:50:16 +02:00
parent e96946e246
commit c5407afd48
2 changed files with 63 additions and 12 deletions

View File

@@ -186,6 +186,8 @@ export default function Whiteboard({ toast, mobile }) {
const [boards, setBoards] = useState([]);
const [loading, setLoading] = useState(true);
const [current, setCurrent] = useState(null); // { id, title, role }
const [creating, setCreating] = useState(false);
const [newTitle, setNewTitle] = useState('');
// ── Canvas-State ──────────────────────────────────────────────────────────
const [elements, setElements] = useState([]);
@@ -516,12 +518,36 @@ export default function Whiteboard({ toast, mobile }) {
WHITEBOARD
</h2>
<div style={{ flex:1 }}/>
<button onClick={async () => {
try {
const wb = await api('/tools/whiteboard', { body: { title: 'Neues Whiteboard' } });
await openBoard(wb);
} catch(e) { toast(e.message, 'error'); }
}} style={S.btn('#4ECDC4')}>+ Neu</button>
{creating ? (
<div style={{ display:'flex', gap:6 }}>
<input autoFocus value={newTitle} onChange={e=>setNewTitle(e.target.value)}
onKeyDown={async e => {
if (e.key === 'Enter') {
if (!newTitle.trim()) return;
try {
const wb = await api('/tools/whiteboard', { body: { title: newTitle.trim() } });
setCreating(false); setNewTitle('');
await openBoard(wb);
} catch(err) { toast(err.message, 'error'); }
}
if (e.key === 'Escape') { setCreating(false); setNewTitle(''); }
}}
placeholder="Name des Whiteboards"
style={{ ...S.inp, width: mobile ? 160 : 220, fontSize:12 }}
/>
<button onClick={async () => {
if (!newTitle.trim()) return;
try {
const wb = await api('/tools/whiteboard', { body: { title: newTitle.trim() } });
setCreating(false); setNewTitle('');
await openBoard(wb);
} catch(err) { toast(err.message, 'error'); }
}} style={S.btn('#4ECDC4', true)}>Erstellen</button>
<button onClick={() => { setCreating(false); setNewTitle(''); }} style={S.btn('#888888', true)}></button>
</div>
) : (
<button onClick={() => setCreating(true)} style={S.btn('#4ECDC4')}>+ Neu</button>
)}
</div>
{loading && <div style={{ color:'rgba(255,255,255,0.3)', fontFamily:'monospace', fontSize:12 }}>Lädt</div>}