Skip to content

Commit

Permalink
feat(useAllStops): Add hook + update typing to support rendering near…
Browse files Browse the repository at this point in the history
…by stops (#2202)

* feat(useAllStops): Add hook + update typing to support rendering nearby stops

* feat(Schedule.Gtfs.Stop): Include vehicle_type

* feat(stop): Parse vehicle_type on frontend

* doc(useAllStops): Add function doc w/ return type

* cleanup(schedule.d.ts): Remove stray RouteType export
  • Loading branch information
KaylaBrady authored Aug 25, 2023
1 parent 9976306 commit 1f97169
Show file tree
Hide file tree
Showing 23 changed files with 412 additions and 54 deletions.
8 changes: 8 additions & 0 deletions assets/src/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,14 @@ export const fetchStations = (): Promise<Stop[]> =>
defaultResult: [],
})

export const fetchAllStops = (): Promise<Stop[]> =>
checkedApiCall<StopData[], Stop[]>({
url: `/api/stops`,
parser: stopsFromData,
dataStruct: array(StopData),
defaultResult: [],
})

export const fetchTimepointsForRoute = (
routeId: RouteId
): Promise<Timepoint[]> =>
Expand Down
12 changes: 12 additions & 0 deletions assets/src/data/stopsBlue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,83 +8,95 @@ const stopsBlue: Stop[] = [
lat: 42.374262,
lon: -71.030395,
locationType: LocationType.Station,
vehicleType: null,
},
{
id: "place-aqucl",
name: "Aquarium",
lat: 42.359784,
lon: -71.051652,
locationType: LocationType.Station,
vehicleType: null,
},
{
id: "place-bmmnl",
name: "Beachmont",
lat: 42.397542,
lon: -70.992319,
locationType: LocationType.Station,
vehicleType: null,
},
{
id: "place-bomnl",
name: "Bowdoin",
lat: 42.361365,
lon: -71.062037,
locationType: LocationType.Station,
vehicleType: null,
},
{
id: "place-gover",
name: "Government Center",
lat: 42.359705,
lon: -71.059215,
locationType: LocationType.Station,
vehicleType: null,
},
{
id: "place-mvbcl",
name: "Maverick",
lat: 42.369119,
lon: -71.03953,
locationType: LocationType.Station,
vehicleType: null,
},
{
id: "place-orhte",
name: "Orient Heights",
lat: 42.386867,
lon: -71.004736,
locationType: LocationType.Station,
vehicleType: null,
},
{
id: "place-rbmnl",
name: "Revere Beach",
lat: 42.407843,
lon: -70.992533,
locationType: LocationType.Station,
vehicleType: null,
},
{
id: "place-sdmnl",
name: "Suffolk Downs",
lat: 42.390501,
lon: -70.997123,
locationType: LocationType.Station,
vehicleType: null,
},
{
id: "place-state",
name: "State",
lat: 42.358978,
lon: -71.057598,
locationType: LocationType.Station,
vehicleType: null,
},
{
id: "place-wimnl",
name: "Wood Island",
lat: 42.37964,
lon: -71.022865,
locationType: LocationType.Station,
vehicleType: null,
},
{
id: "place-wondl",
name: "Wonderland",
lat: 42.41342,
lon: -70.991648,
locationType: LocationType.Station,
vehicleType: null,
},
]

Expand Down
Loading

0 comments on commit 1f97169

Please sign in to comment.