Skip to content

Commit a473d85

Browse files
committed
frontend: redirect to coach-sequence by clicking on Line Name
1 parent 43baf5c commit a473d85

File tree

2 files changed

+26
-9
lines changed

2 files changed

+26
-9
lines changed

frontend/src/components/timetable/ConnectionComponent.svelte

+23-8
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
import Platform from "$components/timetable/info/Platform.svelte";
77
import ViaStops from "$components/timetable/info/ViaStops.svelte";
88
import Messages from "$components/timetable/messages/Messages.svelte";
9+
import type { Station } from "$models/station";
10+
import { DateTime } from "luxon";
911
1012
let {
1113
connection,
@@ -17,6 +19,7 @@
1719
renderInformation: boolean;
1820
} = $props();
1921
const isDeparture = getContext<boolean>("isDeparture");
22+
const station = getContext<Station>("station");
2023
</script>
2124

2225
<div
@@ -30,10 +33,16 @@
3033
<Messages {connection} />
3134

3235
<!-- 2nd row; Line Name -->
33-
<span class="text-lg font-bold">
34-
{connection?.lineInformation?.lineName}
35-
{connection?.lineInformation?.additionalLineName ? " / " + connection?.lineInformation?.additionalLineName : ""}
36-
</span>
36+
<div class="flex flex-row text-lg font-bold">
37+
<a href={`/journey/coach-sequence?lineDetails=${connection?.lineInformation?.product}_${connection?.lineInformation?.fahrtNr}&evaNumber=${station?.evaNumber}&date=${DateTime.local().toFormat("yyyyMMdd")}`}
38+
target="_blank"
39+
>
40+
{connection?.lineInformation?.lineName}
41+
</a>
42+
{#if connection?.lineInformation?.additionalLineName}
43+
<span>/ {connection?.lineInformation?.additionalLineName}</span>
44+
{/if}
45+
</div>
3746

3847
<!-- 3rd row; Time & Platform Information -->
3948
<div class="flex flex-row items-center justify-between text-2xl font-semibold">
@@ -66,10 +75,16 @@
6675
<!-- 2nd row -->
6776
<div class="flex flex-row">
6877
<!-- Line Name -->
69-
<span class="mr-8 flex flex-[1] justify-end text-xl font-semibold">
70-
{connection?.lineInformation?.lineName}
71-
{connection?.lineInformation?.additionalLineName ? " / " + connection?.lineInformation?.additionalLineName : ""}
72-
</span>
78+
<div class="mr-8 flex-[1] justify-end flex flex-row text-right text-xl font-semibold">
79+
<a href={`/journey/coach-sequence?lineDetails=${connection?.lineInformation?.product}_${connection?.lineInformation?.fahrtNr}&evaNumber=${station?.evaNumber}&date=${DateTime.local().toFormat("yyyyMMdd")}`}
80+
target="_blank"
81+
>
82+
{connection?.lineInformation?.lineName}
83+
</a>
84+
{#if connection?.lineInformation?.additionalLineName}
85+
<span>/ {connection?.lineInformation?.additionalLineName}</span>
86+
{/if}
87+
</div>
7388

7489
<!-- viaStops -->
7590
<div class="mr-4 flex-[4] text-lg">

frontend/src/routes/[evaNumber]/[type=type]/+page.svelte

+3-1
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,12 @@
88
import ConnectionComponent from "$components/timetable/ConnectionComponent.svelte";
99
import { page } from "$app/state";
1010
import WingTrain from "$components/timetable/WingTrain.svelte";
11+
import type { Station } from "$models/station";
1112
1213
let { data }: PageProps = $props();
1314
14-
setContext("isDeparture", page.params.type === "departures");
15+
setContext<boolean>("isDeparture", page.params.type === "departures");
16+
setContext<Station>("station", data.station);
1517
1618
let currentFilter = $state(["*"]);
1719
const matchesFilter = (journey: Journey) => {

0 commit comments

Comments
 (0)