Skip to content

Commit

Permalink
change default to false
Browse files Browse the repository at this point in the history
  • Loading branch information
daniel-heppner-ibigroup committed Sep 18, 2024
1 parent 1a7806e commit a9c432b
Showing 1 changed file with 16 additions and 12 deletions.
28 changes: 16 additions & 12 deletions lib/components/form/date-time-modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,15 @@ type Props = {

type DepartArriveValue = 'NOW' | 'DEPART' | 'ARRIVE'

const DepartArriveTypeMap: Record<
DepartArriveValue,
FilterType['sort']['type']
> = {
ARRIVE: 'ARRIVALTIME',
DEPART: 'DEPARTURETIME',
NOW: 'DURATION'
}

function DateTimeModal(props: Props) {
const {
config,
Expand All @@ -45,18 +54,13 @@ function DateTimeModal(props: Props) {
const syncSortWithDepartArrive = config?.itinerary?.syncSortWithDepartArrive
const setQueryParamMiddleware = useCallback(
(params: any) => {
if (syncSortWithDepartArrive !== false) {
switch (params.departArrive) {
case 'NOW':
updateItineraryFilter({ sort: { ...sort, type: 'DURATION' } })
break
case 'DEPART':
updateItineraryFilter({ sort: { ...sort, type: 'DEPARTURETIME' } })
break
case 'ARRIVE':
updateItineraryFilter({ sort: { ...sort, type: 'ARRIVALTIME' } })
break
}
if (syncSortWithDepartArrive) {
updateItineraryFilter({
sort: {
...sort,
type: DepartArriveTypeMap[params.departArrive as DepartArriveValue]
}
})
}
setQueryParam(params)
},
Expand Down

0 comments on commit a9c432b

Please sign in to comment.