From 2d81d303a44c2f8137fa4872f1865065c4595891 Mon Sep 17 00:00:00 2001
From: binh-dam-ibigroup <56846598+binh-dam-ibigroup@users.noreply.github.com>
Date: Thu, 23 Apr 2020 16:39:27 -0400
Subject: [PATCH 01/21] refactor(line-itin/itinerary.css): Remove unused file
from before merge.
---
.../narrative/line-itin/itinerary.css | 375 ------------------
1 file changed, 375 deletions(-)
delete mode 100644 lib/components/narrative/line-itin/itinerary.css
diff --git a/lib/components/narrative/line-itin/itinerary.css b/lib/components/narrative/line-itin/itinerary.css
deleted file mode 100644
index 89df3acf0..000000000
--- a/lib/components/narrative/line-itin/itinerary.css
+++ /dev/null
@@ -1,375 +0,0 @@
-.otp .options.profile .itin-body .place-row {
- margin-left: 55px;
-}
-
-.otp .line-itin {
- margin-bottom: 20px;
-}
-
-/* Itinerary summary */
-
-.otp .line-itin .itin-summary {
- padding-right: 5px;
- height: 60px;
- display: table;
- width: 100%;
- margin-bottom: 15px;
-}
-
-.otp .desktop-narrative-container .options.itinerary .line-itin .itin-summary {
- display: none;
-}
-
-.otp .line-itin .itin-summary .details {
- display: table-cell;
- vertical-align: top;
-}
-
-.otp .line-itin .itin-summary .header {
- font-weight: bold;
- font-size: 18px;
- margin-top: -3px;
-}
-
-.otp .line-itin .itin-summary .detail {
- font-size: 13px;
- color: #999999;
-}
-
-.otp .line-itin .itin-summary .routes {
- display: table-cell;
- text-align: right;
-}
-
-.otp .line-itin .itin-summary .routes .route-preview {
- display: inline-block;
- margin-left: 8px;
- vertical-align: top;
-}
-
-.otp .line-itin .itin-summary .routes .route-preview .mode-icon {
- height: 30px;
- width: 30px;
-}
-
-.otp .line-itin .itin-summary .routes .route-preview .short-name {
- color: white;
- font-weight: 500;
- text-align: center;
- margin-top: 6px;
- font-size: 15px;
- padding-top: 2px;
- text-overflow: ellipsis;
- white-space: nowrap;
- overflow: hidden;
- width: 30px;
- height: 30px;
- border-radius: 15px;
- border: 2px solid white;
- box-shadow: 0 0 0.5em #000;
-}
-
-/* Itinerary main body */
-
-.otp .line-itin .itin-body {
- padding: 20px 0px;
-}
-
-.otp .line-itin .place-row {
- display: table;
- width: 100%;
-}
-
-
-/* Departure/arrival time (1st column in table) */
-
-.otp .line-itin .time {
- display: table-cell;
- width: 60px;
- font-size: 14px;
- color: #999999;
- text-align: right;
- padding-right: 4px;
- padding-top: 1px;
- vertical-align: top;
-}
-
-/* The place icon and line itself (2nd column in table) */
-.otp .line-itin .line-container {
- position: relative;
- display: table-cell;
- width: 20px;
- max-width: 20px;
-}
-
-.otp .line-itin .place-icon-group {
- position: absolute;
- font-size: 18px;
- left: -8px;
- top: -7px;
- z-index: 20;
-}
-
-.otp .line-itin .leg-line {
- position: absolute;
- top: 11px;
- bottom: -11px;
- z-index: 10;
-}
-
-// Internet explorer specific media query to apply the below styling to fix
-// rendering issues with table cell display with undefined heights.
-/*@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) {
- .otp .line-itin .line-container {
- overflow: hidden; // hack for IE to render table cell correctly.
- }
-
- .otp .line-itin .leg-line {
- height: 1000px; // hack for IE to render table cell correctly.
- }
-}*/
-
-.otp .line-itin .leg-line-walk {
- left: 6px;
- right: 6px;
- background: radial-gradient(ellipse at center, #87cefa 40%, transparent 10%);
- background-size: 12px 12px;
- background-repeat: repeat-y;
- background-position: center -5px;
-}
-
-.otp .line-itin .leg-line-bicycle {
- left: 7.5px;
- right: 7.5px;
- background: repeating-linear-gradient(
- 0deg,
- red,
- red 8px,
- white 8px,
- white 12.5px
- );
-}
-
-.otp .line-itin .leg-line-car {
- left: 7.5px;
- right: 7.5px;
- background: repeating-linear-gradient(
- 0deg,
- grey,
- grey 8px,
- white 8px,
- white 12.5px
- );
-}
-
-.otp .line-itin .leg-line-micromobility {
- left: 7.5px;
- right: 7.5px;
- background: repeating-linear-gradient(
- 0deg,
- #f5a729,
- #f5a729 8px,
- white 8px,
- white 12.5px
- );
-}
-
-.otp .line-itin .leg-line-transit {
- left: 5px;
- right: 5px;
- background-color: gray;
-}
-
-/* Place/Leg details (3rd column in table) */
-
-.otp .line-itin .place-details {
- font-size: 13px;
- display: table-cell;
- padding-top: 1px;
-}
-
-.otp .line-itin .place-name {
- font-size: 18px;
- line-height: 20px;
- padding-left: 4px;
- font-weight: 500;
- color: black;
-}
-
-.otp .line-itin .place-subheader {
- font-size: 12px;
- padding-left: 4px;
- padding-top: 1px;
- font-weight: 300;
- color: gray;
-}
-
-.otp .line-itin .interline-dot {
- position: relative;
- float: left;
- margin-left: -13.5px;
- z-index: 25;
- color: #fff;
-}
-
-.otp .line-itin .interline-name {
- font-size: 14px;
- font-weight: 400;
- line-height: 16px;
-}
-
-/* Leg body general */
-
-.otp .line-itin .leg-body {
- padding: 12px 0px 18px 4px;
- font-size: 13px;
- color: #999999;
-}
-
-.otp .line-itin .summary {
- cursor: pointer;
-}
-
-.otp .line-itin .leg-body .icon {
- height: 24px;
- width: 24px;
- float: left;
- margin-right: 6px;
-}
-
-.otp .line-itin .leg-body .leg-description {
- display: table;
-}
-
-.otp .line-itin .leg-body .leg-description > div {
- display: table-cell;
- vertical-align: middle;
-}
-
-/* Leg steps (for turn-by-turn) */
-
-.otp .line-itin .leg-body .steps-header {
- font-size: 13px;
- margin-top: 10px;
- color: #999999;
- font-style: normal;
- display: inline-block;
-}
-
-.otp .line-itin .leg-body .step-row {
- font-size: 13px;
- margin-top: 8px;
- color: #999999;
- font-style: normal;
-}
-
-/* Transit leg details */
-
-.otp .line-itin .leg-body .route-name {
- color: #999999;
- margin-top: 5px;
-}
-
-.otp .line-itin .leg-body .route-short-name {
- display: inline-block;
- background-color: #0f6aac;
- padding-top: 1px;
- color: white;
- font-weight: 500;
- font-size: 14px;
- margin-right: 6px;
- text-align: center;
- width: 24px;
- height: 24px;
- border-radius: 12px;
- border: 1px solid white;
- box-shadow: 0 0 0.25em #000;
- margin-right: 8px;
-}
-
-.otp .line-itin .leg-body .route-long-name {
- font-size: 13px;
- line-height: 16px;
- font-weight: 500;
-}
-
-.otp .line-itin .leg-body .transit-leg-details {
- margin-top: 5px;
-}
-
-.otp .line-itin .leg-body .agency-info {
- margin-top: 5px;
-
-}
-
-.otp .line-itin .leg-body .transit-leg-details .header {
- cursor: pointer;
- color: #999999;
- font-size: 13px;
-}
-
-/* Intermediate stops */
-
-.otp .line-itin .leg-body .transit-leg-details .intermediate-stops .stop-row {
- z-index: 30;
- position: relative;
-}
-
-.otp .line-itin .leg-body .transit-leg-details .intermediate-stops .stop-marker {
- float: left;
- margin-left: -17px;
- color: white;
-}
-
-.otp .line-itin .leg-body .transit-leg-details .intermediate-stops .stop-name {
- color: #999999;
- font-size: 14px;
- margin-top: 3px;
-}
-
-/* Transit alerts */
-
-.otp .line-itin .leg-body .transit-alerts-toggle {
- display: inline-block;
- margin-top: 8px;
- color: #D14727;
- font-weight: 400;
- cursor: pointer;
-}
-
-.otp .line-itin .leg-body .transit-alerts {
- margin-top: 3px;
-}
-
-.otp .line-itin .leg-body .transit-alerts .transit-alert {
- margin-top: 5px;
- background-color: #eee;
- padding: 8px;
- color: black;
- border-radius: 4px;
-}
-
-.otp .line-itin .leg-body .transit-alerts .transit-alert .alert-icon {
- float: left;
- font-size: 18px;
-}
-
-.otp .line-itin .leg-body .transit-alerts .transit-alert .alert-header {
- font-size: 14px;
- margin-left: 30px;
- font-weight: 600;
-}
-
-.otp .line-itin .leg-body .transit-alerts .transit-alert .alert-body {
- font-size: 12px;
- margin-left: 30px;
- /* white space pre-wrap is required to render line breaks correctly. */
- white-space: pre-wrap;
-}
-
-.otp .line-itin .leg-body .transit-alerts .transit-alert .effective-date {
- margin-top: 5px;
- margin-left: 30px;
- font-size: 12px;
- font-style: italic;
-}
From 16dcedf417dc0e847078f85b27ec0bb480340930 Mon Sep 17 00:00:00 2001
From: binh-dam-ibigroup <56846598+binh-dam-ibigroup@users.noreply.github.com>
Date: Fri, 24 Apr 2020 10:27:16 -0400
Subject: [PATCH 02/21] fix(lib/index): Should not have removed LineItinerary
from lib/index.
---
lib/index.js | 2 ++
1 file changed, 2 insertions(+)
diff --git a/lib/index.js b/lib/index.js
index 5fb277044..4ed9f8b55 100644
--- a/lib/index.js
+++ b/lib/index.js
@@ -23,6 +23,7 @@ import SimpleRealtimeAnnotation from './components/narrative/simple-realtime-ann
import TransportationNetworkCompanyLeg from './components/narrative/default/tnc-leg'
import TripDetails from './components/narrative/connected-trip-details'
import TripTools from './components/narrative/trip-tools'
+import LineItinerary from './components/narrative/line-itin/line-itinerary'
import MobileMain from './components/mobile/main'
@@ -66,6 +67,7 @@ export {
// narrative components
LegDiagramPreview,
+ LineItinerary,
NarrativeItineraries,
NarrativeItinerary,
NarrativeRoutingResults,
From 4aeb8230f50b873fd27bcfc092f0fd5c0f7403c4 Mon Sep 17 00:00:00 2001
From: binh-dam-ibigroup <56846598+binh-dam-ibigroup@users.noreply.github.com>
Date: Thu, 30 Apr 2020 12:24:03 -0400
Subject: [PATCH 03/21] refactor(print-layout): Extract LegIcon (and ModeIcon)
props to example.js.
---
example.js | 3 +++
lib/components/app/print-layout.js | 22 +++-------------------
2 files changed, 6 insertions(+), 19 deletions(-)
diff --git a/example.js b/example.js
index 72f5ac230..d26a0d28f 100644
--- a/example.js
+++ b/example.js
@@ -1,5 +1,6 @@
// import this polyfill in order to make webapp compatible with IE 11
import 'es6-math'
+import { TriMetModeIcon, TriMetLegIcon } from '@opentripplanner/icons'
import { createHashHistory } from 'history'
import { connectRouter, routerMiddleware } from 'connected-react-router'
@@ -98,6 +99,8 @@ class OtpRRExample extends Component {
Invalid mobile screen
diff --git a/lib/components/mobile/results-screen.js b/lib/components/mobile/results-screen.js index e62aa0a7c..aa938b3c1 100644 --- a/lib/components/mobile/results-screen.js +++ b/lib/components/mobile/results-screen.js @@ -95,7 +95,7 @@ class MobileResultsScreen extends Component { _toggleRealtime = () => this.props.setUseRealtimeResponse({useRealtime: !this.props.useRealtime}) render () { - const { error, icons, itineraryClass, itineraryFooter, query, realtimeEffects, resultCount, useRealtime, activeItineraryIndex } = this.props + const { error, icons, itineraryClass, itineraryFooter, LegIcon, query, realtimeEffects, resultCount, useRealtime, activeItineraryIndex } = this.props const { expanded } = this.state const narrativeContainerStyle = expanded @@ -205,6 +205,7 @@ class MobileResultsScreen extends Component { expanded={this.state.expanded} onClick={this._optionClicked} showRealtimeAnnotation={showRealtimeAnnotation} + LegIcon={LegIcon} customIcons={icons} /> From 8de95a181f68d1ea81914a1a8c0c8c37d3f54480 Mon Sep 17 00:00:00 2001 From: binh-dam-ibigroup <56846598+binh-dam-ibigroup@users.noreply.github.com> Date: Thu, 30 Apr 2020 17:14:18 -0400 Subject: [PATCH 07/21] refactor(default-itinerary): Extract LegIcon prop from DefaultItineary. --- lib/components/narrative/default/default-itinerary.js | 4 +++- lib/components/narrative/default/itinerary-details.js | 6 ++++-- lib/components/narrative/default/itinerary-summary.js | 9 ++++----- lib/components/narrative/default/transit-leg.js | 8 ++++---- lib/components/narrative/line-itin/line-itinerary.js | 3 +-- 5 files changed, 16 insertions(+), 14 deletions(-) diff --git a/lib/components/narrative/default/default-itinerary.js b/lib/components/narrative/default/default-itinerary.js index efc740c3a..fcbeca04a 100644 --- a/lib/components/narrative/default/default-itinerary.js +++ b/lib/components/narrative/default/default-itinerary.js @@ -18,6 +18,7 @@ export default class DefaultItinerary extends NarrativeItinerary { expanded, index, itinerary, + LegIcon, setActiveLeg, setActiveStep } = this.props @@ -30,7 +31,7 @@ export default class DefaultItinerary extends NarrativeItinerary { Itinerary {index + 1}{' '} {formatDuration(itinerary.duration)}{' '} {formatTime(itinerary.startTime)}—{formatTime(itinerary.endTime)} -Invalid mobile screen
diff --git a/lib/components/mobile/results-screen.js b/lib/components/mobile/results-screen.js index aa938b3c1..007983ebb 100644 --- a/lib/components/mobile/results-screen.js +++ b/lib/components/mobile/results-screen.js @@ -95,7 +95,7 @@ class MobileResultsScreen extends Component { _toggleRealtime = () => this.props.setUseRealtimeResponse({useRealtime: !this.props.useRealtime}) render () { - const { error, icons, itineraryClass, itineraryFooter, LegIcon, query, realtimeEffects, resultCount, useRealtime, activeItineraryIndex } = this.props + const { error, itineraryClass, itineraryFooter, LegIcon, query, realtimeEffects, resultCount, useRealtime, activeItineraryIndex } = this.props const { expanded } = this.state const narrativeContainerStyle = expanded @@ -206,7 +206,6 @@ class MobileResultsScreen extends Component { onClick={this._optionClicked} showRealtimeAnnotation={showRealtimeAnnotation} LegIcon={LegIcon} - customIcons={icons} />Invalid mobile screen
} diff --git a/lib/components/mobile/results-screen.js b/lib/components/mobile/results-screen.js index 007983ebb..3c6b76917 100644 --- a/lib/components/mobile/results-screen.js +++ b/lib/components/mobile/results-screen.js @@ -95,7 +95,17 @@ class MobileResultsScreen extends Component { _toggleRealtime = () => this.props.setUseRealtimeResponse({useRealtime: !this.props.useRealtime}) render () { - const { error, itineraryClass, itineraryFooter, LegIcon, query, realtimeEffects, resultCount, useRealtime, activeItineraryIndex } = this.props + const { + error, + itineraryClass, + itineraryFooter, + LegIcon, + query, + realtimeEffects, + resultCount, + useRealtime, + activeItineraryIndex + } = this.props const { expanded } = this.state const narrativeContainerStyle = expanded From 9219719bac7f92f1d7ead440e50f9e218947b3d5 Mon Sep 17 00:00:00 2001 From: binh-dam-ibigroup <56846598+binh-dam-ibigroup@users.noreply.github.com> Date: Mon, 11 May 2020 15:45:50 -0400 Subject: [PATCH 14/21] refactor(package): Upgrade @opentripplanner packages. Update example.js examples. --- example.js | 59 ++++++++++++-- package.json | 40 +++++----- yarn.lock | 220 +++++++++++++++++++++++++-------------------------- 3 files changed, 182 insertions(+), 137 deletions(-) diff --git a/example.js b/example.js index b70e95a32..0dd37c00c 100644 --- a/example.js +++ b/example.js @@ -1,6 +1,16 @@ // import this polyfill in order to make webapp compatible with IE 11 import 'es6-math' -import { AerialTram, Ferry, TriMetModeIcon, TriMetLegIcon } from '@opentripplanner/icons' + +// The commented imports below are used in the custom icons example. +import { + // ClassicBus, + // ClassicGondola, + ClassicLegIcon, + ClassicModeIcon, + // Ferry, + // LegIcon, + // StandardGondola +} from '@opentripplanner/icons' import { createHashHistory } from 'history' import { connectRouter, routerMiddleware } from 'connected-react-router' @@ -28,21 +38,56 @@ import { import otpConfig from './config.yml' // Define icon sets for modes. -const MyLegIcon = TriMetLegIcon -const MyModeIcon = TriMetModeIcon +const MyLegIcon = ClassicLegIcon +const MyModeIcon = ClassicModeIcon + /** * For testing, try uncommenting the following two statements (and comment the two above), * and see how the icons get changed in: * - the mode options panel (select transit, bike+transit, etc.) * - the itinerary narrative (step-by-step directions). - * - * For more advanced testing, you can replicate and customize components and observe the change in icons. - * - For LegIcon: https://github.com/opentripplanner/otp-ui/blob/master/packages/icons/src/trimet-leg-icon.js - * - For ModeIcon: https://github.com/opentripplanner/otp-ui/blob/master/packages/icons/src/trimet-mode-icon.js */ // const MyLegIcon = () =>