Skip to content

Commit

Permalink
Adding commuter rail landing button
Browse files Browse the repository at this point in the history
  • Loading branch information
devinmatte committed Jul 19, 2024
1 parent 0272985 commit 6af58db
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 6 deletions.
10 changes: 6 additions & 4 deletions modules/landing/LineButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import classNames from 'classnames';
import type { Line } from '../../common/types/lines';
import { lineColorBackground, lineColorBorder } from '../../common/styles/general';
import { LINE_OBJECTS } from '../../common/constants/lines';
import { BUS_DEFAULTS } from '../../common/state/defaults/dateDefaults';
import { BUS_DEFAULTS, COMMUTER_RAIL_DEFAULTS } from '../../common/state/defaults/dateDefaults';

interface LineButtonProps {
children: React.ReactNode;
Expand All @@ -17,9 +17,11 @@ export const LineButton: React.FC<LineButtonProps> = ({ children, line }) => {
return (
<Link
href={
line === 'line-bus'
? `/${lineObject.path}?busRoute=1&date=${BUS_DEFAULTS.singleTripConfig.date}`
: `/${lineObject.path}`
line === 'line-commuter-rail'
? `/commuter-rail/ridership?crRoute=CR-Lowell&startDate=${COMMUTER_RAIL_DEFAULTS.lineConfig.startDate}&endDate=${COMMUTER_RAIL_DEFAULTS.lineConfig.endDate}`
: line === 'line-bus'
? `/${lineObject.path}?busRoute=1&date=${BUS_DEFAULTS.singleTripConfig.date}`
: `/${lineObject.path}`
}
className="group flex cursor-pointer flex-row items-center gap-x-8 gap-y-4 md:flex-col"
>
Expand Down
8 changes: 7 additions & 1 deletion modules/landing/LineSelectionLanding.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { faBus, faTrainSubway, faTrainTram } from '@fortawesome/free-solid-svg-icons';
import { faBus, faTrain, faTrainSubway, faTrainTram } from '@fortawesome/free-solid-svg-icons';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import classNames from 'classnames';
import { LineButton } from './LineButton';
Expand Down Expand Up @@ -40,6 +40,12 @@ export const LineSelectionLanding: React.FC = () => {
className={classNames('h-16 w-16 lg:h-20 lg:w-20', 'text-white')}
/>
</LineButton>
<LineButton line="line-commuter-rail">
<FontAwesomeIcon
icon={faTrain}
className={classNames('h-16 w-16 lg:h-20 lg:w-20', 'text-white')}
/>
</LineButton>
</div>
</div>
);
Expand Down
1 change: 1 addition & 0 deletions modules/landing/charts/OverallRidershipChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ interface OverallRidershipChartProps {
export const OverallRidershipChart: React.FC<OverallRidershipChartProps> = ({ ridershipData }) => {
const labels = Object.values(ridershipData)[0].map((point) => point.date);
const datasets = convertToRidershipDataset(ridershipData);

return (
<LandingChartDiv>
<LandingPageChart datasets={datasets} labels={labels} id="system-ridership" />
Expand Down
3 changes: 2 additions & 1 deletion modules/slowzones/SlowZonesWidget.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,10 @@ export const SlowZonesWidget: React.FC = () => {
const totalSlowTimeReady =
!delayTotals.isError && delayTotals.data && startDateUTC && endDateUTC && lineShort && line;

if (line === 'line-bus' || line === 'line-green') {
if (line === 'line-bus' || line === 'line-green' || line === 'line-commuter-rail') {
return null;
}

return (
<>
<WidgetDiv className="relative">
Expand Down

0 comments on commit 6af58db

Please sign in to comment.