@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.
Files changed (204) hide show
  1. package/.prettierrc.js +3 -1
  2. package/CHANGELOG.md +12 -0
  3. package/README.md +1 -1
  4. package/doc/package.json +4 -3
  5. package/doc/postcss.config.mjs +1 -1
  6. package/doc/src/app/components/GeopsMobilityDoc.tsx +13 -224
  7. package/doc/src/app/components/GeopsMobilitySearchDoc.tsx +11 -107
  8. package/doc/src/app/components/WebComponentDoc.tsx +45 -56
  9. package/doc/src/app/geops-mobility/page.tsx +7 -2
  10. package/doc/src/app/geops-mobility-search/page.tsx +6 -2
  11. package/doc/src/app/globals.css +47 -27
  12. package/doc/src/app/layout.tsx +4 -2
  13. package/docutils.js +33 -17
  14. package/eslint.config.mjs +28 -34
  15. package/iframe.html +181 -207
  16. package/index.html +108 -88
  17. package/index.js +2345 -1976
  18. package/input.css +21 -3
  19. package/package.json +39 -41
  20. package/scripts/build.mjs +2 -2
  21. package/scripts/dev.mjs +3 -3
  22. package/search.html +70 -23
  23. package/src/BaseLayer/BaseLayer.tsx +2 -1
  24. package/src/Copyright/Copyright.tsx +4 -2
  25. package/src/DebugDeparture/DebugDeparture.tsx +16 -12
  26. package/src/DebugStop/DebugStop.tsx +2 -2
  27. package/src/Departure/Departure.tsx +2 -3
  28. package/src/EmbedNavigation/DragPanWarning.ts +125 -0
  29. package/src/EmbedNavigation/EmbedNavigation.tsx +52 -0
  30. package/src/EmbedNavigation/index.js +1 -0
  31. package/src/EmbedNavigation/index.tsx +1 -0
  32. package/src/GeolocationButton/GeolocationButton.tsx +11 -35
  33. package/src/GeolocationButton/index.tsx +1 -1
  34. package/src/Map/Map.tsx +5 -3
  35. package/src/MapDispatchEvents/MapDispatchEvents.tsx +78 -0
  36. package/src/MapDispatchEvents/index.tsx +1 -0
  37. package/src/MobilityMap/MobilityMap.tsx +117 -162
  38. package/src/MobilityMap/MobilityMapAttributes.test.ts +21 -0
  39. package/src/MobilityMap/MobilityMapAttributes.ts +252 -0
  40. package/src/MobilityMap/index.tsx +1 -0
  41. package/src/MobilitySearch/MobilitySearch.tsx +35 -0
  42. package/src/MobilitySearch/MobilitySearchAttributes.test.ts +21 -0
  43. package/src/MobilitySearch/MobilitySearchAttributes.ts +68 -0
  44. package/src/MobilitySearch/index.ts +2 -0
  45. package/src/NotificationLayer/NotificationLayer.tsx +36 -5
  46. package/src/Overlay/Overlay.tsx +24 -11
  47. package/src/Permalink/Permalink.tsx +77 -0
  48. package/src/Permalink/index.tsx +1 -0
  49. package/src/RealtimeLayer/RealtimeLayer.tsx +72 -33
  50. package/src/RouteDestination/RouteDestination.tsx +3 -3
  51. package/src/RouteIcon/RouteIcon.tsx +33 -25
  52. package/src/RouteIcon/index.tsx +1 -1
  53. package/src/RouteIdentifier/RouteIdentifer.tsx +6 -5
  54. package/src/RouteInfos/RouteInfos.tsx +7 -3
  55. package/src/RouteSchedule/RouteSchedule.tsx +3 -3
  56. package/src/RouteScheduleFooter/RouteScheduleFooter.tsx +1 -1
  57. package/src/RouteScheduleHeader/RouteScheduleHeader.tsx +7 -29
  58. package/src/RouteStop/RouteStop.tsx +8 -11
  59. package/src/RouteStopDelay/RouteStopDelay.tsx +2 -1
  60. package/src/RouteStopName/RouteStopName.tsx +2 -2
  61. package/src/RouteStopPlatform/RouteStopPlatform.tsx +2 -2
  62. package/src/RouteStopProgress/RouteStopProgress.tsx +2 -1
  63. package/src/RouteStopServices/RouteStopServices.tsx +2 -2
  64. package/src/RouteStopStation/RouteStopStation.tsx +8 -2
  65. package/src/RouteStopTime/RouteStopTime.tsx +2 -1
  66. package/src/RvfButton/RvfButton.tsx +14 -5
  67. package/src/RvfCheckbox/RvfCheckbox.tsx +8 -8
  68. package/src/RvfEmbedNavigation/DragPanWarning.ts +5 -5
  69. package/src/RvfEmbedNavigation/RvfEmbedNavigation.tsx +1 -0
  70. package/src/RvfExportMenu/RvfExportMenu.tsx +14 -12
  71. package/src/RvfExportMenuButton/RvfExportMenuButton.tsx +6 -7
  72. package/src/RvfFeatureDetails/RvfFeatureDetails.tsx +25 -21
  73. package/src/RvfFeatureDetails/RvfLineNetworkDetails/RvfLineNetworkDetails.tsx +131 -127
  74. package/src/RvfFeatureDetails/RvfNotificationDetails/RvfNotificationDetails.tsx +309 -111
  75. package/src/RvfFeatureDetails/RvfSellingPointDetails/RvfSellingPointDetails.tsx +2 -2
  76. package/src/RvfFeatureDetails/RvfSharedMobilityDetail/FloatingVehiclesDetails/FloatingVehiclesDetails.tsx +3 -3
  77. package/src/RvfFeatureDetails/RvfSharedMobilityDetail/RvfSharedMobilityDetails.tsx +8 -6
  78. package/src/RvfFeatureDetails/RvfSharedMobilityDetail/StationDetails/StationDetails.tsx +5 -4
  79. package/src/RvfFeatureDetailsFooter/RvfFeatureDetailsFooter.tsx +43 -0
  80. package/src/RvfFeatureDetailsFooter/index.tsx +1 -0
  81. package/src/RvfFeatureDetailsTitle/RvfFeatureDetailsTitle.tsx +81 -0
  82. package/src/RvfFeatureDetailsTitle/index.tsx +1 -0
  83. package/src/RvfFloatingMenu/RvfFloatingMenu.tsx +4 -4
  84. package/src/RvfGeolocationButton/GeolocationButton.tsx +98 -0
  85. package/src/RvfGeolocationButton/index.tsx +1 -0
  86. package/src/RvfIconButton/RvfIconButton.tsx +20 -9
  87. package/src/RvfInputCopy/RvfInputCopy.tsx +8 -8
  88. package/src/RvfLayerTree/RvfLayerTree.tsx +5 -2
  89. package/src/RvfLayerTree/TreeItem/TreeItem.tsx +13 -16
  90. package/src/RvfLayerTree/layersTreeReducer.ts +23 -18
  91. package/src/RvfLayerTreeButton/RvfLayerTreeButton.tsx +6 -6
  92. package/src/RvfLineNetworkPlanLayer/RvfLineNetworkPlanLayer.tsx +2 -1
  93. package/src/RvfLink/RvfLink.tsx +4 -3
  94. package/src/RvfMobilityMap/RvfMobilityMap.tsx +324 -320
  95. package/src/RvfModal/RvfModal.tsx +4 -3
  96. package/src/RvfOverlayContent/RvfOverlayContent.tsx +128 -0
  97. package/src/RvfOverlayContent/index.ts +0 -0
  98. package/src/RvfOverlayHeader/RvfOverlayHeader.tsx +13 -10
  99. package/src/RvfPermalink/RvfPermalink.tsx +2 -2
  100. package/src/RvfPoisLayer/RvfPoisLayer.tsx +2 -1
  101. package/src/RvfRadioButton/RvfRadioButton.tsx +1 -1
  102. package/src/RvfRouteIcon/RvfRouteIcon.tsx +10 -0
  103. package/src/RvfRouteIcon/index.tsx +1 -0
  104. package/src/RvfSearch/RvfSearch.tsx +4 -1
  105. package/src/RvfSearchButton/RvfSearchButton.tsx +27 -0
  106. package/src/RvfSearchButton/index.tsx +1 -0
  107. package/src/RvfSelect/RvfSelect.tsx +7 -5
  108. package/src/RvfSelectedFeatureHighlightLayer/RvfSelectedFeatureHighlightLayer.tsx +1 -2
  109. package/src/RvfSellingPointsLayer/RvfSellingPointsLayer.tsx +2 -1
  110. package/src/RvfShare/RvfPermalinkButton/RvfPermalinkButton.tsx +13 -12
  111. package/src/RvfShare/RvfShare.tsx +11 -10
  112. package/src/RvfShareMenuButton/RvfShareMenuButton.tsx +5 -5
  113. package/src/RvfSharedMobilityLayerGroup/RvfSharedMobilityLayerGroup.tsx +25 -22
  114. package/src/RvfSingleClickListener/RvfSingleClickListener.tsx +102 -67
  115. package/src/RvfTarifZonenLayer/RvfTarifZonenLayer.tsx +2 -1
  116. package/src/RvfTopics/RvfTopics.tsx +6 -5
  117. package/src/RvfZoomButtons/RvfZoomButtons.tsx +3 -3
  118. package/src/ScaleLine/ScaleLine.tsx +5 -4
  119. package/src/ScrollableHandler/ScrollableHandler.tsx +2 -1
  120. package/src/ScrollableHandler/index.tsx +1 -1
  121. package/src/SingleClickListener/SingleClickListener.tsx +47 -4
  122. package/src/Station/Station.tsx +5 -5
  123. package/src/StationName/StationName.tsx +3 -3
  124. package/src/StationServices/StationServices.tsx +3 -3
  125. package/src/StationsLayer/StationsLayer.tsx +5 -4
  126. package/src/StopsSearch/StopsSearch.tsx +143 -88
  127. package/src/WindowMessageListener/WindowMessageListener.tsx +68 -0
  128. package/src/WindowMessageListener/index.tsx +1 -0
  129. package/src/icons/Airport/Airport.tsx +4 -4
  130. package/src/icons/ArrowDown/ArrowDown.tsx +1 -1
  131. package/src/icons/ArrowRight/ArrowRight.tsx +19 -0
  132. package/src/icons/ArrowRight/arrow-right.svg +16 -0
  133. package/src/icons/ArrowRight/index.tsx +1 -0
  134. package/src/icons/ArrowUp/ArrowUp.tsx +1 -1
  135. package/src/icons/ArrowUpRight/ArrowUpRight.tsx +1 -1
  136. package/src/icons/BarAndRestaurants/BarAndRestaurants.tsx +2 -2
  137. package/src/icons/Bathroom/Bathroom.tsx +1 -1
  138. package/src/icons/Copy/Copy.tsx +1 -1
  139. package/src/icons/Doc/Doc.tsx +1 -1
  140. package/src/icons/Email/Email.tsx +1 -1
  141. package/src/icons/FilePdf/FilePdf.tsx +1 -1
  142. package/src/icons/Geolocation/Geolocation.tsx +3 -5
  143. package/src/icons/Image/Image.tsx +1 -1
  144. package/src/icons/Menu/Menu.tsx +1 -1
  145. package/src/icons/Minus/Minus.tsx +1 -1
  146. package/src/icons/NoRealtime/NoRealtime.tsx +1 -1
  147. package/src/icons/Plus/Plus.tsx +1 -1
  148. package/src/icons/Police/Police.tsx +3 -3
  149. package/src/icons/Search/Search.tsx +0 -1
  150. package/src/icons/Share/Share.tsx +1 -1
  151. package/src/icons/Stack/Stack.tsx +1 -1
  152. package/src/icons/Tracking/Tracking.tsx +29 -0
  153. package/src/icons/Tracking/airport-14-svgrepo-com.svg +41 -0
  154. package/src/icons/Tracking/index.tsx +1 -0
  155. package/src/icons/WaitingAreas/WaitingAreas.tsx +1 -1
  156. package/src/icons/Warning/Warning.tsx +56 -0
  157. package/src/icons/Warning/index.tsx +1 -0
  158. package/src/icons/Warning/info-achtung-kreisrot-rot.svg +28 -0
  159. package/src/icons/WheelChair/WheelChair.tsx +1 -1
  160. package/src/index.tsx +8 -46
  161. package/src/indexDoc.ts +13 -0
  162. package/src/ui/Button/Button.tsx +57 -0
  163. package/src/ui/Button/index.tsx +1 -0
  164. package/src/ui/IconButton/IconButton.tsx +44 -0
  165. package/src/ui/IconButton/index.tsx +1 -0
  166. package/src/utils/MobilityEvent.ts +4 -3
  167. package/src/utils/applyInitialLayerVisibility.ts +3 -3
  168. package/src/utils/centerOnStation.ts +3 -2
  169. package/src/utils/centerOnVehicle.ts +5 -4
  170. package/src/utils/constants.ts +27 -3
  171. package/src/utils/exportPdf.ts +26 -20
  172. package/src/utils/fullTrajectoryStyle.ts +2 -2
  173. package/src/utils/getAllLayers.ts +4 -3
  174. package/src/utils/getDelayColor.test.ts +1 -0
  175. package/src/utils/getDelayColorForVehicle.test.ts +2 -0
  176. package/src/utils/getDelayString.test.ts +3 -0
  177. package/src/utils/getDelayTextForVehicle.test.ts +4 -0
  178. package/src/utils/getFullTrajectoryAndFit.ts +4 -3
  179. package/src/utils/getHoursAndMinutes.test.ts +1 -0
  180. package/src/utils/getLayersAsFlatArray.ts +2 -2
  181. package/src/utils/getLinkByDevice.ts +1 -1
  182. package/src/utils/getMainColorForVehicle.ts +3 -3
  183. package/src/utils/getPermalinkParameters.ts +2 -2
  184. package/src/utils/getStopStatus.test.ts +2 -1
  185. package/src/utils/getStopStatus.ts +1 -1
  186. package/src/utils/getTextForVehicle.ts +1 -1
  187. package/src/utils/hooks/useDeparture.tsx +6 -5
  188. package/src/utils/hooks/useI18n.tsx +6 -4
  189. package/src/utils/hooks/useInitialLayersVisiblity.tsx +2 -1
  190. package/src/utils/hooks/useLayerConfig.tsx +40 -0
  191. package/src/utils/hooks/useMapContext.tsx +30 -18
  192. package/src/utils/hooks/useRouteStop.tsx +3 -2
  193. package/src/utils/hooks/useRvfContext.tsx +11 -3
  194. package/src/utils/hooks/useStation.tsx +2 -1
  195. package/src/utils/hooks/useUpdatePermalink.tsx +25 -24
  196. package/src/utils/hooks/useZoom.tsx +4 -4
  197. package/src/utils/realtimeRVFStyle.ts +5 -4
  198. package/src/utils/sharingGraphqlUtils.ts +3 -2
  199. package/src/utils/sharingStylesUtils.ts +7 -7
  200. package/src/utils/sharingWFSUtils.ts +9 -15
  201. package/tailwind.config.mjs +1 -0
  202. package/tsconfig.json +1 -1
  203. package/doc/tailwind.config.ts +0 -20
  204. 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
