Working dialog generator

This commit is contained in:
Steve White 2025-06-05 18:46:09 -05:00
parent 6adcadded1
commit 9e4fb35800
2 changed files with 22 additions and 3 deletions

View File

@ -59,14 +59,27 @@ async function loadSpeakers() {
} }
speakers.forEach(speaker => { speakers.forEach(speaker => {
const listItem = document.createElement('li'); const listItem = document.createElement('li');
listItem.textContent = `${speaker.name} (ID: ${speaker.id || 'N/A'}) `;
// Create a container for the speaker name and delete button
const container = document.createElement('div');
container.style.display = 'flex';
container.style.justifyContent = 'space-between';
container.style.alignItems = 'center';
container.style.width = '100%';
// Add speaker name
const nameSpan = document.createElement('span');
nameSpan.textContent = speaker.name;
container.appendChild(nameSpan);
// Add delete button
const deleteBtn = document.createElement('button'); const deleteBtn = document.createElement('button');
deleteBtn.textContent = 'Delete'; deleteBtn.textContent = 'Delete';
deleteBtn.classList.add('delete-speaker-btn'); deleteBtn.classList.add('delete-speaker-btn');
deleteBtn.onclick = () => handleDeleteSpeaker(speaker.id); deleteBtn.onclick = () => handleDeleteSpeaker(speaker.id);
listItem.appendChild(deleteBtn); container.appendChild(deleteBtn);
listItem.appendChild(container);
speakerListUL.appendChild(listItem); speakerListUL.appendChild(listItem);
}); });
} catch (error) { } catch (error) {

View File

@ -4,3 +4,9 @@
608903c4-b157-46c5-a0ea-4b25eb4b83b6: 608903c4-b157-46c5-a0ea-4b25eb4b83b6:
name: Denise name: Denise
sample_path: speaker_samples/608903c4-b157-46c5-a0ea-4b25eb4b83b6.wav sample_path: speaker_samples/608903c4-b157-46c5-a0ea-4b25eb4b83b6.wav
3c93c9df-86dc-4d67-ab55-8104b9301190:
name: Maria
sample_path: speaker_samples/3c93c9df-86dc-4d67-ab55-8104b9301190.wav
fb84ce1c-f32d-4df9-9673-2c64e9603133:
name: Debbie
sample_path: speaker_samples/fb84ce1c-f32d-4df9-9673-2c64e9603133.wav