Skip to content

Commit

Permalink
fix: missing route pills on Solari screens
Browse files Browse the repository at this point in the history
The refactor of this logic to address type errors in 1f411cb was
incorrect and ended up breaking text route pills (e.g. bus numbers,
commuter rail track numbers). The variable mistakenly named `routeImg`
here was intended to be an image-or-string.
  • Loading branch information
digitalcora committed Apr 19, 2024
1 parent 189db3a commit 8de60b7
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions assets/src/components/solari/route_pill.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,31 +69,33 @@ const routeToPill = (
};

const Pill = ({ routeName, routePillColor }: PillType): JSX.Element => {
let routeImg: JSX.Element | undefined;
let route: JSX.Element | string | null;

if (routeName === "CR") {
routeImg = (
route = (
<img
className="departure-route--icon"
src={imagePath("commuter-rail.svg")}
></img>
);
} else if (routeName === "Boat") {
routeImg = (
route = (
<img className="departure-route--icon" src={imagePath("ferry.svg")}></img>
);
} else if (routeName === "BUS") {
routeImg = (
route = (
<img
className="departure-route--icon"
src={imagePath("bus-black.svg")}
></img>
);
} else {
route = routeName;
}

return (
<div className={classWithModifier("departure-route", routePillColor)}>
{routeImg && <BaseRoutePill route={routeImg} />}
{route && <BaseRoutePill route={route} />}
</div>
);
};
Expand Down

0 comments on commit 8de60b7

Please sign in to comment.