Skip to content

Conversation

@VillePihlava
Copy link
Contributor

Proposed Changes

  • Add indoor routing to itinerarydetails, navigator, and map
  • Indoor routing features include:
    • New line color
    • Displaying metro entrance icons
      • Metro icon
      • Metro entrance letter icon
      • Wheelchair icon for wheelchair accessible entrances
    • Indoor route step markers on map
      • Clicking the step marker opens a popup that shows the indoor route
    • ItineraryDetails panel that can be opened to show indoor route
      • Icons showing vertical direction
      • Text that can show vertical transportation use type, vertical direction, or destination level for elevators
    • Indoor routing capability in stop and near you views (small range walk query is made in these based on current location)
    • Navigator changes to show indoor route
    • Improved navigator CSS layout
image

Copy link
Member

@vesameskanen vesameskanen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indoor step rendering is fragmented especially in NaviCardExtension and quite hard to follow. Would it be possible to move most required rendering code and logic to IndoorContainer class? So, move leg rendering would be something like:

if (showIndoorRoute) {
<IndoorContainer ...>
{ Steps.length === 1 && stopInformation() }
}

import { isKeyboardSelectionEvent } from '../../util/browser';
import Icon from '../Icon';

export default function IndoorRouteInfo(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In UI context, Route refers to transit lines such as tram 7 or bus 500. Users search itineraries, not routes. In finnish we have to share the word Reitti for many purposes but in code we can avoid that.

I have a feeling that dropping Route from the names would be good:

  • IndoorInfo
  • IndoorStep
  • IndoorSteps or IndoorLeg
  • navigator/IndoorButton

etc.

Comment on lines +27 to +41
const [defaultBackgroundImageUrl, setDefaultBackgroundImageUrl] = useState();
const [indoorBackgroundImageUrl, setIndoorBackgroundImageUrl] = useState();
useEffect(() => {
Promise.all([
import(
/* webpackChunkName: "dotted-line" */ `../../configurations/images/default/dotted-line.svg`
),
import(
/* webpackChunkName: "indoor-dotted-line" */ `../../configurations/images/default/indoor-dotted-line.svg`
),
]).then(([defaultImageUrl, insideImageUrl]) => {
setDefaultBackgroundImageUrl(`url(${defaultImageUrl.default})`);
setIndoorBackgroundImageUrl(`url(${insideImageUrl.default})`);
});
}, []);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This convention you copied from old code looks terrible. It really makes no sense to lazy load tiny svg snippets one by one, and the code is far too verbose and complicated. I believe it is possible to convert svg entry dynamically to css compatible form, or at least use one of the methods here:

https://www.svgbackgrounds.com/how-to-add-svgs-with-css-background-image/

Url approach still fetches images one by one but at least looks simple. Embedding the data as part of css is probably the best way.

import {
subwayTransferUsesSameStation,
getIndoorRouteLegType,
getIndoorStepsWithVerticalTransportationUse,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Somehow postfix 'Use' at the end does not help but makes things harder to understand.

Comment on lines +96 to +101
useEffect(() => {
// If there is only one indoor routing step, always show it.
if (indoorRouteSteps.length === 1) {
setShowIntermediateSteps(true);
}
}, [indoorRouteSteps]);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do not use this kind of effect. getIndoorStepsWithVerticalTransportationUse regenerates new array in each call and effect triggers at every render. I suggest initializing showIntermediateSteps state directly with one single call to getIndoorStepsWithVerticalTransportationUse.

) {
return getIndoorSteps(previousLeg, leg, nextLeg).filter(step =>
// eslint-disable-next-line no-underscore-dangle
isVerticalTransportationUse(step?.feature?.__typename),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it really possible that step list contains null entries? The same applies to step.feature - can it be null and what happens when rendering code gets such steps?

If so I suggest filtering invalid steps here so that the rest of the code can trust them.

}

export function getEntranceWheelchairAccessibility(leg) {
return leg?.steps?.find(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd expect leg is not null. Let the code crash if somebody does not know how to use this func.

Comment on lines +57 to +58
export function getEntranceObject(previousLeg, leg) {
const entranceObjects = leg?.steps
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

leg is not null, no need for ?

export function createFeatureObjects(objects) {
return objects.map(object => ({
type: 'Feature',
properties: { ...object.properties },
Copy link
Member

@vesameskanen vesameskanen Dec 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you copy the object?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants