From af9f653f1d0dec934913ef1ec57fb42eeb995f42 Mon Sep 17 00:00:00 2001 From: binh-dam-ibigroup <56846598+binh-dam-ibigroup@users.noreply.github.com> Date: Fri, 9 Apr 2021 15:10:27 -0400 Subject: [PATCH] fix(actions/ui): Split ItineraryView hidden state. --- lib/actions/ui.js | 8 +++++--- lib/components/mobile/batch-results-screen.js | 9 ++++++--- lib/components/narrative/narrative-itineraries.js | 4 +++- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/lib/actions/ui.js b/lib/actions/ui.js index a435fe027..7379dfeee 100644 --- a/lib/actions/ui.js +++ b/lib/actions/ui.js @@ -243,12 +243,14 @@ export const ItineraryView = { DEFAULT: 'list', /** One itinerary is shown. (In mobile view, the map is hidden.) */ FULL: 'full', - /** Itinerary is hidden. (In mobile view, the map is expanded.) */ - HIDDEN: 'hidden', /** One itinerary is shown, itinerary and map are focused on a leg. (The mobile view is split.) */ LEG: 'leg', + /** One itinerary leg is hidden. (In mobile view, the map is expanded.) */ + LEG_HIDDEN: 'leg-hidden', /** The list of itineraries is shown. (The mobile view is split.) */ - LIST: 'list' + LIST: 'list', + /** The list of itineraries is hidden. (In mobile view, the map is expanded.) */ + LIST_HIDDEN: 'list-hidden' } /** diff --git a/lib/components/mobile/batch-results-screen.js b/lib/components/mobile/batch-results-screen.js index 45b505e20..da1750bb3 100644 --- a/lib/components/mobile/batch-results-screen.js +++ b/lib/components/mobile/batch-results-screen.js @@ -85,9 +85,12 @@ class BatchMobileResultsScreen extends Component { _toggleMapExpanded = () => { const { itineraryView, setItineraryView } = this.props - if (itineraryView !== ItineraryView.HIDDEN) { + if (itineraryView === ItineraryView.LEG) { this.setState({ previousSplitView: itineraryView }) - setItineraryView(ItineraryView.HIDDEN) + setItineraryView(ItineraryView.LEG_HIDDEN) + } else if (itineraryView === ItineraryView.LIST) { + this.setState({ previousSplitView: itineraryView }) + setItineraryView(ItineraryView.LIST_HIDDEN) } else { setItineraryView(this.state.previousSplitView) } @@ -96,7 +99,7 @@ class BatchMobileResultsScreen extends Component { render () { const { errors, itineraries, itineraryView } = this.props const hasErrorsAndNoResult = itineraries.length === 0 && errors.length > 0 - const mapExpanded = itineraryView === ItineraryView.HIDDEN + const mapExpanded = itineraryView === ItineraryView.LEG_HIDDEN || itineraryView === ItineraryView.LIST_HIDDEN const itineraryExpanded = itineraryView === ItineraryView.FULL return ( diff --git a/lib/components/narrative/narrative-itineraries.js b/lib/components/narrative/narrative-itineraries.js index 12beb7af9..cdcaec0ff 100644 --- a/lib/components/narrative/narrative-itineraries.js +++ b/lib/components/narrative/narrative-itineraries.js @@ -71,7 +71,9 @@ class NarrativeItineraries extends Component { _isShowingDetails = () => { const { itineraryView } = this.props - return itineraryView === ItineraryView.FULL || itineraryView === ItineraryView.LEG + return itineraryView === ItineraryView.FULL || + itineraryView === ItineraryView.LEG || + itineraryView === ItineraryView.LEG_HIDDEN } _toggleDetailedItinerary = () => {