- }) as DragPan;
91
+ });
92
92
 
93
93
  if (!this.dragPan) {
94
94
  console.error(
@@ -2,6 +2,7 @@ import { MouseWheelZoom } from "ol/interaction";
2
2
  import { useEffect, useState } from "preact/hooks";
3
3
 
4
4
  import useMapContext from "../utils/hooks/useMapContext";
5
+
5
6
  import DragPanWarning from "./DragPanWarning";
6
7
 
7
8
  function RvfEmbedNavigation() {
@@ -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-2">
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((format) => {
52
- return <option key={format}>{format}</option>;
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
- <RvfButton
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: (map, layers) => {
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
- map.set(LAYER_PROP_IS_EXPORTING, false);
79
+ mapp.set(LAYER_PROP_IS_EXPORTING, false);
79
80
  },
80
81
 
81
- onBefore: (map, layers) => {
82
- map.set(LAYER_PROP_IS_EXPORTING, true);
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
- </RvfButton>
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 RvfIconButton from "../RvfIconButton";
5
+ import IconButton from "../ui/IconButton";
8
6
  import useRvfContext from "../utils/hooks/useRvfContext";
9
7
 
10
- export type RvfExportMenuButtonProps = JSX.HTMLAttributes<HTMLButtonElement> &
11
- PreactDOMAttributes;
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
- <RvfIconButton {...props} onClick={onClick} selected={isExportMenuOpen}>
20
+ <IconButton {...props} onClick={onClick} selected={isExportMenuOpen}>
22
21
  <Download />
23
- </RvfIconButton>
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
- // import RvfNotificationDetails from "./RvfNotificationDetails";
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("severity");
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
- {isSellingPoint && <RvfSellingPointDetails feature={selectedFeature} />}
49
- {isSharedMobility && (
50
- <RvfSharedMobilityDetails selectedFeature={selectedFeature} />
51
- )}
52
- {isNotification && null}
53
- {/* <RvfNotificationDetails feature={selectedFeature} />} */}
54
- {isLineNetwork && (
55
- <RvfLineNetworkDetails
56
- feature={selectedFeature}
57
- features={selectedFeatures}
58
- />
59
- )}
60
- {!isLineNetwork &&
61
- !isNotification &&
62
- !isSharedMobility &&
63
- !isSellingPoint &&
64
- showDefaultData()}
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
- import { RouteStopContext } from "../../utils/hooks/useRouteStop";
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
- fetchInfos(source?.url);
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, feature) => {
108
- return acc + feature.get(RUNS_PROP);
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="flex flex-col gap-4">
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
- {linesInfos
154
- .sort((a, b) => {
155
- return a.runs < b.runs ? 1 : -1;
156
- })
157
- .map((lineInfo) => {
158
- const {
159
- color: backgroundColor,
160
- id,
161
- // color,
162
- // external_id,
163
- long_name,
164
- mot,
165
- runs,
166
- short_name: shortName,
167
- text_color: textColor,
168
- } = lineInfo;
169
- let longName = long_name;
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
- let stops = null;
172
- //stopInfoIdsByLineId?.[id] || null;
173
- if (!stops?.length) {
174
- stops = null;
175
- }
167
+ let stops = null;
168
+ //stopInfoIdsByLineId?.[id] || null;
169
+ if (!stops?.length) {
170
+ stops = null;
171
+ }
176
172
 
177
- if (!longName && stops) {
178
- const names = stops.map((stopId) => {
179
- return stopInfos[stopId].short_name;
180
- });
173
+ if (!longName && stops) {
174
+ const names = stops.map((stopId) => {
175
+ return stopInfos[stopId].short_name;
176
+ });
181
177
 
182
- longName = [
183
- ...new Set([names[0], names[names.length - 1]]),
184
- ].join(" - ");
185
- }
178
+ longName = [
179
+ ...new Set([names[0], names[names.length - 1]]),
180
+ ].join(" - ");
181
+ }
186
182
 
187
- // Build a line object
188
- const line: { type: string } & RealtimeLine = {
189
- color: null,
190
- id: null,
191
- name: shortName,
192
- stroke: null,
193
- text_color: null,
194
- type: mot,
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
- if (textColor) {
198
- line.text_color =
199
- textColor[0] === "#" ? textColor : "#" + textColor;
200
- }
193
+ if (textColor) {
194
+ line.text_color = textColor.startsWith("#")
195
+ ? textColor
196
+ : `#${textColor}`;
197
+ }
201
198
 
202
- if (backgroundColor) {
203
- line.color =
204
- backgroundColor[0] === "#"
199
+ if (backgroundColor) {
200
+ line.color = backgroundColor.startsWith("#")
205
201
  ? backgroundColor
206
- : "#" + backgroundColor;
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
- {!!stops && (
230
- <button className={"shrink-0"}>
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={`${stopInfosOpenId === id ? "" : "hidden"}`}
208
+ className={"flex justify-between gap-2"}
209
+ // onClick={() => {
210
+ // setStopInfosOpenId(stopInfosOpenId === id ? null : id);
211
+ // }}
242
212
  >
243
- {stops?.map((stopId, index, arr) => {
244
- const stop = stopInfos[stopId];
245
- return (
246
- <div
247
- className={"flex items-center gap-2"}
248
- key={stopId}
249
- >
250
- <RouteStopContext.Provider
251
- value={{
252
- index,
253
- status: {
254
- isFirst: !index,
255
- isLast: index === arr.length - 1,
256
- isLeft: false,
257
- isPassed: false,
258
- progress: !index ? 50 : 0,
259
- },
260
- stop,
261
- }}
262
- >
263
- <RouteStopProgress
264
- className="relative flex size-8 shrink-0 items-center justify-center"
265
- lineColor={line.color}
266
- />
267
- <div>{stop.short_name}</div>
268
- </RouteStopContext.Provider>
269
- </div>
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
- </div>
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
  })}