From 9cca53a345c10c8baaadbb091cbef8d2d42f6ea3 Mon Sep 17 00:00:00 2001 From: binh-dam-ibigroup <56846598+binh-dam-ibigroup@users.noreply.github.com> Date: Wed, 18 Dec 2024 11:51:39 -0500 Subject: [PATCH 1/2] refactor(AdvancedOptions): Remove dead code --- .../form/call-taker/advanced-options.js | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) diff --git a/lib/components/form/call-taker/advanced-options.js b/lib/components/form/call-taker/advanced-options.js index 891db3c4b..80f0c0802 100644 --- a/lib/components/form/call-taker/advanced-options.js +++ b/lib/components/form/call-taker/advanced-options.js @@ -1,6 +1,4 @@ /* eslint-disable react/prop-types */ -// FIXME: Remove the following eslint rule exception. -/* eslint-disable jsx-a11y/label-has-for */ import * as TripFormClasses from '@opentripplanner/trip-form/lib/styled' import { checkIfModeSettingApplies } from '@opentripplanner/trip-form/lib/MetroModeSelector/utils' import { injectIntl } from 'react-intl' @@ -9,7 +7,6 @@ import { populateSettingWithValue, SubmodeSelector } from '@opentripplanner/trip-form' -import isEmpty from 'lodash.isempty' import React, { Component, lazy, Suspense } from 'react' import styled from 'styled-components' @@ -43,9 +40,6 @@ export const StyledSubmodeSelector = styled(SubmodeSelector)` margin: 5px 0; ` -const metersToMiles = (meters) => Math.round(meters * 0.000621371 * 100) / 100 -const milesToMeters = (miles) => miles / 0.000621371 - /** * Converts a new TransportMode object to legacy style underscore qualifier */ @@ -80,7 +74,7 @@ class AdvancedOptions extends Component { this.props.findRoutesIfNeeded() } - componentDidUpdate(prevProps) { + componentDidUpdate() { const { routes } = this.props // Once routes are available, map them to the route options format. const routeOptions = Object.values(routes).map(this.routeToOption) @@ -113,17 +107,6 @@ class AdvancedOptions extends Component { return bannedRoutes && bannedRoutes.find((o) => o.value === option.value) } - getDistanceStep = (distanceInMeters) => { - // Determine step for max walk/bike based on current value. Increment by a - // quarter mile if dealing with small values, whatever number will round off - // the number if it is not an integer, or default to one mile. - return metersToMiles(distanceInMeters) <= 2 - ? '.25' - : metersToMiles(distanceInMeters) % 1 !== 0 - ? `${metersToMiles(distanceInMeters) % 1}` - : '1' - } - _onSubModeChange = (changedMode) => { // Get previous transit modes from state and all modes from query. const transitModes = [...this.state.transitModes] From db0b06da610af88ebbb1d863ce06fdf18f5c50b6 Mon Sep 17 00:00:00 2001 From: binh-dam-ibigroup <56846598+binh-dam-ibigroup@users.noreply.github.com> Date: Thu, 19 Dec 2024 14:02:15 -0500 Subject: [PATCH 2/2] fix(ct/AdvancedOptions): Set query params for configured params --- lib/components/form/call-taker/advanced-options.js | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/components/form/call-taker/advanced-options.js b/lib/components/form/call-taker/advanced-options.js index 80f0c0802..6ada941cd 100644 --- a/lib/components/form/call-taker/advanced-options.js +++ b/lib/components/form/call-taker/advanced-options.js @@ -140,6 +140,7 @@ class AdvancedOptions extends Component { _setCustomModeSetting = (option) => { this.props.setUrlSearch(option) + this.props.setQueryParam(option) } /**