Orphan-Junction-Cleanup + Refresh-Button für Fragen/Wörter
- Backend: DELETE question/word räumt alle Junction-Zeilen mit auf - Backend: /purge-orphans bereinigt verwaiste Junctions per Objekt - Frontend: reloadQW ruft purgeOrphans vor dem Neu-Laden auf - Frontend: ↺-Button in Wörter- und Fragen-Sidebar Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -14,6 +14,7 @@ import {
|
||||
getObjectWords,
|
||||
deleteQuestion,
|
||||
deleteWord,
|
||||
purgeOrphans,
|
||||
type GenerateStats,
|
||||
type ObjectQuestion,
|
||||
type ObjectWord,
|
||||
@@ -180,6 +181,7 @@ export default function GenerateIt() {
|
||||
|
||||
const reloadQW = (objId: string) => {
|
||||
if (!token) return
|
||||
purgeOrphans(objId, token).catch(console.error)
|
||||
getObjectQuestions(objId, token).then(setQuestions).catch(console.error)
|
||||
getObjectWords(objId, token).then(setObjWords).catch(console.error)
|
||||
}
|
||||
@@ -439,9 +441,12 @@ export default function GenerateIt() {
|
||||
{/* Words sidebar */}
|
||||
<aside className="sidebar sidebar--words">
|
||||
<div className="sidebar-panel" style={{ flex: 1, overflow: 'hidden', display: 'flex', flexDirection: 'column' }}>
|
||||
<h3 className="sidebar-heading">
|
||||
<h3 className="sidebar-heading" style={{ display: 'flex', alignItems: 'center', gap: 4 }}>
|
||||
Wörter
|
||||
{objWords.length > 0 && <span className="badge">{objWords.length}</span>}
|
||||
{selectedObjId && (
|
||||
<button onClick={() => reloadQW(selectedObjId)} style={{ marginLeft: 'auto', background: 'none', border: 'none', cursor: 'pointer', fontSize: 13, color: 'var(--muted)', padding: '0 2px' }} title="Neu laden">↺</button>
|
||||
)}
|
||||
</h3>
|
||||
{objWords.length === 0 ? (
|
||||
<div className="empty-state">–</div>
|
||||
@@ -468,9 +473,12 @@ export default function GenerateIt() {
|
||||
{/* Questions sidebar */}
|
||||
<aside className="sidebar sidebar--right" style={{ width: 300, minWidth: 240 }}>
|
||||
<div className="sidebar-panel" style={{ flex: 1, overflow: 'hidden', display: 'flex', flexDirection: 'column' }}>
|
||||
<h3 className="sidebar-heading">
|
||||
<h3 className="sidebar-heading" style={{ display: 'flex', alignItems: 'center', gap: 4 }}>
|
||||
Fragen
|
||||
{questions.length > 0 && <span className="badge">{questions.length}</span>}
|
||||
{selectedObjId && (
|
||||
<button onClick={() => reloadQW(selectedObjId)} style={{ marginLeft: 'auto', background: 'none', border: 'none', cursor: 'pointer', fontSize: 13, color: 'var(--muted)', padding: '0 2px' }} title="Neu laden">↺</button>
|
||||
)}
|
||||
</h3>
|
||||
{questions.length === 0 ? (
|
||||
<div className="empty-state">Klicke „Generate it".</div>
|
||||
|
||||
Reference in New Issue
Block a user