diff --git a/.gitea b/.gitea index b1647bf..e77c3f5 100644 --- a/.gitea +++ b/.gitea @@ -1 +1 @@ -@https://gitea.schwenk.online/froxxxy/bscscore/issues/10 \ No newline at end of file +https://gitea.schwenk.online/froxxxy/bscscore/issues/26 \ No newline at end of file diff --git a/src/components/App.jsx b/src/components/App.jsx index 8962ce5..d291002 100644 --- a/src/components/App.jsx +++ b/src/components/App.jsx @@ -312,6 +312,7 @@ const App = () => { onNext={handleRaceToNext} onCancel={() => setNewGameStep('gameType')} initialValue={newGameData.raceTo} + gameType={newGameData.gameType} /> )} diff --git a/src/components/NewGame.jsx b/src/components/NewGame.jsx index 10c0b25..f38a63c 100644 --- a/src/components/NewGame.jsx +++ b/src/components/NewGame.jsx @@ -560,11 +560,28 @@ const GameTypeStep = ({ onNext, onCancel, initialValue = '' }) => { * @param {Function} props.onNext * @param {Function} props.onCancel * @param {string|number} [props.initialValue] + * @param {string} [props.gameType] * @returns {import('preact').VNode} */ -const RaceToStep = ({ onNext, onCancel, initialValue = '' }) => { - const [raceTo, setRaceTo] = useState(initialValue); - const quickPicks = [1, 2, 3, 4, 5, 6, 7, 8, 9]; +const RaceToStep = ({ onNext, onCancel, initialValue = '', gameType }) => { + let quickPicks, defaultValue; + if (gameType === '14/1 endlos') { + quickPicks = [60, 70, 80, 90, 100]; + defaultValue = 80; + } else { + quickPicks = [1, 2, 3, 4, 5, 6, 7, 8, 9]; + defaultValue = 5; + } + const [raceTo, setRaceTo] = useState(initialValue !== '' ? initialValue : defaultValue); + + useEffect(() => { + if ((initialValue === '' || initialValue === undefined) && raceTo !== defaultValue) { + setRaceTo(defaultValue); + } + if (initialValue !== '' && initialValue !== undefined && initialValue !== raceTo) { + setRaceTo(initialValue); + } + }, [gameType, initialValue, defaultValue]); const handleQuickPick = (value) => { setRaceTo(value);