Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions lib/editor/components/EntityDetails.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ type Props = {
newGtfsEntity: typeof editorActions.newGtfsEntity,
offset: number,
project: Project,
resetActiveEntity: typeof activeActions.resetActiveGtfsEntity,
resetActiveGtfsEntity: typeof activeActions.resetActiveGtfsEntity,
saveActiveGtfsEntity: typeof activeActions.saveActiveGtfsEntity,
setActiveEntity: typeof activeActions.setActiveEntity,
showConfirmModal: any,
Expand Down Expand Up @@ -115,7 +115,6 @@ export default class EntityDetails extends Component<Props, State> {
return (
<div style={panelStyle}>
<div className='entity-details'>
{/* // $FlowFixMe */}
<EntityDetailsHeader
validationErrors={validationErrors}
editFareRules={this.state.editFareRules}
Expand Down
22 changes: 11 additions & 11 deletions lib/editor/components/EntityDetailsHeader.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ type Props = {
entityEdited: boolean,
feedSource: Feed,
mapState: MapState,
resetActiveEntity: typeof activeActions.resetActiveGtfsEntity,
resetActiveGtfsEntity: typeof activeActions.resetActiveGtfsEntity,
saveActiveGtfsEntity: typeof activeActions.saveActiveGtfsEntity,
setActiveEntity: typeof activeActions.setActiveEntity,
subComponent: string,
subEntityId: number,
subEntity: number,
toggleEditFareRules: boolean => void,
updateMapSetting: typeof mapActions.updateMapSetting,
validationErrors: Array<EditorValidationIssue>
Expand All @@ -48,26 +48,26 @@ export default class EntityDetailsHeader extends Component<Props> {
activeComponent,
activeEntity,
activePattern,
resetActiveEntity,
resetActiveGtfsEntity,
subComponent
} = this.props
if (subComponent === 'trippattern') {
const castedRoute = ((activeEntity: any): RouteWithPatterns)
const pattern = castedRoute.tripPatterns.find(p => p.id === activePattern.id)
if (pattern) resetActiveEntity({ entity: pattern, component: 'trippattern' })
if (pattern) resetActiveGtfsEntity({ entity: pattern, component: 'trippattern' })
else console.warn(`Could not locate pattern with id=${activePattern.id}`)
} else {
resetActiveEntity({ entity: activeEntity, component: activeComponent })
resetActiveGtfsEntity({ entity: activeEntity, component: activeComponent })
}
}

_onClickZoomTo = () => {
const { activeEntity, subEntityId, updateMapSetting } = this.props
const { activeEntity, subEntity, updateMapSetting } = this.props
let props
if (subEntityId) {
if (subEntity) {
const castedRoute = ((activeEntity: any): RouteWithPatterns)
const pattern = castedRoute.tripPatterns.find(p => p.id === subEntityId)
props = { bounds: getEntityBounds(pattern), target: subEntityId }
const pattern = castedRoute.tripPatterns.find(p => p.id === subEntity)
props = { bounds: getEntityBounds(pattern), target: subEntity }
} else {
props = { bounds: getEntityBounds(activeEntity), target: +activeEntity.id }
}
Expand Down Expand Up @@ -112,7 +112,7 @@ export default class EntityDetailsHeader extends Component<Props> {
entityEdited,
mapState,
subComponent,
subEntityId,
subEntity,
validationErrors
} = this.props
const validationTooltip = (
Expand All @@ -129,7 +129,7 @@ export default class EntityDetailsHeader extends Component<Props> {
const icon = GTFS_ICONS.find(i => i.id === activeComponent)
const zoomDisabled = activeEntity && !subComponent
? mapState.target === activeEntity.id
: mapState.target === subEntityId
: mapState.target === subEntity
const iconName = icon ? icon.icon : null
const nameWidth = activeComponent === 'stop' || activeComponent === 'route'
? '176px'
Expand Down
1 change: 1 addition & 0 deletions lib/editor/components/EntityList.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ type Props = ContainerProps & {
hasRoutes: boolean,
list: ImmutableList, // FIXME Immutable.List
newGtfsEntity: typeof editorActions.newGtfsEntity,
resetActiveGtfsEntity: typeof activeActions.resetActiveGtfsEntity,
setActiveEntity: typeof activeActions.setActiveEntity,
sort: DataStateSort,
updateActiveGtfsEntity: typeof activeActions.updateActiveGtfsEntity,
Expand Down
2 changes: 1 addition & 1 deletion lib/editor/components/GtfsEditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ type Props = ContainerProps & {
removeControlPoint: typeof mapActions.removeControlPoint,
removeEditorLock: typeof editorActions.removeEditorLock,
removeStopFromPattern: typeof stopStrategiesActions.removeStopFromPattern,
resetActiveEntity: typeof activeActions.resetActiveGtfsEntity,
resetActiveGtfsEntity: typeof activeActions.resetActiveGtfsEntity,
saveActiveGtfsEntity: typeof activeActions.saveActiveGtfsEntity,
setActiveEntity: typeof activeActions.setActiveEntity,
setActiveGtfsEntity: typeof activeActions.setActiveGtfsEntity,
Expand Down
2 changes: 2 additions & 0 deletions lib/editor/containers/ActiveEntityList.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {connect} from 'react-redux'
import {
deleteGtfsEntity,
enterTimetableEditor,
resetActiveGtfsEntity,
setActiveEntity,
updateActiveGtfsEntity
} from '../actions/active'
Expand Down Expand Up @@ -53,6 +54,7 @@ const mapDispatchToProps = {
deleteGtfsEntity,
enterTimetableEditor,
newGtfsEntity,
resetActiveGtfsEntity,
setActiveEntity,
updateActiveGtfsEntity,
updateEntitySort
Expand Down