From 240588a1ec90a04a1d422eaad2996eb0c5b8ac81 Mon Sep 17 00:00:00 2001 From: Landon Reed Date: Fri, 30 Jul 2021 10:02:34 -0400 Subject: [PATCH 01/15] fix(field-trip): reverse outbound/inbound in field trip list view fix ibi-group/trimet-mod-otp#303 --- lib/components/admin/field-trip-list.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/components/admin/field-trip-list.js b/lib/components/admin/field-trip-list.js index 6b1de4994..5ae1de8cb 100644 --- a/lib/components/admin/field-trip-list.js +++ b/lib/components/admin/field-trip-list.js @@ -223,10 +223,10 @@ class FieldTripRequestRecord extends Component { - {this._getStatusIcon(inboundTripStatus)} Inbound + {this._getStatusIcon(outboundTripStatus)} Outbound - {this._getStatusIcon(outboundTripStatus)} Outbound + {this._getStatusIcon(inboundTripStatus)} Inbound From 34679f4dc2dc6719cfca7c3979f2aa023422c396 Mon Sep 17 00:00:00 2001 From: Landon Reed Date: Fri, 30 Jul 2021 10:38:05 -0400 Subject: [PATCH 02/15] fix(field-trip): refactor trip status icon this does not resolve entirely ibi-group/trimet-mod-otp#302 (a backend change is also needed), but it does DRY things out a bit and make things a bit easier to follow re ibi-group/trimet-mod-otp#302 --- lib/components/admin/field-trip-list.js | 9 +++------ lib/components/admin/trip-status.js | 12 +++++------- 2 files changed, 8 insertions(+), 13 deletions(-) diff --git a/lib/components/admin/field-trip-list.js b/lib/components/admin/field-trip-list.js index 5ae1de8cb..794c101a5 100644 --- a/lib/components/admin/field-trip-list.js +++ b/lib/components/admin/field-trip-list.js @@ -10,6 +10,7 @@ import Loading from '../narrative/loading' import {getVisibleRequests, TABS} from '../../util/call-taker' import {FETCH_STATUS} from '../../util/constants' +import FieldTripStatusIcon from './field-trip-status-icon' import {FieldTripRecordButton, WindowHeader} from './styled' import DraggableWindow from './draggable-window' @@ -186,10 +187,6 @@ class FieldTripRequestRecord extends Component { onClick(request) } - _getStatusIcon = (status) => status - ? - : - render () { const {active, request} = this.props const style = { @@ -223,10 +220,10 @@ class FieldTripRequestRecord extends Component { - {this._getStatusIcon(outboundTripStatus)} Outbound + Outbound - {this._getStatusIcon(inboundTripStatus)} Inbound + Inbound diff --git a/lib/components/admin/trip-status.js b/lib/components/admin/trip-status.js index 629390e02..7de04c4d9 100644 --- a/lib/components/admin/trip-status.js +++ b/lib/components/admin/trip-status.js @@ -5,9 +5,9 @@ import { connect } from 'react-redux' import * as fieldTripActions from '../../actions/field-trip' import * as formActions from '../../actions/form' -import Icon from '../narrative/icon' import { getTripFromRequest } from '../../util/call-taker' +import FieldTripStatusIcon from './field-trip-status-icon' import { Bold, Button, @@ -47,13 +47,11 @@ class TripStatus extends Component { viewRequestTripItineraries(request, outbound) } - _renderStatusIcon = () => this.props.status - ? - : + _tripIsPlanned = () => this.props.status && this.props.trip _renderTripStatus = () => { - const { status, trip } = this.props - if (!status || !trip) { + const { trip } = this.props + if (!this._tripIsPlanned()) { return ( No itineraries planned! Click Plan to plan trip. @@ -92,7 +90,7 @@ class TripStatus extends Component { return (
- {this._renderStatusIcon()} + {outbound ? 'Outbound' : 'Inbound'} trip @@ -261,7 +259,7 @@ class CallTakerPanel extends Component { right: '0', // FIXME: This top pixel value can be variable dependent on // height of the form above. It may need to be specified differently - top: 193 + intermediatePlaces.length * 45 + top: 210 + intermediatePlaces.length * 45 }} /> diff --git a/lib/components/form/call-taker/date-time-options.js b/lib/components/form/call-taker/date-time-options.js index fd0e5cb5f..45fab3615 100644 --- a/lib/components/form/call-taker/date-time-options.js +++ b/lib/components/form/call-taker/date-time-options.js @@ -190,28 +190,26 @@ export default class DateTimeOptions extends Component {