From 72980b4cdbd493a9f64a9af99814b2f78bc291ef Mon Sep 17 00:00:00 2001 From: miles-grant-ibigroup Date: Tue, 8 Aug 2023 14:17:24 -0400 Subject: [PATCH 1/6] refactor: remove old view trip button --- lib/components/viewers/view-trip-button.tsx | 56 --------------------- lib/index.js | 2 - 2 files changed, 58 deletions(-) delete mode 100644 lib/components/viewers/view-trip-button.tsx diff --git a/lib/components/viewers/view-trip-button.tsx b/lib/components/viewers/view-trip-button.tsx deleted file mode 100644 index 1cf0fce9e..000000000 --- a/lib/components/viewers/view-trip-button.tsx +++ /dev/null @@ -1,56 +0,0 @@ -import { Button } from 'react-bootstrap' -import { connect } from 'react-redux' -import { FormattedMessage } from 'react-intl' -import React, { Component } from 'react' - -import { MainPanelContent } from '../../actions/ui-constants' -import { setMainPanelContent, setViewedTrip } from '../../actions/ui' - -type Props = { - fromIndex: number - setMainPanelContent: (panel: number | null) => void - setViewedTrip({ - fromIndex, - toIndex, - tripId - }: { - fromIndex: number - toIndex: number - tripId: string - }): void - text: JSX.Element - toIndex: number - tripId: string -} - -class ViewTripButton extends Component { - _onClick = () => { - this.props.setMainPanelContent(MainPanelContent.TRIP_VIEWER) - this.props.setViewedTrip({ - fromIndex: this.props.fromIndex, - toIndex: this.props.toIndex, - tripId: this.props.tripId - }) - } - - render() { - return ( - - ) - } -} - -const mapDispatchToProps = { - setMainPanelContent, - setViewedTrip -} - -export default connect(null, mapDispatchToProps)(ViewTripButton) diff --git a/lib/index.js b/lib/index.js index dea45ab4e..3fc9e61c5 100644 --- a/lib/index.js +++ b/lib/index.js @@ -27,7 +27,6 @@ import NavLoginButton from './components/user/nav-login-button' import NavLoginButtonAuth0 from './components/user/nav-login-button-auth0' import StopViewer from './components/viewers/stop-viewer' import ViewStopButton from './components/viewers/view-stop-button' -import ViewTripButton from './components/viewers/view-trip-button' import ViewerContainer from './components/viewers/viewer-container' import ResponsiveWebapp from './components/app/responsive-webapp' import AppMenu from './components/app/app-menu' @@ -91,7 +90,6 @@ export { StopViewer, ViewerContainer, ViewStopButton, - ViewTripButton, // user-related components NavLoginButton, From ed93acdd705c16598cbdc7adf20e363bd5ded63c Mon Sep 17 00:00:00 2001 From: miles-grant-ibigroup Date: Tue, 8 Aug 2023 14:41:19 -0400 Subject: [PATCH 2/6] refactor: make use of new OTP2 props --- lib/components/viewers/trip-viewer.js | 28 +++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/lib/components/viewers/trip-viewer.js b/lib/components/viewers/trip-viewer.js index 2336b558c..df40cf95b 100644 --- a/lib/components/viewers/trip-viewer.js +++ b/lib/components/viewers/trip-viewer.js @@ -88,6 +88,13 @@ class TripViewer extends Component { timeZone: homeTimezone }) + const fromIndex = tripData?.stops?.findIndex( + (stop) => stop.stopId === viewedTrip?.fromStopId + ) + const toIndex = tripData?.stops?.findIndex( + (stop) => stop.stopId === viewedTrip?.toStopId + ) + return (
@@ -133,20 +140,16 @@ class TripViewer extends Component { screenreader or keyboard nav, the departure, arrival, and stop viewer links are all accessible without having to go through all the stops not on the trip. */} - {viewedTrip?.fromIndex && ( + {fromIndex && ( - {tripData.stops?.[viewedTrip?.fromIndex]?.name} - + {tripData.stops?.[fromIndex]?.name} ), disembarkAtStop: ( - - {tripData.stops?.[viewedTrip?.toIndex]?.name} - + {tripData.stops?.[toIndex]?.name} ) }} /> @@ -197,12 +200,12 @@ class TripViewer extends Component { } let stopLabel = null - if (viewedTrip?.fromIndex === i) { + if (fromIndex === i) { stopLabel = ( ) } - if (viewedTrip?.toIndex === i) { + if (toIndex === i) { stopLabel = ( ) @@ -210,12 +213,9 @@ class TripViewer extends Component { // determine whether to show highlight in strip map let highlightClass - if (i === viewedTrip?.fromIndex) { + if (i === fromIndex) { highlightClass = 'strip-map-highlight-first' - } else if ( - i > viewedTrip?.fromIndex && - i < viewedTrip.toIndex - ) { + } else if (i > fromIndex && i < toIndex) { highlightClass = 'strip-map-highlight' } else if (i === viewedTrip?.toIndex) { highlightClass = 'strip-map-highlight-last' From 4a2e1c6a092a0264dccd2c2970a6512da7891ddf Mon Sep 17 00:00:00 2001 From: miles-grant-ibigroup Date: Wed, 9 Aug 2023 10:20:31 -0400 Subject: [PATCH 3/6] refactor: use correct toIndex --- lib/components/viewers/trip-viewer.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/components/viewers/trip-viewer.js b/lib/components/viewers/trip-viewer.js index df40cf95b..0c4991977 100644 --- a/lib/components/viewers/trip-viewer.js +++ b/lib/components/viewers/trip-viewer.js @@ -217,7 +217,7 @@ class TripViewer extends Component { highlightClass = 'strip-map-highlight-first' } else if (i > fromIndex && i < toIndex) { highlightClass = 'strip-map-highlight' - } else if (i === viewedTrip?.toIndex) { + } else if (i === toIndex) { highlightClass = 'strip-map-highlight-last' } From 9ed9c561f23eeed24e6734771988ed103bac61fe Mon Sep 17 00:00:00 2001 From: miles-grant-ibigroup Date: Wed, 13 Sep 2023 12:41:12 -0400 Subject: [PATCH 4/6] chore(deps): update otp-ui --- package.json | 12 ++++----- yarn.lock | 72 ++++++++++++++++++++++++++-------------------------- 2 files changed, 42 insertions(+), 42 deletions(-) diff --git a/package.json b/package.json index 46e9ff69a..596d7a0e2 100644 --- a/package.json +++ b/package.json @@ -39,19 +39,19 @@ "@bugsnag/plugin-react": "^7.17.0", "@floating-ui/react": "^0.19.2", "@opentripplanner/base-map": "^3.0.14", - "@opentripplanner/core-utils": "^11.0.2", + "@opentripplanner/core-utils": "^11.0.3", "@opentripplanner/endpoints-overlay": "^2.0.8", "@opentripplanner/from-to-location-picker": "^2.1.8", "@opentripplanner/geocoder": "^1.4.2", "@opentripplanner/humanize-distance": "^1.2.0", "@opentripplanner/icons": "^2.0.5", - "@opentripplanner/itinerary-body": "^5.0.5", - "@opentripplanner/location-field": "^2.0.7", + "@opentripplanner/itinerary-body": "^5.0.6", + "@opentripplanner/location-field": "^2.0.8", "@opentripplanner/location-icon": "^1.4.1", "@opentripplanner/map-popup": "^2.0.5", "@opentripplanner/otp2-tile-overlay": "^1.0.5", - "@opentripplanner/printable-itinerary": "2.0.10-alpha.4", "@opentripplanner/park-and-ride-overlay": "^2.0.6", + "@opentripplanner/printable-itinerary": "2.0.12", "@opentripplanner/route-viewer-overlay": "^2.0.13", "@opentripplanner/stop-viewer-overlay": "^2.0.6", "@opentripplanner/stops-overlay": "^5.1.1", @@ -132,7 +132,7 @@ "@craco/craco": "^6.3.0", "@jackwilsdon/craco-use-babelrc": "^1.0.0", "@opentripplanner/scripts": "^1.2.0", - "@opentripplanner/types": "^6.1.0", + "@opentripplanner/types": "^6.1.1", "@percy/cli": "^1.20.3", "@percy/puppeteer": "^2.0.2", "@pmmmwh/react-refresh-webpack-plugin": "^0.5.1", @@ -240,4 +240,4 @@ "percy-css": ".percy-hide { opacity: 0!important; } " } } -} \ No newline at end of file +} diff --git a/yarn.lock b/yarn.lock index d24a5c104..a5c8b7679 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2439,10 +2439,10 @@ lodash.isequal "^4.5.0" qs "^6.9.1" -"@opentripplanner/core-utils@^11.0.2": - version "11.0.2" - resolved "https://registry.yarnpkg.com/@opentripplanner/core-utils/-/core-utils-11.0.2.tgz#ebfa939c3b7b266e3bf47dcaddda88e093430a9d" - integrity sha512-3oQYvnhFHY88K61j2tUkU2fm8tDci5qaMVGEgqTzxpE5NmBTUdAWU1V7W9snJoRATzz3zy+K9qrtIhGjwbwlnA== +"@opentripplanner/core-utils@^11.0.3": + version "11.0.3" + resolved "https://registry.yarnpkg.com/@opentripplanner/core-utils/-/core-utils-11.0.3.tgz#b8aa21f81be420c07128e78c20a74d32d0034476" + integrity sha512-hTLZwU8YyokTA86tIa+iy46g0lqcjBX/HDxyzwxvbm6lFnUvUhHgWRPKvr8fzUA5aE0vYzwlj16WygQ43n4ubQ== dependencies: "@conveyal/lonlat" "^1.4.1" "@mapbox/polyline" "^1.1.0" @@ -2546,14 +2546,6 @@ resolved "https://registry.yarnpkg.com/@opentripplanner/humanize-distance/-/humanize-distance-1.2.0.tgz#71cf5d5d1b756adef15300edbba0995ccd4b35ee" integrity sha512-x0QRXMDhypFeazZ6r6vzrdU8vhiV56nZ/WX6zUbxpgp6T9Oclw0gwR2Zdw6DZiiFpSYVNeVNxVzZwsu6NRGjcA== -"@opentripplanner/icons@^2.0.1", "@opentripplanner/icons@^2.0.5": - version "2.0.5" - resolved "https://registry.yarnpkg.com/@opentripplanner/icons/-/icons-2.0.5.tgz#7274597e1d568b1d18861c36d9d4f77f4a6f82f3" - integrity sha512-0QIXsoGHK8c5Y2rFwKKfsDFTIL6NXuvTUtKDNH6qybkMDPc+IovswCdFjKLDvgR+7pmE5iEmhTvNBHvw/MZjig== - dependencies: - "@opentripplanner/core-utils" "^9.0.2" - prop-types "^15.7.2" - "@opentripplanner/icons@^2.0.3": version "2.0.3" resolved "https://registry.yarnpkg.com/@opentripplanner/icons/-/icons-2.0.3.tgz#c7c587f5b3b8ea050f50af3537e2e409d7258829" @@ -2570,14 +2562,22 @@ "@opentripplanner/core-utils" "^9.0.0" prop-types "^15.7.2" -"@opentripplanner/itinerary-body@^4.2.0-alpha.3": - version "4.2.0-alpha.4" - resolved "https://registry.yarnpkg.com/@opentripplanner/itinerary-body/-/itinerary-body-4.2.0-alpha.4.tgz#407dcab1e74bab536c4818d11d39cdc2ca7f1e21" - integrity sha512-zJX/Safz7ZKtW10T9aF5VIYDAhXR8pkD6EfdlHS42j+eiwlL2ISsjEHWZ8NxaqGPHpqFW2C3A8rOXcduFTLrTw== +"@opentripplanner/icons@^2.0.5": + version "2.0.5" + resolved "https://registry.yarnpkg.com/@opentripplanner/icons/-/icons-2.0.5.tgz#7274597e1d568b1d18861c36d9d4f77f4a6f82f3" + integrity sha512-0QIXsoGHK8c5Y2rFwKKfsDFTIL6NXuvTUtKDNH6qybkMDPc+IovswCdFjKLDvgR+7pmE5iEmhTvNBHvw/MZjig== dependencies: - "@opentripplanner/core-utils" "^8.2.1" + "@opentripplanner/core-utils" "^9.0.2" + prop-types "^15.7.2" + +"@opentripplanner/itinerary-body@^5.0.0": + version "5.0.5" + resolved "https://registry.yarnpkg.com/@opentripplanner/itinerary-body/-/itinerary-body-5.0.5.tgz#3038a910291e42d1a7ed3a03abcd8ecd32cd958e" + integrity sha512-58xn0cadRt7Vth8arjExZOt85KVESkqt9MKh2yqnMeXeSFMvP14/+jobgBRY+xsAh+EcLWPVBKq3ylas8npmEw== + dependencies: + "@opentripplanner/core-utils" "^9.0.2" "@opentripplanner/humanize-distance" "^1.2.0" - "@opentripplanner/icons" "^2.0.1" + "@opentripplanner/icons" "^2.0.4" "@opentripplanner/location-icon" "^1.4.1" "@styled-icons/fa-solid" "^10.34.0" "@styled-icons/foundation" "^10.34.0" @@ -2588,10 +2588,10 @@ react-resize-detector "^4.2.1" string-similarity "^4.0.4" -"@opentripplanner/itinerary-body@^5.0.0", "@opentripplanner/itinerary-body@^5.0.5": - version "5.0.5" - resolved "https://registry.yarnpkg.com/@opentripplanner/itinerary-body/-/itinerary-body-5.0.5.tgz#3038a910291e42d1a7ed3a03abcd8ecd32cd958e" - integrity sha512-58xn0cadRt7Vth8arjExZOt85KVESkqt9MKh2yqnMeXeSFMvP14/+jobgBRY+xsAh+EcLWPVBKq3ylas8npmEw== +"@opentripplanner/itinerary-body@^5.0.2", "@opentripplanner/itinerary-body@^5.0.6": + version "5.0.6" + resolved "https://registry.yarnpkg.com/@opentripplanner/itinerary-body/-/itinerary-body-5.0.6.tgz#33ad8c0dfa06702ed76ecbbd53974a1c0df8d21c" + integrity sha512-+9xDpo6HJrgOPyC2aOb6cw/Juimf0BBF9j3brSstJA9DIODp3cMsz39Iv35rETIory9R4wstEYFBwFzwE62I+g== dependencies: "@opentripplanner/core-utils" "^9.0.2" "@opentripplanner/humanize-distance" "^1.2.0" @@ -2606,10 +2606,10 @@ react-resize-detector "^4.2.1" string-similarity "^4.0.4" -"@opentripplanner/location-field@^2.0.7": - version "2.0.7" - resolved "https://registry.yarnpkg.com/@opentripplanner/location-field/-/location-field-2.0.7.tgz#a4479041c0c82d8f469076a47bc9874de2330efb" - integrity sha512-yexAnUk4CEnxDhAzTmA4rR4xF7aw18THFhdstf6Z7TdceVUxUdIFJv3Pa6A4IjudURN947hi6euuY+qUU0TBqw== +"@opentripplanner/location-field@^2.0.8": + version "2.0.8" + resolved "https://registry.yarnpkg.com/@opentripplanner/location-field/-/location-field-2.0.8.tgz#cf684a5dd902410378924b06434783f35c758c85" + integrity sha512-xmJJgdRsKBaiWSHdh8XDtyq+deuvn/QWgSh0Cab9/BlNlQGlodl1IF6j+faf+93zfmHbwXcl8ZZ/rdG1Z5fqLw== dependencies: "@conveyal/geocoder-arcgis-geojson" "^0.0.3" "@opentripplanner/core-utils" "^9.0.2" @@ -2662,13 +2662,13 @@ "@opentripplanner/base-map" "^3.0.13" "@opentripplanner/from-to-location-picker" "^2.1.7" -"@opentripplanner/printable-itinerary@2.0.10-alpha.4": - version "2.0.10-alpha.4" - resolved "https://registry.yarnpkg.com/@opentripplanner/printable-itinerary/-/printable-itinerary-2.0.10-alpha.4.tgz#c2debbb816346770e45968740b315d731858798c" - integrity sha512-vL/KTy5IDiUzhIRTBoliIP+FDVUeaUqEkOiYJ0aCvir/mm+xX80wqERsb9Z9THIpKT5rjx9s5Y6mZNE3sbtB6Q== +"@opentripplanner/printable-itinerary@2.0.12": + version "2.0.12" + resolved "https://registry.yarnpkg.com/@opentripplanner/printable-itinerary/-/printable-itinerary-2.0.12.tgz#1eb42d76e7a359660116bad77937ed3c4ccb2f26" + integrity sha512-gdlU5uDtcJioM1JqnA2USuvahYGpw6HolJEaCfyTMBT5PiChGf5dEX8tWV8F8c/YnlOyQJ/M3EMEtlN2iNxP5g== dependencies: - "@opentripplanner/core-utils" "^8.2.1" - "@opentripplanner/itinerary-body" "^4.2.0-alpha.3" + "@opentripplanner/core-utils" "^9.0.2" + "@opentripplanner/itinerary-body" "^5.0.2" "@opentripplanner/route-viewer-overlay@^2.0.13": version "2.0.13" @@ -2771,10 +2771,10 @@ "@opentripplanner/base-map" "^3.0.13" "@opentripplanner/core-utils" "^9.0.0" -"@opentripplanner/types@^6.1.0": - version "6.1.0" - resolved "https://registry.yarnpkg.com/@opentripplanner/types/-/types-6.1.0.tgz#dd5b88cc0b73939cd1eb5bd44d4768e21bedaacc" - integrity sha512-fFuNMJLrSCIoIWJ7VugM1Jb7HfIcRDzb8o2LNsASExWAEYDuONFxyGYT/98g82/70Grl8kCSMSAFi0lEiQ/cPQ== +"@opentripplanner/types@^6.1.1": + version "6.1.1" + resolved "https://registry.yarnpkg.com/@opentripplanner/types/-/types-6.1.1.tgz#ed28406d71b48d5299edc7ac884583d00917edc9" + integrity sha512-VNqWQI8hQfQQZQZFHrUbxGZzldNODMls3wXM9aawUJ7OJRjjmNOhkgTjohMcpvA3Ed3wUAkzOXByBQO3MTVH6Q== "@opentripplanner/vehicle-rental-overlay@^2.1.2": version "2.1.2" From 3afe67afa809b852148b41756df448164b425f65 Mon Sep 17 00:00:00 2001 From: miles-grant-ibigroup Date: Fri, 15 Sep 2023 14:26:24 -0400 Subject: [PATCH 5/6] update caniuse db --- yarn.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/yarn.lock b/yarn.lock index a5c8b7679..071239597 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5711,9 +5711,9 @@ caniuse-api@^3.0.0: lodash.uniq "^4.5.0" caniuse-lite@^1.0.0, caniuse-lite@^1.0.30000981, caniuse-lite@^1.0.30001109, caniuse-lite@^1.0.30001125, caniuse-lite@^1.0.30001251: - version "1.0.30001465" - resolved "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001465.tgz" - integrity sha512-HvjgL3MYAJjceTDCcjRnQGjwUz/5qec9n7JPOzUursUoOTIsYCSDOb1l7RsnZE8mjbxG78zVRCKfrBXyvChBag== + version "1.0.30001534" + resolved "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001534.tgz" + integrity sha512-vlPVrhsCS7XaSh2VvWluIQEzVhefrUQcEsQWSS5A5V+dM07uv1qHeQzAOTGIMy9i3e9bH15+muvI/UHojVgS/Q== capture-exit@^2.0.0: version "2.0.0" From 00426d037afcb19b727a8c7c2088905a43708178 Mon Sep 17 00:00:00 2001 From: miles-grant-ibigroup Date: Fri, 15 Sep 2023 14:27:35 -0400 Subject: [PATCH 6/6] address pr feedback --- lib/components/viewers/trip-viewer.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/components/viewers/trip-viewer.js b/lib/components/viewers/trip-viewer.js index 0c4991977..b76db43e1 100644 --- a/lib/components/viewers/trip-viewer.js +++ b/lib/components/viewers/trip-viewer.js @@ -140,7 +140,7 @@ class TripViewer extends Component { screenreader or keyboard nav, the departure, arrival, and stop viewer links are all accessible without having to go through all the stops not on the trip. */} - {fromIndex && ( + {fromIndex > -1 && (