Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
67 commits
Select commit Hold shift + click to select a range
10a3f13
fix: location prop name for search
vesameskanen Nov 18, 2025
b4cc48d
Merge branch 'v3' into AB#74
vesameskanen Nov 27, 2025
5652a79
fix: remove unnecessary div with nonexistent style class
vesameskanen Nov 27, 2025
40c5a7b
chore: rename variables
vesameskanen Nov 27, 2025
dcaab48
chore: refactor DepartureRow
vesameskanen Nov 27, 2025
e9f1167
fix: use simple callback prop for capacity modal opening
vesameskanen Nov 27, 2025
754dc11
chore: remove useless prop
vesameskanen Nov 27, 2025
2c86889
chore: use consistently favourite (not favorite)
vesameskanen Nov 27, 2025
ca95d57
chore: rename more components
vesameskanen Nov 27, 2025
e35ab5e
fix: remove invalid param from executeAction
vesameskanen Nov 27, 2025
80003b3
fix: strange double expression
vesameskanen Nov 28, 2025
10e9de3
fix: various update bugs
vesameskanen Nov 28, 2025
4bc76ab
fix: NearYouFavouritesMapContainer props
vesameskanen Nov 28, 2025
09aec9e
fix: hundreds of relay warnings caused by missing vehicle rental stat…
vesameskanen Nov 28, 2025
2ce8c71
fix: favourite vehicle rental station prop name errors
vesameskanen Nov 28, 2025
15af1ea
chore: remove fake props
vesameskanen Nov 28, 2025
faf7995
fix: remove useless connection with 2 stores
vesameskanen Nov 28, 2025
857d32d
chore: remove unused prop
vesameskanen Nov 28, 2025
010b38d
chore: refactor StopNearYou
vesameskanen Nov 28, 2025
84cc123
chore: refactor VehicleRentalStationNearYou
vesameskanen Nov 28, 2025
4b79ac8
fix: remove unnecessary store connection from NearYouContainer
vesameskanen Nov 29, 2025
946c8df
fix: remove unnecessary store connections from NearYouMapContainer
vesameskanen Dec 2, 2025
8d6ed1f
fix: favouriteIds is required prop, code will crash without it
vesameskanen Dec 3, 2025
851095c
chore: refactor
vesameskanen Dec 3, 2025
a81847d
fix: wrong prop type for FavouritesMapContainer
vesameskanen Dec 3, 2025
2d2c101
fix: pass correct favouriteIds set prop to NearYouContainer
vesameskanen Dec 3, 2025
ddafa1b
chore: refactor and rename
vesameskanen Dec 3, 2025
9e58c51
fix: correct stopsNearYou prop type
vesameskanen Dec 3, 2025
2b66e85
feat: refactor NearYouContainer thoroughly
vesameskanen Dec 7, 2025
66c0ccc
chore: rename
vesameskanen Dec 8, 2025
0973d61
feat: move update button to sub component
vesameskanen Dec 8, 2025
b924aea
feat: move top level map rendering logic to a new component
vesameskanen Dec 9, 2025
004640a
chore: rename more
vesameskanen Dec 9, 2025
f630726
feat: move modal which asks initial location into new component
vesameskanen Dec 9, 2025
0709288
fix: give understandable names for the two search components
vesameskanen Dec 9, 2025
62a1f61
feat: move location search into sub component
vesameskanen Dec 10, 2025
7a1616d
chore: refactor searches more
vesameskanen Dec 10, 2025
e29e822
chore: refactor searches more
vesameskanen Dec 10, 2025
5809c76
feat: convert NearYouPage to function and refactor it
vesameskanen Dec 10, 2025
f73ff90
fix: update renamed props in map component, too
vesameskanen Dec 11, 2025
96de343
Merge branch 'v3' into AB#74-patch1
vesameskanen Dec 17, 2025
94aa516
fix: buggy LocationMarker key, remove unnecessary wrapper func
vesameskanen Dec 17, 2025
6ec7a3c
chore: refactor route and vehicle drawing on near you map
vesameskanen Dec 17, 2025
59919b6
chore: refactor near you map more
vesameskanen Dec 17, 2025
9cf8100
fix: remove unnecessary stop list conversion to another data type, re…
vesameskanen Dec 17, 2025
35ad0ee
fix: show vehicles on favourites near you map
vesameskanen Dec 17, 2025
5e85d29
fix: remove unused query fields and arguments from fav map container
vesameskanen Dec 18, 2025
0d72539
fix: remove triple code in favourite mapping
vesameskanen Dec 18, 2025
1b90286
fix: remove unncessary near youy map container query fields and argum…
vesameskanen Dec 18, 2025
453d70d
fix: remove strange relay.loadMore from near you map
vesameskanen Dec 18, 2025
d893c85
chore: simplify nearyou code more
vesameskanen Dec 23, 2025
b85aa68
feat: move city bike info to own component
vesameskanen Dec 23, 2025
4c32d91
fix: don't render 0
vesameskanen Dec 23, 2025
7fe3728
Merge branch 'v3' into AB#74-patch1
vesameskanen Dec 23, 2025
cc90356
fix: restore bike season
vesameskanen Dec 23, 2025
21fe5e1
fix: use standard severe alert color for low city bike capacity
vesameskanen Dec 29, 2025
b6f672c
fix: use color variable instead of hard coded value
vesameskanen Dec 29, 2025
49717c6
fix: favourites were available only in HSL itinerary page search
vesameskanen Dec 29, 2025
8db2885
feat: method which counts favourite locations
vesameskanen Dec 29, 2025
2a62c60
fix: add 'own locations' sub menu only if fav locations exist
vesameskanen Dec 29, 2025
e6eb980
chore: inherit config values from base config
vesameskanen Dec 29, 2025
8f6d80c
chore: refactor nearyou props
vesameskanen Dec 30, 2025
2f4ab0e
fix: refactor the insane prop spaghetti of near you buttons
vesameskanen Dec 30, 2025
b9f4497
feat: use refactored near you button component
vesameskanen Dec 30, 2025
24cb10d
fix: new bugs after refactoring
vesameskanen Dec 30, 2025
9420f61
chore: remove unused config
vesameskanen Dec 30, 2025
b28af44
fix: use nearyou consistently (no more nearbys)
vesameskanen Dec 30, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions app/component/DepartureRow.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export default function DepartureRow(
let backgroundShape;
let sr;
if (
route?.alerts?.filter(alert => isAlertValid(alert, props.currentTime))
route.alerts?.filter(alert => isAlertValid(alert, props.currentTime))
?.length > 0
) {
const alert = getMostSevereAlert(route);
Expand All @@ -72,7 +72,7 @@ export default function DepartureRow(
const headsign =
departure.headsign ||
trip.tripHeadsign ||
getHeadsignFromRouteLongName(trip.route);
getHeadsignFromRouteLongName(route);
let shownTime;
if (timeDiffInMinutes <= 0) {
shownTime = intl.formatMessage({
Expand All @@ -90,7 +90,7 @@ export default function DepartureRow(
{ minutes: timeDiffInMinutes },
);
}
const { shortName } = trip.route;
const { shortName } = route;
const lowerCaseShortName = shortName?.toLowerCase();
const nameOrIcon =
shortName?.length > 6 || !shortName?.length ? (
Expand Down Expand Up @@ -163,7 +163,7 @@ export default function DepartureRow(
className={cx('route-number-container', {
long: shortName && shortName.length <= 6 && shortName.length >= 5,
})}
style={{ backgroundColor: `#${trip.route.color}` }}
style={{ backgroundColor: `#${route.color}` }}
>
<div aria-hidden="true" className="route-number">
{nameOrIcon}
Expand All @@ -185,7 +185,7 @@ export default function DepartureRow(
</td>
<td className={cx('route-headsign', departure.bottomRow ? 'bottom' : '')}>
<div className="headsign">
{headsign} {departure.bottomRow && departure.bottomRow}
{headsign} {departure.bottomRow}
</div>
</td>
<td className="time-cell">
Expand Down
49 changes: 28 additions & 21 deletions app/component/IndexPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -229,49 +229,53 @@ class IndexPage extends React.Component {
const { intl, config } = this.context;
const { colors, fontWeights } = config;
const { lang } = this.props;
const transportModes = getTransportModes(config);
const nearYouModes = getNearYouModes(config);

// Styles are defined by which button type is configured (narrow/wide)
const narrowButtons = config.narrowNearYouButtons;
const modeTitles = filterObject(
transportModes,
'availableForSelection',
true,
);
// If nearYouModes is configured, display those. Otherwise, display all configured transport modes
const modes =
nearYouModes?.length > 0 ? nearYouModes : Object.keys(modeTitles);
const modeArray =
nearYouModes.length > 0
? nearYouModes
: Object.keys(
filterObject(
getTransportModes(config),
'availableForSelection',
true,
),
);

const alertsContext = {
currentTime: this.props.currentTime,
getModesWithAlerts,
feedIds: config.feedIds,
};

const directionProps = config.narrowNearYouButtons
? { modeSet: config.iconModeSet }
: {
buttonStyle: config.nearYouButton,
modeSet: config.nearYouModeSet,
horizontal: false,
};

return config.showNearYouButtons ? (
<CtrlPanel.NearStopsAndRoutes
modeArray={modes}
modeArray={modeArray}
urlPrefix={`/${PREFIX_NEARYOU}`}
language={lang}
showTitle
title={config.nearYouTitle}
alertsContext={alertsContext}
origin={this.props.origin}
omitLanguageUrl
onClick={this.clickStopNearIcon}
buttonStyle={narrowButtons ? undefined : config.nearYouButton}
title={narrowButtons ? undefined : config.nearYouTitle}
modes={narrowButtons ? undefined : modeTitles}
modeSet={config.nearbyModeSet || config.iconModeSet}
modeIconColors={colors.iconColors}
fontWeights={fontWeights}
{...directionProps}
/>
) : (
<div className="stops-near-you-text">
<h2>
{intl.formatMessage({
id: 'stop-near-you-title',
defaultMessage: 'Stops and lines near you',
id: 'near-you-search',
defaultMessage: 'Search stops and routes',
})}
</h2>
</div>
Expand All @@ -288,12 +292,15 @@ class IndexPage extends React.Component {
const { breakpoint, lang } = this.props;
const origin = this.pendingOrigin || this.props.origin;
const destination = this.pendingDestination || this.props.destination;
const locationSources = ['History', 'Datasource'];
const sources = ['Favourite', 'History', 'Datasource'];
const stopAndRouteSearchTargets = ['Stations', 'Stops', 'Routes'];
const targets = getLocationSearchTargets(config, breakpoint !== 'large');

targets.push('FutureRoutes');

if (this.context.getStore('FavouriteStore').getLocationCount()) {
locationSources.push('Favourite');
}
if (!config.targetsFromOTP) {
if (useCitybikes(config.vehicleRental?.networks, config)) {
stopAndRouteSearchTargets.push('VehicleRentalStations');
Expand All @@ -312,7 +319,7 @@ class IndexPage extends React.Component {
origin,
destination,
lang,
sources,
locationSources,
targets,
color,
hoverColor,
Expand Down
2 changes: 1 addition & 1 deletion app/component/itinerary/OriginDestinationBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ const connectedComponent = connectToStores(
['PreferencesStore', 'FavouriteStore', 'ViaPointStore', 'PositionStore'],
({ getStore }) => ({
language: getStore('PreferencesStore').getLanguage(),
showFavourites: getStore('FavouriteStore').getStatus() === 'has-data',
showFavourites: getStore('FavouriteStore').getLocationCount() > 0,
viaPoints: getStore('ViaPointStore').getViaPoints(),
locationState: getStore('PositionStore').getLocationState(),
}),
Expand Down
Loading
Loading