diff --git a/ui/lobby/src/ctrl.ts b/ui/lobby/src/ctrl.ts index d06b257265297..22fbf63d2dcb6 100644 --- a/ui/lobby/src/ctrl.ts +++ b/ui/lobby/src/ctrl.ts @@ -75,6 +75,17 @@ export default class LobbyController { const forceOptions: ForceSetupOptions = {}; const urlParams = new URLSearchParams(location.search); const friendUser = urlParams.get('user') ?? undefined; + const minutesPerSide = urlParams.get('minutesPerSide'); + const increment = urlParams.get('increment'); + + if (minutesPerSide) { + forceOptions.time = parseInt(minutesPerSide); + } + + if (increment) { + forceOptions.increment = parseInt(increment); + } + if (locationHash === 'hook') { if (urlParams.get('time') === 'realTime') { this.tab = 'real_time'; diff --git a/ui/lobby/src/interfaces.ts b/ui/lobby/src/interfaces.ts index d1a4fc44818a4..e99f9e6fb1eda 100644 --- a/ui/lobby/src/interfaces.ts +++ b/ui/lobby/src/interfaces.ts @@ -143,4 +143,6 @@ export interface ForceSetupOptions { variant?: VariantKey; fen?: string; timeMode?: TimeMode; + time?: number; + increment?: number; } diff --git a/ui/lobby/src/setupCtrl.ts b/ui/lobby/src/setupCtrl.ts index 24cc3232d6d42..75137740393bc 100644 --- a/ui/lobby/src/setupCtrl.ts +++ b/ui/lobby/src/setupCtrl.ts @@ -103,8 +103,10 @@ export default class SetupController { this.variant = propWithEffect(forceOptions?.variant || storeProps.variant, this.onDropdownChange); this.fen = this.propWithApply(forceOptions?.fen || storeProps.fen); this.timeMode = propWithEffect(forceOptions?.timeMode || storeProps.timeMode, this.onDropdownChange); - this.timeV = this.propWithApply(sliderInitVal(storeProps.time, timeVToTime, 100)!); - this.incrementV = this.propWithApply(sliderInitVal(storeProps.increment, incrementVToIncrement, 100)!); + this.timeV = this.propWithApply(sliderInitVal(forceOptions?.time || storeProps.time, timeVToTime, 100)!); + this.incrementV = this.propWithApply( + sliderInitVal(forceOptions?.increment || storeProps.increment, incrementVToIncrement, 100)!, + ); this.daysV = this.propWithApply(sliderInitVal(storeProps.days, daysVToDays, 20)!); this.gameMode = this.propWithApply(storeProps.gameMode); this.ratingMin = this.propWithApply(storeProps.ratingMin);