• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

rm-hull / maps / 25609402468

09 May 2026 07:06PM UTC coverage: 25.219% (+0.7%) from 24.488%
25609402468

push

github

web-flow
feat: add Next Departures map layer (#1180)

* feat: add Next Departures map layer

This commit introduces a new map layer that displays public transport
stops (bus and train) based on the current map viewport.

-   Adds `NextDeparturesLayer` to visualize transport stops using NaPTAN
    data.
-   Implements a custom `useNaPTAN` hook with `react-query` for
efficient
    data fetching and caching.
-   Introduces a dynamic `busStopWithBearing` icon that renders an
    SVG-based arrow indicating the direction of the stop.
-   Provides stop details including name, locality, and bearing within
    map popups.
-   Includes unit tests for icon rotation logic.

```mermaid
sequenceDiagram
    participant M as Map (Leaflet)
    participant L as NextDeparturesLayer
    participant H as useNaPTAN Hook
    participant S as Next Departures Service
    participant A as API

    M->>L: Provides Bounds
    L->>H: Request data for bounds
    H->>S: fetchNaPTAN(bounds)
    S->>A: GET /v1/next-departures/search?bbox=...
    A-->>S: JSON NaPTAN Results
    S-->>H: SearchResponse
    H-->>L: results[]
    L->>M: Render Markers with custom Icons
```

* refactor: move bearing logic to BearingIndicator

This change migrates the bus stop bearing display from a dynamic
`DivIcon` string generator to a reusable React component.

- Created `BearingIndicator` component using `react-leaflet` **Tooltip**
  to render direction arrows.
- Simplified `NextDeparturesLayer` by using the standard `busStop` icon
  wrapped in the new indicator.
- Added CSS to remove default **Tooltip** borders, backgrounds, and
  pointers for a clean SVG-only look.
- Updated unit tests to cover the new component and removed obsolete
  icon generation tests.

* refactor: rename BearingIndicator bearing prop

Renames the `bearing` prop to `direction` to improve clarity and
consistency across the codebase. Removes `bearingAngles` from the
icon suite tests to reflect changes in the exported API.

* fix: pass prec... (continued)

178 of 723 branches covered (24.62%)

Branch coverage included in aggregate %.

23 of 57 new or added lines in 9 files covered. (40.35%)

312 of 1220 relevant lines covered (25.57%)

2.67 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/hooks/useNextDestination.ts


Source Not Available

STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc