@geops/rvf-mobility-web-component 0.1.46 → 0.1.47
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.prettierrc.js +3 -1
- package/CHANGELOG.md +12 -0
- package/README.md +1 -1
- package/doc/package.json +4 -3
- package/doc/postcss.config.mjs +1 -1
- package/doc/src/app/components/GeopsMobilityDoc.tsx +13 -224
- package/doc/src/app/components/GeopsMobilitySearchDoc.tsx +11 -107
- package/doc/src/app/components/WebComponentDoc.tsx +45 -56
- package/doc/src/app/geops-mobility/page.tsx +7 -2
- package/doc/src/app/geops-mobility-search/page.tsx +6 -2
- package/doc/src/app/globals.css +47 -27
- package/doc/src/app/layout.tsx +4 -2
- package/docutils.js +33 -17
- package/eslint.config.mjs +28 -34
- package/iframe.html +181 -207
- package/index.html +108 -88
- package/index.js +2345 -1976
- package/input.css +21 -3
- package/package.json +39 -41
- package/scripts/build.mjs +2 -2
- package/scripts/dev.mjs +3 -3
- package/search.html +70 -23
- package/src/BaseLayer/BaseLayer.tsx +2 -1
- package/src/Copyright/Copyright.tsx +4 -2
- package/src/DebugDeparture/DebugDeparture.tsx +16 -12
- package/src/DebugStop/DebugStop.tsx +2 -2
- package/src/Departure/Departure.tsx +2 -3
- package/src/EmbedNavigation/DragPanWarning.ts +125 -0
- package/src/EmbedNavigation/EmbedNavigation.tsx +52 -0
- package/src/EmbedNavigation/index.js +1 -0
- package/src/EmbedNavigation/index.tsx +1 -0
- package/src/GeolocationButton/GeolocationButton.tsx +11 -35
- package/src/GeolocationButton/index.tsx +1 -1
- package/src/Map/Map.tsx +5 -3
- package/src/MapDispatchEvents/MapDispatchEvents.tsx +78 -0
- package/src/MapDispatchEvents/index.tsx +1 -0
- package/src/MobilityMap/MobilityMap.tsx +117 -162
- package/src/MobilityMap/MobilityMapAttributes.test.ts +21 -0
- package/src/MobilityMap/MobilityMapAttributes.ts +252 -0
- package/src/MobilityMap/index.tsx +1 -0
- package/src/MobilitySearch/MobilitySearch.tsx +35 -0
- package/src/MobilitySearch/MobilitySearchAttributes.test.ts +21 -0
- package/src/MobilitySearch/MobilitySearchAttributes.ts +68 -0
- package/src/MobilitySearch/index.ts +2 -0
- package/src/NotificationLayer/NotificationLayer.tsx +36 -5
- package/src/Overlay/Overlay.tsx +24 -11
- package/src/Permalink/Permalink.tsx +77 -0
- package/src/Permalink/index.tsx +1 -0
- package/src/RealtimeLayer/RealtimeLayer.tsx +72 -33
- package/src/RouteDestination/RouteDestination.tsx +3 -3
- package/src/RouteIcon/RouteIcon.tsx +33 -25
- package/src/RouteIcon/index.tsx +1 -1
- package/src/RouteIdentifier/RouteIdentifer.tsx +6 -5
- package/src/RouteInfos/RouteInfos.tsx +7 -3
- package/src/RouteSchedule/RouteSchedule.tsx +3 -3
- package/src/RouteScheduleFooter/RouteScheduleFooter.tsx +1 -1
- package/src/RouteScheduleHeader/RouteScheduleHeader.tsx +7 -29
- package/src/RouteStop/RouteStop.tsx +8 -11
- package/src/RouteStopDelay/RouteStopDelay.tsx +2 -1
- package/src/RouteStopName/RouteStopName.tsx +2 -2
- package/src/RouteStopPlatform/RouteStopPlatform.tsx +2 -2
- package/src/RouteStopProgress/RouteStopProgress.tsx +2 -1
- package/src/RouteStopServices/RouteStopServices.tsx +2 -2
- package/src/RouteStopStation/RouteStopStation.tsx +8 -2
- package/src/RouteStopTime/RouteStopTime.tsx +2 -1
- package/src/RvfButton/RvfButton.tsx +14 -5
- package/src/RvfCheckbox/RvfCheckbox.tsx +8 -8
- package/src/RvfEmbedNavigation/DragPanWarning.ts +5 -5
- package/src/RvfEmbedNavigation/RvfEmbedNavigation.tsx +1 -0
- package/src/RvfExportMenu/RvfExportMenu.tsx +14 -12
- package/src/RvfExportMenuButton/RvfExportMenuButton.tsx +6 -7
- package/src/RvfFeatureDetails/RvfFeatureDetails.tsx +25 -21
- package/src/RvfFeatureDetails/RvfLineNetworkDetails/RvfLineNetworkDetails.tsx +131 -127
- package/src/RvfFeatureDetails/RvfNotificationDetails/RvfNotificationDetails.tsx +309 -111
- package/src/RvfFeatureDetails/RvfSellingPointDetails/RvfSellingPointDetails.tsx +2 -2
- package/src/RvfFeatureDetails/RvfSharedMobilityDetail/FloatingVehiclesDetails/FloatingVehiclesDetails.tsx +3 -3
- package/src/RvfFeatureDetails/RvfSharedMobilityDetail/RvfSharedMobilityDetails.tsx +8 -6
- package/src/RvfFeatureDetails/RvfSharedMobilityDetail/StationDetails/StationDetails.tsx +5 -4
- package/src/RvfFeatureDetailsFooter/RvfFeatureDetailsFooter.tsx +43 -0
- package/src/RvfFeatureDetailsFooter/index.tsx +1 -0
- package/src/RvfFeatureDetailsTitle/RvfFeatureDetailsTitle.tsx +81 -0
- package/src/RvfFeatureDetailsTitle/index.tsx +1 -0
- package/src/RvfFloatingMenu/RvfFloatingMenu.tsx +4 -4
- package/src/RvfGeolocationButton/GeolocationButton.tsx +98 -0
- package/src/RvfGeolocationButton/index.tsx +1 -0
- package/src/RvfIconButton/RvfIconButton.tsx +20 -9
- package/src/RvfInputCopy/RvfInputCopy.tsx +8 -8
- package/src/RvfLayerTree/RvfLayerTree.tsx +5 -2
- package/src/RvfLayerTree/TreeItem/TreeItem.tsx +13 -16
- package/src/RvfLayerTree/layersTreeReducer.ts +23 -18
- package/src/RvfLayerTreeButton/RvfLayerTreeButton.tsx +6 -6
- package/src/RvfLineNetworkPlanLayer/RvfLineNetworkPlanLayer.tsx +2 -1
- package/src/RvfLink/RvfLink.tsx +4 -3
- package/src/RvfMobilityMap/RvfMobilityMap.tsx +324 -320
- package/src/RvfModal/RvfModal.tsx +4 -3
- package/src/RvfOverlayContent/RvfOverlayContent.tsx +128 -0
- package/src/RvfOverlayContent/index.ts +0 -0
- package/src/RvfOverlayHeader/RvfOverlayHeader.tsx +13 -10
- package/src/RvfPermalink/RvfPermalink.tsx +2 -2
- package/src/RvfPoisLayer/RvfPoisLayer.tsx +2 -1
- package/src/RvfRadioButton/RvfRadioButton.tsx +1 -1
- package/src/RvfRouteIcon/RvfRouteIcon.tsx +10 -0
- package/src/RvfRouteIcon/index.tsx +1 -0
- package/src/RvfSearch/RvfSearch.tsx +4 -1
- package/src/RvfSearchButton/RvfSearchButton.tsx +27 -0
- package/src/RvfSearchButton/index.tsx +1 -0
- package/src/RvfSelect/RvfSelect.tsx +7 -5
- package/src/RvfSelectedFeatureHighlightLayer/RvfSelectedFeatureHighlightLayer.tsx +1 -2
- package/src/RvfSellingPointsLayer/RvfSellingPointsLayer.tsx +2 -1
- package/src/RvfShare/RvfPermalinkButton/RvfPermalinkButton.tsx +13 -12
- package/src/RvfShare/RvfShare.tsx +11 -10
- package/src/RvfShareMenuButton/RvfShareMenuButton.tsx +5 -5
- package/src/RvfSharedMobilityLayerGroup/RvfSharedMobilityLayerGroup.tsx +25 -22
- package/src/RvfSingleClickListener/RvfSingleClickListener.tsx +102 -67
- package/src/RvfTarifZonenLayer/RvfTarifZonenLayer.tsx +2 -1
- package/src/RvfTopics/RvfTopics.tsx +6 -5
- package/src/RvfZoomButtons/RvfZoomButtons.tsx +3 -3
- package/src/ScaleLine/ScaleLine.tsx +5 -4
- package/src/ScrollableHandler/ScrollableHandler.tsx +2 -1
- package/src/ScrollableHandler/index.tsx +1 -1
- package/src/SingleClickListener/SingleClickListener.tsx +47 -4
- package/src/Station/Station.tsx +5 -5
- package/src/StationName/StationName.tsx +3 -3
- package/src/StationServices/StationServices.tsx +3 -3
- package/src/StationsLayer/StationsLayer.tsx +5 -4
- package/src/StopsSearch/StopsSearch.tsx +143 -88
- package/src/WindowMessageListener/WindowMessageListener.tsx +68 -0
- package/src/WindowMessageListener/index.tsx +1 -0
- package/src/icons/Airport/Airport.tsx +4 -4
- package/src/icons/ArrowDown/ArrowDown.tsx +1 -1
- package/src/icons/ArrowRight/ArrowRight.tsx +19 -0
- package/src/icons/ArrowRight/arrow-right.svg +16 -0
- package/src/icons/ArrowRight/index.tsx +1 -0
- package/src/icons/ArrowUp/ArrowUp.tsx +1 -1
- package/src/icons/ArrowUpRight/ArrowUpRight.tsx +1 -1
- package/src/icons/BarAndRestaurants/BarAndRestaurants.tsx +2 -2
- package/src/icons/Bathroom/Bathroom.tsx +1 -1
- package/src/icons/Copy/Copy.tsx +1 -1
- package/src/icons/Doc/Doc.tsx +1 -1
- package/src/icons/Email/Email.tsx +1 -1
- package/src/icons/FilePdf/FilePdf.tsx +1 -1
- package/src/icons/Geolocation/Geolocation.tsx +3 -5
- package/src/icons/Image/Image.tsx +1 -1
- package/src/icons/Menu/Menu.tsx +1 -1
- package/src/icons/Minus/Minus.tsx +1 -1
- package/src/icons/NoRealtime/NoRealtime.tsx +1 -1
- package/src/icons/Plus/Plus.tsx +1 -1
- package/src/icons/Police/Police.tsx +3 -3
- package/src/icons/Search/Search.tsx +0 -1
- package/src/icons/Share/Share.tsx +1 -1
- package/src/icons/Stack/Stack.tsx +1 -1
- package/src/icons/Tracking/Tracking.tsx +29 -0
- package/src/icons/Tracking/airport-14-svgrepo-com.svg +41 -0
- package/src/icons/Tracking/index.tsx +1 -0
- package/src/icons/WaitingAreas/WaitingAreas.tsx +1 -1
- package/src/icons/Warning/Warning.tsx +56 -0
- package/src/icons/Warning/index.tsx +1 -0
- package/src/icons/Warning/info-achtung-kreisrot-rot.svg +28 -0
- package/src/icons/WheelChair/WheelChair.tsx +1 -1
- package/src/index.tsx +8 -46
- package/src/indexDoc.ts +13 -0
- package/src/ui/Button/Button.tsx +57 -0
- package/src/ui/Button/index.tsx +1 -0
- package/src/ui/IconButton/IconButton.tsx +44 -0
- package/src/ui/IconButton/index.tsx +1 -0
- package/src/utils/MobilityEvent.ts +4 -3
- package/src/utils/applyInitialLayerVisibility.ts +3 -3
- package/src/utils/centerOnStation.ts +3 -2
- package/src/utils/centerOnVehicle.ts +5 -4
- package/src/utils/constants.ts +27 -3
- package/src/utils/exportPdf.ts +26 -20
- package/src/utils/fullTrajectoryStyle.ts +2 -2
- package/src/utils/getAllLayers.ts +4 -3
- package/src/utils/getDelayColor.test.ts +1 -0
- package/src/utils/getDelayColorForVehicle.test.ts +2 -0
- package/src/utils/getDelayString.test.ts +3 -0
- package/src/utils/getDelayTextForVehicle.test.ts +4 -0
- package/src/utils/getFullTrajectoryAndFit.ts +4 -3
- package/src/utils/getHoursAndMinutes.test.ts +1 -0
- package/src/utils/getLayersAsFlatArray.ts +2 -2
- package/src/utils/getLinkByDevice.ts +1 -1
- package/src/utils/getMainColorForVehicle.ts +3 -3
- package/src/utils/getPermalinkParameters.ts +2 -2
- package/src/utils/getStopStatus.test.ts +2 -1
- package/src/utils/getStopStatus.ts +1 -1
- package/src/utils/getTextForVehicle.ts +1 -1
- package/src/utils/hooks/useDeparture.tsx +6 -5
- package/src/utils/hooks/useI18n.tsx +6 -4
- package/src/utils/hooks/useInitialLayersVisiblity.tsx +2 -1
- package/src/utils/hooks/useLayerConfig.tsx +40 -0
- package/src/utils/hooks/useMapContext.tsx +30 -18
- package/src/utils/hooks/useRouteStop.tsx +3 -2
- package/src/utils/hooks/useRvfContext.tsx +11 -3
- package/src/utils/hooks/useStation.tsx +2 -1
- package/src/utils/hooks/useUpdatePermalink.tsx +25 -24
- package/src/utils/hooks/useZoom.tsx +4 -4
- package/src/utils/realtimeRVFStyle.ts +5 -4
- package/src/utils/sharingGraphqlUtils.ts +3 -2
- package/src/utils/sharingStylesUtils.ts +7 -7
- package/src/utils/sharingWFSUtils.ts +9 -15
- package/tailwind.config.mjs +1 -0
- package/tsconfig.json +1 -1
- package/doc/tailwind.config.ts +0 -20
- package/src/utils/getFeatureInformationTitle.tsx +0 -54
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import type { Map, MapBrowserEvent } from "ol";
|
|
2
|
-
import type { Options } from "ol/control/Control";
|
|
3
|
-
|
|
4
1
|
import { Control } from "ol/control";
|
|
5
|
-
import { EventsKey } from "ol/events";
|
|
6
2
|
import { DragPan } from "ol/interaction";
|
|
7
3
|
import { unByKey } from "ol/Observable";
|
|
8
4
|
|
|
5
|
+
import type { Map, MapBrowserEvent } from "ol";
|
|
6
|
+
import type { Options } from "ol/control/Control";
|
|
7
|
+
import type { EventsKey } from "ol/events";
|
|
8
|
+
|
|
9
9
|
type DragPanWarningOptions = {
|
|
10
10
|
className?: string;
|
|
11
11
|
} & Options;
|
|
@@ -88,7 +88,7 @@ class DragPanWarning extends Control {
|
|
|
88
88
|
.getArray()
|
|
89
89
|
.find((interaction) => {
|
|
90
90
|
return interaction instanceof DragPan;
|
|
91
|
-
})
|
|
91
|
+
});
|
|
92
92
|
|
|
93
93
|
if (!this.dragPan) {
|
|
94
94
|
console.error(
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import type { JSX, PreactDOMAttributes } from "preact";
|
|
2
|
-
|
|
3
1
|
import { memo, useId, useState } from "preact/compat";
|
|
4
2
|
|
|
5
|
-
import RvfButton from "../RvfButton";
|
|
6
3
|
import RvfCheckbox from "../RvfCheckbox";
|
|
7
4
|
import RvfSelect from "../RvfSelect";
|
|
5
|
+
import Button from "../ui/Button";
|
|
8
6
|
import { LAYER_PROP_IS_EXPORTING } from "../utils/constants";
|
|
9
7
|
import exportPdf from "../utils/exportPdf";
|
|
10
8
|
import getAllLayers from "../utils/getAllLayers";
|
|
11
9
|
import useMapContext from "../utils/hooks/useMapContext";
|
|
12
10
|
|
|
11
|
+
import type { JSX, PreactDOMAttributes } from "preact";
|
|
12
|
+
|
|
13
13
|
export type RvfExportMenuButtonProps = JSX.HTMLAttributes<HTMLDivElement> &
|
|
14
14
|
PreactDOMAttributes;
|
|
15
15
|
|
|
@@ -28,7 +28,7 @@ function RvfExportMenu({ ...props }: RvfExportMenuButtonProps) {
|
|
|
28
28
|
return (
|
|
29
29
|
<div {...props}>
|
|
30
30
|
{/* <!-- Content --> */}
|
|
31
|
-
<div className="flex flex-1 flex-col gap-
|
|
31
|
+
<div className="flex flex-1 flex-col gap-4">
|
|
32
32
|
<div className={"flex flex-wrap items-center gap-2"}>
|
|
33
33
|
<RvfCheckbox
|
|
34
34
|
checked={useMaxExtent}
|
|
@@ -48,16 +48,17 @@ function RvfExportMenu({ ...props }: RvfExportMenuButtonProps) {
|
|
|
48
48
|
setFormat((evt.target as HTMLSelectElement).value);
|
|
49
49
|
}}
|
|
50
50
|
>
|
|
51
|
-
{formats.map((
|
|
52
|
-
return <option key={
|
|
51
|
+
{formats.map((formatt) => {
|
|
52
|
+
return <option key={formatt}>{formatt}</option>;
|
|
53
53
|
})}
|
|
54
54
|
</RvfSelect>
|
|
55
55
|
</div>
|
|
56
56
|
</div>
|
|
57
57
|
{/* <!-- Footer --> */}
|
|
58
58
|
<div>
|
|
59
|
-
<
|
|
59
|
+
<Button
|
|
60
60
|
disabled={isExporting}
|
|
61
|
+
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
|
61
62
|
onClick={async () => {
|
|
62
63
|
setIsExportingError(false);
|
|
63
64
|
setIsExporting(true);
|
|
@@ -65,7 +66,7 @@ function RvfExportMenu({ ...props }: RvfExportMenuButtonProps) {
|
|
|
65
66
|
map,
|
|
66
67
|
{ format },
|
|
67
68
|
{
|
|
68
|
-
onAfter: (
|
|
69
|
+
onAfter: (mapp, layers) => {
|
|
69
70
|
if (
|
|
70
71
|
realtimeLayer &&
|
|
71
72
|
prevRealtimeLayerVisibility !== realtimeLayer?.getVisible()
|
|
@@ -75,11 +76,11 @@ function RvfExportMenu({ ...props }: RvfExportMenuButtonProps) {
|
|
|
75
76
|
getAllLayers(layers).forEach((layer) => {
|
|
76
77
|
layer.set(LAYER_PROP_IS_EXPORTING, false);
|
|
77
78
|
});
|
|
78
|
-
|
|
79
|
+
mapp.set(LAYER_PROP_IS_EXPORTING, false);
|
|
79
80
|
},
|
|
80
81
|
|
|
81
|
-
onBefore: (
|
|
82
|
-
|
|
82
|
+
onBefore: (mapp, layers) => {
|
|
83
|
+
mapp.set(LAYER_PROP_IS_EXPORTING, true);
|
|
83
84
|
if (realtimeLayer) {
|
|
84
85
|
prevRealtimeLayerVisibility = realtimeLayer.getVisible();
|
|
85
86
|
if (realtimeLayer.getVisible()) {
|
|
@@ -99,12 +100,13 @@ function RvfExportMenu({ ...props }: RvfExportMenuButtonProps) {
|
|
|
99
100
|
}, 1000);
|
|
100
101
|
}}
|
|
101
102
|
>
|
|
103
|
+
{/* eslint-disable-next-line no-nested-ternary */}
|
|
102
104
|
{isExporting
|
|
103
105
|
? "Exporting..."
|
|
104
106
|
: isExportingError
|
|
105
107
|
? "Error"
|
|
106
108
|
: "Download"}
|
|
107
|
-
</
|
|
109
|
+
</Button>
|
|
108
110
|
</div>
|
|
109
111
|
</div>
|
|
110
112
|
);
|
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
import type { JSX, PreactDOMAttributes } from "preact";
|
|
2
|
-
|
|
3
1
|
import { memo } from "preact/compat";
|
|
4
2
|
import { useCallback } from "preact/hooks";
|
|
5
3
|
|
|
6
4
|
import Download from "../icons/Download";
|
|
7
|
-
import
|
|
5
|
+
import IconButton from "../ui/IconButton";
|
|
8
6
|
import useRvfContext from "../utils/hooks/useRvfContext";
|
|
9
7
|
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
import type { IconButtonProps } from "../ui/IconButton/IconButton";
|
|
9
|
+
|
|
10
|
+
export type RvfExportMenuButtonProps = IconButtonProps;
|
|
12
11
|
|
|
13
12
|
function RvfExportMenuButton({ ...props }: RvfExportMenuButtonProps) {
|
|
14
13
|
const { isExportMenuOpen, setIsExportMenuOpen } = useRvfContext();
|
|
@@ -18,9 +17,9 @@ function RvfExportMenuButton({ ...props }: RvfExportMenuButtonProps) {
|
|
|
18
17
|
}, [isExportMenuOpen, setIsExportMenuOpen]);
|
|
19
18
|
|
|
20
19
|
return (
|
|
21
|
-
<
|
|
20
|
+
<IconButton {...props} onClick={onClick} selected={isExportMenuOpen}>
|
|
22
21
|
<Download />
|
|
23
|
-
</
|
|
22
|
+
</IconButton>
|
|
24
23
|
);
|
|
25
24
|
}
|
|
26
25
|
|
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import type { JSX, PreactDOMAttributes } from "preact";
|
|
2
|
-
|
|
3
1
|
import { memo } from "preact/compat";
|
|
4
2
|
|
|
5
3
|
import useRvfContext from "../utils/hooks/useRvfContext";
|
|
4
|
+
|
|
6
5
|
import RvfLineNetworkDetails from "./RvfLineNetworkDetails/RvfLineNetworkDetails";
|
|
7
|
-
|
|
6
|
+
import RvfNotificationDetails from "./RvfNotificationDetails";
|
|
8
7
|
import RvfSellingPointDetails from "./RvfSellingPointDetails";
|
|
9
8
|
import RvfSharedMobilityDetails from "./RvfSharedMobilityDetail";
|
|
10
9
|
|
|
10
|
+
import type { JSX, PreactDOMAttributes } from "preact";
|
|
11
|
+
|
|
11
12
|
export type RvfFeatureDetailsProps = JSX.HTMLAttributes<HTMLDivElement> &
|
|
12
13
|
PreactDOMAttributes;
|
|
13
14
|
|
|
@@ -25,7 +26,7 @@ function RvfFeatureDetails(props: RvfFeatureDetailsProps) {
|
|
|
25
26
|
const { selectedFeature, selectedFeatures } = useRvfContext();
|
|
26
27
|
const isSharedMobility = getIsSharedMobility(selectedFeature);
|
|
27
28
|
const isSellingPoint = !!selectedFeature.get("tickets");
|
|
28
|
-
const isNotification = !!selectedFeature.get("
|
|
29
|
+
const isNotification = !!selectedFeature.get("situation");
|
|
29
30
|
const isLineNetwork = !!selectedFeature.get("original_line_id");
|
|
30
31
|
|
|
31
32
|
const showDefaultData = () => {
|
|
@@ -45,23 +46,26 @@ function RvfFeatureDetails(props: RvfFeatureDetailsProps) {
|
|
|
45
46
|
|
|
46
47
|
return (
|
|
47
48
|
<div {...props}>
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
49
|
+
<div className="p-4 pb-0">
|
|
50
|
+
{isSellingPoint && <RvfSellingPointDetails feature={selectedFeature} />}
|
|
51
|
+
{isSharedMobility && (
|
|
52
|
+
<RvfSharedMobilityDetails selectedFeature={selectedFeature} />
|
|
53
|
+
)}
|
|
54
|
+
{isNotification && <RvfNotificationDetails feature={selectedFeature} />}
|
|
55
|
+
{isLineNetwork && (
|
|
56
|
+
<RvfLineNetworkDetails
|
|
57
|
+
feature={selectedFeature}
|
|
58
|
+
features={selectedFeatures}
|
|
59
|
+
/>
|
|
60
|
+
)}
|
|
61
|
+
{!isLineNetwork &&
|
|
62
|
+
!isNotification &&
|
|
63
|
+
!isSharedMobility &&
|
|
64
|
+
!isSellingPoint &&
|
|
65
|
+
showDefaultData()}
|
|
66
|
+
</div>
|
|
67
|
+
{/* TODO find why -1px is necessary */}
|
|
68
|
+
<div className="pointer-events-none sticky bottom-[-1px] h-6 w-full bg-gradient-to-b from-transparent to-white" />
|
|
65
69
|
</div>
|
|
66
70
|
);
|
|
67
71
|
}
|
|
@@ -1,14 +1,10 @@
|
|
|
1
|
-
import { VectorTileSource } from "maplibre-gl";
|
|
2
|
-
import { RealtimeLine } from "mobility-toolbox-js/types";
|
|
3
|
-
import { Feature } from "ol";
|
|
4
1
|
import { useEffect, useMemo, useState } from "preact/hooks";
|
|
5
2
|
|
|
6
|
-
import ArrowDown from "../../icons/ArrowDown";
|
|
7
|
-
import ArrowUp from "../../icons/ArrowUp";
|
|
8
3
|
import RouteIcon from "../../RouteIcon";
|
|
9
|
-
import RouteStopProgress from "../../RouteStopProgress";
|
|
10
4
|
import useMapContext from "../../utils/hooks/useMapContext";
|
|
11
|
-
|
|
5
|
+
|
|
6
|
+
import type { RealtimeLine } from "mobility-toolbox-js/types";
|
|
7
|
+
import type { Feature } from "ol";
|
|
12
8
|
|
|
13
9
|
let cacheLineInfosById = null;
|
|
14
10
|
let cacheStopInfosById = null;
|
|
@@ -57,9 +53,7 @@ function RvfLineNetworkDetails({
|
|
|
57
53
|
}, []);
|
|
58
54
|
|
|
59
55
|
useEffect(() => {
|
|
60
|
-
const source = baseLayer?.mapLibreMap?.getSource(
|
|
61
|
-
LNP_SOURCE_ID,
|
|
62
|
-
) as VectorTileSource;
|
|
56
|
+
const source = baseLayer?.mapLibreMap?.getSource(LNP_SOURCE_ID);
|
|
63
57
|
const abortController = new AbortController();
|
|
64
58
|
const fetchInfos = async (url) => {
|
|
65
59
|
if (!cacheLineInfosById) {
|
|
@@ -71,8 +65,10 @@ function RvfLineNetworkDetails({
|
|
|
71
65
|
setLineInfos(cacheLineInfosById);
|
|
72
66
|
setStopInfos(cacheStopInfosById);
|
|
73
67
|
};
|
|
68
|
+
// @ts-expect-error --- IGNORE ---
|
|
74
69
|
if (source?.url) {
|
|
75
|
-
|
|
70
|
+
// @ts-expect-error --- IGNORE ---git as
|
|
71
|
+
void fetchInfos(source?.url);
|
|
76
72
|
}
|
|
77
73
|
return () => {
|
|
78
74
|
abortController?.abort();
|
|
@@ -104,8 +100,8 @@ function RvfLineNetworkDetails({
|
|
|
104
100
|
.filter((f) => {
|
|
105
101
|
return f.get(ORIGINAL_LINE_ID_PROP) === id;
|
|
106
102
|
})
|
|
107
|
-
.reduce((acc,
|
|
108
|
-
return acc +
|
|
103
|
+
.reduce((acc, featuree) => {
|
|
104
|
+
return acc + featuree.get(RUNS_PROP);
|
|
109
105
|
}, 0);
|
|
110
106
|
lineInfos[id].id = id;
|
|
111
107
|
lineInfos[id].runs = runs;
|
|
@@ -138,7 +134,7 @@ function RvfLineNetworkDetails({
|
|
|
138
134
|
}
|
|
139
135
|
|
|
140
136
|
return (
|
|
141
|
-
<div className="
|
|
137
|
+
<div className="space-y-4">
|
|
142
138
|
{Object.entries(lineInfosByOperator)
|
|
143
139
|
.sort(([operatorNameA], [operatorNameB]) => {
|
|
144
140
|
return lineInfosByOperator[operatorNameA].runs <
|
|
@@ -150,130 +146,138 @@ function RvfLineNetworkDetails({
|
|
|
150
146
|
return (
|
|
151
147
|
<div className={"flex flex-col gap-2"} key={operatorName}>
|
|
152
148
|
<div>{operatorName}</div>
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
149
|
+
<div className="flex flex-wrap gap-2">
|
|
150
|
+
{linesInfos
|
|
151
|
+
.sort((a, b) => {
|
|
152
|
+
return a.runs < b.runs ? 1 : -1;
|
|
153
|
+
})
|
|
154
|
+
.map((lineInfo) => {
|
|
155
|
+
const {
|
|
156
|
+
color: backgroundColor,
|
|
157
|
+
// color,
|
|
158
|
+
// external_id,
|
|
159
|
+
long_name,
|
|
160
|
+
mot,
|
|
161
|
+
runs,
|
|
162
|
+
short_name: shortName,
|
|
163
|
+
text_color: textColor,
|
|
164
|
+
} = lineInfo;
|
|
165
|
+
let longName = long_name;
|
|
170
166
|
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
167
|
+
let stops = null;
|
|
168
|
+
//stopInfoIdsByLineId?.[id] || null;
|
|
169
|
+
if (!stops?.length) {
|
|
170
|
+
stops = null;
|
|
171
|
+
}
|
|
176
172
|
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
173
|
+
if (!longName && stops) {
|
|
174
|
+
const names = stops.map((stopId) => {
|
|
175
|
+
return stopInfos[stopId].short_name;
|
|
176
|
+
});
|
|
181
177
|
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
178
|
+
longName = [
|
|
179
|
+
...new Set([names[0], names[names.length - 1]]),
|
|
180
|
+
].join(" - ");
|
|
181
|
+
}
|
|
186
182
|
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
183
|
+
// Build a line object
|
|
184
|
+
const line: { type: string } & RealtimeLine = {
|
|
185
|
+
color: null,
|
|
186
|
+
id: null,
|
|
187
|
+
name: shortName,
|
|
188
|
+
stroke: null,
|
|
189
|
+
text_color: null,
|
|
190
|
+
type: mot,
|
|
191
|
+
};
|
|
196
192
|
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
193
|
+
if (textColor) {
|
|
194
|
+
line.text_color = textColor.startsWith("#")
|
|
195
|
+
? textColor
|
|
196
|
+
: `#${textColor}`;
|
|
197
|
+
}
|
|
201
198
|
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
backgroundColor[0] === "#"
|
|
199
|
+
if (backgroundColor) {
|
|
200
|
+
line.color = backgroundColor.startsWith("#")
|
|
205
201
|
? backgroundColor
|
|
206
|
-
:
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
return (
|
|
210
|
-
<div key={shortName}>
|
|
211
|
-
<div
|
|
212
|
-
className={
|
|
213
|
-
"flex w-full items-center justify-between gap-2"
|
|
214
|
-
}
|
|
215
|
-
// onClick={() => {
|
|
216
|
-
// setStopInfosOpenId(stopInfosOpenId === id ? null : id);
|
|
217
|
-
// }}
|
|
218
|
-
>
|
|
219
|
-
<div>
|
|
220
|
-
<RouteIcon line={line}></RouteIcon>
|
|
221
|
-
</div>
|
|
222
|
-
{!!longName && (
|
|
223
|
-
<div className={"flex-1 text-left"}>{longName}</div>
|
|
224
|
-
)}
|
|
225
|
-
{isRunsDisplay && (
|
|
226
|
-
<div className={"text-xs"}>{runs}</div>
|
|
227
|
-
)}
|
|
202
|
+
: `#${backgroundColor}`;
|
|
203
|
+
}
|
|
228
204
|
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
{stopInfosOpenId === id ? (
|
|
232
|
-
<ArrowUp />
|
|
233
|
-
) : (
|
|
234
|
-
<ArrowDown />
|
|
235
|
-
)}
|
|
236
|
-
</button>
|
|
237
|
-
)}
|
|
238
|
-
</div>
|
|
239
|
-
{!!stops && (
|
|
205
|
+
return (
|
|
206
|
+
<div className={longName ? "w-full" : ""} key={shortName}>
|
|
240
207
|
<div
|
|
241
|
-
className={
|
|
208
|
+
className={"flex justify-between gap-2"}
|
|
209
|
+
// onClick={() => {
|
|
210
|
+
// setStopInfosOpenId(stopInfosOpenId === id ? null : id);
|
|
211
|
+
// }}
|
|
242
212
|
>
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
<
|
|
268
|
-
|
|
269
|
-
</
|
|
270
|
-
)
|
|
271
|
-
})}
|
|
213
|
+
<div>
|
|
214
|
+
<RouteIcon line={line}></RouteIcon>
|
|
215
|
+
</div>
|
|
216
|
+
{!!longName && (
|
|
217
|
+
<div
|
|
218
|
+
className={
|
|
219
|
+
"flex-1 text-left *:before:content-['_–'] *:first:font-semibold *:first:before:!content-[_p] *:last:font-semibold *:last:before:!content-[_p]"
|
|
220
|
+
}
|
|
221
|
+
>
|
|
222
|
+
{longName.split("-").map((name) => {
|
|
223
|
+
return <div key={name}>{name}</div>;
|
|
224
|
+
})}
|
|
225
|
+
</div>
|
|
226
|
+
)}
|
|
227
|
+
{isRunsDisplay && (
|
|
228
|
+
<div className={"text-xs"}>{runs}</div>
|
|
229
|
+
)}
|
|
230
|
+
|
|
231
|
+
{/* We deactivate the list of stopsfor now */}
|
|
232
|
+
{/* {!!stops && (
|
|
233
|
+
<button className={"shrink-0"}>
|
|
234
|
+
{stopInfosOpenId === id ? (
|
|
235
|
+
<ArrowUp />
|
|
236
|
+
) : (
|
|
237
|
+
<ArrowDown />
|
|
238
|
+
)}
|
|
239
|
+
</button>
|
|
240
|
+
)} */}
|
|
272
241
|
</div>
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
242
|
+
{/* {!!stops && (
|
|
243
|
+
<div
|
|
244
|
+
className={`${stopInfosOpenId === id ? "" : "hidden"}`}
|
|
245
|
+
>
|
|
246
|
+
{stops?.map((stopId, index, arr) => {
|
|
247
|
+
const stop = stopInfos[stopId];
|
|
248
|
+
return (
|
|
249
|
+
<div
|
|
250
|
+
className={"flex items-center gap-2"}
|
|
251
|
+
key={stopId}
|
|
252
|
+
>
|
|
253
|
+
<RouteStopContext.Provider
|
|
254
|
+
value={{
|
|
255
|
+
index,
|
|
256
|
+
status: {
|
|
257
|
+
isFirst: !index,
|
|
258
|
+
isLast: index === arr.length - 1,
|
|
259
|
+
isLeft: false,
|
|
260
|
+
isPassed: false,
|
|
261
|
+
progress: !index ? 50 : 0,
|
|
262
|
+
},
|
|
263
|
+
stop,
|
|
264
|
+
}}
|
|
265
|
+
>
|
|
266
|
+
<RouteStopProgress
|
|
267
|
+
className="relative flex size-8 shrink-0 items-center justify-center"
|
|
268
|
+
lineColor={line.color}
|
|
269
|
+
/>
|
|
270
|
+
<div>{stop.short_name}</div>
|
|
271
|
+
</RouteStopContext.Provider>
|
|
272
|
+
</div>
|
|
273
|
+
);
|
|
274
|
+
})}
|
|
275
|
+
</div>
|
|
276
|
+
)} */}
|
|
277
|
+
</div>
|
|
278
|
+
);
|
|
279
|
+
})}
|
|
280
|
+
</div>
|
|
277
281
|
</div>
|
|
278
282
|
);
|
|
279
283
|
})}
|