Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deselect all submodes #1265

Merged
merged 15 commits into from
Oct 22, 2024
Merged
Changes from 14 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions lib/components/form/advanced-settings-panel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ const AdvancedSettingsPanel = ({
)

const processedModeSettings = processSettings(modeSettingDefinitions)

josh-willis-arcadis marked this conversation as resolved.
Show resolved Hide resolved
const processedModeButtons = modeButtonOptions.map(
pipe(
addModeButtonIcon(ModeIcon),
Expand All @@ -177,6 +178,15 @@ const AdvancedSettingsPanel = ({
)
)

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

const handleAllSubmodesDisabled = (modeButton: ModeButtonDefinition) => {
josh-willis-arcadis marked this conversation as resolved.
Show resolved Hide resolved
handleModeButtonToggle(modeButton.key, false)
}

const onSaveAndReturnClick = useCallback(async () => {
await setCloseAdvancedSettingsWithDelay()
setClosingBySave(true)
Expand Down Expand Up @@ -221,11 +231,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
Loading