fix: auto-advance on new-game selections
Advance the wizard immediately when selecting game type, break rule, race-to quick picks, and completed break-order choices for a consistent tap-first flow. Made-with: Cursor
This commit is contained in:
@@ -27,10 +27,17 @@ export const BreakOrderStep = ({ players, rule, onNext, onCancel, initialFirst =
|
||||
|
||||
const handleFirst = (idx: number) => {
|
||||
setFirst(idx);
|
||||
const isImmediateFlow = rule !== 'wechselbreak' || playerCount !== 3;
|
||||
if (isImmediateFlow) {
|
||||
onNext(idx);
|
||||
}
|
||||
};
|
||||
|
||||
const handleSecond = (idx: number) => {
|
||||
setSecond(idx);
|
||||
if (rule === 'wechselbreak' && playerCount === 3 && first > 0) {
|
||||
onNext(first, idx);
|
||||
}
|
||||
};
|
||||
|
||||
const handleSubmit = (e: Event) => {
|
||||
|
||||
@@ -16,6 +16,7 @@ export const BreakRuleStep = ({ onNext, onCancel, initialValue = 'winnerbreak' }
|
||||
|
||||
const handleSelect = (nextRule: BreakRule) => {
|
||||
setRule(nextRule);
|
||||
onNext(nextRule);
|
||||
};
|
||||
|
||||
const handleSubmit = (e: Event) => {
|
||||
|
||||
@@ -16,6 +16,7 @@ export const GameTypeStep = ({ onNext, onCancel, initialValue = '' }: GameTypeSt
|
||||
|
||||
const handleSelect = (selectedType: string) => {
|
||||
setGameType(selectedType);
|
||||
onNext(selectedType);
|
||||
};
|
||||
|
||||
const handleSubmit = (e: Event) => {
|
||||
|
||||
@@ -23,6 +23,11 @@ export const RaceToStep = ({ onNext, onCancel, initialValue = '', gameType }: Ra
|
||||
initialValue !== '' ? initialValue : defaultValue
|
||||
);
|
||||
|
||||
const toRaceToValue = (value: string | number) => {
|
||||
if (value === RACE_TO_INFINITY || value === 'Infinity') return Infinity;
|
||||
return parseInt(String(value), 10) || 0;
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
if (initialValue === '' || initialValue === undefined) {
|
||||
setRaceTo(defaultValue);
|
||||
@@ -34,6 +39,7 @@ export const RaceToStep = ({ onNext, onCancel, initialValue = '', gameType }: Ra
|
||||
const handleQuickPick = (value: number | typeof RACE_TO_INFINITY) => {
|
||||
const selected = value === RACE_TO_INFINITY ? RACE_TO_INFINITY : value;
|
||||
setRaceTo(selected);
|
||||
onNext(toRaceToValue(selected));
|
||||
};
|
||||
|
||||
const handleInputChange = (e: Event) => {
|
||||
@@ -43,8 +49,7 @@ export const RaceToStep = ({ onNext, onCancel, initialValue = '', gameType }: Ra
|
||||
|
||||
const handleSubmit = (e: Event) => {
|
||||
e.preventDefault();
|
||||
const raceToValue = raceTo === 'Infinity' ? Infinity : (parseInt(String(raceTo), 10) || 0);
|
||||
onNext(raceToValue);
|
||||
onNext(toRaceToValue(raceTo));
|
||||
};
|
||||
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user