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

Calltaker Fixes #1328

Merged
merged 4 commits into from
Jan 6, 2025
Merged
Show file tree
Hide file tree
Changes from all 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
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,8 @@ exports[`components > viewers > stop viewer should render with initial stop id a
}
>
<StopScheduleViewer
calendarMax="2025-12-31"
calendarMin="2024-01-01"
calendarMax="2026-12-31"
calendarMin="2025-01-01"
findStopTimesForStop={[Function]}
homeTimezone="America/Los_Angeles"
intl={
Expand Down
20 changes: 2 additions & 18 deletions lib/components/form/call-taker/advanced-options.js
Original file line number Diff line number Diff line change
@@ -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'
Expand All @@ -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'

Expand Down Expand Up @@ -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
*/
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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]
Expand Down Expand Up @@ -157,6 +140,7 @@ class AdvancedOptions extends Component {

_setCustomModeSetting = (option) => {
this.props.setUrlSearch(option)
this.props.setQueryParam(option)
}

/**
Expand Down
Loading