Skip to content

Commit b28af44

Browse files
committed
fix: use nearyou consistently (no more nearbys)
1 parent 9420f61 commit b28af44

File tree

8 files changed

+26
-26
lines changed

8 files changed

+26
-26
lines changed

app/component/IndexPage.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ class IndexPage extends React.Component {
252252
? { modeSet: config.iconModeSet }
253253
: {
254254
buttonStyle: config.nearYouButton,
255-
modeSet: config.nearbyModeSet,
255+
modeSet: config.nearYouModeSet,
256256
horizontal: false,
257257
};
258258

app/component/map/NearYouMap.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ import {
1717
changeRealTimeClientTopics,
1818
} from '../../action/realTimeClientAction';
1919
import {
20-
sortNearbyRentalStations,
21-
sortNearbyStops,
20+
sortNearYouRentalStations,
21+
sortNearYouStops,
2222
} from '../../util/sortUtils';
2323
import ItineraryLine from './ItineraryLine';
2424
import {
@@ -274,11 +274,11 @@ function NearYouMap(
274274
});
275275
sortedEdges = filteredCityBikeEdges
276276
.slice()
277-
.sort(sortNearbyRentalStations(favouriteIds));
277+
.sort(sortNearYouRentalStations(favouriteIds));
278278
} else {
279279
sortedEdges = stops.nearest.edges
280280
.slice()
281-
.sort(sortNearbyStops(favouriteIds, walkRoutingThreshold));
281+
.sort(sortNearYouStops(favouriteIds, walkRoutingThreshold));
282282
}
283283

284284
sortedEdges.unshift(

app/component/nearyou/NearYouContainer.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ import { configShape, relayShape } from '../../util/shapes';
66
import StopNearYouContainer from './StopNearYouContainer';
77
import withBreakpoint from '../../util/withBreakpoint';
88
import {
9-
sortNearbyRentalStations,
10-
sortNearbyStops,
9+
sortNearYouRentalStations,
10+
sortNearYouStops,
1111
} from '../../util/sortUtils';
1212
import VehicleRentalStationNearYou from './VehicleRentalStationNearYou';
1313
import Loading from '../Loading';
@@ -76,7 +76,7 @@ function NearYouContainer(
7676
const fetchMore =
7777
edges.filter(
7878
stop => !(stop.node.place.stoptimesWithoutPatterns?.length === 0),
79-
).length < 5 && refetches.current < config.maxNearbyStopRefetches;
79+
).length < 5 && refetches.current < config.maxNearYouStopRefetches;
8080
if (fetchMore) {
8181
showMore(true);
8282
}
@@ -95,7 +95,7 @@ function NearYouContainer(
9595
loadingDone();
9696
}, []);
9797

98-
const createNearbyStops = () => {
98+
const createNearYouStops = () => {
9999
if (!places?.nearest) {
100100
return [];
101101
}
@@ -114,12 +114,12 @@ function NearYouContainer(
114114
});
115115
sorted = filteredCityBikeStopEdges
116116
.slice(0, 5)
117-
.sort(sortNearbyRentalStations(favouriteIds));
117+
.sort(sortNearYouRentalStations(favouriteIds));
118118
sorted.push(...filteredCityBikeStopEdges.slice(5));
119119
} else {
120120
sorted = edges
121121
.slice(0, 5)
122-
.sort(sortNearbyStops(favouriteIds, walkRoutingThreshold));
122+
.sort(sortNearYouStops(favouriteIds, walkRoutingThreshold));
123123
sorted.push(...edges.slice(5));
124124
}
125125

@@ -158,13 +158,13 @@ function NearYouContainer(
158158
return stops;
159159
};
160160

