Skip to content

Commit fc882c1

Browse files
Add Blue Line 2 (#134)
* update * fix formatting for prettier * update most of this is Liza's! Co-authored-by: Liza Pressman <lizarogot@gmail.com> * fix formatting for prettier * update label name * bump version --------- Co-authored-by: Liza Pressman <lizarogot@gmail.com>
1 parent a5384ee commit fc882c1

10 files changed

Lines changed: 51 additions & 5 deletions

File tree

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "new-train-tracker",
3-
"version": "2.2.0",
3+
"version": "2.3.0",
44
"description": "New Train Tracker by TransitMattters",
55
"main": "index.tsx",
66
"scripts": {

server/fleet.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
green_is_new = lambda x: int(x) >= 3900 and int(x) <= 3924
1616
orange_is_new = lambda x: int(x) >= 1400 and int(x) <= 1551
1717
silver_is_new = lambda x: int(x) >= 1294 and int(x) <= 1299
18+
blue_is_new = lambda _: False
1819

1920

2021
def get_is_new_dict(route_ids, test_fn):
@@ -27,6 +28,7 @@ def get_is_new_dict(route_ids, test_fn):
2728
"Orange": orange_is_new,
2829
**get_is_new_dict(GREEN_ROUTE_IDS, green_is_new),
2930
**get_is_new_dict(SILVER_ROUTE_IDS, silver_is_new),
31+
"Blue": blue_is_new
3032
}
3133

3234

server/initial_data.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ def calc_stats(vehicle_array):
1313
totalGreen = filter_route("Green", vehicle_array)
1414
totalOrange = filter_route("Orange", vehicle_array)
1515
totalRed = filter_route("Red", vehicle_array)
16+
totalBlue = filter_route("Blue", vehicle_array)
1617

1718
# intialize dictionary of stats
1819
vehicle_stats = {
@@ -30,6 +31,11 @@ def calc_stats(vehicle_array):
3031
"totalActive": len(totalRed),
3132
"totalNew": len(filter_new(totalRed)),
3233
"totalOld": len(filter_old(totalRed)),
34+
},
35+
"Blue": {
36+
"totalActive": len(totalBlue),
37+
"totalNew": len(filter_new(totalBlue)),
38+
"totalOld": len(filter_old(totalBlue))
3339
}
3440
}
3541

server/mbta_api.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,8 @@ def maybe_reverse(stops, route):
8484
return reverse_if_stops_out_of_order(stops, "Park Street", "Downtown Crossing")
8585
if route == "Orange":
8686
return reverse_if_stops_out_of_order(stops, "Oak Grove", "Wellington")
87+
if route == "Blue":
88+
return reverse_if_stops_out_of_order(stops, "Bowdoin", "Wonderland")
8789
return stops
8890

8991

server/routes.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
DEFAULT_ROUTE_IDS = [
1313
"Orange",
14+
"Blue",
1415
"Red-A",
1516
"Red-B",
1617
*GREEN_ROUTE_IDS,

src/components/App.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { useEffect, useLayoutEffect } from 'react';
22
import Favicon from 'react-favicon';
33
import { useTabState } from 'reakit';
44

5-
import { greenLine, orangeLine, redLine } from '../lines';
5+
import { greenLine, orangeLine, redLine, blueLine } from '../lines';
66
import { useMbtaApi } from '../useMbtaApi';
77
import { getInitialDataByKey } from '../initialData';
88

@@ -21,6 +21,7 @@ const lineByTabId: Record<string, TLine> = {
2121
'tab-Green': greenLine,
2222
'tab-Orange': orangeLine,
2323
'tab-Red': redLine,
24+
'tab-Blue': blueLine,
2425
};
2526

2627
export const App: React.FC = () => {

src/components/LineTabPicker.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,11 @@ export const LineTabPicker: React.FC<LineTabPickerProps> = ({ lines, tabState, t
5858
{line.abbreviation}
5959
</div>
6060
<div className="label">
61-
{trains.length} {trains.length === 1 ? 'train' : 'trains'}
61+
{trains.length}{' '}
62+
<span className="label-trains-text">
63+
{' '}
64+
{trains.length === 1 ? 'train' : 'trains'}{' '}
65+
</span>
6266
</div>
6367
</Tab>
6468
);

src/lines.ts

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,3 +249,29 @@ export const redLine: Line = {
249249
},
250250
},
251251
};
252+
253+
const enum BLStations {
254+
Bowdoin = 'place-bomnl',
255+
Wonderland = 'place-wondl',
256+
}
257+
258+
export const blueLine = {
259+
name: 'Blue',
260+
abbreviation: 'BL',
261+
colorSecondary: '#3434D1',
262+
color: '#7CA5E3',
263+
getStationLabelPosition: () => 'right',
264+
fixedTrainLabelPosition: 'right',
265+
routes: {
266+
Blue: {
267+
shape: [
268+
start(0, 0, 90),
269+
stationRange({
270+
end: BLStations.Wonderland,
271+
start: BLStations.Bowdoin,
272+
commands: [line(150)],
273+
}),
274+
],
275+
},
276+
},
277+
};

src/main.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,10 @@ a {
113113
padding-top: 5px;
114114
padding-bottom: 15px;
115115
}
116+
117+
.label-trains-text {
118+
display: none;
119+
}
116120
}
117121

118122
.line-pane {

0 commit comments

Comments
 (0)