Skip to content

Commit 10596bf

Browse files
committed
mark train as canceled if current point departure is canceled instead of all via points
1 parent 50e84b7 commit 10596bf

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

src/routes/departureboard/-components/BoardEntry.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export const BoardEntry: FC<BoardEntryProps> = ({ isFreight, entry, currentPoint
2121
<div className={"flex flex-col w-full"}>
2222
<div className="flex flex-row">
2323
<BoardTimeInfo time={entry.scheduledTime} timeParser={timeParser} />
24-
<BoardTrainInfo isFreight={isFreight} via={entry.via} transport={entry.transport} />
24+
<BoardTrainInfo isFreight={isFreight} isEventCancelled={entry.cancelled} transport={entry.transport} />
2525
<BoardDestinationInfo currentPointName={currentPoint.name} via={entry.via} />
2626
<BoardPlatformInfo
2727
scheduledStop={entry.scheduledPassengerStop}

src/routes/departureboard/-components/BoardTrainInfo.tsx

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,26 @@
1-
import type { BoardTransportDto, BoardViaEventDto } from "@/api/generated";
1+
import type { BoardTransportDto } from "@/api/generated";
22
import { cn } from "@/lib/utils.ts";
33
import type { FC } from "react";
44

55
type BoardTrainInfoProps = {
66
isFreight: boolean;
7-
via: Array<BoardViaEventDto>;
7+
isEventCancelled: boolean;
88
transport: BoardTransportDto;
99
};
1010

11-
export const BoardTrainInfo: FC<BoardTrainInfoProps> = ({ isFreight, via, transport }) => {
11+
export const BoardTrainInfo: FC<BoardTrainInfoProps> = ({ isFreight, isEventCancelled, transport }) => {
1212
const formattedName = formatTrainName(transport);
13-
const allViaCancelled = via.every(entry => entry.cancelled);
1413
return (
1514
<div
1615
className={cn(
1716
"w-80 text-center rounded-lg py-1 px-2 ml-4 text-white text-4xl font-medium",
1817
"bg-gray-700",
1918
isFreight && "bg-gray-500",
20-
allViaCancelled && "bg-transparent text-gray-600 border-2",
19+
isEventCancelled && "bg-transparent text-gray-600 border-2",
2120
)}
2221
>
2322
<span
24-
className={cn("inline-block max-w-full whitespace-nowrap overflow-hidden", allViaCancelled && "line-through")}
23+
className={cn("inline-block max-w-full whitespace-nowrap overflow-hidden", isEventCancelled && "line-through")}
2524
>
2625
{formattedName}
2726
</span>

0 commit comments

Comments
 (0)