lib/components/modification/select-feed-route-and-patterns.js
/**
 * Select a (group of) patterns from the GTFS feed
 */
Select a (group of) patterns from the GTFS feed
Select a ( group of ) patterns from the GTFS feed
function SelectFeedRouteAndPatterns({
  allowMultipleRoutes = false,
  onChange,
  routes,
  trips,
  ...p
}) {
  const feeds = useSelector(selectFeeds)
  const routePatterns = useSelector(selectRoutePatterns)
  const selectedFeed = useSelector(selectModificationFeed)
  function _selectTrips(trips) {
    onChange({
      feed: get(selectedFeed, 'id'),
      routes,
      trips
    })
  }
  function _selectFeedAndRoutes({feed, routes}) {
    onChange({feed, routes, trips: null})
  }
  return (
    <Stack spacing={4} {...p}>
      <SelectFeedAndRoutes
        allowMultipleRoutes={allowMultipleRoutes}
        feeds={feeds}
        onChange={_selectFeedAndRoutes}
        selectedFeed={selectedFeed}
        selectedRouteIds={routes}
      />
      {get(routes, 'length') < 2 && routePatterns.length > 0 && (
        <SelectPatterns onChange={_selectTrips} trips={trips} />
      )}
    </Stack>
  )
}
function SelectFeedRouteAndPatterns ( { allowMultipleRoutes = false , onChange , routes , trips , ... p } ) { const feeds = useSelector ( selectFeeds ) const routePatterns = useSelector ( selectRoutePatterns ) const selectedFeed = useSelector ( selectModificationFeed ) function _selectTrips ( trips ) { onChange ( { feed : get ( selectedFeed , 'id' ) , routes , trips } ) } function _selectFeedAndRoutes ( { feed , routes } ) { onChange ( { feed , routes , trips : null } ) } return ( < Stack spacing = { 4 } { ... p } > < SelectFeedAndRoutes allowMultipleRoutes = { allowMultipleRoutes } feeds = { feeds } onChange = { _selectFeedAndRoutes } selectedFeed = { selectedFeed } selectedRouteIds = { routes } / > { get ( routes , 'length' ) < 2 && routePatterns . length > 0 && ( < SelectPatterns onChange = { _selectTrips } trips = { trips } / > ) } < / Stack > ) }
Select a (group of) patterns from the GTFS feed
Select a ( group of ) patterns from the GTFS feed