Skip to content

Commit

Permalink
fix: mobile view fix
Browse files Browse the repository at this point in the history
  • Loading branch information
tekoiv committed Nov 6, 2023
1 parent 7b664c4 commit 96a915b
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 4 deletions.
14 changes: 14 additions & 0 deletions app/component/ItineraryLegs.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ class ItineraryLegs extends React.Component {
toggleCanceledLegsBanner: PropTypes.func.isRequired,
waitThreshold: PropTypes.number.isRequired,
focusToLeg: PropTypes.func,
changeHash: PropTypes.func,
tabIndex: PropTypes.number,
};

static defaultProps = {
Expand Down Expand Up @@ -230,6 +232,8 @@ class ItineraryLegs extends React.Component {
leg={leg}
interliningLegs={interliningLegs}
focusAction={this.focus(leg.from)}
changeHash={this.props.changeHash}
tabIndex={this.props.tabIndex}
/>,
);
} else if (leg.mode === 'TRAM' && !leg.interlineWithPreviousLeg) {
Expand All @@ -239,6 +243,8 @@ class ItineraryLegs extends React.Component {
leg={leg}
interliningLegs={interliningLegs}
focusAction={this.focus(leg.from)}
changeHash={this.props.changeHash}
tabIndex={this.props.tabIndex}
/>,
);
} else if (leg.mode === 'FERRY' && !leg.interlineWithPreviousLeg) {
Expand All @@ -248,6 +254,8 @@ class ItineraryLegs extends React.Component {
leg={leg}
interliningLegs={interliningLegs}
focusAction={this.focus(leg.from)}
changeHash={this.props.changeHash}
tabIndex={this.props.tabIndex}
/>,
);
} else if (leg.mode === 'FUNICULAR' && !leg.interlineWithPreviousLeg) {
Expand All @@ -257,6 +265,8 @@ class ItineraryLegs extends React.Component {
leg={leg}
interliningLegs={interliningLegs}
focusAction={this.focus(leg.from)}
changeHash={this.props.changeHash}
tabIndex={this.props.tabIndex}
/>,
);
} else if (leg.mode === 'RAIL' && !leg.interlineWithPreviousLeg) {
Expand All @@ -266,6 +276,8 @@ class ItineraryLegs extends React.Component {
leg={leg}
interliningLegs={interliningLegs}
focusAction={this.focus(leg.from)}
changeHash={this.props.changeHash}
tabIndex={this.props.tabIndex}
/>,
);
} else if (leg.mode === 'SUBWAY' && !leg.interlineWithPreviousLeg) {
Expand All @@ -275,6 +287,8 @@ class ItineraryLegs extends React.Component {
leg={leg}
interliningLegs={interliningLegs}
focusAction={this.focus(leg.from)}
changeHash={this.props.changeHash}
tabIndex={this.props.tabIndex}
/>,
);
} else if (leg.mode === 'AIRPLANE') {
Expand Down
3 changes: 3 additions & 0 deletions app/component/ItineraryTab.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ class ItineraryTab extends React.Component {
currentTime: PropTypes.number.isRequired,
hideTitle: PropTypes.bool,
currentLanguage: PropTypes.string,
changeHash: PropTypes.func,
};

static defaultProps = {
Expand Down Expand Up @@ -348,6 +349,8 @@ class ItineraryTab extends React.Component {
itinerary={itinerary}
focusToPoint={this.handleFocus}
focusToLeg={this.props.focusToLeg}
changeHash={this.props.changeHash}
tabIndex={suggestionIndex - 1}
/>
{config.showRouteInformation && <RouteInformation />}
</div>
Expand Down
13 changes: 12 additions & 1 deletion app/component/LegInfo.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ const LegInfo = (
alertSeverityLevel,
isAlternativeLeg,
displayTime,
changeHash,
tabIndex,
},
{ config, intl },
) => {
Expand Down Expand Up @@ -113,7 +115,14 @@ const LegInfo = (
closeButtonLabel="Close"
variant="small"
isOpen={capacityModalOpen}
onCrossClick={() => setCapacityModalOpen(false)}
onCrossClick={() => {
setCapacityModalOpen(false);
if (changeHash) {
setTimeout(() => {
changeHash(tabIndex);
}, 500);
}
}}
>
<CapacityModal config={config} />
</Modal>
Expand All @@ -129,6 +138,8 @@ LegInfo.propTypes = {
alertSeverityLevel: PropTypes.string,
isAlternativeLeg: PropTypes.bool.isRequired,
displayTime: PropTypes.bool.isRequired,
changeHash: PropTypes.func,
tabIndex: PropTypes.number,
};

LegInfo.contextTypes = {
Expand Down
2 changes: 2 additions & 0 deletions app/component/MobileItineraryWrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ const MobileItineraryWrapper = (props, context) => {
params={context.match.params}
focusToPoint={props.focusToPoint}
focusToLeg={props.focusToLeg}
changeHash={props.changeHash}
isMobile
/>
</div>
Expand Down Expand Up @@ -72,6 +73,7 @@ MobileItineraryWrapper.propTypes = {
plan: PropTypes.object,
serviceTimeRange: PropTypes.object.isRequired,
onSwipe: PropTypes.func,
changeHash: PropTypes.func,
};

MobileItineraryWrapper.contextTypes = {
Expand Down
1 change: 1 addition & 0 deletions app/component/SummaryPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -2732,6 +2732,7 @@ class SummaryPage extends React.Component {
serviceTimeRange={this.props.serviceTimeRange}
focusToLeg={this.focusToLeg}
onSwipe={this.changeHash}
changeHash={this.changeHash}
>
{this.props.content &&
combinedItineraries.map((itinerary, i) =>
Expand Down
4 changes: 4 additions & 0 deletions app/component/TransitLeg.js
Original file line number Diff line number Diff line change
Expand Up @@ -456,6 +456,8 @@ class TransitLeg extends React.Component {
alertSeverityLevel={alertSeverityLevel}
isAlternativeLeg={false}
displayTime={this.displayAlternativeLegs()}
changeHash={this.props.changeHash}
tabIndex={this.props.tabIndex}
/>

{this.state.showAlternativeLegs &&
Expand Down Expand Up @@ -695,6 +697,8 @@ TransitLeg.propTypes = {
children: PropTypes.node.isRequired,
lang: PropTypes.string.isRequired,
omitDivider: PropTypes.bool,
changeHash: PropTypes.func,
tabIndex: PropTypes.number,
};

TransitLeg.defaultProps = {
Expand Down
4 changes: 1 addition & 3 deletions app/component/departure.scss
Original file line number Diff line number Diff line change
Expand Up @@ -290,12 +290,10 @@
.capacity-icon-container {
padding-left: 7px;
margin-top: 15px;
cursor: pointer;
svg {
margin-top: 4px;
}
&:hover {
cursor: pointer;
}
}
}

Expand Down

0 comments on commit 96a915b

Please sign in to comment.