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

feat: add slow zone map for green line #1017

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
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
11 changes: 2 additions & 9 deletions common/components/nav/SubwayDropdown.tsx
Original file line number Diff line number Diff line change
@@ -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, ALL_PAGES } from '../../constants/pages';
import { OVERVIEW_PAGE, LINE_PAGES, TRIP_PAGES } from '../../constants/pages';
import { lineColorBorder } from '../../styles/general';
import type { Line } from '../../types/lines';

Expand All @@ -21,14 +21,7 @@ export const SubwayDropdown: React.FC<SubwayDropdownProps> = ({ line, close }) =
>
<SidebarTabs tabs={OVERVIEW_PAGE} close={close} />
<hr className="h-[1px] w-3/4 self-center border-neutral-500" />
<SidebarTabs
tabs={
line === 'line-green'
? LINE_PAGES.filter((cur) => cur !== ALL_PAGES.slowzones)
: LINE_PAGES
}
close={close}
/>
<SidebarTabs tabs={LINE_PAGES} close={close} />
<hr className="h-[1px] w-3/4 self-center border-neutral-500" />
<SidebarTabs tabs={TRIP_PAGES} close={close} />
</div>
Expand Down
3 changes: 2 additions & 1 deletion modules/slowzones/SlowZonesDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ export function SlowZonesDetails() {
const totalSlowTimeReady =
!delayTotals.isError && delayTotals.data && startDateUTC && endDateUTC && lineShort && line;
const segmentsReady = !allSlow.isError && allSlow.data && startDateUTC && lineShort;
const canShowSlowZonesMap = lineShort === 'Red' || lineShort === 'Blue' || lineShort === 'Orange';
const canShowSlowZonesMap =
lineShort === 'Red' || lineShort === 'Blue' || lineShort === 'Orange' || lineShort === 'Green';
const isDesktop = useBreakpoint('lg');

if (!endDateUTC || !startDateUTC) {
Expand Down
3 changes: 2 additions & 1 deletion modules/slowzones/SystemSlowZonesDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ export function SystemSlowZonesDetails({ showTitle = false }: SystemSlowZonesDet

const [lineShort, setLineShort] = useState<LineShort>('Red');
const line = `line-${lineShort.toLowerCase()}` as Line;
const canShowSlowZonesMap = lineShort === 'Red' || lineShort === 'Blue' || lineShort === 'Orange';
const canShowSlowZonesMap =
lineShort === 'Red' || lineShort === 'Blue' || lineShort === 'Orange' || lineShort === 'Green';
const isDesktop = useBreakpoint('lg');

const {
Expand Down
13 changes: 13 additions & 0 deletions modules/slowzones/map/SlowZonesMap.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,19 @@ export const Primary = () => {
direction="vertical"
speedRestrictions={[]}
/>

<SlowZonesMap
lineName="Green"
slowZones={slowZonesResponses}
direction="vertical"
speedRestrictions={[]}
/>
<SlowZonesMap
lineName="Green"
slowZones={slowZonesResponses}
direction="horizontal"
speedRestrictions={[]}
/>
</>
);
};
2 changes: 1 addition & 1 deletion modules/slowzones/map/SlowZonesMap.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ export const SlowZonesMap: React.FC<SlowZonesMapProps> = ({
diagram={diagram}
strokeOptions={{ stroke: line.color }}
direction={direction}
getSegments={getSegmentsForSlowZones}
getSegments={(isHorizontal) => []}
rudiejd marked this conversation as resolved.
Show resolved Hide resolved
getStationLabel={abbreviateStationName}
tooltip={{ snapToSegment: true, maxDistance: 20, render: renderSlowZonesTooltip }}
/>
Expand Down
2 changes: 1 addition & 1 deletion modules/slowzones/types.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
const SLOW_ZONES_LINES = ['Red', 'Blue', 'Orange'] as const;
const SLOW_ZONES_LINES = ['Red', 'Blue', 'Orange', 'Green'] as const;

export type SlowZonesLineName = (typeof SLOW_ZONES_LINES)[number];
Loading
Loading