-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path+page.svelte
45 lines (39 loc) · 1.24 KB
/
+page.svelte
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<script lang="ts">
import type { PageProps } from "./$types";
import Sequence from "$components/sequence/Sequence.svelte";
import { MetaTags } from "svelte-meta-tags";
let { data }: PageProps = $props();
const tripReference = (): { referenceId: string; destination: string } => {
const referenceIds = new Set<string>();
const destinations = new Set<string>();
data.sequence?.vehicleGroup?.forEach(({ tripReference: { category, fahrtNr, destination } }) => {
if (fahrtNr) referenceIds.add(`${category} ${fahrtNr}`);
if (destination?.name) destinations.add(destination.name);
});
return {
referenceId: Array.from(referenceIds).join(" / "),
destination: Array.from(destinations).join(" / ")
};
};
</script>
<MetaTags
title={`Coach Sequence for ${tripReference().referenceId}`}
description={`See the sequence of coaches on the track`}
openGraph={{
url: "https://navigator.voldechse.wtf/",
title: "Navigator",
siteName: "Navigator",
description: "The Navigator for your train journeys.",
images: [
{
url: "https://navigator.voldechse.wtf/logo.png",
width: 1024,
height: 1024,
alt: "Navigator Logo"
}
]
}}
/>
<div class="mb-6 flex flex-1 justify-center">
<Sequence sequence={data.sequence} />
</div>