Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Commuter rail in Data Dashboard #898

Merged
merged 87 commits into from
Mar 2, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
87 commits
Select commit Hold shift + click to select a range
7acd7c5
Using Gobble data
devinmatte Dec 17, 2023
06fda87
Adding commuter rail data to data dashboard
devinmatte Dec 18, 2023
de039bd
Merge remote-tracking branch 'origin/main' into gobble-data
devinmatte Dec 18, 2023
a378dc4
Merge branch 'main' into gobble-data
devinmatte Dec 20, 2023
f361981
Merge branch 'main' into gobble-data
devinmatte Dec 20, 2023
74ce70a
Treat bus the same as rapid for dates
devinmatte Dec 20, 2023
02cb728
Merge branch 'main' into commuter-rail-in-dd
devinmatte Dec 21, 2023
75c60ab
Better if statement
devinmatte Dec 22, 2023
aa40939
Handle date formats with timezones
devinmatte Dec 22, 2023
30ddd1f
Renaming date_utils
devinmatte Dec 22, 2023
a122a88
Cleanup imports
devinmatte Dec 22, 2023
6751998
Merge branch 'main' into gobble-data
devinmatte Dec 22, 2023
9532a70
Inject timezone into non-timezone datestamps
devinmatte Dec 22, 2023
5bb67e6
Merge branch 'gobble-data' into commuter-rail-in-dd
devinmatte Dec 22, 2023
ee77537
Set minimum commuter rail date
devinmatte Dec 22, 2023
4577978
Adding some initial platform ids
devinmatte Dec 22, 2023
d137236
Adding lowell line platform ids
devinmatte Dec 22, 2023
20c5eec
Properly fetching CR stations
devinmatte Dec 22, 2023
3a89a12
Acutally fetching CR data
devinmatte Dec 23, 2023
a8ed493
Adding franklin line ids
devinmatte Dec 23, 2023
94b1f5a
Populating stations
devinmatte Dec 23, 2023
b23874e
Adding more lines
devinmatte Dec 26, 2023
90443ff
Adding Haverhill stops
devinmatte Dec 26, 2023
43db5e0
Updating min dates
devinmatte Dec 26, 2023
772d10e
Adding more lines and better stop population
devinmatte Dec 26, 2023
8552827
Clean up scripts
devinmatte Dec 26, 2023
5917d97
Allowing commuter rail ridership fetching
devinmatte Dec 27, 2023
abb331c
Merge branch 'main' into commuter-rail-in-dd
devinmatte Dec 27, 2023
e17b392
Updating line files
devinmatte Dec 27, 2023
4f3f337
Adding more stop ids
devinmatte Dec 27, 2023
d223d02
Merge branch 'main' into commuter-rail-in-dd
devinmatte Jan 1, 2024
8de71df
Merge branch 'main' into commuter-rail-in-dd
devinmatte Jan 8, 2024
6a42b6d
Fixing bus typing
devinmatte Jan 8, 2024
078206f
Merge remote-tracking branch 'origin/main' into commuter-rail-in-dd
devinmatte Jan 9, 2024
7e4505f
Remove foxboro for now
devinmatte Jan 9, 2024
b69f386
Merge branch 'main' into commuter-rail-in-dd
devinmatte Jan 11, 2024
b169555
Merge remote-tracking branch 'origin/main' into commuter-rail-in-dd
devinmatte Jan 11, 2024
8db9c46
Fix widget title import
devinmatte Jan 11, 2024
a094889
Merge remote-tracking branch 'origin/main' into commuter-rail-in-dd
devinmatte Jan 17, 2024
3b102e1
Updating CR line files
devinmatte Jan 17, 2024
d5913dd
Merge branch 'main' into commuter-rail-in-dd
devinmatte Jan 20, 2024
35c5410
Hide stations we don't have stops for
devinmatte Jan 21, 2024
3101977
Nevermind
devinmatte Jan 21, 2024
c27a83e
Populate with newer stops
devinmatte Jan 21, 2024
93b5197
Merge branch 'main' into commuter-rail-in-dd
devinmatte Jan 23, 2024
8b40dc5
Merge branch 'main' into commuter-rail-in-dd
devinmatte Jan 30, 2024
631a5f0
Fixing CR data calls
devinmatte Feb 4, 2024
144a6f2
Merge branch 'main' into commuter-rail-in-dd
devinmatte Feb 10, 2024
6d6da82
Merge branch 'main' into commuter-rail-in-dd
devinmatte Feb 14, 2024
f722dde
Merge branch 'main' into commuter-rail-in-dd
devinmatte Feb 25, 2024
ef4c548
Merge branch 'main' into commuter-rail-in-dd
devinmatte Mar 9, 2024
8fb44d1
Fixing 120+ minute headways for CR
devinmatte Mar 10, 2024
634b983
Updating commuter rail stations and notices
devinmatte Mar 11, 2024
4810c36
Merge remote-tracking branch 'origin/main' into commuter-rail-in-dd
devinmatte May 17, 2024
7ce77b4
Fixing data fetching issues for cr
devinmatte May 17, 2024
d837b4c
Remove unused
devinmatte May 17, 2024
3b34d1b
Merge branch 'main' into commuter-rail-in-dd
devinmatte Jun 18, 2024
e281387
Merge branch 'main' into commuter-rail-in-dd
devinmatte Jul 18, 2024
5ed4575
Adding commuter rail ridership to dashboard
devinmatte Jul 19, 2024
0272985
Fixing props
devinmatte Jul 19, 2024
6af58db
Adding commuter rail landing button
devinmatte Jul 19, 2024
0285525
Merge branch 'commuter-rail-ridership' into commuter-rail-in-dd
devinmatte Jul 19, 2024
c23d10f
Fixing commuter rail links
devinmatte Jul 19, 2024
cabcc80
Fix linting issues
devinmatte Jul 19, 2024
8389487
Merge remote-tracking branch 'origin/main' into commuter-rail-in-dd
devinmatte Jul 29, 2024
8b17144
Adding log retention policy
devinmatte Aug 1, 2024
3742ac3
Oops we'd need to delete the stack
devinmatte Aug 1, 2024
385f905
Okay nevermind
devinmatte Aug 1, 2024
35ed79f
Merge branch 'main' into commuter-rail-in-dd
devinmatte Dec 6, 2024
7f721b5
Merge branch 'main' into commuter-rail-in-dd
devinmatte Jan 18, 2025
0f015a4
Update lines with current data
devinmatte Jan 18, 2025
7dc121d
Add in newburyport line
devinmatte Jan 21, 2025
e4da0ef
Beta notice in all commuter rail
devinmatte Jan 21, 2025
484158a
Merge branch 'main' into commuter-rail-in-dd
devinmatte Jan 25, 2025
81ccc94
Merge remote-tracking branch 'origin' into commuter-rail-in-dd
devinmatte Feb 2, 2025
da3b53e
Merge branch 'main' into commuter-rail-in-dd
devinmatte Feb 11, 2025
ed90f93
Update modules/tripexplorer/CommuterRailTripGraphs.tsx
devinmatte Feb 16, 2025
53961c3
Merge branch 'main' into commuter-rail-in-dd
devinmatte Feb 19, 2025
6509260
Merge branch 'main' into commuter-rail-in-dd
devinmatte Feb 21, 2025
926d9d3
Merge branch 'main' into commuter-rail-in-dd
devinmatte Mar 1, 2025
51df9fb
Clean up date selection and remaining small bugs
devinmatte Mar 1, 2025
67db703
Version bump and improve legend
devinmatte Mar 1, 2025
73b8ad1
Format Y axis
devinmatte Mar 1, 2025
340b542
Update lockfile
devinmatte Mar 1, 2025
5c11f07
Merge branch 'main' into commuter-rail-in-dd
devinmatte Mar 2, 2025
2b0f538
Include commuter rail in description
devinmatte Mar 2, 2025
4419c52
Improve page warnings
devinmatte Mar 2, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,6 @@
"python.formatting.provider": "black",
"[python]": {
"editor.defaultFormatter": "ms-python.black-formatter"
}
},
"cSpell.words": ["MBTA"]
}
5 changes: 5 additions & 0 deletions common/components/charts/AggregateLineChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,11 @@ export const AggregateLineChart: React.FC<AggregateLineProps> = ({
},
ticks: {
precision: 1,
callback: (value) => {
return yUnit === 'Minutes' && typeof value === 'number'
? getFormattedTimeString(value, 'minutes')
: value.toLocaleString();
},
},
suggestedMin: suggestedYMin,
suggestedMax: suggestedYMax,
Expand Down
32 changes: 25 additions & 7 deletions common/components/charts/Legend.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { Disclosure } from '@headlessui/react';
import React from 'react';
import { useDelimitatedRoute } from '../../utils/router';

interface LegendProps {
showUnderRatio?: boolean;
}

export const LegendSingleDay: React.FC<LegendProps> = ({ showUnderRatio = false }) => {
export const LegendSingleDay: React.FC<LegendProps> = ({ showUnderRatio }) => {
const { line } = useDelimitatedRoute();
return (
<Disclosure>
{({ open }) => (
Expand All @@ -18,12 +20,28 @@
<FontAwesomeIcon icon={open ? faChevronUp : faChevronDown} className="" />
</div>
</Disclosure.Button>
<Disclosure.Panel
className={
'grid w-full grid-cols-2 items-baseline p-1 px-4 text-left text-xs lg:flex lg:flex-row lg:gap-4'
}
>
<LegendSingle showUnderRatio={showUnderRatio} />
<Disclosure.Panel>
<div
className={
'grid w-full grid-cols-2 items-baseline p-1 px-4 text-left text-xs lg:flex lg:flex-row lg:gap-4'
}
>
<LegendSingle showUnderRatio={showUnderRatio} />
</div>

<div
className={
'mx-1 mb-1 grid w-full grid-cols-2 items-baseline p-1 px-4 text-left text-xs text-gray-500 lg:flex lg:flex-row lg:gap-4'
}
>
{line === 'line-commuter-rail' && (
<p>
Due to how we collect data for Commuter Rail, we may occasionally miss trips or
stops. This can lead to inaccuracies in headways numbers and gaps in travel time
data. Confirm data you see here with official MBTA sources when possible.
</p>
)}
</div>
</Disclosure.Panel>
</div>
)}
Expand All @@ -31,7 +49,7 @@
);
};

const LegendSingle: React.FC<LegendProps> = ({ showUnderRatio = false }) => {

Check warning on line 52 in common/components/charts/Legend.tsx

View workflow job for this annotation

GitHub Actions / frontend (20, 3.12)

'showUnderRatio' is assigned a value but never used
return (
<>
<div className="col-span-2 flex flex-row items-baseline gap-2 pb-1 italic lg:pb-0">
Expand Down
5 changes: 5 additions & 0 deletions common/components/charts/SingleDayLineChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,11 @@ export const SingleDayLineChart: React.FC<SingleDayLineProps> = ({
display: true,
ticks: {
color: COLORS.design.subtitleGrey,
callback: (value) => {
return units === 'Minutes' && typeof value === 'number'
? getFormattedTimeString(value, 'minutes')
: value.toLocaleString();
},
},
title: {
display: true,
Expand Down
12 changes: 9 additions & 3 deletions common/components/controls/ControlPanel.tsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,24 @@
import React from 'react';
import classNames from 'classnames';
import { lineColorBorder } from '../../styles/general';
import type { BusRoute, Line } from '../../types/lines';
import type { BusRoute, CommuterRailRoute, Line } from '../../types/lines';
import type { DateStoreSection } from '../../constants/pages';
import { StationSelectorWidget } from '../widgets/StationSelectorWidget';
import { DateControl } from './DateControl';

interface ControlPanelProps {
dateStoreSection: DateStoreSection;
busRoute: BusRoute | undefined;
crRoute: CommuterRailRoute | undefined;
line: Line | undefined;
}

export const ControlPanel: React.FC<ControlPanelProps> = ({ dateStoreSection, line, busRoute }) => {
export const ControlPanel: React.FC<ControlPanelProps> = ({
dateStoreSection,
line,
busRoute,
crRoute,
}) => {
const getControls = () => {
if ((dateStoreSection === 'singleTrips' || dateStoreSection === 'multiTrips') && line) {
return (
Expand All @@ -21,7 +27,7 @@ export const ControlPanel: React.FC<ControlPanelProps> = ({ dateStoreSection, li
dateStoreSection={dateStoreSection}
queryType={dateStoreSection === 'singleTrips' ? 'single' : 'range'}
/>
<StationSelectorWidget line={line} busRoute={busRoute} />
<StationSelectorWidget line={line} busRoute={busRoute} crRoute={crRoute} />
</>
);
}
Expand Down
6 changes: 4 additions & 2 deletions common/components/controls/MobileControlPanel.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import classNames from 'classnames';
import type { BusRoute, Line } from '../../types/lines';
import type { BusRoute, CommuterRailRoute, Line } from '../../types/lines';
import type { DateStoreSection } from '../../constants/pages';
import { lineColorBackground } from '../../styles/general';
import { StationSelectorWidget } from '../widgets/StationSelectorWidget';
Expand All @@ -9,13 +9,15 @@ import { DateControl } from './DateControl';
interface MobileControlPanelProps {
dateStoreSection: DateStoreSection;
busRoute: BusRoute | undefined;
crRoute: CommuterRailRoute | undefined;
line: Line | undefined;
}

export const MobileControlPanel: React.FC<MobileControlPanelProps> = ({
dateStoreSection,
line,
busRoute,
crRoute,
}) => {
const singleDate = dateStoreSection === 'singleTrips';
const getControls = () => {
Expand All @@ -34,7 +36,7 @@ export const MobileControlPanel: React.FC<MobileControlPanelProps> = ({
lineColorBackground[line ?? 'DEFAULT']
)}
>
<StationSelectorWidget line={line} busRoute={busRoute} />
<StationSelectorWidget line={line} busRoute={busRoute} crRoute={crRoute} />
</div>
</>
);
Expand Down
6 changes: 3 additions & 3 deletions common/components/inputs/DateSelection/DatePickers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import Flatpickr from 'react-flatpickr';
import 'flatpickr/dist/themes/light.css';
import { useDelimitatedRoute, useUpdateQuery } from '../../../utils/router';
import { FLAT_PICKER_OPTIONS, TODAY_STRING, RANGE_PRESETS } from '../../../constants/dates';
import { TODAY_STRING, RANGE_PRESETS, getDatePickerOptions } from '../../../constants/dates';
import { buttonHighlightFocus } from '../../../styles/general';
import type { Line } from '../../../types/lines';
import { ALL_PAGES } from '../../../constants/pages';
Expand Down Expand Up @@ -108,7 +108,7 @@ export const DatePickers: React.FC<DatePickerProps> = ({ range, setRange, type,
value={startDate ?? date}
key={'start'}
placeholder={'mm/dd/yyyy'}
options={FLAT_PICKER_OPTIONS[tab]}
options={getDatePickerOptions(tab, page)}
onChange={(dates, currentDateString) => {
if (isSingleDate) {
handleDateChange(currentDateString);
Expand All @@ -135,7 +135,7 @@ export const DatePickers: React.FC<DatePickerProps> = ({ range, setRange, type,
value={endDate}
key={'end'}
placeholder={'mm/dd/yyyy'}
options={FLAT_PICKER_OPTIONS[tab]}
options={getDatePickerOptions(tab, page)}
onChange={(dates, currentDateString) => {
handleEndDateChange(currentDateString);
}}
Expand Down
13 changes: 8 additions & 5 deletions common/components/inputs/StationSelector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { faBicycle, faChevronDown, faWheelchair } from '@fortawesome/free-solid-
import classNames from 'classnames';
import type { Station } from '../../types/stations';
import { useDelimitatedRoute } from '../../utils/router';
import { optionsForField } from '../../utils/stations';
import { optionsForField, stopIdsForStations } from '../../utils/stations';
import {
buttonHighlightFocus,
lineColorBackground,
Expand All @@ -30,16 +30,17 @@ export const StationSelector: React.FC<StationSelector> = ({
const {
line,
lineShort,
query: { busRoute },
query: { busRoute, crRoute },
} = useDelimitatedRoute();
const mdBreakpoint = useBreakpoint('md');
const station = type === 'from' ? fromStation : toStation;
const stationOptions = optionsForField(type, lineShort, fromStation, busRoute);
const stationOptions = optionsForField(type, lineShort, fromStation, busRoute, crRoute);
const branchLabelWidth = {
'line-red': 'w-8',
'line-green': 'w-12',
DEFAULT: 'w-0',
};

return (
<Listbox value={station} onChange={setStation}>
{({ open }) => (
Expand Down Expand Up @@ -76,8 +77,10 @@ export const StationSelector: React.FC<StationSelector> = ({
key={stationIndex}
disabled={
type === 'from'
? station.station === toStation.station
: station.station === fromStation.station
? station.station === toStation.station ||
stopIdsForStations(station, toStation).fromStopIds?.length === 0
: station.station === fromStation.station ||
stopIdsForStations(fromStation, station).toStopIds?.length === 0
}
className={({ active, selected, disabled }) =>
classNames(
Expand Down
8 changes: 3 additions & 5 deletions common/components/nav/CommuterRailDropdown.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import { SidebarTabs } from '../../../modules/navigation/SidebarTabs';
import { COMMUTER_RAIL_OVERVIEW } from '../../constants/pages';
import { COMMUTER_RAIL_OVERVIEW, TRIP_PAGES } from '../../constants/pages';
import { CommuterRailRouteSelection } from './CommuterRailRouteSelection';

interface CommuterRailDropdownProps {
Expand All @@ -18,10 +18,8 @@ export const CommuterRailDropdown: React.FC<CommuterRailDropdownProps> = ({ clos
role={'navigation'}
>
<SidebarTabs tabs={COMMUTER_RAIL_OVERVIEW} close={close} />

{/* TODO: Once we have reliable travel data for CR */}
{/* <hr className="h-[1px] w-3/4 self-center border-neutral-500" /> */}
{/* <SidebarTabs tabs={TRIP_PAGES} close={close} /> */}
<hr className="h-[1px] w-3/4 self-center border-neutral-500" />
<SidebarTabs tabs={TRIP_PAGES} close={close} />
</div>
</div>
);
Expand Down
2 changes: 1 addition & 1 deletion common/components/nav/MenuDropdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export const MenuDropdown: React.FC<MenuDropdownProps> = ({ line, route, childre
case 'line-bus':
return `/bus/trips/single?busRoute=1&date=${BUS_DEFAULTS.singleTripConfig.date}`;
case 'line-commuter-rail':
return `/commuter-rail/ridership?crRoute=CR-Lowell&startDate=${COMMUTER_RAIL_DEFAULTS.lineConfig.startDate}&endDate=${COMMUTER_RAIL_DEFAULTS.lineConfig.endDate}`;
return `/commuter-rail/trips/single?crRoute=CR-Fairmount&date=${COMMUTER_RAIL_DEFAULTS.singleTripConfig.date}`;
default:
return getLineSelectionItemHref(line, route);
}
Expand Down
18 changes: 2 additions & 16 deletions common/components/notices/BetaDataNotice.tsx
Original file line number Diff line number Diff line change
@@ -1,28 +1,14 @@
import React from 'react';
import dayjs from 'dayjs';
import Link from 'next/link';
import classNames from 'classnames';
import { ExclamationTriangleIcon } from '@heroicons/react/20/solid';
import { useDelimitatedRoute } from '../../utils/router';
import { BUS_MAX_DAY } from '../../constants/dates';
import { lineColorTextHover } from '../../styles/general';

export const BetaDataNotice: React.FC = () => {
const {
line,
linePath,
query: { date, startDate, endDate },
} = useDelimitatedRoute();
const { line, linePath } = useDelimitatedRoute();

const isStartDateAfterBusMaxDay =
(startDate !== undefined && dayjs(startDate).isAfter(BUS_MAX_DAY)) ||
(date !== undefined && dayjs(date).isAfter(BUS_MAX_DAY));
const isEndDateAfterBusMaxDay = endDate !== undefined && dayjs(endDate).isAfter(BUS_MAX_DAY);

if (
(line === 'line-commuter-rail' || linePath === 'commuter-rail') &&
(isStartDateAfterBusMaxDay || isEndDateAfterBusMaxDay)
) {
if (line === 'line-commuter-rail' || linePath === 'commuter-rail') {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

whats the difference between these?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe the issue is that sometimes one of the values may be undefined so we need to check both

Copy link
Contributor

@rudiejd rudiejd Feb 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: could we consistently use commuter rail? I feel like line-commuter-rail makes it sound like a GTFS route, which could be confusing since commuter rail has many GTFS routes

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

although I guess it's fine since we currently have bus as line-bus lol

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah this is probably something we should clean up someday

return (
<div className="rounded-md bg-yellow-50 p-4">
<div className="flex">
Expand Down
24 changes: 24 additions & 0 deletions common/components/notices/CommuterRailDataNotice.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import React from 'react';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { faLocationCrosshairs } from '@fortawesome/free-solid-svg-icons';
import { useDelimitatedRoute } from '../../utils/router';

export const CommuterRailDataNotice: React.FC = () => {
const { line, linePath } = useDelimitatedRoute();

if (line === 'line-commuter-rail' || linePath === 'commuter-rail') {
return (
<div className={'flex items-center'}>
<FontAwesomeIcon icon={faLocationCrosshairs} size={'lg'} />
<div className={'mx-3 my-2 text-sm italic'}>
<p>
Due to how we collect data for Commuter Rail, we may occasionally miss trips or stops.
This can lead to inaccuracies in headways numbers and gaps in travel time data. Confirm
data you see here with official MBTA sources when possible.
</p>
</div>
</div>
);
}
return null;
};
13 changes: 10 additions & 3 deletions common/components/widgets/StationSelectorWidget.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,24 +11,31 @@ import {
optionsStation,
stopIdsForStations,
} from '../../utils/stations';
import type { BusRoute, Line } from '../../types/lines';
import type { BusRoute, CommuterRailRoute, Line } from '../../types/lines';
import { LINE_OBJECTS } from '../../constants/lines';
import type { Station } from '../../types/stations';

interface StationSelectorWidgetProps {
line: Line;
busRoute: BusRoute | undefined;
crRoute: CommuterRailRoute | undefined;
}

export const StationSelectorWidget: React.FC<StationSelectorWidgetProps> = ({ line, busRoute }) => {
export const StationSelectorWidget: React.FC<StationSelectorWidgetProps> = ({
line,
busRoute,
crRoute,
}) => {
const updateQueryParams = useUpdateQuery();
const lineShort = LINE_OBJECTS[line].short;
const {
query: { from, to },
} = useDelimitatedRoute();
const stations = optionsStation(lineShort, busRoute);

const stations = optionsStation(lineShort, busRoute, crRoute);
const toStation = to ? getParentStationForStopId(to, lineShort) : stations?.[stations.length - 2];
const fromStation = from ? getParentStationForStopId(from, lineShort) : stations?.[1];

React.useEffect(() => {
const { fromStopIds, toStopIds } = stopIdsForStations(fromStation, toStation);
updateQueryParams({ from: fromStopIds?.[0], to: toStopIds?.[0] });
Expand Down
Loading
Loading