fix: make wizard progression explicit and consistent

Require explicit Weiter confirmation after selection in game type, race-to, break rule, and break order steps to prevent accidental auto-advance and keep step behavior predictable. Refs #30.

Made-with: Cursor
This commit is contained in:
Frank Schwenk
2026-04-04 11:32:23 +02:00
parent 9bf4c20f11
commit 586e5f26bd
4 changed files with 29 additions and 25 deletions
@@ -26,18 +26,29 @@ export const BreakOrderStep = ({ players, rule, onNext, onCancel, initialFirst =
const handleFirst = (idx: number) => {
setFirst(idx);
if (rule === 'winnerbreak' || (rule === 'wechselbreak' && playerCount === 2)) {
onNext(idx);
}
};
const handleSecond = (idx: number) => {
setSecond(idx);
onNext(first, idx);
};
const handleSubmit = (e: Event) => {
e.preventDefault();
if (rule === 'wechselbreak' && playerCount === 3) {
if (first > 0 && (second ?? 0) > 0) {
onNext(first, second);
}
return;
}
if (first > 0) {
onNext(first);
}
};
return (
<form className={styles['new-game-form']} aria-label="Break-Reihenfolge wählen">
<form className={styles['new-game-form']} aria-label="Break-Reihenfolge wählen" onSubmit={handleSubmit}>
<div className={styles['form-header']}>
<div className={styles['screen-title']}>Wer hat den ersten Anstoss?</div>
<ProgressIndicator currentStep={7} style={{ marginBottom: 24 }} />
@@ -87,18 +98,9 @@ export const BreakOrderStep = ({ players, rule, onNext, onCancel, initialFirst =
&#8592;
</button>
<button
type="button"
type="submit"
className={styles['arrow-btn']}
aria-label="Weiter"
onClick={() => {
if (rule === 'wechselbreak' && playerCount === 3) {
if (first > 0 && (second ?? 0) > 0) {
handleSecond(second as number);
}
} else if (first > 0) {
onNext(first);
}
}}
disabled={
(rule === 'wechselbreak' && playerCount === 3) ? !(first > 0 && (second ?? 0) > 0) : !(first > 0)
}