Skip to content

Commit 95435bc

Browse files
feat: add stat dropdown links to official MBTA project pages (#272)
Signed-off-by: Nathan Weinberg <nathansweinberg@gmail.com>
1 parent e5ae02e commit 95435bc

3 files changed

Lines changed: 28 additions & 4 deletions

File tree

src/components/LineStats/LineStats.css

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,3 +46,8 @@ td:nth-child(2) {
4646
text-align: center;
4747
font-weight: bold;
4848
}
49+
50+
.program-link {
51+
text-align: center !important;
52+
font-size: smaller;
53+
}

src/components/LineStats/LineStatsTable.tsx

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ interface LineStatsTableProps {
1717
totalOldInactive?: number;
1818
totalActive?: number;
1919
totalInactive?: number;
20+
programLink?: string;
2021
};
2122
}
2223

@@ -77,6 +78,13 @@ export const LineStatsTable: React.FC<LineStatsTableProps> = ({ line, stats }) =
7778
</td>
7879
<td className="stat-count">{stats.totalType7Inactive}</td>
7980
</tr>
81+
{stats.programLink !== undefined && (
82+
<tr>
83+
<td className="program-link">
84+
Read more about the program <a href={stats.programLink}>here</a>
85+
</td>
86+
</tr>
87+
)}
8088
</tbody>
8189
</table>
8290
);
@@ -122,6 +130,13 @@ export const LineStatsTable: React.FC<LineStatsTableProps> = ({ line, stats }) =
122130
<td className="stat-count">{stats.totalOldInactive}</td>
123131
</tr>
124132
)}
133+
{stats.programLink !== undefined && (
134+
<tr>
135+
<td className="program-link">
136+
Read more about the program <a href={stats.programLink}>here</a>
137+
</td>
138+
</tr>
139+
)}
125140
</tbody>
126141
</table>
127142
);

src/static_data.json

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,15 @@
33
"totalActive": 144,
44
"totalInactive": 4,
55
"totalNewDelivered": 148,
6-
"totalNewUndelivered": 4
6+
"totalNewUndelivered": 4,
7+
"programLink": "https://www.mbta.com/projects/orange-line-program#cars"
78
},
89
"Red": {
910
"totalOldActive": 146,
1011
"totalOldInactive": 6,
1112
"totalNewDelivered": 48,
12-
"totalNewUndelivered": 204
13+
"totalNewUndelivered": 204,
14+
"programLink": "https://www.mbta.com/projects/red-line-program#cars"
1315
},
1416
"Green": {
1517
"totalType7Active": 84,
@@ -19,15 +21,17 @@
1921
"totalType9Active": 24,
2022
"totalType9Inactive": 0,
2123
"totalType10Delivered": 0,
22-
"totalType10Undelivered": 102
24+
"totalType10Undelivered": 102,
25+
"programLink": "https://www.mbta.com/projects/green-line-type-10-vehicles"
2326
},
2427
"Blue": {
2528
"totalActive": 94,
2629
"totalInactive": 0
2730
},
2831
"Mattapan": {
2932
"totalActive": 7,
30-
"totalInactive": 3
33+
"totalInactive": 3,
34+
"programLink": "https://www.mbta.com/projects/mattapan-line-program"
3135
},
3236
"Sources": {
3337
"fleet_numbers": "http://roster.transithistory.org/",

0 commit comments

Comments
 (0)