lib/components/report/adjust-frequency.js
/**
 * Display an adjust-frequency modification
 */
Display an adjust-frequency modification
Display an adjust - frequency modification
function AdjustFrequency(props) {
  const {modification, feedsById} = props
  const feed = feedsById[modification.feed]
  const route = feed.routes.find((r) => r.route_id === modification.routes[0])
  const bounds = L.latLngBounds(
    flatten(
      route.patterns.map((p) =>
        p.geometry.coordinates.map(([lat, lon]) => [lon, lat])
      )
    )
  )
  return (
    <Stack>
      <Heading size='sm'>
        {message('common.route')}:{' '}
        {!!route.route_short_name && route.route_short_name}{' '}
        {!!route.route_long_name && route.route_long_name}
      </Heading>
      <Box>
        <MiniMap bounds={bounds}>
          <PatternLayer
            feed={feed}
            color={colors.MODIFIED}
            modification={modification}
          />
        </MiniMap>
      </Box>
      <Box textAlign='center'>
        <i>
          {modification.retainTripsOutsideFrequencyEntries
            ? message('report.keepTripsOutside')
            : message('report.removeTripsOutside')}
        </i>
      </Box>
      <Heading size='sm'>{message('report.newFrequencies')}</Heading>
      <Box as='table'>
        <thead>
          <tr>
            <th>{message('report.frequency.name')}</th>
            <th>{message('report.frequency.direction')}</th>
            <th>{message('report.frequency.startTime')}</th>
            <th>{message('report.frequency.endTime')}</th>
            <th>{message('report.frequency.frequency')}</th>
            <th>{message('report.frequency.daysOfService')}</th>
            <th>{message('report.frequency.nTrips')}</th>
            <th>{message('report.patternLength')}</th>
          </tr>
        </thead>
        <tbody>
          {modification.entries.map((entry, i) => (
            <TimetableEntry key={i} {...props} entry={entry} />
          ))}
        </tbody>
      </Box>
    </Stack>
  )
}
function AdjustFrequency ( props ) { const { modification , feedsById } = props const feed = feedsById [ modification . feed ] const route = feed . routes . find ( ( r ) => r . route_id === modification . routes [ 0 ] ) const bounds = L . latLngBounds ( flatten ( route . patterns . map ( ( p ) => p . geometry . coordinates . map ( ( [ lat , lon ] ) => [ lon , lat ] ) ) ) ) return ( < Stack > < Heading size = 'sm' > { message ( 'common.route' ) } : { ' ' } { ! ! route . route_short_name && route . route_short_name } { ' ' } { ! ! route . route_long_name && route . route_long_name } < / Heading > < Box > < MiniMap bounds = { bounds } > < PatternLayer feed = { feed } color = { colors . MODIFIED } modification = { modification } / > < / MiniMap > < / Box > < Box textAlign = 'center' > < i > { modification . retainTripsOutsideFrequencyEntries ? message ( 'report.keepTripsOutside' ) : message ( 'report.removeTripsOutside' ) } < / i > < / Box > < Heading size = 'sm' > { message ( 'report.newFrequencies' ) } < / Heading > < Box as = 'table' > < thead > < tr > < th > { message ( 'report.frequency.name' ) } < / th > < th > { message ( 'report.frequency.direction' ) } < / th > < th > { message ( 'report.frequency.startTime' ) } < / th > < th > { message ( 'report.frequency.endTime' ) } < / th > < th > { message ( 'report.frequency.frequency' ) } < / th > < th > { message ( 'report.frequency.daysOfService' ) } < / th > < th > { message ( 'report.frequency.nTrips' ) } < / th > < th > { message ( 'report.patternLength' ) } < / th > < / tr > < / thead > < tbody > { modification . entries . map ( ( entry , i ) => ( < TimetableEntry key = { i } { ... props } entry = { entry } / > ) ) } < / tbody > < / Box > < / Stack > ) }
Display an adjust-frequency modification
Display an adjust - frequency modification