<commit_before>// @flow
import React, {PureComponent} from 'react'

import type {Feed, RoutePatterns} from '../../types'

import SelectPatterns from './select-patterns'
import SelectFeedAndRoutes from './select-feed-and-routes'

type Props = {
  allowMultipleRoutes?: boolean,
  feeds: Feed[],
  onChange: ({
    feed: null | string,
    routes: null | string[],
    trips: null | string[]
  }) => void,
  routePatterns: RoutePatterns,
  routes: null | string[],
  selectedFeed: null | Feed,
  trips: null | string[] // trips can be null indicating a wildcard
}

/**
 * Select a (group of) patterns from the GTFS feed
 */
export default class SelectFeedRouteAndPatterns
  extends PureComponent<void, Props, void> {
  _selectTrips = ({patterns, trips}: {patterns: string[], trips: string[]}) => {
    const {selectedFeed, routes} = this.props
    this.props.onChange({
      feed: selectedFeed ? selectedFeed.id : null,
      routes,
      patterns,
      trips
    })
  }

  _selectFeedAndRoutes = ({
    feed,
    routes
  }: {
    feed: null | string,
    routes: null | string[]
  }) => {
    this.props.onChange({feed, routes, trips: null})
  }

  render () {
    const {<commit_msg>fix(reroute): Remove passing patterns which are unnecessary and unintentionally saved for reroute mo<commit_after>// @flow
import React, {PureComponent} from 'react'

import type {Feed, RoutePatterns} from '../../types'

import SelectPatterns from './select-patterns'
import SelectFeedAndRoutes from './select-feed-and-routes'

type Props = {
  allowMultipleRoutes?: boolean,
  feeds: Feed[],
  onChange: ({|
    feed: null | string,
    routes: null | string[],
    trips: null | string[]
  |}) => void,
  routePatterns: RoutePatterns,
  routes: null | string[],
  selectedFeed: null | Feed,
  trips: null | string[] // trips can be null indicating a wildcard
}

/**
 * Select a (group of) patterns from the GTFS feed
 */
export default class SelectFeedRouteAndPatterns
  extends PureComponent<void, Props, void> {
  _selectTrips = ({patterns, trips}: {patterns: string[], trips: string[]}) => {
    const {selectedFeed, routes} = this.props
    this.props.onChange({
      feed: selectedFeed ? selectedFeed.id : null,
      routes,
      trips
    })
  }

  _selectFeedAndRoutes = ({
    feed,
    routes
  }: {
    feed: null | string,
    routes: null | string[]
  }) => {
    this.props.onChange({feed, routes, trips: null})
  }

  render () {
    const {
{'fraction_non_alphanumeric': 0.13567633837351858, 'fraction_numerical': 0.0, 'mean_word_length': 3.294736842105263, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2274619', 'n_tokens_mistral': 764, 'n_tokens_neox': 782, 'n_words': 225}