Skip to content

Commit

Permalink
cleanup (#110)
Browse files Browse the repository at this point in the history
  • Loading branch information
thomassth authored Jun 2, 2024
1 parent 343c5f1 commit aee6dda
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 34 deletions.
2 changes: 1 addition & 1 deletion src/components/display/VehicleLocation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export default function VehicleLocation(props: {
const [view, setView] = useState<RView>({ center, zoom: 16 });

useEffect(() => {
if (data && data.vehicle) {
if (data?.vehicle) {
const latlong = fromLonLat([data.vehicle?.lon, data.vehicle?.lat]);
setCenter(latlong);
setView({ center: latlong, zoom: 16 });
Expand Down
7 changes: 4 additions & 3 deletions src/components/etaCard/EtaCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,10 @@ export function EtaCard(props: {
}) {
return (
<li
className={
"eta-card" + (props.editable ? " " + style["card-with-button"] : "")
}
className={[
"eta-card",
props.editable ? style["card-with-button"] : "",
].join(" ")}
>
<Link to={props.stopUrl} className={style["grid-item"]}>
<Card className={style["clickable-card"]}>
Expand Down
58 changes: 29 additions & 29 deletions src/components/fetch/FetchSubwayRoute.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,35 @@ import RawDisplay from "../rawDisplay/RawDisplay.js";
import styles from "./FetchSubwayRoute.module.css";
import { getTTCSubwayData } from "./fetchUtils.js";

const filterSubwayDirection = (input: string) => {
return input.replace(/LINE \d \([\w-]+\) /, "").toLowerCase();
};

const filterSubwayTitle = (input: string) => {
return `${input.split(/\(|\)/)[1].toLowerCase()} Line`;
};

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));
};

function RouteInfo(props: { line: number }): JSX.Element {
const [data, setData] = useState<SubwayStations>();
const [lineNum] = useState(props.line);
Expand Down Expand Up @@ -140,32 +169,3 @@ function RouteInfo(props: { line: number }): JSX.Element {
}
}
export default RouteInfo;

const filterSubwayDirection = (input: string) => {
return input.replace(/LINE \d \([\w-]+\) /, "").toLowerCase();
};

const filterSubwayTitle = (input: string) => {
return input.split(/\(|\)/)[1].toLowerCase() + " Line";
};

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));
};
2 changes: 1 addition & 1 deletion src/components/settings/Settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ export function Settings() {
const handleSearchClick = useCallback(() => {
if (stopInput !== "")
if (stopInput === "yrt") {
navigate(`../yrt`);
navigate("../yrt");
} else navigate(`../yrt/stops/${stopInput}`);
}, [stopInput]);

Expand Down

0 comments on commit aee6dda

Please # to comment.