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

Field trip/calltaker tweaks September '23 #1000

Merged
merged 8 commits into from
Oct 3, 2023
2 changes: 2 additions & 0 deletions example-config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,8 @@ itinerary:

# Whether to show the "# itineraries found" text above the itinerary results
showHeaderText: false
# Whether to show the mode descriptions in the batch UI results. Defaults to true
showBatchUiItineraryHeaders: false
# Whether to hide the gray loading bars that appear while results are loading
hideSkeletons: true
# Whether the itinerary listing background should match the header
Expand Down
8 changes: 4 additions & 4 deletions lib/components/app/call-taker-panel.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ class CallTakerPanel extends Component {
if (
// Only enabled when field trip is enabled, as otherwise
// this flashes a lot, possibly to an annoying extent
this.props.fieldTripEnabled &&
this.props.fieldTripVisible &&
(prevProps?.currentQuery?.from?.name !==
this.props?.currentQuery?.from?.name ||
prevProps?.currentQuery?.to?.name !==
Expand Down Expand Up @@ -338,7 +338,7 @@ class CallTakerPanel extends Component {

// connect to the redux store
const mapStateToProps = (state) => {
const { activeId, requests } = state.callTaker.fieldTrip
const { activeId, groupSize, requests, visible } = state.callTaker.fieldTrip
const request = requests.data.find((req) => req.id === activeId)
const showUserSettings = getShowUserSettings(state)
const moduleConfig = getModuleConfig(state, Modules.CALL_TAKER)?.options
Expand All @@ -351,8 +351,8 @@ const mapStateToProps = (state) => {
return {
activeSearch: getActiveSearch(state),
currentQuery: state.otp.currentQuery,
fieldTripEnabled: isModuleEnabled(state, Modules.FIELD_TRIP),
groupSize: state.callTaker.fieldTrip.groupSize,
fieldTripVisible: visible,
groupSize,
mainPanelContent: state.otp.ui.mainPanelContent,
maxGroupSize: getGroupSize(request),
modeDropdownOptions:
Expand Down
4 changes: 2 additions & 2 deletions lib/components/form/call-taker/advanced-options.js
Original file line number Diff line number Diff line change
Expand Up @@ -237,11 +237,11 @@ class AdvancedOptions extends Component {
name="walkReluctance"
onChange={this._setWalkTolerance}
options={[
{ text: 'Avoid Walking', value: 15 },
{ text: 'Normal Walking', value: 3 },
{ text: 'Avoid Walking', value: 15 },
{ text: 'Prefer walking', value: 1 }
]}
style={{ display: 'block' }}
style={{ display: 'block', width: '33ch' }}
value={this.props.modeSettingValues.walkReluctance}
/>

Expand Down
16 changes: 10 additions & 6 deletions lib/components/narrative/default/default-itinerary.js
Original file line number Diff line number Diff line change
Expand Up @@ -249,10 +249,10 @@ class DefaultItinerary extends NarrativeItinerary {
return false
}

// eslint-disable-next-line complexity
render() {
const {
accessibilityScoreGradationMap,
active,
co2Config,
configCosts,
defaultFareType,
Expand All @@ -262,11 +262,11 @@ class DefaultItinerary extends NarrativeItinerary {
LegIcon,
setActiveLeg,
showRealtimeAnnotation,
showResultHeaders,
visible
} = this.props
const isFlexItinerary = itinerary.legs.some(isFlex)
const isCallAhead = itinerary.legs.some(isAdvanceBookingRequired)
const isContDropoff = itinerary.legs.some(isCoordinationRequired)
const { SvgIcon } = this.context

const localizedGradationMapWithIcons = localizeGradationMap(
Expand Down Expand Up @@ -321,9 +321,11 @@ class DefaultItinerary extends NarrativeItinerary {
onClick={this._onHeaderClick}
>
<div className="title">
<h3>
<ItineraryDescription intl={intl} itinerary={itinerary} />
</h3>
{showResultHeaders && (
<h3>
<ItineraryDescription intl={intl} itinerary={itinerary} />
</h3>
)}
<ItinerarySummary itinerary={itinerary} LegIcon={LegIcon} />
{itineraryHasAccessibilityScores(itinerary) && (
<AccessibilityRating
Expand Down Expand Up @@ -407,7 +409,9 @@ const mapStateToProps = (state, ownProps) => {
defaultFareType: state.otp.config.itinerary?.defaultFareType || {
mediumId: null,
riderCategoryId: null
}
},
showResultHeaders:
state.otp.config.itinerary?.showBatchUiItineraryHeaders !== false
}
}

Expand Down
3 changes: 2 additions & 1 deletion lib/components/narrative/narrative-itinerary.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@ export default class NarrativeItinerary extends Component {
}

__setItinToActiveIndex = () => {
const { index, setActiveItinerary } = this.props
const { index, setActiveItinerary, setVisibleItinerary } = this.props
setActiveItinerary && setActiveItinerary({ index })
setVisibleItinerary && setVisibleItinerary({ index })
}

_onDirectClick = () => {
Expand Down
Loading