diff --git a/frontend/app.js b/frontend/app.js index 59ab963..3e1f505 100644 --- a/frontend/app.js +++ b/frontend/app.js @@ -10,7 +10,6 @@ const modalTitle = document.getElementById('modal-title'); const modalBody = document.getElementById('modal-body'); const modalOpenBtn = document.getElementById('modal-open-btn'); const modalCloseBtn = document.getElementById('modal-close-btn'); -const modalReprocessBtn = document.getElementById('modal-reprocess-btn'); let _modalPath = null; let _modalFilename = null; @@ -69,20 +68,6 @@ modalOpenBtn.addEventListener('click', () => { if (_modalPath) apiFetch('/open', { method: 'POST', body: JSON.stringify({ path: _modalPath }) }); }); -modalReprocessBtn.addEventListener('click', async () => { - if (!_modalFilename) return; - modalReprocessBtn.disabled = true; - modalBody.textContent = 'Wird neu verarbeitet\u2026'; - const instructions = instructionsEl.value; - const r = await apiFetch(`/transcripts/${encodeURIComponent(_modalFilename)}/reprocess`, { - method: 'POST', - body: JSON.stringify({ instructions }), - }); - const md = await r.text(); - modalBody.innerHTML = DOMPurify.sanitize(marked.parse(md)); - modalReprocessBtn.disabled = false; -}); - instructionsEl.addEventListener('input', async () => { await apiFetch('/instructions', { method: 'POST', @@ -145,6 +130,21 @@ async function loadTranscripts() { div.addEventListener('click', () => openModal(t.filename, t.path)); + const reprocessBtn = document.createElement('button'); + reprocessBtn.className = 'del-btn'; + reprocessBtn.title = 'Neu verarbeiten'; + reprocessBtn.innerHTML = ''; + reprocessBtn.addEventListener('click', async (e) => { + e.stopPropagation(); + reprocessBtn.disabled = true; + await apiFetch(`/transcripts/${encodeURIComponent(t.filename)}/reprocess`, { + method: 'POST', + body: JSON.stringify({ instructions: instructionsEl.value }), + }); + reprocessBtn.disabled = false; + loadTranscripts(); + }); + const delBtn = document.createElement('button'); delBtn.className = 'del-btn'; delBtn.title = 'Löschen'; @@ -155,7 +155,7 @@ async function loadTranscripts() { loadTranscripts(); }); - div.append(name, meta, delBtn); + div.append(name, meta, reprocessBtn, delBtn); return div; }) ); diff --git a/frontend/index.html b/frontend/index.html index b56de29..4455148 100644 --- a/frontend/index.html +++ b/frontend/index.html @@ -200,11 +200,6 @@