Skip to content

Commit

Permalink
Merge branch 'master' of github.com-school:Techno3d/TransitArrivalBoard
Browse files Browse the repository at this point in the history
  • Loading branch information
rexmagnusdavid committed May 23, 2024
2 parents 99f42e6 + 01ce610 commit 29bde5b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions app/components/Bulletin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ export function Bulletin(props: { routes: Record<string, Route>; stop: Stop; wal
return vehicle.minutes_until_arrival > props.walk_time / 2;
});

return (
return times.length > 0 ? (
<div
className="flex min-h-29 flex-row items-center rounded-lg bg-slate-200 text-black"
key={Math.random()}
key={times[0].route_id + "_" + times[0].destination_id}
>
<div className="flex min-h-full basis-5/6 flex-row items-center rounded-lg bg-slate-100 shadow-2xl">
<div className="flex min-h-full basis-4/5 flex-row items-center justify-start gap-2 px-2">
Expand All @@ -54,7 +54,7 @@ export function Bulletin(props: { routes: Record<string, Route>; stop: Stop; wal
) : undefined}
</div>
</div>
);
) : undefined;
});
})
) : (
Expand Down
4 changes: 2 additions & 2 deletions app/components/Message.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ export function Message(props: { routes: Record<string, Route>; name: string; he
{props.headers.length > 0 ? (
<div className="flex min-h-62 flex-row items-start rounded-lg bg-slate-100 px-4">
<h1 className="line-clamp-4 text-pretty font-semibold 2xl:text-5xl 2xl:leading-tight">
{props.headers[props.index].split(/(\[.*?\])/).map((text) => {
{props.headers[props.index].split(/(\[.*?\])/).map((text, index) => {
if (text.length == 0) return;
if (text.substring(0, 1) != "[" || text.substring(text.length - 1) != "]") return text;
return (
<div className="mx-1 inline-flex -translate-y-1.5" key={Math.random()}>
<div className="mx-1 inline-flex -translate-y-1.5" key={index}>
<Bullet route={props.routes[text.substring(1, text.length - 1)]} size={42} />
</div>
);
Expand Down
4 changes: 2 additions & 2 deletions app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ export default function Home() {
{Object.values(config.subway).map((value) => {
return (
<Countdown
key={Math.random()}
key={value.stop_ids[0]}
stop={stops[value.stop_ids[0]]}
walk_time={value.walk_time}
routes={routes}
Expand All @@ -129,7 +129,7 @@ export default function Home() {
{Object.values(config.bus).map((value) => {
return (
<Bulletin
key={Math.random()}
key={value.stop_ids[0]}
stop={stops[value.stop_ids[0]]}
routes={routes}
walk_time={value.walk_time}
Expand Down

0 comments on commit 29bde5b

Please sign in to comment.