From 4dae31ab63008d02d3611813e986e55cdd0cb931 Mon Sep 17 00:00:00 2001 From: miles-grant-ibigroup Date: Fri, 3 Jan 2025 18:01:34 +0100 Subject: [PATCH] use new `GtfsLocation` where previously `GtfsLocationGroup` was used --- lib/editor/actions/location.js | 2 +- lib/editor/components/pattern/EditShapePanel.js | 4 ++-- lib/editor/selectors/index.js | 2 +- lib/editor/util/map.js | 5 ++--- lib/types/index.js | 7 +++++++ 5 files changed, 13 insertions(+), 7 deletions(-) diff --git a/lib/editor/actions/location.js b/lib/editor/actions/location.js index 105f12d4d..5d7cccc5e 100644 --- a/lib/editor/actions/location.js +++ b/lib/editor/actions/location.js @@ -10,7 +10,7 @@ import { receivedNewEntity, savedGtfsEntity } from './active' export function saveLocationGroup ( feedId: ?string, - locationGroup: GtfsLocationGroup, + locationGroup: GtfsLocation, refetch: ?boolean = true ) { return function (dispatch: dispatchFn, getState: getStateFn) { diff --git a/lib/editor/components/pattern/EditShapePanel.js b/lib/editor/components/pattern/EditShapePanel.js index f9086f64b..b0da6789d 100644 --- a/lib/editor/components/pattern/EditShapePanel.js +++ b/lib/editor/components/pattern/EditShapePanel.js @@ -21,7 +21,7 @@ import { getPatternDistance, isValidStopControlPoint } from '../../util/map' -import type {ControlPoint, LatLng, Pattern, GtfsStop, GtfsLocation, GtfsLocationGroup} from '../../../types' +import type {ControlPoint, LatLng, Pattern, GtfsStop, GtfsLocation} from '../../../types' import type {EditSettingsUndoState} from '../../../types/reducers' import EditSettings from './EditSettings' @@ -30,7 +30,7 @@ type Props = { activePattern: Pattern, controlPoints: Array, editSettings: EditSettingsUndoState, - locationGroups: Array, + locationGroups: Array, locations: Array, patternSegment: number, resetActiveGtfsEntity: typeof activeActions.resetActiveGtfsEntity, diff --git a/lib/editor/selectors/index.js b/lib/editor/selectors/index.js index 652ce7412..cf695f617 100644 --- a/lib/editor/selectors/index.js +++ b/lib/editor/selectors/index.js @@ -432,7 +432,7 @@ function addPatternStopsToShapePoints ( patternStops: Array, activePatternStops: Array, activePatternLocations: Array, - activePatternLocationGroups: Array, + activePatternLocationGroups: Array, projectStops: boolean = false, totalShapePointsDistTraveled: number ): {patternSegments: Array, shapePoints: Array} { diff --git a/lib/editor/util/map.js b/lib/editor/util/map.js index c7ee355c1..d7e628b37 100644 --- a/lib/editor/util/map.js +++ b/lib/editor/util/map.js @@ -25,7 +25,6 @@ import type { GeoJsonLinestring, GeoJsonPoint, GtfsLocation, - GtfsLocationGroup, GtfsStop, LatLng, Pattern, @@ -875,7 +874,7 @@ export function straightLineDistancesBetweenStopAnchors ( export function generateControlPointsFromPatternStops ( patternStops: Array, stops: Array, - locationGroups: Array, + locationGroups: Array, locations: Array ): any { // FIXME: fix flow return type const controlPoints = [] @@ -915,7 +914,7 @@ export function generateControlPointsFromPatternStops ( } } -export function stopToPoint (stop: GtfsStop | GtfsLocation | GtfsLocationGroup) { +export function stopToPoint (stop: GtfsStop | GtfsLocation) { if (!stop.stop_lon || !stop.stop_lat) { console.error('Serious issue: stopToPoint called without a point! Using 0, 0 coordinates. This is a very bad thing') return point([0, 0]) diff --git a/lib/types/index.js b/lib/types/index.js index 66114a040..f163caf9c 100644 --- a/lib/types/index.js +++ b/lib/types/index.js @@ -824,6 +824,13 @@ export type GtfsLocation = {| zone_id?: string |} +// export type GtfsLocationGroup = { +// id: number, +// location_group_id: string, +// location_group_name: ?string, +// stop_id: ?string[] +// } + export type StopWithFeed = GtfsStop & {child_stops?: Array, feed: Feed} export type LatLng = {