Skip to content

Commit 844f6a0

Browse files
committed
Revert "Reapply "Merge pull request #5464 from HSLdevcom/DT-6325""
This reverts commit 42508f8.
1 parent 5472de3 commit 844f6a0

File tree

4 files changed

+46
-53
lines changed

4 files changed

+46
-53
lines changed

app/component/DisruptionBanner.js

Lines changed: 32 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import PropTypes from 'prop-types';
22
import React from 'react';
3+
import { createFragmentContainer, graphql } from 'react-relay';
34
import connectToStores from 'fluxible-addons-react/connectToStores';
45
import isEmpty from 'lodash/isEmpty';
56
import { configShape, alertShape } from '../util/shapes';
@@ -109,13 +110,37 @@ class DisruptionBanner extends React.Component {
109110
}
110111
const DisruptionBannerWithBreakpoint = withBreakpoint(DisruptionBanner);
111112

112-
const containerComponent = connectToStores(
113-
DisruptionBannerWithBreakpoint,
114-
['TimeStore', 'PreferencesStore'],
115-
({ getStore }) => ({
116-
currentTime: getStore('TimeStore').getCurrentTime(),
117-
language: getStore('PreferencesStore').getLanguage(),
118-
}),
113+
const containerComponent = createFragmentContainer(
114+
connectToStores(
115+
DisruptionBannerWithBreakpoint,
116+
['TimeStore', 'PreferencesStore'],
117+
({ getStore }) => ({
118+
currentTime: getStore('TimeStore').getCurrentTime(),
119+
language: getStore('PreferencesStore').getLanguage(),
120+
}),
121+
),
122+
{
123+
alerts: graphql`
124+
fragment DisruptionBanner_alerts on Alert @relay(plural: true) {
125+
feed
126+
id
127+
alertSeverityLevel
128+
alertHeaderText
129+
alertEffect
130+
alertCause
131+
alertDescriptionText
132+
effectiveStartDate
133+
effectiveEndDate
134+
entities {
135+
__typename
136+
... on Route {
137+
mode
138+
shortName
139+
}
140+
}
141+
}
142+
`,
143+
},
119144
);
120145

121146
export { containerComponent as default, DisruptionBanner as Component };

app/component/map/NearYouMap.js

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -117,13 +117,7 @@ const handleBounds = (location, edges) => {
117117
};
118118

119119
const getLocationMarker = location => {
120-
return (
121-
<LocationMarker
122-
key={`from-${location.lat}:${location.lat}`}
123-
position={location}
124-
type="from"
125-
/>
126-
);
120+
return <LocationMarker position={location} type="from" />;
127121
};
128122

129123
function NearYouMap(

app/component/nearyou/NearYouPage.js

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import {
2222
checkPositioningPermission,
2323
startLocationWatch,
2424
} from '../../action/PositionActions';
25+
import DisruptionBanner from '../DisruptionBanner';
2526
import StopsNearYouSearch from './StopsNearYouSearch';
2627
import {
2728
getGeolocationState,
@@ -246,6 +247,7 @@ class NearYouPage extends React.Component {
246247
filterByModes: modes,
247248
filterByPlaceTypes: placeTypes,
248249
omitNonPickups: this.context.config.omitNonPickups,
250+
feedIds: this.context.config.feedIds,
249251
prioritizedStopIds: prioritizedStops,
250252
filterByNetwork: allowedNetworks,
251253
};
@@ -436,6 +438,7 @@ class NearYouPage extends React.Component {
436438
$maxResults: Int!
437439
$maxDistance: Int!
438440
$omitNonPickups: Boolean!
441+
$feedIds: [String!]
439442
$filterByNetwork: [String!]
440443
) {
441444
stopPatterns: viewer {
@@ -452,6 +455,9 @@ class NearYouPage extends React.Component {
452455
filterByNetwork: $filterByNetwork
453456
)
454457
}
458+
alerts: alerts(feeds: $feedIds, severityLevel: [SEVERE]) {
459+
...DisruptionBanner_alerts
460+
}
455461
}
456462
`}
457463
variables={this.getQueryVariables(nearByStopMode)}
@@ -476,6 +482,13 @@ class NearYouPage extends React.Component {
476482
config.prioritizedStopsNearYou[nearByStopMode.toLowerCase()];
477483
return (
478484
<div className="stops-near-you-page">
485+
{renderDisruptionBanner && (
486+
<DisruptionBanner
487+
alerts={(props && props.alerts) || []}
488+
mode={nearByStopMode}
489+
trafficNowLink={config.trafficNowLink}
490+
/>
491+
)}
479492
{renderSearch && (
480493
<StopsNearYouSearch
481494
mode={nearByStopMode}
@@ -610,8 +623,6 @@ class NearYouPage extends React.Component {
610623
stopPatterns={props.stopPatterns}
611624
position={this.state.searchPosition}
612625
withSeparator={!renderSearch}
613-
nearByStopMode={nearByStopMode}
614-
renderDisruptionBanner={renderDisruptionBanner}
615626
/>
616627
)}
617628
</div>

app/component/nearyou/StopsNearYouContainer.js

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ import CityBikeStopNearYou from './VehicleRentalStationNearYou';
1515
import Loading from '../Loading';
1616
import Icon from '../Icon';
1717
import { getDefaultNetworks } from '../../util/vehicleRentalUtils';
18-
import DisruptionBanner from '../DisruptionBanner';
1918

2019
class StopsNearYouContainer extends React.Component {
2120
static propTypes = {
@@ -34,15 +33,12 @@ class StopsNearYouContainer extends React.Component {
3433
}).isRequired,
3534
withSeparator: PropTypes.bool,
3635
prioritizedStops: PropTypes.arrayOf(PropTypes.string),
37-
nearByStopMode: PropTypes.string.isRequired,
38-
renderDisruptionBanner: PropTypes.bool,
3936
};
4037

4138
static defaultProps = {
4239
stopPatterns: undefined,
4340
withSeparator: false,
4441
prioritizedStops: undefined,
45-
renderDisruptionBanner: false,
4642
};
4743

4844
static contextTypes = {
@@ -258,23 +254,12 @@ class StopsNearYouContainer extends React.Component {
258254
/>
259255
);
260256
const stops = this.createNearbyStops().filter(e => e);
261-
const alerts = stops
262-
.flatMap(stop => stop.props.stop?.routes || [])
263-
.flatMap(route => route?.alerts || [])
264-
.filter(alert => alert.alertSeverityLevel === 'SEVERE');
265257
const noStopsFound =
266258
!stops.length &&
267259
this.state.refetches >= this.state.maxRefetches &&
268260
!this.state.isLoadingmoreStops;
269261
return (
270262
<>
271-
{this.props.renderDisruptionBanner && (
272-
<DisruptionBanner
273-
alerts={alerts || []}
274-
mode={this.props.nearByStopMode}
275-
trafficNowLink={this.context.config.trafficNowLink}
276-
/>
277-
)}
278263
{((!this.props.relay.hasMore() &&
279264
!stops.length &&
280265
!this.props.prioritizedStops?.length) ||
@@ -404,28 +389,6 @@ const refetchContainer = createPaginationContainer(
404389
) {
405390
scheduledArrival
406391
}
407-
routes {
408-
... on Route {
409-
alerts {
410-
feed
411-
id
412-
alertSeverityLevel
413-
alertHeaderText
414-
alertEffect
415-
alertCause
416-
alertDescriptionText
417-
effectiveStartDate
418-
effectiveEndDate
419-
entities {
420-
__typename
421-
... on Route {
422-
mode
423-
shortName
424-
}
425-
}
426-
}
427-
}
428-
}
429392
}
430393
}
431394
}

0 commit comments

Comments
 (0)