Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
ea59c51
fix: add notificationid, trainid and stationid attribute
oterral Oct 30, 2025
6d7e5ee
fix: make lnp stations clickable
oterral Oct 30, 2025
7dd49a7
fix: better attributes description
oterral Oct 30, 2025
5cb314a
feat: add new search
oterral Oct 30, 2025
870eb00
feat: add trajectories search
oterral Oct 30, 2025
d4232fb
fix: add translations for search
oterral Oct 31, 2025
f367f34
fix: add translations for search
oterral Oct 31, 2025
787333c
fix: test if it exists
oterral Oct 31, 2025
a1323f5
fix: replace lnpid by lineid
oterral Nov 3, 2025
a8fb52b
fix: use mbt beta version with heading style
oterral Nov 3, 2025
564d720
fix: use mbt beta version with heading style
oterral Nov 3, 2025
728c132
fix: use mbt beta version with heading style
oterral Nov 3, 2025
4c86a57
fix: add icon props to input search
oterral Nov 3, 2025
02b8090
fix: add search context
oterral Nov 3, 2025
d691120
fix: use the same type everywhere
oterral Nov 4, 2025
b9f4bed
chore: fix typing
oterral Nov 4, 2025
b9a35d9
chore: fix typing
oterral Nov 4, 2025
a5abc69
chore: fix typing
oterral Nov 4, 2025
7ee60c8
chore: fix typing
oterral Nov 4, 2025
be5e7cb
fix: make search better configurable
oterral Nov 4, 2025
8c9f37b
fix: zoom when we load from station id
oterral Nov 4, 2025
3874cb8
fix: load station and zoom
oterral Nov 4, 2025
32493e1
fix: use ref to avoid rerender
oterral Nov 4, 2025
c87a140
fix: remove log
oterral Nov 4, 2025
c623593
fix: remove log
oterral Nov 4, 2025
c31d243
fix: use situationId
oterral Nov 5, 2025
2eefd0b
fix: up mbt
oterral Nov 7, 2025
66c0cc2
fix: make things more logical
oterral Nov 7, 2025
861566a
fix: up mbt
oterral Nov 7, 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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"jspdf": "^3.0.3",
"lodash.debounce": "^4.0.8",
"maplibre-gl": "^5.10.0",
"mobility-toolbox-js": "3.4.6",
"mobility-toolbox-js": "3.5.0",
"ol": "^10.6.1",
"preact": "^10.27.2",
"preact-custom-element": "^4.5.1",
Expand Down
9 changes: 6 additions & 3 deletions src/Departure/Departure.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ export interface DepartureProps {
}

function Departure({ departure, index, ...props }: DepartureProps) {
const { setStationId, setTrainId } = useMapContext();
const { realtimeLayer, setFeaturesInfos, setStationId, setTrainId } =
useMapContext();

const departureState = useMemo(() => {
return { departure, index };
Expand All @@ -23,10 +24,12 @@ function Departure({ departure, index, ...props }: DepartureProps) {
return (
<DepartureContext.Provider value={departureState}>
<button
className="w-full border-b"
className="w-full cursor-pointer border-b"
onClick={() => {
setTrainId(departure.train_id);
setFeaturesInfos(undefined);
setStationId();
realtimeLayer?.setVisible(true);
setTrainId(departure.train_id);
}}
{...props}
>
Expand Down
9 changes: 6 additions & 3 deletions src/FeatureDetails/FeatureDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ function FeatureDetails({ feature, featuresInfo, layer }: FeatureDetailsProps) {
const {
linesIds,
linesNetworkPlanLayer,
notificationId,
notificationsLayer,
realtimeLayer,
stationId,
Expand All @@ -50,9 +51,11 @@ function FeatureDetails({ feature, featuresInfo, layer }: FeatureDetailsProps) {
features={featuresInfo?.features || []}
/>
)}
{feature && !!notificationsLayer && layer === notificationsLayer && (
<NotificationDetails className={contentClassName} feature={feature} />
)}
{!!notificationsLayer &&
layer === notificationsLayer &&
notificationId && (
<NotificationDetails className={contentClassName} feature={feature} />
)}
</>
);
}
Expand Down
22 changes: 22 additions & 0 deletions src/FeaturesInfosListener/FeaturesInfosListener.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { useEffect } from "preact/hooks";

import { LNP_LINE_ID_PROP } from "../utils/constants";
import useMapContext from "../utils/hooks/useMapContext";

/**
Expand All @@ -9,7 +10,9 @@ function FeaturesInfosListener() {
const {
featuresInfos,
featuresInfosHovered,
linesNetworkPlanLayer,
realtimeLayer,
setLinesIds,
setSelectedFeature,
setSelectedFeatures,
setStationId,
Expand Down Expand Up @@ -37,6 +40,20 @@ function FeaturesInfosListener() {
return info.layer === stationsLayer;
})?.features || [];

// Find the line to highlight in the LNP layer
const linesFeatures =
featuresInfos?.find((featuresInfo) => {
return featuresInfo.layer === linesNetworkPlanLayer;
})?.features || [];

const linesIds = [
...new Set(
(linesFeatures || []).map((f) => {
return f.get(LNP_LINE_ID_PROP) as string;
}),
),
];

const features =
featuresInfos?.flatMap((info) => {
return info.features;
Expand All @@ -52,10 +69,15 @@ function FeaturesInfosListener() {
} else {
setSelectedFeatures(features);
setSelectedFeature(realtimeFeature || stationFeature || features[0]);
if (linesIds.length) {
setLinesIds(linesIds?.length ? linesIds : null);
}
}
}, [
featuresInfos,
linesNetworkPlanLayer,
realtimeLayer,
setLinesIds,
setSelectedFeature,
setSelectedFeatures,
setStationId,
Expand Down
16 changes: 12 additions & 4 deletions src/LayerTreeMenu/LayerTreeMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@ import { memo, useEffect, useMemo, useState } from "preact/compat";

import LayerTree from "../LayerTree";
import { SelectionType } from "../LayerTree/TreeItem";
import { LAYER_TREE_ORDER } from "../utils/constants";
import {
LAYER_TREE_HIDE_PROP,
LAYER_TREE_ORDER,
LAYER_TREE_TITLE_FUNC_PROP,
} from "../utils/constants";
import useLayersConfig from "../utils/hooks/useLayersConfig";
import useMapContext from "../utils/hooks/useMapContext";

Expand Down Expand Up @@ -39,7 +43,7 @@ const getConfigForLayer = (
layersConfig: Record<string, LayerConfig> = {},
): LayerTreeConfig => {
const defaultTitle = layersConfig[layer.get("name")]?.title || "";
const customTitleFunction = layer.get("layerTreeTitle");
const customTitleFunction = layer.get(LAYER_TREE_TITLE_FUNC_PROP);
let title = defaultTitle;
if (typeof customTitleFunction === "function") {
title = customTitleFunction(title);
Expand Down Expand Up @@ -78,8 +82,12 @@ function LayerTreeMenu({
.getArray()
.filter(
filter ??
(() => {
return true;
((layer) => {
return (
(layer.get(LAYER_TREE_HIDE_PROP) ||
layersConfig[layer.get("name")]?.[LAYER_TREE_HIDE_PROP]) !==
true
);
}),
)
.sort((a, b) => {
Expand Down
Loading