161-
const stops = createNearbyStops();
161+
const stops = createNearYouStops();
162162
const alerts = stops
163163
.flatMap(stop => stop?.props?.stop?.routes || [])
164164
.flatMap(route => route?.alerts || [])
165165
.filter(alert => alert.alertSeverityLevel === 'SEVERE');
166166
const noStopsFound =
167-
!stops.length && refetches >= config.maxNearbyStopRefetches && !loading;
167+
!stops.length && refetches >= config.maxNearYouStopRefetches && !loading;
168168
return (
169169
<>
170170
{renderDisruptionBanner && (

app/component/nearyou/NearYouPage.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -193,8 +193,8 @@ function NearYouPage(
193193
lat: searchPosition.lat,
194194
lon: searchPosition.lon,
195195
maxResults: 10,
196-
first: config.maxNearbyStopAmount,
197-
maxDistance: config.maxNearbyStopDistance[queryMode.toLowerCase()],
196+
first: config.maxNearYouStopAmount,
197+
maxDistance: config.maxNearYouStopDistance[queryMode.toLowerCase()],
198198
filterByModes: qModes,
199199
filterByPlaceTypes: placeTypes,
200200
omitNonPickups: config.omitNonPickups,

app/configurations/config.default.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -163,15 +163,15 @@ export default {
163163
minimalRegexp: /.{2,}/,
164164
},
165165

166-
nearbyRoutes: {
166+
nearYouRoutes: {
167167
radius: 10000,
168168
bucketSize: 1000,
169169
},
170170

171171
omitNonPickups: true,
172-
maxNearbyStopAmount: 5,
173-
maxNearbyStopRefetches: 5,
174-
maxNearbyStopDistance: {
172+
maxNearYouStopAmount: 5,
173+
maxNearYouStopRefetches: 5,
174+
maxNearYouStopDistance: {
175175
favorite: 20000,
176176
bus: 50000,
177177
tram: 20000,
@@ -344,7 +344,7 @@ export default {
344344
sv: 'Köp ett abonnemang för en dag, en vecka eller för en hel säsong',
345345
en: 'Buy a daily, weekly or season pass',
346346
},
347-
maxNearbyRentalVehicleAmount: 5,
347+
maxNearYouRentalVehicleAmount: 5,
348348
maxDistanceToRentalVehiclesInMeters: 100,
349349
maxMinutesToRentalJourneyStart: 60,
350350
maxMinutesToRentalJourneyEnd: 720,

app/configurations/config.hsl.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ export default {
108108
loginAnalyticsEventName: 'user-hsl-id',
109109
loginAnalyticsKey: 'hsl-id',
110110

111-
nearbyRoutes: {
111+
nearYouRoutes: {
112112
radius: 500,
113113
bucketSize: 100,
114114
},
@@ -335,7 +335,7 @@ export default {
335335
en: 'HSL',
336336
},
337337

338-
maxNearbyStopDistance: {
338+
maxNearYouStopDistance: {
339339
favorite: 20000,
340340
bus: 20000,
341341
tram: 20000,

app/configurations/config.waltti.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,8 @@ export default {
123123
en: 'Timetables and routes',
124124
},
125125
nearYouModes: ['bus'],
126-
nearbyModeSet: 'waltti',
127-
maxNearbyStopDistance: {
126+
nearYouModeSet: 'waltti',
127+
maxNearYouStopDistance: {
128128
bus: 30000,
129129
tram: 30000,
130130
rail: 50000,

app/util/sortUtils.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*
44
* @param {Set} favouriteRentalStationsIds stationIds of favourite bike rental stations.
55
*/
6-
export const sortNearbyRentalStations = favouriteRentalStationsIds => {
6+
export const sortNearYouRentalStations = favouriteRentalStationsIds => {
77
return (first, second) => {
88
const firstIsClose = first.node.distance < 1500;
99
const secondIsClose = second.node.distance < 1500;
@@ -29,7 +29,7 @@ export const sortNearbyRentalStations = favouriteRentalStationsIds => {
2929
* @param {Set} favouriteStopIds gtfsIds of favourite stops and stations.
3030
* @param distanceThreshold maximum distance with which the stops are priorized
3131
*/
32-
export const sortNearbyStops = (favouriteStopIds, distanceThreshold) => {
32+
export const sortNearYouStops = (favouriteStopIds, distanceThreshold) => {
3333
return (first, second) => {
3434
const firstStopOrStationId = first.node.place.gtfsId;
3535
const firstStopOrStationIsClose = first.node.distance < distanceThreshold;

0 commit comments

Comments
 (0)