Skip to content

Commit

Permalink
line 3
Browse files Browse the repository at this point in the history
  • Loading branch information
thomassth committed Oct 3, 2023
1 parent 0badce6 commit 1dcc036
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/components/fetch/FetchRouteList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ function subwayCards() {

function JumpBar() {
const jumpbarMap = [
['', "Regular"],
["", "Regular"],
[200, "Seasonal"],
[300, "Night"],
[501, "Streetcar"],
Expand Down
56 changes: 47 additions & 9 deletions src/components/fetch/FetchSubwayRoute.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,15 @@ function RouteInfo(props: { line: number }): JSX.Element {
return data;
};

fetchSubwayData().then((res) => {
try {
setData(JSON.parse(res));
} catch (error) {
setData({ routeBranchesWithStops: [], Error: true });
}
});
if (lineNum !== 3) {
fetchSubwayData().then((res) => {
try {
setData(JSON.parse(res));
} catch (error) {
setData({ routeBranchesWithStops: [], Error: true });
}
});
}

// when useEffect is called, the following clean-up fn will run first
return () => {
Expand Down Expand Up @@ -78,7 +80,12 @@ function RouteInfo(props: { line: number }): JSX.Element {
return (
<div className="stopsListContainer">
<ul>
{props.line === 3 && <li>Line 3 has ceased to be.</li>}
{props.line === 3 && (
<li>
Line 3 is permanently closed. <br />
{line3Tribute()}
</li>
)}
<li>
<RawDisplay data={data} />
</li>
Expand All @@ -90,7 +97,17 @@ function RouteInfo(props: { line: number }): JSX.Element {
return (
<LinkFluent appearance="subtle" onClick={handleFetchBusClick}>
<Text as="h1" weight="semibold">
{t("reminder.loading")}
<div className="stopsListContainer">
<ul>
{props.line === 3 && (
<li>
Line 3 is permanently closed. <br />
{line3Tribute()}
</li>
)}
{props.line !== 3 && t("reminder.loading")}
</ul>
</div>
</Text>
</LinkFluent>
);
Expand All @@ -112,3 +129,24 @@ const filterSubwayDirection = (input: string) => {
const filterSubwayTitle = (input: string) => {
return input.split(/\(|\)/)[1];
};

const line3Tribute = () => {
const lines = new Map([
[0, "It is no more."],
[1, "It has ceased to be."],
[2, "Bereft of life, it rests in peace."],
[3, "It is an ex-line."],
[4, "It is pining for the fjords."],
[5, "It has kicked the bucket."],
[
6,
"It has shuffled off its mortal coil, run down the curtain and joined the choir invisible.",
],
[7, "Its metallic processes are now history."],
[8, "It's definitely deceased."],
[9, "It is expired and gone to meet its maker."],
[10, "It's passed on."],
]);

return lines.get(Math.floor(Math.random() * 11));
};

0 comments on commit 1dcc036

Please sign in to comment.