mirror of
https://github.com/denizsafak/abogen.git
synced 2026-07-18 21:50:28 +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 prevButtons = Array.from(wizard.querySelectorAll('[data-role="step-prev"]'));
|
||||||
const panels = new Map();
|
const panels = new Map();
|
||||||
const initialStep = wizard.dataset.initialStep || "chapters";
|
const initialStep = wizard.dataset.initialStep || "chapters";
|
||||||
|
const speakerModeSelect = form.querySelector("#speaker_mode");
|
||||||
stepOrder.forEach((step) => {
|
stepOrder.forEach((step) => {
|
||||||
const panel = wizard.querySelector(`[data-step-panel="${step}"]`);
|
const panel = wizard.querySelector(`[data-step-panel="${step}"]`);
|
||||||
if (panel) {
|
if (panel) {
|
||||||
@@ -259,6 +260,27 @@ document.addEventListener("DOMContentLoaded", () => {
|
|||||||
}
|
}
|
||||||
let currentStep = initialStep;
|
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 updateIndicator = (activeStep) => {
|
||||||
const activeIndex = indicatorOrder.indexOf(activeStep);
|
const activeIndex = indicatorOrder.indexOf(activeStep);
|
||||||
indicatorSteps.forEach((item) => {
|
indicatorSteps.forEach((item) => {
|
||||||
@@ -358,6 +380,10 @@ document.addEventListener("DOMContentLoaded", () => {
|
|||||||
button.addEventListener("click", () => {
|
button.addEventListener("click", () => {
|
||||||
const target = button.dataset.stepTarget || "speakers";
|
const target = button.dataset.stepTarget || "speakers";
|
||||||
if (target === "speakers") {
|
if (target === "speakers") {
|
||||||
|
if (shouldSkipSpeakersStep()) {
|
||||||
|
submitFinalize();
|
||||||
|
return;
|
||||||
|
}
|
||||||
submitForAnalysis();
|
submitForAnalysis();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user