mirror of
https://github.com/denizsafak/abogen.git
synced 2026-07-18 13:40:27 +02:00
feat: Add speaker mode selection and skip logic for speakers step in the wizard
This commit is contained in:
@@ -243,6 +243,7 @@ document.addEventListener("DOMContentLoaded", () => {
|
||||
const prevButtons = Array.from(wizard.querySelectorAll('[data-role="step-prev"]'));
|
||||
const panels = new Map();
|
||||
const initialStep = wizard.dataset.initialStep || "chapters";
|
||||
const speakerModeSelect = form.querySelector("#speaker_mode");
|
||||
stepOrder.forEach((step) => {
|
||||
const panel = wizard.querySelector(`[data-step-panel="${step}"]`);
|
||||
if (panel) {
|
||||
@@ -259,6 +260,27 @@ document.addEventListener("DOMContentLoaded", () => {
|
||||
}
|
||||
let currentStep = initialStep;
|
||||
|
||||
const shouldSkipSpeakersStep = () => {
|
||||
const modeValue = (speakerModeSelect?.value || "").toLowerCase();
|
||||
if (!modeValue) {
|
||||
return true;
|
||||
}
|
||||
return modeValue !== "multi";
|
||||
};
|
||||
|
||||
const submitFinalize = () => {
|
||||
if (!form.reportValidity()) {
|
||||
return;
|
||||
}
|
||||
if (activeStepInput) {
|
||||
activeStepInput.value = currentStep;
|
||||
}
|
||||
if (finalizeAction) {
|
||||
form.action = finalizeAction;
|
||||
}
|
||||
form.submit();
|
||||
};
|
||||
|
||||
const updateIndicator = (activeStep) => {
|
||||
const activeIndex = indicatorOrder.indexOf(activeStep);
|
||||
indicatorSteps.forEach((item) => {
|
||||
@@ -358,6 +380,10 @@ document.addEventListener("DOMContentLoaded", () => {
|
||||
button.addEventListener("click", () => {
|
||||
const target = button.dataset.stepTarget || "speakers";
|
||||
if (target === "speakers") {
|
||||
if (shouldSkipSpeakersStep()) {
|
||||
submitFinalize();
|
||||
return;
|
||||
}
|
||||
submitForAnalysis();
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user