@geops/rvf-mobility-web-component 0.1.128 → 0.1.129
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/CHANGELOG.md +7 -0
- package/dist/index.js +22 -1
- package/package.json +11 -4
- package/.fixpackrc +0 -21
- package/.github/CODEOWNERS +0 -37
- package/.github/workflows/conventional-pr-title.yml +0 -36
- package/.husky/commit-msg +0 -1
- package/.husky/post-checkout +0 -1
- package/.husky/post-merge +0 -1
- package/.husky/post-rebase +0 -1
- package/.husky/pre-commit +0 -1
- package/.lintstagedrc.js +0 -13
- package/.nvmrc +0 -1
- package/.prettierrc.js +0 -3
- package/.vscode/settings.json +0 -2
- package/Logo.svg +0 -10
- package/__mocks__/dataurl.js +0 -11
- package/__mocks__/mapbox-gl.js +0 -19
- package/commitlint.config.cjs +0 -1
- package/doc/.eslintrc.json +0 -3
- package/doc/.fixpackrc +0 -21
- package/doc/.prettierrc +0 -1
- package/doc/README.md +0 -14
- package/doc/next.config.mjs +0 -8
- package/doc/package.json +0 -44
- package/doc/postcss.config.mjs +0 -8
- package/doc/public/ExportMenu-HGGM7Z53.js +0 -229
- package/doc/public/README.md +0 -1
- package/doc/public/chunk-5TBO732O.js +0 -1
- package/doc/public/chunk-7SZT7G2L.js +0 -3
- package/doc/public/chunk-AOWOBR67.js +0 -37
- package/doc/public/chunk-CZ6RUAVW.js +0 -3
- package/doc/public/chunk-FK6H3RFT.js +0 -1
- package/doc/public/chunk-L5TSFF6Q.js +0 -6
- package/doc/public/chunk-W5KNTEOZ.js +0 -1
- package/doc/public/deflate-7Y7TJOU7.js +0 -1
- package/doc/public/html2canvas-HSPYX66M.js +0 -28
- package/doc/public/index.es-LIBYYWEU.js +0 -23
- package/doc/public/jpeg-IRWWL5ZF.js +0 -1
- package/doc/public/lerc-NVL4MKRG.js +0 -6
- package/doc/public/lzw-EHQHNZB6.js +0 -1
- package/doc/public/packbits-PQSBS4GQ.js +0 -1
- package/doc/public/purify.es-4R37HRTQ.js +0 -7
- package/doc/public/raw-OK63VTT6.js +0 -1
- package/doc/public/webimage-DLGKDXZD.js +0 -1
- package/doc/public/zstd-JFJYRN7P.js +0 -1
- package/doc/src/app/components/GeopsAPIKeyLink.tsx +0 -6
- package/doc/src/app/components/GeopsAPIsLink.tsx +0 -6
- package/doc/src/app/components/GeopsMapsAPILink.tsx +0 -8
- package/doc/src/app/components/GeopsMobility.tsx +0 -23
- package/doc/src/app/components/GeopsMobilityDoc.tsx +0 -39
- package/doc/src/app/components/GeopsMobilitySearch.tsx +0 -22
- package/doc/src/app/components/GeopsMobilitySearchDoc.tsx +0 -33
- package/doc/src/app/components/GeopsRealtimeAPILink.tsx +0 -10
- package/doc/src/app/components/GeopsStopsAPILink.tsx +0 -8
- package/doc/src/app/components/Link.tsx +0 -9
- package/doc/src/app/components/WebComponentDoc.tsx +0 -284
- package/doc/src/app/favicon.ico +0 -0
- package/doc/src/app/geops-mobility/page.tsx +0 -11
- package/doc/src/app/geops-mobility-search/page.tsx +0 -11
- package/doc/src/app/globals.css +0 -58
- package/doc/src/app/hooks/useAttrFromUrlParams.ts +0 -21
- package/doc/src/app/hooks/useIsFullScreen.ts +0 -14
- package/doc/src/app/hooks/usePublicKey.ts +0 -19
- package/doc/src/app/layout.tsx +0 -53
- package/doc/src/app/page.tsx +0 -86
- package/doc/src/geops-ui.ts +0 -3
- package/doc/tsconfig.json +0 -41
- package/docutils.js +0 -417
- package/eslint.config.mjs +0 -34
- package/favicon.ico +0 -0
- package/fonts/source-sans-3/source-sans-3-v15-latin-500.ttf +0 -0
- package/fonts/source-sans-3/source-sans-3-v15-latin-500.woff2 +0 -0
- package/fonts/source-sans-3/source-sans-3-v15-latin-600.ttf +0 -0
- package/fonts/source-sans-3/source-sans-3-v15-latin-600.woff2 +0 -0
- package/fonts/source-sans-3/source-sans-3-v15-latin-700.ttf +0 -0
- package/fonts/source-sans-3/source-sans-3-v15-latin-700.woff2 +0 -0
- package/fonts/source-sans-3/source-sans-3-v15-latin-regular.ttf +0 -0
- package/fonts/source-sans-3/source-sans-3-v15-latin-regular.woff2 +0 -0
- package/global.d.ts +0 -9
- package/iframe.html +0 -233
- package/index.html +0 -147
- package/index.js +0 -4343
- package/input.css +0 -59
- package/jest-setup.js +0 -13
- package/jest.config.js +0 -17
- package/notifications.html +0 -144
- package/scripts/build.mjs +0 -15
- package/scripts/dev.mjs +0 -27
- package/search.html +0 -122
- package/src/BaseLayer/BaseLayer.tsx +0 -61
- package/src/BaseLayer/index.tsx +0 -1
- package/src/Copyright/Copyright.tsx +0 -51
- package/src/Copyright/index.tsx +0 -1
- package/src/DebugDeparture/DebugDeparture.tsx +0 -120
- package/src/DebugDeparture/index.tsx +0 -1
- package/src/DebugStop/DebugStop.tsx +0 -47
- package/src/DebugStop/index.tsx +0 -1
- package/src/Departure/Departure.tsx +0 -57
- package/src/Departure/index.tsx +0 -1
- package/src/EmbedNavigation/DragPanWarning.ts +0 -133
- package/src/EmbedNavigation/EmbedNavigation.tsx +0 -89
- package/src/EmbedNavigation/index.js +0 -1
- package/src/EmbedNavigation/index.tsx +0 -1
- package/src/ExportMenu/ExportMenu.tsx +0 -114
- package/src/ExportMenu/index.tsx +0 -1
- package/src/ExportMenuButton/ExportMenuButton.tsx +0 -33
- package/src/ExportMenuButton/index.tsx +0 -1
- package/src/FeatureDetails/FeatureDetails.tsx +0 -62
- package/src/FeatureDetails/index.ts +0 -1
- package/src/FeaturesInfosListener/FeaturesInfosListener.tsx +0 -142
- package/src/FeaturesInfosListener/index.tsx +0 -1
- package/src/GeolocationButton/GeolocationButton.tsx +0 -78
- package/src/GeolocationButton/index.tsx +0 -1
- package/src/I18n/I18n.tsx +0 -38
- package/src/I18n/index.tsx +0 -1
- package/src/LayerTree/LayerTree.tsx +0 -58
- package/src/LayerTree/TreeItem/TreeItem.tsx +0 -153
- package/src/LayerTree/TreeItem/index.tsx +0 -1
- package/src/LayerTree/index.tsx +0 -1
- package/src/LayerTree/layersTreeContext.ts +0 -4
- package/src/LayerTree/layersTreeReducer.ts +0 -158
- package/src/LayerTreeButton/LayerTreeButton.tsx +0 -33
- package/src/LayerTreeButton/index.tsx +0 -1
- package/src/LayerTreeMenu/LayerTreeMenu.tsx +0 -147
- package/src/LayerTreeMenu/index.tsx +0 -1
- package/src/LayoutState/LayoutState.tsx +0 -380
- package/src/LayoutState/index.tsx +0 -1
- package/src/LinesNetworkPlanDetails/LinesNetworkPlanDetails.tsx +0 -274
- package/src/LinesNetworkPlanDetails/index.tsx +0 -1
- package/src/LinesNetworkPlanLayer/LinesNetworkPlanLayer.tsx +0 -51
- package/src/LinesNetworkPlanLayer/index.tsx +0 -1
- package/src/LinesNetworkPlanLayerHighlight/LinesNetworkPlanLayerHighlight.tsx +0 -59
- package/src/LinesNetworkPlanLayerHighlight/index.tsx +0 -1
- package/src/Map/Map.tsx +0 -166
- package/src/Map/index.tsx +0 -1
- package/src/MapDispatchEvents/MapDispatchEvents.tsx +0 -87
- package/src/MapDispatchEvents/index.tsx +0 -1
- package/src/MapLayout/MapLayout.tsx +0 -172
- package/src/MapLayout/index.tsx +0 -1
- package/src/MapsetLayer/MapsetLayer.tsx +0 -111
- package/src/MapsetLayer/index.tsx +0 -1
- package/src/MobilityMap/MobilityMap.tsx +0 -338
- package/src/MobilityMap/MobilityMapAttributes.test.ts +0 -59
- package/src/MobilityMap/MobilityMapAttributes.ts +0 -381
- package/src/MobilityMap/MobilityMapEvents.ts +0 -53
- package/src/MobilityMap/index.css +0 -0
- package/src/MobilityMap/index.tsx +0 -2
- package/src/MobilityNotifications/MobilityNotifications.tsx +0 -153
- package/src/MobilityNotifications/MobilityNotificationsAttributes.test.ts +0 -35
- package/src/MobilityNotifications/MobilityNotificationsAttributes.ts +0 -53
- package/src/MobilityNotifications/index.ts +0 -2
- package/src/MobilitySearch/MobilitySearch.tsx +0 -35
- package/src/MobilitySearch/MobilitySearchAttributes.test.ts +0 -21
- package/src/MobilitySearch/MobilitySearchAttributes.ts +0 -87
- package/src/MobilitySearch/MobilitySearchEvents.ts +0 -21
- package/src/MobilitySearch/index.ts +0 -2
- package/src/NotificationDetails/NotificationDetails.tsx +0 -309
- package/src/NotificationDetails/index.ts +0 -1
- package/src/NotificationsLayer/NotificationsLayer.tsx +0 -124
- package/src/NotificationsLayer/index.tsx +0 -1
- package/src/Overlay/Overlay.tsx +0 -61
- package/src/Overlay/index.tsx +0 -1
- package/src/OverlayContent/OverlayContent.tsx +0 -88
- package/src/OverlayContent/index.ts +0 -1
- package/src/OverlayDetails/OverlayDetails.tsx +0 -93
- package/src/OverlayDetails/index.ts +0 -1
- package/src/OverlayDetailsFooter/OverlayDetailsFooter.tsx +0 -50
- package/src/OverlayDetailsFooter/index.tsx +0 -1
- package/src/OverlayDetailsHeader/OverlayDetailsHeader.tsx +0 -30
- package/src/OverlayDetailsHeader/index.ts +0 -1
- package/src/OverlayFooter/OverlayFooter.tsx +0 -42
- package/src/OverlayFooter/index.tsx +0 -1
- package/src/OverlayHeader/OverlayHeader.tsx +0 -44
- package/src/OverlayHeader/index.tsx +0 -1
- package/src/Permalink/Permalink.tsx +0 -89
- package/src/Permalink/index.tsx +0 -1
- package/src/PermalinkInput/PermalinkInput.tsx +0 -33
- package/src/PermalinkInput/index.tsx +0 -1
- package/src/RealtimeLayer/RealtimeLayer.tsx +0 -299
- package/src/RealtimeLayer/index.tsx +0 -1
- package/src/RouteDestination/RouteDestination.test.tsx +0 -13
- package/src/RouteDestination/RouteDestination.tsx +0 -15
- package/src/RouteDestination/index.tsx +0 -1
- package/src/RouteFollowingButton/RouteFollowingButton.tsx +0 -30
- package/src/RouteFollowingButton/index.tsx +0 -1
- package/src/RouteIcon/RouteIcon.tsx +0 -99
- package/src/RouteIcon/index.tsx +0 -1
- package/src/RouteIdentifier/RouteIdentifer.tsx +0 -36
- package/src/RouteIdentifier/index.tsx +0 -1
- package/src/RouteInfos/RouteInfos.tsx +0 -26
- package/src/RouteInfos/index.tsx +0 -1
- package/src/RouteSchedule/RouteSchedule.tsx +0 -59
- package/src/RouteSchedule/firstStation.png +0 -0
- package/src/RouteSchedule/index.tsx +0 -1
- package/src/RouteSchedule/lastStation.png +0 -0
- package/src/RouteSchedule/line.png +0 -0
- package/src/RouteSchedule/station.png +0 -0
- package/src/RouteScheduleFooter/RouteScheduleFooter.tsx +0 -46
- package/src/RouteScheduleFooter/index.tsx +0 -1
- package/src/RouteScheduleHeader/RouteScheduleHeader.tsx +0 -23
- package/src/RouteScheduleHeader/index.tsx +0 -1
- package/src/RouteStop/RouteStop.tsx +0 -108
- package/src/RouteStop/index.tsx +0 -1
- package/src/RouteStopDelay/RouteStopDelay.tsx +0 -37
- package/src/RouteStopDelay/index.tsx +0 -1
- package/src/RouteStopName/RouteStopName.tsx +0 -24
- package/src/RouteStopName/index.tsx +0 -1
- package/src/RouteStopPlatform/RouteStopPlatform.tsx +0 -27
- package/src/RouteStopPlatform/index.tsx +0 -1
- package/src/RouteStopProgress/RouteStopProgress.tsx +0 -100
- package/src/RouteStopProgress/index.tsx +0 -1
- package/src/RouteStopServices/RouteStopServices.tsx +0 -26
- package/src/RouteStopServices/index.tsx +0 -1
- package/src/RouteStopStation/RouteStopStation.tsx +0 -38
- package/src/RouteStopStation/index.tsx +0 -1
- package/src/RouteStopTime/RouteStopTime.tsx +0 -35
- package/src/RouteStopTime/index.tsx +0 -1
- package/src/RvfButton/RvfButton.tsx +0 -57
- package/src/RvfButton/index.tsx +0 -1
- package/src/RvfCheckbox/RvfCheckbox.tsx +0 -31
- package/src/RvfCheckbox/index.tsx +0 -1
- package/src/RvfCopyright/RvfCopyright.tsx +0 -36
- package/src/RvfCopyright/index.tsx +0 -1
- package/src/RvfFeatureDetails/RvfFeatureDetails.tsx +0 -46
- package/src/RvfFeatureDetails/RvfLineNetworkDetails/RvfLineNetworkDetails.tsx +0 -292
- package/src/RvfFeatureDetails/RvfLineNetworkDetails/index.js +0 -1
- package/src/RvfFeatureDetails/RvfNotificationDetails/RvfNotificationDetails.tsx +0 -36
- package/src/RvfFeatureDetails/RvfNotificationDetails/index.ts +0 -1
- package/src/RvfFeatureDetails/RvfSellingPointDetails/RvfSellingPointDetails.tsx +0 -50
- package/src/RvfFeatureDetails/RvfSellingPointDetails/index.js +0 -1
- package/src/RvfFeatureDetails/RvfSharedMobilityDetail/FloatingVehiclesDetails/FloatingVehiclesDetails.tsx +0 -74
- package/src/RvfFeatureDetails/RvfSharedMobilityDetail/FloatingVehiclesDetails/index.tsx +0 -1
- package/src/RvfFeatureDetails/RvfSharedMobilityDetail/RvfSharedMobilityDetails.tsx +0 -134
- package/src/RvfFeatureDetails/RvfSharedMobilityDetail/StationDetails/StationDetails.tsx +0 -84
- package/src/RvfFeatureDetails/RvfSharedMobilityDetail/StationDetails/index.tsx +0 -1
- package/src/RvfFeatureDetails/RvfSharedMobilityDetail/index.tsx +0 -1
- package/src/RvfFeatureDetails/index.tsx +0 -1
- package/src/RvfIconButton/RvfIconButton.tsx +0 -49
- package/src/RvfIconButton/index.tsx +0 -1
- package/src/RvfInputCopy/RvfInputCopy.tsx +0 -67
- package/src/RvfInputCopy/index.tsx +0 -1
- package/src/RvfLink/RvfLink.tsx +0 -54
- package/src/RvfLink/index.tsx +0 -1
- package/src/RvfMainLinkButton/RvfMainLinkButton.tsx +0 -62
- package/src/RvfMainLinkButton/index.tsx +0 -1
- package/src/RvfMapLayout/RvfMapLayout.tsx +0 -202
- package/src/RvfMapLayout/index.tsx +0 -1
- package/src/RvfMobilityMap/RvfMobilityMap.tsx +0 -58
- package/src/RvfMobilityMap/index.css +0 -13
- package/src/RvfMobilityMap/index.tsx +0 -1
- package/src/RvfModal/RvfModal.tsx +0 -53
- package/src/RvfModal/index.tsx +0 -1
- package/src/RvfOpenStrikeNotification/RvfOpenStrikeNotification.tsx +0 -120
- package/src/RvfOpenStrikeNotification/index.tsx +0 -1
- package/src/RvfOverlayHeader/RvfOverlayHeader.tsx +0 -43
- package/src/RvfOverlayHeader/index.tsx +0 -1
- package/src/RvfPoisLayer/RvfPoisLayer.tsx +0 -48
- package/src/RvfPoisLayer/index.tsx +0 -1
- package/src/RvfRadioButton/RvfRadioButton.tsx +0 -16
- package/src/RvfRadioButton/index.tsx +0 -1
- package/src/RvfRealtimeLayer/RvfRealtimeLayer.tsx +0 -77
- package/src/RvfRealtimeLayer/index.tsx +0 -1
- package/src/RvfRouteIcon/RvfRouteIcon.tsx +0 -10
- package/src/RvfRouteIcon/index.tsx +0 -1
- package/src/RvfSearch/RvfSearch.tsx +0 -34
- package/src/RvfSearch/index.tsx +0 -1
- package/src/RvfSelect/RvfSelect.tsx +0 -24
- package/src/RvfSelect/index.tsx +0 -1
- package/src/RvfSelectedFeatureHighlightLayer/RvfSelectedFeatureHighlightLayer.tsx +0 -101
- package/src/RvfSelectedFeatureHighlightLayer/index.tsx +0 -1
- package/src/RvfSellingPointsLayer/RvfSellingPointsLayer.tsx +0 -67
- package/src/RvfSellingPointsLayer/index.tsx +0 -1
- package/src/RvfSharedMobilityLayerGroup/RvfSharedMobilityLayerGroup.tsx +0 -479
- package/src/RvfSharedMobilityLayerGroup/index.tsx +0 -1
- package/src/RvfStationsLayer/RvfStationsLayer.tsx +0 -19
- package/src/RvfStationsLayer/index.tsx +0 -1
- package/src/RvfTarifZonenLayer/RvfTarifZonenLayer.tsx +0 -48
- package/src/RvfTarifZonenLayer/index.tsx +0 -1
- package/src/ScaleLine/ScaleLine.tsx +0 -52
- package/src/ScaleLine/index.css +0 -6
- package/src/ScaleLine/index.tsx +0 -1
- package/src/ScrollableHandler/ScrollableHandler.tsx +0 -66
- package/src/ScrollableHandler/index.tsx +0 -1
- package/src/Search/Search.tsx +0 -50
- package/src/Search/SearchBase.tsx +0 -187
- package/src/Search/SearchHeadless.tsx +0 -79
- package/src/Search/index.tsx +0 -3
- package/src/SearchButton/SearchButton.tsx +0 -33
- package/src/SearchButton/index.tsx +0 -1
- package/src/SearchLinesResult/SearchLinesResult.tsx +0 -43
- package/src/SearchLinesResult/index.tsx +0 -1
- package/src/SearchLinesResults/SearchLinesResults.tsx +0 -106
- package/src/SearchLinesResults/index.tsx +0 -1
- package/src/SearchLnpStopsResult/SearchLnpStopsResult.tsx +0 -42
- package/src/SearchLnpStopsResult/index.tsx +0 -1
- package/src/SearchLnpStopsResults/SearchLnpStopsResults.tsx +0 -106
- package/src/SearchLnpStopsResults/index.tsx +0 -1
- package/src/SearchResult/SearchResult.tsx +0 -25
- package/src/SearchResult/index.tsx +0 -1
- package/src/SearchResults/SearchResults.tsx +0 -81
- package/src/SearchResults/index.tsx +0 -1
- package/src/SearchResultsHeader/SearchResultsHeader.tsx +0 -36
- package/src/SearchResultsHeader/index.tsx +0 -1
- package/src/SearchStopsResult/SearchStopsResult.tsx +0 -43
- package/src/SearchStopsResult/index.tsx +0 -1
- package/src/SearchStopsResults/SearchStopsResults.tsx +0 -101
- package/src/SearchStopsResults/index.tsx +0 -1
- package/src/SearchTrainsResult/SearchTrainsResult.tsx +0 -42
- package/src/SearchTrainsResult/index.tsx +0 -1
- package/src/SearchTrainsResults/SearchTrainsResults.tsx +0 -106
- package/src/SearchTrainsResults/index.tsx +0 -1
- package/src/ShadowOverflow/ShadowOverflow.tsx +0 -28
- package/src/ShadowOverflow/index.tsx +0 -1
- package/src/ShareMenu/ShareMenu.tsx +0 -43
- package/src/ShareMenu/index.tsx +0 -1
- package/src/ShareMenuButton/ShareMenuButton.tsx +0 -34
- package/src/ShareMenuButton/index.tsx +0 -1
- package/src/SingleClickListener/SingleClickListener.tsx +0 -164
- package/src/SingleClickListener/index.tsx +0 -1
- package/src/SituationDetails/SituationDetails.tsx +0 -370
- package/src/SituationDetails/index.ts +0 -1
- package/src/Station/Station.tsx +0 -50
- package/src/Station/index.tsx +0 -1
- package/src/StationHeader/StationHeader.tsx +0 -32
- package/src/StationHeader/index.tsx +0 -1
- package/src/StationName/StationName.tsx +0 -21
- package/src/StationName/index.tsx +0 -1
- package/src/StationServices/StationServices.tsx +0 -80
- package/src/StationServices/index.tsx +0 -1
- package/src/StationsLayer/StationsLayer.tsx +0 -53
- package/src/StationsLayer/index.tsx +0 -1
- package/src/StopsSearch/StopsSearch.tsx +0 -344
- package/src/StopsSearch/index.tsx +0 -1
- package/src/WindowMessageListener/WindowMessageListener.tsx +0 -74
- package/src/WindowMessageListener/index.tsx +0 -1
- package/src/ZoomButtons/ZoomButtons.tsx +0 -80
- package/src/ZoomButtons/index.tsx +0 -1
- package/src/icons/Airport/Airport.tsx +0 -17
- package/src/icons/Airport/airport-14-svgrepo-com.svg +0 -1
- package/src/icons/Airport/index.tsx +0 -1
- package/src/icons/ArrowDown/ArrowDown.tsx +0 -22
- package/src/icons/ArrowDown/down-open.svg +0 -1
- package/src/icons/ArrowDown/index.tsx +0 -1
- package/src/icons/ArrowRight/ArrowRight.tsx +0 -19
- package/src/icons/ArrowRight/arrow-right.svg +0 -1
- package/src/icons/ArrowRight/index.tsx +0 -1
- package/src/icons/ArrowUp/ArrowUp.tsx +0 -22
- package/src/icons/ArrowUp/index.tsx +0 -1
- package/src/icons/ArrowUp/up-open.svg +0 -1
- package/src/icons/ArrowUpRight/ArrowUpRight.tsx +0 -35
- package/src/icons/ArrowUpRight/index.tsx +0 -1
- package/src/icons/ArrowUpRight/up-open.svg +0 -1
- package/src/icons/Automat/Automat.tsx +0 -8
- package/src/icons/Automat/index.tsx +0 -1
- package/src/icons/Automat/rvf_automat.svg +0 -1
- package/src/icons/BarAndRestaurants/BarAndRestaurants.tsx +0 -17
- package/src/icons/BarAndRestaurants/food-restaurant-svgrepo-com.svg +0 -1
- package/src/icons/BarAndRestaurants/index.tsx +0 -1
- package/src/icons/Bathroom/Bathroom.tsx +0 -59
- package/src/icons/Bathroom/bathroom-restroom-svgrepo-com.svg +0 -1
- package/src/icons/Bathroom/index.tsx +0 -1
- package/src/icons/Bike/Bike.tsx +0 -8
- package/src/icons/Bike/index.tsx +0 -1
- package/src/icons/Bike/rvf_shared_bike.svg +0 -1
- package/src/icons/BikeStorage/BikeStorage.tsx +0 -17
- package/src/icons/BikeStorage/index.tsx +0 -1
- package/src/icons/BikeStorage/parking-bicycle-14-svgrepo-com.svg +0 -1
- package/src/icons/Cancel/Cancel.tsx +0 -21
- package/src/icons/Cancel/cancel.svg +0 -1
- package/src/icons/Cancel/index.tsx +0 -1
- package/src/icons/Car/Car.tsx +0 -8
- package/src/icons/Car/index.tsx +0 -1
- package/src/icons/Car/rvf_shared_car.svg +0 -1
- package/src/icons/CargoBike/CargoBike.tsx +0 -8
- package/src/icons/CargoBike/index.tsx +0 -1
- package/src/icons/CargoBike/rvf_shared_cargo_bike.svg +0 -1
- package/src/icons/Copy/Copy.tsx +0 -25
- package/src/icons/Copy/index.tsx +0 -1
- package/src/icons/Doc/Doc.tsx +0 -19
- package/src/icons/Doc/doc.svg +0 -1
- package/src/icons/Doc/index.tsx +0 -1
- package/src/icons/DownOpen/DownOpen.tsx +0 -24
- package/src/icons/DownOpen/down-open.svg +0 -1
- package/src/icons/DownOpen/index.tsx +0 -1
- package/src/icons/Download/Download.tsx +0 -20
- package/src/icons/Download/download.svg +0 -1
- package/src/icons/Download/index.tsx +0 -1
- package/src/icons/Ebike/Ebike.tsx +0 -8
- package/src/icons/Ebike/index.tsx +0 -1
- package/src/icons/Ebike/rvf_shared_e-bike.svg +0 -1
- package/src/icons/Elevator/Elevator.tsx +0 -16
- package/src/icons/Elevator/elevator-svgrepo-com.svg +0 -1
- package/src/icons/Elevator/index.tsx +0 -1
- package/src/icons/Email/Email.tsx +0 -19
- package/src/icons/Email/email.svg +0 -1
- package/src/icons/Email/index.tsx +0 -1
- package/src/icons/FilePdf/FilePdf.tsx +0 -19
- package/src/icons/FilePdf/file-pdf.svg +0 -1
- package/src/icons/FilePdf/index.tsx +0 -1
- package/src/icons/Geolocation/Geolocation.tsx +0 -19
- package/src/icons/Geolocation/index.tsx +0 -1
- package/src/icons/Geolocation/location.svg +0 -1
- package/src/icons/Image/Image.tsx +0 -24
- package/src/icons/Image/index.tsx +0 -1
- package/src/icons/InPerson/InPerson.tsx +0 -8
- package/src/icons/InPerson/index.tsx +0 -1
- package/src/icons/InPerson/rvf_persoenlich.svg +0 -1
- package/src/icons/Menu/Menu.tsx +0 -32
- package/src/icons/Menu/index.tsx +0 -1
- package/src/icons/Menu/menu.svg +0 -1
- package/src/icons/Minus/Minus.tsx +0 -19
- package/src/icons/Minus/index.tsx +0 -1
- package/src/icons/Minus/minus-grey.svg +0 -1
- package/src/icons/Minus/minus.svg +0 -1
- package/src/icons/NoRealtime/NoRealtime.tsx +0 -44
- package/src/icons/NoRealtime/index.tsx +0 -1
- package/src/icons/NoRealtime/norealtime.svg +0 -1
- package/src/icons/Ok/ok-grey.svg +0 -1
- package/src/icons/Ok/ok.svg +0 -1
- package/src/icons/Plus/Plus.tsx +0 -19
- package/src/icons/Plus/index.tsx +0 -1
- package/src/icons/Plus/plus.svg +0 -1
- package/src/icons/Police/Police.tsx +0 -20
- package/src/icons/Police/index.tsx +0 -1
- package/src/icons/Police/polizia.png +0 -0
- package/src/icons/README.md +0 -52
- package/src/icons/Ride/Ride.tsx +0 -8
- package/src/icons/Ride/index.tsx +0 -1
- package/src/icons/Ride/rvf_shared_ride.svg +0 -1
- package/src/icons/Scooter/Scooter.tsx +0 -8
- package/src/icons/Scooter/index.tsx +0 -1
- package/src/icons/Scooter/rvf_shared_scooter.svg +0 -1
- package/src/icons/Search/Search.tsx +0 -38
- package/src/icons/Search/index.tsx +0 -1
- package/src/icons/Search/search.svg +0 -1
- package/src/icons/Share/Share.tsx +0 -24
- package/src/icons/Share/index.tsx +0 -1
- package/src/icons/Stack/Stack.tsx +0 -24
- package/src/icons/Stack/index.tsx +0 -1
- package/src/icons/TouchFingers/TouchFingers.tsx +0 -20
- package/src/icons/TouchFingers/index.tsx +0 -1
- package/src/icons/Tracking/Tracking.tsx +0 -29
- package/src/icons/Tracking/airport-14-svgrepo-com.svg +0 -1
- package/src/icons/Tracking/index.tsx +0 -1
- package/src/icons/Video/Video.tsx +0 -8
- package/src/icons/Video/index.tsx +0 -1
- package/src/icons/Video/rvf_video.svg +0 -1
- package/src/icons/WaitingAreas/WaitingAreas.tsx +0 -16
- package/src/icons/WaitingAreas/highway-rest-area-svgrepo-com.svg +0 -1
- package/src/icons/WaitingAreas/index.tsx +0 -1
- package/src/icons/WaitingAreas/wheelchair-svgrepo-com.svg +0 -1
- package/src/icons/Warning/Warning.tsx +0 -56
- package/src/icons/Warning/exported_features_20251029101203.kml +0 -20
- package/src/icons/Warning/index.tsx +0 -1
- package/src/icons/Warning/info-achtung-kreisrot-rot.svg +0 -1
- package/src/icons/WheelChair/WheelChair.tsx +0 -16
- package/src/icons/WheelChair/disabili.png +0 -0
- package/src/icons/WheelChair/index.tsx +0 -1
- package/src/icons/WheelChair/wheelchair-svgrepo-com.svg +0 -1
- package/src/icons/disruption-type-banner.xcf +0 -0
- package/src/icons/rvf_shared_ride_2.svg +0 -1
- package/src/icons/sbb_add_stop.png +0 -0
- package/src/icons/sbb_add_stop.svg +0 -1
- package/src/icons/sbb_alternative.png +0 -0
- package/src/icons/sbb_alternative.svg +0 -1
- package/src/icons/sbb_cancellation.png +0 -0
- package/src/icons/sbb_cancellation.svg +0 -1
- package/src/icons/sbb_construction.png +0 -0
- package/src/icons/sbb_construction.svg +0 -1
- package/src/icons/sbb_construction_banner.png +0 -0
- package/src/icons/sbb_delay.png +0 -0
- package/src/icons/sbb_delay.svg +0 -1
- package/src/icons/sbb_disruption.png +0 -0
- package/src/icons/sbb_disruption.svg +0 -1
- package/src/icons/sbb_disruption_banner.png +0 -0
- package/src/icons/sbb_info.png +0 -0
- package/src/icons/sbb_info.svg +0 -1
- package/src/icons/sbb_missed_connection.png +0 -0
- package/src/icons/sbb_missed_connection.svg +0 -1
- package/src/icons/sbb_missed_connection_banner.png +0 -0
- package/src/icons/sbb_platform_change.png +0 -0
- package/src/icons/sbb_platform_change.svg +0 -1
- package/src/icons/sbb_replacementbus.png +0 -0
- package/src/icons/sbb_replacementbus.svg +0 -1
- package/src/icons/sbb_replacementbus_banner.png +0 -0
- package/src/icons/sbb_reroute.png +0 -0
- package/src/icons/sbb_reroute.svg +0 -1
- package/src/icons/warning-banner.png +0 -0
- package/src/icons/warning-banner.xcf +0 -0
- package/src/icons/warning.png +0 -0
- package/src/index.tsx +0 -44
- package/src/indexDoc.ts +0 -35
- package/src/logos/00_RegioRad_Stuttgart.svg +0 -1
- package/src/logos/01_Call_a_bike.svg +0 -1
- package/src/logos/03_KVV_nextbike.svg +0 -1
- package/src/logos/05_VrnNextbike.svg +0 -1
- package/src/logos/2em_carsharing.svg +0 -1
- package/src/logos/CarSharing-Renningen.png +0 -0
- package/src/logos/aubonne-basel-pickebike.svg +0 -1
- package/src/logos/br_logo.svg +0 -1
- package/src/logos/callabike_logo.png +0 -0
- package/src/logos/carsharing_stadtmobil_karlsruhe_rhein_neckar.svg +0 -1
- package/src/logos/compte-mobilite.png +0 -0
- package/src/logos/deer.svg +0 -1
- package/src/logos/donkey_republic.png +0 -0
- package/src/logos/edrive_carsharing.svg +0 -1
- package/src/logos/flinkster_logo.png +0 -0
- package/src/logos/gruene-flotte-logo-1.svg +0 -1
- package/src/logos/gruene_flotte_logo.png +0 -0
- package/src/logos/lasten_velo_freiburg.png +0 -0
- package/src/logos/lie_mobil.svg +0 -1
- package/src/logos/logo-einfach-mobil-ortenau.png +0 -0
- package/src/logos/logo-red.svg +0 -1
- package/src/logos/logo_frelo_web_rgb.png +0 -0
- package/src/logos/logo_teilauto.png +0 -0
- package/src/logos/mein_konrad.svg +0 -1
- package/src/logos/mit_fahr_punkt.png +0 -0
- package/src/logos/natur_energie_logo.png +0 -0
- package/src/logos/natur_energie_logo.xcf +0 -0
- package/src/logos/publibike_logo.svg +0 -1
- package/src/logos/share-birrer.svg +0 -1
- package/src/logos/stadtmobil_suedbaden.svg +0 -1
- package/src/logos/stadtwerke_tauberfranken.png +0 -0
- package/src/logos/teilauto_biberach.png +0 -0
- package/src/logos/velospot_fribourg.png +0 -0
- package/src/logos/yoio_logo.png +0 -0
- package/src/logos/zeag_carsharing.png +0 -0
- package/src/logos/zeo_carsharing.png +0 -0
- package/src/logos/zeus_logo.png +0 -0
- package/src/logos/zeus_logo.xcf +0 -0
- package/src/ui/Button/Button.tsx +0 -64
- package/src/ui/Button/index.tsx +0 -1
- package/src/ui/Checkbox/Checkbox.tsx +0 -32
- package/src/ui/Checkbox/index.tsx +0 -1
- package/src/ui/IconButton/IconButton.tsx +0 -64
- package/src/ui/IconButton/index.tsx +0 -1
- package/src/ui/Input/Input.tsx +0 -24
- package/src/ui/Input/index.tsx +0 -1
- package/src/ui/InputCopy/InputCopy.tsx +0 -97
- package/src/ui/InputCopy/index.tsx +0 -1
- package/src/ui/InputSearch/InputSearch.tsx +0 -106
- package/src/ui/InputSearch/index.tsx +0 -1
- package/src/ui/Link/Link.tsx +0 -49
- package/src/ui/Link/index.tsx +0 -1
- package/src/ui/Select/Select.tsx +0 -24
- package/src/ui/Select/index.tsx +0 -1
- package/src/utils/MobilityEvent.ts +0 -22
- package/src/utils/applyInitialLayerVisibility.ts +0 -48
- package/src/utils/centerOnVehicle.ts +0 -58
- package/src/utils/constants.ts +0 -242
- package/src/utils/exportPdf.ts +0 -671
- package/src/utils/fullTrajectoryStyle.ts +0 -53
- package/src/utils/getAllLayers.ts +0 -26
- package/src/utils/getBgColor.ts +0 -20
- package/src/utils/getDelayColor.test.ts +0 -23
- package/src/utils/getDelayColor.ts +0 -23
- package/src/utils/getDelayColorForVehicle.test.ts +0 -47
- package/src/utils/getDelayColorForVehicle.ts +0 -27
- package/src/utils/getDelayString.test.ts +0 -25
- package/src/utils/getDelayString.ts +0 -28
- package/src/utils/getDelayTextForVehicle.test.ts +0 -32
- package/src/utils/getDelayTextForVehicle.ts +0 -25
- package/src/utils/getFullTrajectoryAndFit.ts +0 -41
- package/src/utils/getHoursAndMinutes.test.ts +0 -15
- package/src/utils/getHoursAndMinutes.ts +0 -22
- package/src/utils/getLayersAsFlatArray.ts +0 -22
- package/src/utils/getLinkByDevice.ts +0 -23
- package/src/utils/getMainColorForVehicle.test.ts +0 -25
- package/src/utils/getMainColorForVehicle.ts +0 -54
- package/src/utils/getPermalinkParameters.ts +0 -35
- package/src/utils/getRadius.ts +0 -46
- package/src/utils/getStopStatus.test.ts +0 -105
- package/src/utils/getStopStatus.ts +0 -171
- package/src/utils/getTextColor.ts +0 -10
- package/src/utils/getTextColorForVehicle.ts +0 -31
- package/src/utils/getTextFontForVehicle.test.ts +0 -7
- package/src/utils/getTextFontForVehicle.tsx +0 -17
- package/src/utils/getTextForVehicle.test.ts +0 -17
- package/src/utils/getTextForVehicle.ts +0 -25
- package/src/utils/getUrlFromTemplate.test.ts +0 -23
- package/src/utils/getUrlFromTemplate.ts +0 -47
- package/src/utils/highlightLinesNetworkPlan.ts +0 -25
- package/src/utils/hooks/useDebug.tsx +0 -11
- package/src/utils/hooks/useDeparture.tsx +0 -24
- package/src/utils/hooks/useFit.tsx +0 -57
- package/src/utils/hooks/useFitOnFeatures.tsx +0 -77
- package/src/utils/hooks/useI18n.tsx +0 -23
- package/src/utils/hooks/useInitialLayersVisiblity.tsx +0 -58
- package/src/utils/hooks/useInitialPermalink.tsx +0 -93
- package/src/utils/hooks/useLayerConfig.tsx +0 -17
- package/src/utils/hooks/useLayersConfig.tsx +0 -49
- package/src/utils/hooks/useLnp.tsx +0 -146
- package/src/utils/hooks/useMapContext.tsx +0 -166
- package/src/utils/hooks/useMocoSituation.tsx +0 -62
- package/src/utils/hooks/useParams.ts +0 -5
- package/src/utils/hooks/usePermalink.tsx +0 -25
- package/src/utils/hooks/useRealtimeDepartures.tsx +0 -45
- package/src/utils/hooks/useRealtimeRenderedTrajectory.tsx +0 -42
- package/src/utils/hooks/useRealtimeStation.tsx +0 -39
- package/src/utils/hooks/useRealtimeStopSequences.tsx +0 -43
- package/src/utils/hooks/useRealtimeTrainsByRouteIdentifier.tsx +0 -72
- package/src/utils/hooks/useRouteStop.tsx +0 -40
- package/src/utils/hooks/useRvfContext.tsx +0 -46
- package/src/utils/hooks/useScrollTo.tsx +0 -36
- package/src/utils/hooks/useSearchLines.tsx +0 -34
- package/src/utils/hooks/useSearchLnpStops.tsx +0 -38
- package/src/utils/hooks/useSearchStops.tsx +0 -85
- package/src/utils/hooks/useSearchTrains.tsx +0 -83
- package/src/utils/hooks/useZoom.tsx +0 -44
- package/src/utils/mergePublications.test.ts +0 -91
- package/src/utils/mergePublications.ts +0 -52
- package/src/utils/realtimeRVFStyle.ts +0 -523
- package/src/utils/sharingGraphqlUtils.ts +0 -320
- package/src/utils/sharingStylesUtils.ts +0 -222
- package/src/utils/sharingWFSUtils.ts +0 -116
- package/src/utils/translations.ts +0 -252
- package/src/utils/translationsReasons.ts +0 -716
- package/tailwind.config.mjs +0 -95
- package/testNotification.json +0 -115
- package/tsconfig.json +0 -12
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
import getStopStatus from "./getStopStatus";
|
|
2
|
-
|
|
3
|
-
describe("getStopStatus", () => {
|
|
4
|
-
describe("when the station is empty", () => {
|
|
5
|
-
it("returns a correct status", () => {
|
|
6
|
-
const stopSequence = {
|
|
7
|
-
stations: [{}],
|
|
8
|
-
};
|
|
9
|
-
const {
|
|
10
|
-
// progress,
|
|
11
|
-
// isInBetween,
|
|
12
|
-
// isCancelled,
|
|
13
|
-
// isFirst,
|
|
14
|
-
// isLast,
|
|
15
|
-
// isPassed,
|
|
16
|
-
// isLeft,
|
|
17
|
-
// isNotRealtime,
|
|
18
|
-
isNotStop,
|
|
19
|
-
// isBoarding,
|
|
20
|
-
// isNextStop,
|
|
21
|
-
// isCloseToNextStop,
|
|
22
|
-
// @ts-expect-error bad type definition
|
|
23
|
-
} = getStopStatus(stopSequence, 0);
|
|
24
|
-
expect(isNotStop).toBe(true);
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
it("returns a correct isNotRealtime status", () => {
|
|
28
|
-
const stopSequence = {
|
|
29
|
-
stations: [
|
|
30
|
-
{ arrivalDelay: null, departureDelay: null, state: "PENDING" },
|
|
31
|
-
{ arrivalDelay: null, departureDelay: null, state: "TIME_BASED" },
|
|
32
|
-
{ arrivalDelay: 0, departureDelay: 0, state: "PENDING" },
|
|
33
|
-
{ arrivalDelay: 0, departureDelay: 0, state: "TIME_BASED" },
|
|
34
|
-
],
|
|
35
|
-
};
|
|
36
|
-
let {
|
|
37
|
-
isNotRealtime,
|
|
38
|
-
// @ts-expect-error bad type definition
|
|
39
|
-
} = getStopStatus(stopSequence, 0);
|
|
40
|
-
expect(isNotRealtime).toBe(true);
|
|
41
|
-
// @ts-expect-error bad type definition
|
|
42
|
-
isNotRealtime = getStopStatus(stopSequence, 1).isNotRealtime;
|
|
43
|
-
expect(isNotRealtime).toBe(true);
|
|
44
|
-
// @ts-expect-error bad type definition
|
|
45
|
-
isNotRealtime = getStopStatus(stopSequence, 2).isNotRealtime;
|
|
46
|
-
expect(isNotRealtime).toBe(false);
|
|
47
|
-
// @ts-expect-error bad type definition
|
|
48
|
-
isNotRealtime = getStopStatus(stopSequence, 3).isNotRealtime;
|
|
49
|
-
expect(isNotRealtime).toBe(true);
|
|
50
|
-
});
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
describe("when it's the first station", () => {
|
|
54
|
-
it("returns a correct status", () => {
|
|
55
|
-
const stopSequence = {
|
|
56
|
-
stations: [{}],
|
|
57
|
-
};
|
|
58
|
-
const {
|
|
59
|
-
// isInBetween,
|
|
60
|
-
// isCancelled,
|
|
61
|
-
isFirst,
|
|
62
|
-
// isLast,
|
|
63
|
-
// isPassed,
|
|
64
|
-
// isLeft,
|
|
65
|
-
// isNotRealtime,
|
|
66
|
-
// isNotStop,
|
|
67
|
-
// isBoarding,
|
|
68
|
-
isNextStop,
|
|
69
|
-
progress,
|
|
70
|
-
// isCloseToNextStop,
|
|
71
|
-
// @ts-expect-error bad type definition
|
|
72
|
-
} = getStopStatus(stopSequence, 0);
|
|
73
|
-
expect(progress).toBe(50);
|
|
74
|
-
expect(isFirst).toBe(true);
|
|
75
|
-
expect(isNextStop).toBe(true);
|
|
76
|
-
});
|
|
77
|
-
});
|
|
78
|
-
|
|
79
|
-
describe("when it's the first station and not a stop", () => {
|
|
80
|
-
it("returns a correct status", () => {
|
|
81
|
-
const stopSequence = {
|
|
82
|
-
stations: [{}],
|
|
83
|
-
};
|
|
84
|
-
const {
|
|
85
|
-
// isInBetween,
|
|
86
|
-
// isCancelled,
|
|
87
|
-
isFirst,
|
|
88
|
-
// isBoarding,
|
|
89
|
-
isNextStop,
|
|
90
|
-
// isLast,
|
|
91
|
-
// isPassed,
|
|
92
|
-
// isLeft,
|
|
93
|
-
// isNotRealtime,
|
|
94
|
-
isNotStop,
|
|
95
|
-
progress,
|
|
96
|
-
// isCloseToNextStop,
|
|
97
|
-
// @ts-expect-error bad type definition
|
|
98
|
-
} = getStopStatus(stopSequence, 0);
|
|
99
|
-
expect(progress).toBe(50);
|
|
100
|
-
expect(isFirst).toBe(true);
|
|
101
|
-
expect(isNextStop).toBe(true);
|
|
102
|
-
expect(isNotStop).toBe(true);
|
|
103
|
-
});
|
|
104
|
-
});
|
|
105
|
-
});
|
|
@@ -1,171 +0,0 @@
|
|
|
1
|
-
import type { RealtimeStopSequence } from "mobility-toolbox-js/types";
|
|
2
|
-
|
|
3
|
-
export interface StopStatus {
|
|
4
|
-
isBoarding?: boolean;
|
|
5
|
-
isCancelled?: boolean;
|
|
6
|
-
isCloseToNextStop?: boolean;
|
|
7
|
-
isFirst?: boolean;
|
|
8
|
-
isInBetween?: boolean;
|
|
9
|
-
isLast?: boolean;
|
|
10
|
-
isLeft?: boolean;
|
|
11
|
-
isNextStop?: boolean;
|
|
12
|
-
isNotRealtime?: boolean;
|
|
13
|
-
isNotStop?: boolean;
|
|
14
|
-
isPassed?: boolean;
|
|
15
|
-
progress?: number;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
const getBasicStatus = (stop, currTime, previousStop, nextStop) => {
|
|
19
|
-
let topBoundary = stop.arrivalTime;
|
|
20
|
-
let bottomBoundary = stop.arrivalTime;
|
|
21
|
-
|
|
22
|
-
if (previousStop) {
|
|
23
|
-
topBoundary =
|
|
24
|
-
stop.arrivalTime - (stop.arrivalTime - previousStop.arrivalTime) / 2;
|
|
25
|
-
}
|
|
26
|
-
if (nextStop) {
|
|
27
|
-
bottomBoundary =
|
|
28
|
-
stop.arrivalTime + (nextStop.arrivalTime - stop.arrivalTime) / 2;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
const isNotStop = !stop.arrivalTime && !stop.departureTime;
|
|
32
|
-
const hasNoDelays =
|
|
33
|
-
stop.arrivalDelay === null && stop.departureDelay === null;
|
|
34
|
-
const isNotRealtime = stop.state === "TIME_BASED" || hasNoDelays;
|
|
35
|
-
const isCancelled =
|
|
36
|
-
stop.state === "JOURNEY_CANCELLED" || stop.state === "STOP_CANCELLED";
|
|
37
|
-
const isBoarding = stop.state === "BOARDING";
|
|
38
|
-
|
|
39
|
-
const isPassedBottom = currTime > bottomBoundary;
|
|
40
|
-
|
|
41
|
-
const isLeft =
|
|
42
|
-
stop.state === "LEAVING" ||
|
|
43
|
-
(isNotRealtime && isPassedBottom) ||
|
|
44
|
-
(isCancelled && isPassedBottom);
|
|
45
|
-
|
|
46
|
-
return {
|
|
47
|
-
bottomBoundary,
|
|
48
|
-
isBoarding,
|
|
49
|
-
isCancelled,
|
|
50
|
-
isLeft,
|
|
51
|
-
isNotRealtime,
|
|
52
|
-
isNotStop,
|
|
53
|
-
isPassedBottom,
|
|
54
|
-
topBoundary,
|
|
55
|
-
};
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
/**
|
|
59
|
-
* This function provide an object with some informations about the status of the vehicle for this station.
|
|
60
|
-
* If the vehicul has already passed the sattion how far is it from the station, ...
|
|
61
|
-
*/
|
|
62
|
-
const getStopStatus = (
|
|
63
|
-
stopSequence: RealtimeStopSequence,
|
|
64
|
-
index: number,
|
|
65
|
-
): StopStatus => {
|
|
66
|
-
const { stations: stops } = stopSequence;
|
|
67
|
-
let progress = 0;
|
|
68
|
-
const previousStop = stops[index - 1];
|
|
69
|
-
const stop = stops[index];
|
|
70
|
-
const nextStop = stops[index + 1];
|
|
71
|
-
|
|
72
|
-
if (!stop) {
|
|
73
|
-
return {};
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
const currTime = Date.now();
|
|
77
|
-
const previousStopStatus =
|
|
78
|
-
previousStop &&
|
|
79
|
-
getBasicStatus(previousStop, currTime, stops[index - 2], stop);
|
|
80
|
-
const basicStatus = getBasicStatus(stop, currTime, previousStop, nextStop);
|
|
81
|
-
let { isLeft } = basicStatus;
|
|
82
|
-
const {
|
|
83
|
-
bottomBoundary,
|
|
84
|
-
isBoarding,
|
|
85
|
-
isCancelled,
|
|
86
|
-
isNotRealtime,
|
|
87
|
-
isNotStop,
|
|
88
|
-
isPassedBottom,
|
|
89
|
-
topBoundary,
|
|
90
|
-
} = basicStatus;
|
|
91
|
-
|
|
92
|
-
const isNextStop = !isLeft && (!previousStop || previousStopStatus.isLeft);
|
|
93
|
-
|
|
94
|
-
// The future stop is the stop after a stop with state === "BOARDING"
|
|
95
|
-
const isFutureStop = !isLeft && (!previousStop || !previousStopStatus.isLeft);
|
|
96
|
-
|
|
97
|
-
let isCloseToNextStop = false;
|
|
98
|
-
if (isNextStop) {
|
|
99
|
-
const timeGap = (bottomBoundary - topBoundary) * 0.2; // 20% of the duration between 2 stops
|
|
100
|
-
isCloseToNextStop = currTime > stop.arrivalTime - timeGap;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
// Check if the stop has been passed
|
|
104
|
-
// For SBAHNMW-298
|
|
105
|
-
// Considerate the state ("LEAVING")
|
|
106
|
-
// which is important if the data has not been updated for a long time
|
|
107
|
-
let isPassed = isPassedBottom && !isNextStop && !isFutureStop;
|
|
108
|
-
|
|
109
|
-
if (topBoundary < currTime && currTime < bottomBoundary && !isFutureStop) {
|
|
110
|
-
progress = Math.round(
|
|
111
|
-
((currTime - topBoundary) * 100) / (bottomBoundary - topBoundary),
|
|
112
|
-
);
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
// For SBAHNMW-298
|
|
116
|
-
// Set the progress manually
|
|
117
|
-
// if the data has not been updated for a long time.
|
|
118
|
-
// These stops would have be passed if the data were up-to-date
|
|
119
|
-
if (isPassedBottom && (isNextStop || isFutureStop)) {
|
|
120
|
-
progress = 0;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
// The first station is a special case because the top boundary starts at 50% of the div element.
|
|
124
|
-
const isFirstStation = index === 0;
|
|
125
|
-
|
|
126
|
-
if (isFirstStation) {
|
|
127
|
-
progress = 50;
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
if (isBoarding) {
|
|
131
|
-
// When the train has not left the first station the progress is 0.
|
|
132
|
-
progress = 50;
|
|
133
|
-
} else if (
|
|
134
|
-
!isFirstStation &&
|
|
135
|
-
((isLeft && progress < 50) || (!isLeft && progress > 50))
|
|
136
|
-
) {
|
|
137
|
-
// Here we ensure that isLeft and progress values are properly synced
|
|
138
|
-
// It doesn't apply to the the first station.
|
|
139
|
-
progress = 50;
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
// For SBAHNMW-210
|
|
143
|
-
// If some data (arrivalTime or state) from backend are wrong, 2 stops have the progress bar.
|
|
144
|
-
// So to avoid double progress display, we force the isPassed value to true.
|
|
145
|
-
if (progress > 50 && getStopStatus(stopSequence, index + 1).progress > 0) {
|
|
146
|
-
progress = 100;
|
|
147
|
-
isLeft = true;
|
|
148
|
-
isPassed = true;
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
if (isPassed) {
|
|
152
|
-
progress = 100;
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
return {
|
|
156
|
-
isBoarding,
|
|
157
|
-
isCancelled,
|
|
158
|
-
isCloseToNextStop,
|
|
159
|
-
isFirst: !previousStop,
|
|
160
|
-
isInBetween: !isPassed && progress > 0,
|
|
161
|
-
isLast: !nextStop,
|
|
162
|
-
isLeft,
|
|
163
|
-
isNextStop,
|
|
164
|
-
isNotRealtime,
|
|
165
|
-
isNotStop,
|
|
166
|
-
isPassed,
|
|
167
|
-
progress,
|
|
168
|
-
};
|
|
169
|
-
};
|
|
170
|
-
|
|
171
|
-
export default getStopStatus;
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { realtimeConfig } from "mobility-toolbox-js/ol";
|
|
2
|
-
|
|
3
|
-
import getTextColor from "./getTextColor";
|
|
4
|
-
|
|
5
|
-
import type {
|
|
6
|
-
RealtimeDeparture,
|
|
7
|
-
RealtimeLine,
|
|
8
|
-
RealtimeStopSequence,
|
|
9
|
-
RealtimeTrajectory,
|
|
10
|
-
} from "mobility-toolbox-js/types";
|
|
11
|
-
|
|
12
|
-
import type { LnpLineInfo } from "./hooks/useLnp";
|
|
13
|
-
|
|
14
|
-
const getTextColorForVehicle = (object: unknown) => {
|
|
15
|
-
const textColor =
|
|
16
|
-
(object as LnpLineInfo | RealtimeLine).text_color ||
|
|
17
|
-
(object as RealtimeDeparture | RealtimeStopSequence).line?.text_color ||
|
|
18
|
-
(object as RealtimeTrajectory).properties?.line?.text_color;
|
|
19
|
-
|
|
20
|
-
if (textColor) {
|
|
21
|
-
return textColor;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
const type =
|
|
25
|
-
(object as RealtimeStopSequence).type ||
|
|
26
|
-
(object as RealtimeTrajectory).properties?.type;
|
|
27
|
-
|
|
28
|
-
return getTextColor(type) || realtimeConfig.getTextColorForType(type);
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
export default getTextColorForVehicle;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import type { ViewState } from "mobility-toolbox-js/types";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Return the font depending on an object representing a vehicle or a line.
|
|
5
|
-
* This function is used to have the same font on the map and on other components.
|
|
6
|
-
*/
|
|
7
|
-
const getTextFontForVehicle = (
|
|
8
|
-
object?: unknown,
|
|
9
|
-
viewState?: ViewState,
|
|
10
|
-
fontSize?: number,
|
|
11
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
12
|
-
text?: string,
|
|
13
|
-
) => {
|
|
14
|
-
return `bold ${fontSize}px arial`;
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
export default getTextFontForVehicle;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import getTextForVehicle from "./getTextForVehicle";
|
|
2
|
-
|
|
3
|
-
describe("getTextForVehicle", () => {
|
|
4
|
-
it("returns empty", () => {
|
|
5
|
-
expect(getTextForVehicle()).toBe("");
|
|
6
|
-
expect(getTextForVehicle(null)).toBe("");
|
|
7
|
-
});
|
|
8
|
-
|
|
9
|
-
it("returns name", () => {
|
|
10
|
-
expect(getTextForVehicle("name")).toBe("name");
|
|
11
|
-
expect(getTextForVehicle({ name: "name" })).toBe("name");
|
|
12
|
-
expect(getTextForVehicle({ line: { name: "name" } })).toBe("name");
|
|
13
|
-
expect(getTextForVehicle({ properties: { line: { name: "name" } } })).toBe(
|
|
14
|
-
"name",
|
|
15
|
-
);
|
|
16
|
-
});
|
|
17
|
-
});
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
RealtimeLine,
|
|
3
|
-
RealtimeStopSequence,
|
|
4
|
-
RealtimeTrajectory,
|
|
5
|
-
} from "mobility-toolbox-js/types";
|
|
6
|
-
|
|
7
|
-
import type { LnpLineInfo } from "./hooks/useLnp";
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Return the text depending on an object representing a vehicle or a line.
|
|
11
|
-
* This function is used to have the same text on the map and on other components.
|
|
12
|
-
*/
|
|
13
|
-
const getTextForVehicle = (object: unknown = ""): string => {
|
|
14
|
-
const name =
|
|
15
|
-
(object as RealtimeTrajectory)?.properties?.line?.name ||
|
|
16
|
-
(object as RealtimeStopSequence)?.line?.name ||
|
|
17
|
-
(object as RealtimeLine)?.name ||
|
|
18
|
-
(object as LnpLineInfo)?.short_name ||
|
|
19
|
-
(object as string) ||
|
|
20
|
-
"";
|
|
21
|
-
|
|
22
|
-
return name;
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
export default getTextForVehicle;
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import getUrlFromTemplate from "./getUrlFromTemplate";
|
|
2
|
-
|
|
3
|
-
describe("getUrlFromTemplate", () => {
|
|
4
|
-
it("should replace parameters in the template", () => {
|
|
5
|
-
const template = "?z={{z}}&x={{x}}&y={{y}}";
|
|
6
|
-
const params = new URLSearchParams({ x: "512", y: "200", z: "10" });
|
|
7
|
-
const url = getUrlFromTemplate(template, params);
|
|
8
|
-
expect(url).toBe("http://localhost/?z=10&x=512&y=200");
|
|
9
|
-
});
|
|
10
|
-
|
|
11
|
-
it("should handle hash templates", () => {
|
|
12
|
-
const template = "#/map/{{z}}/{{x}}/{{y}}";
|
|
13
|
-
const params = new URLSearchParams({ x: "512", y: "200", z: "10" });
|
|
14
|
-
const url = getUrlFromTemplate(template, params);
|
|
15
|
-
expect(url).toBe("http://localhost/#/map/10/512/200");
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
it("should handle null templates returning the window location", () => {
|
|
19
|
-
const params = new URLSearchParams({ x: "512", y: "200", z: "10" });
|
|
20
|
-
const url = getUrlFromTemplate(null, params);
|
|
21
|
-
expect(url).toBe("http://localhost/");
|
|
22
|
-
});
|
|
23
|
-
});
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Return an url as a string from a template and a list of parameters.
|
|
3
|
-
* Example:
|
|
4
|
-
* template: "https://example.com/{{z}}/{{x}}/{{y}}.png"
|
|
5
|
-
* params: {z: "10", x: "512", y: "512"}
|
|
6
|
-
* return: "https://example.com/10/512/512.png"
|
|
7
|
-
*
|
|
8
|
-
* If a parameter is missing, the template is not replaced.
|
|
9
|
-
*
|
|
10
|
-
* @param template - The url template containing parameters in the form {{param}}
|
|
11
|
-
* @param params - An object containing the parameters to replace in the template
|
|
12
|
-
* @returns The url with the parameters replaced
|
|
13
|
-
*/
|
|
14
|
-
function getUrlFromTemplate(template: string, params: URLSearchParams): string {
|
|
15
|
-
let tpl = template || "";
|
|
16
|
-
params?.forEach((value, key) => {
|
|
17
|
-
tpl = tpl.replace(`{{${key}}}`, value);
|
|
18
|
-
});
|
|
19
|
-
if (tpl.startsWith("#")) {
|
|
20
|
-
tpl = `${window.location.href.split("#")[0]}${tpl}`;
|
|
21
|
-
} else if (tpl.startsWith("?") || !tpl) {
|
|
22
|
-
const existingParams = new URLSearchParams(window.location.search);
|
|
23
|
-
|
|
24
|
-
// Set current values of the template parameters
|
|
25
|
-
const tplParams = new URLSearchParams(tpl);
|
|
26
|
-
tplParams.forEach((value, key) => {
|
|
27
|
-
existingParams.set(key, value);
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
// Remove duplicated parameters if the template already includes them
|
|
31
|
-
if (template?.includes("{{x}}") && template?.includes("{{y}}")) {
|
|
32
|
-
existingParams.delete("center");
|
|
33
|
-
}
|
|
34
|
-
if (template?.includes("{{z}}")) {
|
|
35
|
-
existingParams.delete("zoom");
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
let str = existingParams.toString();
|
|
39
|
-
if (!str.startsWith("?") && tpl.length) {
|
|
40
|
-
str = `?${str}`;
|
|
41
|
-
}
|
|
42
|
-
tpl = `${window.location.href.split("?")[0]}${str}${window.location.hash}`;
|
|
43
|
-
}
|
|
44
|
-
return tpl;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
export default getUrlFromTemplate;
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { LNP_LAYER_ID_HIGHLIGHT, LNP_LINE_ID_PROP } from "./constants";
|
|
2
|
-
|
|
3
|
-
import type { MaplibreLayer } from "mobility-toolbox-js/ol";
|
|
4
|
-
|
|
5
|
-
function highlightLinesNetworkPlan(
|
|
6
|
-
ids: number[] | string[] = [0],
|
|
7
|
-
baseLayer: MaplibreLayer,
|
|
8
|
-
) {
|
|
9
|
-
try {
|
|
10
|
-
const styleLayer = baseLayer?.mapLibreMap?.getLayer(LNP_LAYER_ID_HIGHLIGHT);
|
|
11
|
-
if (styleLayer) {
|
|
12
|
-
baseLayer?.mapLibreMap?.setFilter(styleLayer.id, [
|
|
13
|
-
"match",
|
|
14
|
-
["get", LNP_LINE_ID_PROP],
|
|
15
|
-
ids,
|
|
16
|
-
true,
|
|
17
|
-
false,
|
|
18
|
-
]);
|
|
19
|
-
}
|
|
20
|
-
} catch (e) {
|
|
21
|
-
// eslint-disable-next-line no-console
|
|
22
|
-
console.error("Error setting filter for highlight layer", e);
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
export default highlightLinesNetworkPlan;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { useMemo } from "preact/hooks";
|
|
2
|
-
|
|
3
|
-
const useDebug = () => {
|
|
4
|
-
const debug = useMemo(() => {
|
|
5
|
-
const value = new URLSearchParams(window.location.search).get("debug");
|
|
6
|
-
return !value || value === "false" ? false : value;
|
|
7
|
-
}, []);
|
|
8
|
-
return debug;
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
export default useDebug;
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { createContext } from "preact";
|
|
2
|
-
import { useContext } from "preact/hooks";
|
|
3
|
-
|
|
4
|
-
import type { RealtimeDeparture } from "mobility-toolbox-js/types";
|
|
5
|
-
|
|
6
|
-
export interface DepartureContextType {
|
|
7
|
-
departure?: RealtimeDeparture;
|
|
8
|
-
index?: number;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export const DepartureContext = createContext({
|
|
12
|
-
departure: null,
|
|
13
|
-
index: null,
|
|
14
|
-
} as DepartureContextType);
|
|
15
|
-
|
|
16
|
-
const useDeparture = (): DepartureContextType => {
|
|
17
|
-
const context = useContext<DepartureContextType>(DepartureContext);
|
|
18
|
-
if (!context) {
|
|
19
|
-
throw new Error("useDeparture must be used within a ContextProvider");
|
|
20
|
-
}
|
|
21
|
-
return context;
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
export default useDeparture;
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import { Feature } from "ol";
|
|
2
|
-
import { Point } from "ol/geom";
|
|
3
|
-
import { fromExtent } from "ol/geom/Polygon";
|
|
4
|
-
import { useEffect, useRef } from "preact/hooks";
|
|
5
|
-
|
|
6
|
-
import useFitOnFeatures from "./useFitOnFeatures";
|
|
7
|
-
|
|
8
|
-
import type { RealtimeRouteIdentifierMatch } from "mobility-toolbox-js/types";
|
|
9
|
-
import type { GeoJSONFeature } from "ol/format/GeoJSON";
|
|
10
|
-
|
|
11
|
-
import type { LnpLineInfo, LnpStopInfo } from "./useLnp";
|
|
12
|
-
import type { StopsFeature } from "./useSearchStops";
|
|
13
|
-
|
|
14
|
-
export type FitOnObject = (obj: FitObject, willOverlayOpen?: boolean) => void;
|
|
15
|
-
|
|
16
|
-
export type FitObject =
|
|
17
|
-
| LnpLineInfo
|
|
18
|
-
| LnpStopInfo
|
|
19
|
-
| RealtimeRouteIdentifierMatch
|
|
20
|
-
| StopsFeature;
|
|
21
|
-
|
|
22
|
-
function useFit() {
|
|
23
|
-
const fitOnFeatures = useFitOnFeatures();
|
|
24
|
-
const fit = useRef<FitOnObject>();
|
|
25
|
-
|
|
26
|
-
useEffect(() => {
|
|
27
|
-
fit.current = (obj: FitObject, willOverlayOpen = false) => {
|
|
28
|
-
if (
|
|
29
|
-
(obj as StopsFeature)?.type === "Feature" &&
|
|
30
|
-
(obj as StopsFeature).geometry
|
|
31
|
-
) {
|
|
32
|
-
fitOnFeatures.current([obj as GeoJSONFeature], willOverlayOpen);
|
|
33
|
-
return;
|
|
34
|
-
}
|
|
35
|
-
const extent =
|
|
36
|
-
(obj as LnpLineInfo)?.extent ||
|
|
37
|
-
(obj as RealtimeRouteIdentifierMatch)?.bounds;
|
|
38
|
-
|
|
39
|
-
if (extent) {
|
|
40
|
-
const feature = new Feature(fromExtent(extent));
|
|
41
|
-
fitOnFeatures.current([feature], willOverlayOpen);
|
|
42
|
-
return;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
const coordinate = (obj as LnpStopInfo)?.coordinates;
|
|
46
|
-
if (coordinate) {
|
|
47
|
-
const feature = new Feature(new Point(coordinate));
|
|
48
|
-
fitOnFeatures.current([feature], willOverlayOpen);
|
|
49
|
-
return;
|
|
50
|
-
}
|
|
51
|
-
};
|
|
52
|
-
}, [fitOnFeatures]);
|
|
53
|
-
|
|
54
|
-
return fit;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
export default useFit;
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import { GeoJSON } from "ol/format";
|
|
2
|
-
import { Vector } from "ol/source";
|
|
3
|
-
import { useEffect, useRef } from "preact/hooks";
|
|
4
|
-
|
|
5
|
-
import { FIT_ON_FEATURES_MAX_ZOOM_POINT } from "../constants";
|
|
6
|
-
|
|
7
|
-
import useMapContext from "./useMapContext";
|
|
8
|
-
|
|
9
|
-
import type { Feature, Map } from "ol";
|
|
10
|
-
import type { GeoJSONFeature } from "ol/format/GeoJSON";
|
|
11
|
-
const geojson = new GeoJSON();
|
|
12
|
-
|
|
13
|
-
export type FitOnFeatures = (
|
|
14
|
-
features: (Feature | GeoJSONFeature)[],
|
|
15
|
-
willOverlayOpen?: boolean,
|
|
16
|
-
map?: Map,
|
|
17
|
-
) => void;
|
|
18
|
-
|
|
19
|
-
const useFitOnFeatures = () => {
|
|
20
|
-
const { isOverlayOpen, map: contextMap } = useMapContext();
|
|
21
|
-
|
|
22
|
-
const isOverlayOpenRef = useRef(isOverlayOpen);
|
|
23
|
-
const fitOnFeatures = useRef<FitOnFeatures>();
|
|
24
|
-
|
|
25
|
-
useEffect(() => {
|
|
26
|
-
isOverlayOpenRef.current = isOverlayOpen;
|
|
27
|
-
}, [isOverlayOpen]);
|
|
28
|
-
|
|
29
|
-
useEffect(() => {
|
|
30
|
-
fitOnFeatures.current = (
|
|
31
|
-
features: (Feature | GeoJSONFeature)[],
|
|
32
|
-
willOverlayOpen = false,
|
|
33
|
-
map?: Map,
|
|
34
|
-
) => {
|
|
35
|
-
if ((!map && !contextMap) || !features?.length) {
|
|
36
|
-
return;
|
|
37
|
-
}
|
|
38
|
-
let feats = features as Feature[];
|
|
39
|
-
|
|
40
|
-
// Convert to ol features if GeoJSON
|
|
41
|
-
const geoJSONFeature = features?.[0] as GeoJSONFeature;
|
|
42
|
-
if (geoJSONFeature?.geometry && geoJSONFeature?.type === "Feature") {
|
|
43
|
-
// Single feature case
|
|
44
|
-
feats = geojson.readFeatures(
|
|
45
|
-
{
|
|
46
|
-
features,
|
|
47
|
-
type: "FeatureCollection",
|
|
48
|
-
},
|
|
49
|
-
{ featureProjection: "EPSG:3857" },
|
|
50
|
-
);
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
const mapToUse = map || contextMap;
|
|
54
|
-
const extent = new Vector({ features: feats }).getExtent();
|
|
55
|
-
mapToUse.getView().fit(extent, {
|
|
56
|
-
duration: 500,
|
|
57
|
-
maxZoom:
|
|
58
|
-
extent[0] === extent[2] || extent[1] === extent[3]
|
|
59
|
-
? FIT_ON_FEATURES_MAX_ZOOM_POINT
|
|
60
|
-
: undefined,
|
|
61
|
-
padding: [
|
|
62
|
-
50,
|
|
63
|
-
50,
|
|
64
|
-
50,
|
|
65
|
-
willOverlayOpen || isOverlayOpenRef.current ? 350 : 50,
|
|
66
|
-
],
|
|
67
|
-
});
|
|
68
|
-
return () => {
|
|
69
|
-
mapToUse?.getView().cancelAnimations();
|
|
70
|
-
};
|
|
71
|
-
};
|
|
72
|
-
}, [contextMap]);
|
|
73
|
-
|
|
74
|
-
return fitOnFeatures;
|
|
75
|
-
};
|
|
76
|
-
|
|
77
|
-
export default useFitOnFeatures;
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { createContext } from "preact";
|
|
2
|
-
import { useContext } from "preact/hooks";
|
|
3
|
-
|
|
4
|
-
export interface I18NContextType {
|
|
5
|
-
locale(lang?: string): string;
|
|
6
|
-
t: (id: string, templateValues?: Record<string, string>) => string;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export const I18nContext = createContext<I18NContextType>({
|
|
10
|
-
t: (id: string, templateValues?: Record<string, string>) => {
|
|
11
|
-
return `${id} ${JSON.stringify(templateValues)}`;
|
|
12
|
-
},
|
|
13
|
-
} as I18NContextType);
|
|
14
|
-
|
|
15
|
-
const useI18n = (): I18NContextType => {
|
|
16
|
-
const context = useContext<I18NContextType>(I18nContext);
|
|
17
|
-
if (!context) {
|
|
18
|
-
throw new Error("useI18n must be used within a ContextProvider");
|
|
19
|
-
}
|
|
20
|
-
return context;
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
export default useI18n;
|