import { connect } from 'react-redux'

import { getEntityName } from '../util/gtfs'
import EntityList from '../components/EntityList'

const mapStateToProps = (state, ownProps) => {
  const entity =
    state.editor.data.active && state.editor.data.active.entity && state.editor.data.active.entity.id === ownProps.activeEntityId
    ? state.editor.data.active.entity
    : state.editor.data.active && state.editor.data.active.entity && ownProps.activeComponent === 'feedinfo'
    ? state.editor.data.active.entity
    : null
  const activeEntity = entity
    ? {
      name: getEntityName(ownProps.activeComponent, entity),
      id: entity.id
    }
    : null
  return {
    activeEntity
  }
}

const mapDispatchToProps = (dispatch, ownProps) => { return { } }

const ActiveEntityList = connect(mapStateToProps, mapDispatchToProps)(EntityList)

export default ActiveEntityList

@@ -32,16 +32,73 @@
 redux'%0A%0A
+import %7B enterTimetableEditor %7D from '../actions/active'%0A
 import %7B
@@ -711,16 +711,109 @@
  : null%0A
+  const route = state.editor.data.tables.route%0A  const hasRoutes = route && route.length %3E 0%0A
   return
@@ -831,16 +831,31 @@
 veEntity
+,%0A    hasRoutes
 %0A  %7D%0A%7D%0A%0A
@@ -906,16 +906,18 @@
 ps) =%3E %7B
+%0A 
  return 
@@ -917,19 +917,86 @@
 return %7B
- %7D 
+%0A    enterTimetableEditor: () =%3E dispatch(enterTimetableEditor())%0A  %7D%0A
 %7D%0A%0Aconst

add enterTimetableEditor prop