Skip to content

Commit

Permalink
Add in newburyport line
Browse files Browse the repository at this point in the history
  • Loading branch information
devinmatte committed Jan 21, 2025
1 parent 0f015a4 commit 7dc121d
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 3 deletions.
8 changes: 5 additions & 3 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 Down Expand Up @@ -77,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
1 change: 1 addition & 0 deletions common/components/widgets/StationSelectorWidget.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ export const StationSelectorWidget: React.FC<StationSelectorWidgetProps> = ({
const stations = optionsStation(lineShort, busRoute, crRoute);
const toStation = to ? getParentStationForStopId(to) : stations?.[stations.length - 2];
const fromStation = from ? getParentStationForStopId(from) : stations?.[1];

React.useEffect(() => {
const { fromStopIds, toStopIds } = stopIdsForStations(fromStation, toStation);
updateQueryParams({ from: fromStopIds?.[0], to: toStopIds?.[0] });
Expand Down
2 changes: 2 additions & 0 deletions common/constants/stations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ import cr_greenbush from './cr_constants/cr-greenbush.json';
import cr_fairmount from './cr_constants/cr-fairmount.json';
import cr_kingston from './cr_constants/cr-kingston.json';
import cr_middleborough from './cr_constants/cr-middleborough.json';
import cr_newburyport from './cr_constants/cr-newburyport.json';
import cr_needham from './cr_constants/cr-needham.json';
import cr_providence from './cr_constants/cr-providence.json';

Expand Down Expand Up @@ -155,6 +156,7 @@ export const crStations: { [key: string]: LineMap } = {
...cr_fairmount,
...cr_kingston,
...cr_middleborough,
...cr_newburyport,
...cr_needham,
...cr_providence,
};
Expand Down
2 changes: 2 additions & 0 deletions modules/tripexplorer/TripExplorer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ export const TripExplorer = () => {
if (!(fromStation && toStation)) {
return null;
}

return (
<PageWrapper pageTitle={'Trips'}>
<ChartPageDiv>
Expand All @@ -53,4 +54,5 @@ export const TripExplorer = () => {
</PageWrapper>
);
};

TripExplorer.Layout = Layout.Dashboard;

0 comments on commit 7dc121d

Please sign in to comment.