From d8a32c688bc03e46629e94f7dd1ffbb18e965aaf Mon Sep 17 00:00:00 2001 From: JD <46619169+rudiejd@users.noreply.github.com> Date: Sat, 6 Jan 2024 13:05:49 -0500 Subject: [PATCH] fix: make green line slow zones page unselectable (#922) --- common/components/nav/SubwayDropdown.tsx | 11 +++++++++-- common/types/lines.ts | 1 + pages/[line]/slowzones.tsx | 2 +- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/common/components/nav/SubwayDropdown.tsx b/common/components/nav/SubwayDropdown.tsx index e6a262155..1560683d7 100644 --- a/common/components/nav/SubwayDropdown.tsx +++ b/common/components/nav/SubwayDropdown.tsx @@ -1,7 +1,7 @@ import classNames from 'classnames'; import React from 'react'; import { SidebarTabs } from '../../../modules/navigation/SidebarTabs'; -import { OVERVIEW_PAGE, LINE_PAGES, TRIP_PAGES } from '../../constants/pages'; +import { OVERVIEW_PAGE, LINE_PAGES, TRIP_PAGES, ALL_PAGES } from '../../constants/pages'; import { lineColorBorder } from '../../styles/general'; import type { Line } from '../../types/lines'; @@ -21,7 +21,14 @@ export const SubwayDropdown: React.FC = ({ line, close }) = >
- + cur !== ALL_PAGES.slowzones) + : LINE_PAGES + } + close={close} + />
diff --git a/common/types/lines.ts b/common/types/lines.ts index 0d38b290c..e9c0f6793 100644 --- a/common/types/lines.ts +++ b/common/types/lines.ts @@ -77,6 +77,7 @@ export const BUS_ROUTES: BusRoute[] = [ '220/221/222', ]; +// potential TODO: make this a type or make the line names for routing constants export const ALL_LINE_PATHS = RAIL_LINES.map((line) => { return { params: { diff --git a/pages/[line]/slowzones.tsx b/pages/[line]/slowzones.tsx index 47a1462e9..d3332c7f4 100644 --- a/pages/[line]/slowzones.tsx +++ b/pages/[line]/slowzones.tsx @@ -7,7 +7,7 @@ export async function getStaticProps() { export async function getStaticPaths() { return { - paths: ALL_LINE_PATHS, + paths: ALL_LINE_PATHS.filter((p) => p.params.line !== 'green'), fallback: false, }; }