Skip to content

Commit

Permalink
Merge pull request #1265 from opentripplanner/deselect-all-submodes
Browse files Browse the repository at this point in the history
Deselect all submodes
  • Loading branch information
josh-willis-arcadis authored Oct 22, 2024
2 parents 44d69dc + 38de6c2 commit cab7c04
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions lib/components/form/advanced-settings-panel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,15 @@ const AdvancedSettingsPanel = ({
)
)

const handleModeButtonToggle = setModeButton(
enabledModeButtons,
onSettingsUpdate(setQueryParam)
)

const handleAllSubmodesDisabled = (modeButton: ModeButtonDefinition) => {
handleModeButtonToggle(modeButton.key, false)
}

const onSaveAndReturnClick = useCallback(async () => {
await setCloseAdvancedSettingsWithDelay()
setClosingBySave(true)
Expand Down Expand Up @@ -221,11 +230,9 @@ const AdvancedSettingsPanel = ({
id: 'components.BatchSearchScreen.submodeSelectorLabel'
})}
modeButtons={processedModeButtons}
onAllSubmodesDisabled={handleAllSubmodesDisabled}
onSettingsUpdate={onSettingsUpdate(setQueryParam)}
onToggleModeButton={setModeButton(
enabledModeButtons,
onSettingsUpdate(setQueryParam)
)}
onToggleModeButton={handleModeButtonToggle}
/>
{saveAndReturnButton && (
<ReturnToTripPlanButton
Expand Down

0 comments on commit cab7c04

Please sign in to comment.