Skip to content

Commit 24885fe

Browse files
committed
fix(editor): fix undo button
fixes #416
1 parent 883eb33 commit 24885fe

File tree

5 files changed

+16
-14
lines changed

5 files changed

+16
-14
lines changed

lib/editor/components/EntityDetails.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ type Props = {
3333
newGtfsEntity: typeof editorActions.newGtfsEntity,
3434
offset: number,
3535
project: Project,
36-
resetActiveEntity: typeof activeActions.resetActiveGtfsEntity,
36+
resetActiveGtfsEntity: typeof activeActions.resetActiveGtfsEntity,
3737
saveActiveGtfsEntity: typeof activeActions.saveActiveGtfsEntity,
3838
setActiveEntity: typeof activeActions.setActiveEntity,
3939
showConfirmModal: any,
@@ -115,7 +115,6 @@ export default class EntityDetails extends Component<Props, State> {
115115
return (
116116
<div style={panelStyle}>
117117
<div className='entity-details'>
118-
{/* // $FlowFixMe */}
119118
<EntityDetailsHeader
120119
validationErrors={validationErrors}
121120
editFareRules={this.state.editFareRules}

lib/editor/components/EntityDetailsHeader.js

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,11 @@ type Props = {
2424
entityEdited: boolean,
2525
feedSource: Feed,
2626
mapState: MapState,
27-
resetActiveEntity: typeof activeActions.resetActiveGtfsEntity,
27+
resetActiveGtfsEntity: typeof activeActions.resetActiveGtfsEntity,
2828
saveActiveGtfsEntity: typeof activeActions.saveActiveGtfsEntity,
2929
setActiveEntity: typeof activeActions.setActiveEntity,
3030
subComponent: string,
31-
subEntityId: number,
31+
subEntity: number,
3232
toggleEditFareRules: boolean => void,
3333
updateMapSetting: typeof mapActions.updateMapSetting,
3434
validationErrors: Array<EditorValidationIssue>
@@ -48,26 +48,26 @@ export default class EntityDetailsHeader extends Component<Props> {
4848
activeComponent,
4949
activeEntity,
5050
activePattern,
51-
resetActiveEntity,
51+
resetActiveGtfsEntity,
5252
subComponent
5353
} = this.props
5454
if (subComponent === 'trippattern') {
5555
const castedRoute = ((activeEntity: any): RouteWithPatterns)
5656
const pattern = castedRoute.tripPatterns.find(p => p.id === activePattern.id)
57-
if (pattern) resetActiveEntity({ entity: pattern, component: 'trippattern' })
57+
if (pattern) resetActiveGtfsEntity({ entity: pattern, component: 'trippattern' })
5858
else console.warn(`Could not locate pattern with id=${activePattern.id}`)
5959
} else {
60-
resetActiveEntity({ entity: activeEntity, component: activeComponent })
60+
resetActiveGtfsEntity({ entity: activeEntity, component: activeComponent })
6161
}
6262
}
6363

6464
_onClickZoomTo = () => {
65-
const { activeEntity, subEntityId, updateMapSetting } = this.props
65+
const { activeEntity, subEntity, updateMapSetting } = this.props
6666
let props
67-
if (subEntityId) {
67+
if (subEntity) {
6868
const castedRoute = ((activeEntity: any): RouteWithPatterns)
69-
const pattern = castedRoute.tripPatterns.find(p => p.id === subEntityId)
70-
props = { bounds: getEntityBounds(pattern), target: subEntityId }
69+
const pattern = castedRoute.tripPatterns.find(p => p.id === subEntity)
70+
props = { bounds: getEntityBounds(pattern), target: subEntity }
7171
} else {
7272
props = { bounds: getEntityBounds(activeEntity), target: +activeEntity.id }
7373
}
@@ -112,7 +112,7 @@ export default class EntityDetailsHeader extends Component<Props> {
112112
entityEdited,
113113
mapState,
114114
subComponent,
115-
subEntityId,
115+
subEntity,
116116
validationErrors
117117
} = this.props
118118
const validationTooltip = (
@@ -129,7 +129,7 @@ export default class EntityDetailsHeader extends Component<Props> {
129129
const icon = GTFS_ICONS.find(i => i.id === activeComponent)
130130
const zoomDisabled = activeEntity && !subComponent
131131
? mapState.target === activeEntity.id
132-
: mapState.target === subEntityId
132+
: mapState.target === subEntity
133133
const iconName = icon ? icon.icon : null
134134
const nameWidth = activeComponent === 'stop' || activeComponent === 'route'
135135
? '176px'

lib/editor/components/EntityList.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ type Props = ContainerProps & {
2828
hasRoutes: boolean,
2929
list: ImmutableList, // FIXME Immutable.List
3030
newGtfsEntity: typeof editorActions.newGtfsEntity,
31+
resetActiveGtfsEntity: typeof activeActions.resetActiveGtfsEntity,
3132
setActiveEntity: typeof activeActions.setActiveEntity,
3233
sort: DataStateSort,
3334
updateActiveGtfsEntity: typeof activeActions.updateActiveGtfsEntity,

lib/editor/components/GtfsEditor.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ type Props = ContainerProps & {
9595
removeControlPoint: typeof mapActions.removeControlPoint,
9696
removeEditorLock: typeof editorActions.removeEditorLock,
9797
removeStopFromPattern: typeof stopStrategiesActions.removeStopFromPattern,
98-
resetActiveEntity: typeof activeActions.resetActiveGtfsEntity,
98+
resetActiveGtfsEntity: typeof activeActions.resetActiveGtfsEntity,
9999
saveActiveGtfsEntity: typeof activeActions.saveActiveGtfsEntity,
100100
setActiveEntity: typeof activeActions.setActiveEntity,
101101
setActiveGtfsEntity: typeof activeActions.setActiveGtfsEntity,

lib/editor/containers/ActiveEntityList.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import {connect} from 'react-redux'
55
import {
66
deleteGtfsEntity,
77
enterTimetableEditor,
8+
resetActiveGtfsEntity,
89
setActiveEntity,
910
updateActiveGtfsEntity
1011
} from '../actions/active'
@@ -53,6 +54,7 @@ const mapDispatchToProps = {
5354
deleteGtfsEntity,
5455
enterTimetableEditor,
5556
newGtfsEntity,
57+
resetActiveGtfsEntity,
5658
setActiveEntity,
5759
updateActiveGtfsEntity,
5860
updateEntitySort

0 commit comments

Comments
 (0)