Skip to content

Commit 3b2574e

Browse files
committed
chore: linting
1 parent 5cf4e33 commit 3b2574e

18 files changed

+224
-185
lines changed

backend/controllers/journey/SequenceController.ts

+11-8
Original file line numberDiff line numberDiff line change
@@ -33,18 +33,21 @@ export class SequenceController extends Controller {
3333
}
3434

3535
const fetchCoachSequence = async (query: SequenceQuery): Promise<any> => {
36-
const request = await fetch(`https://app.vendo.noncd.db.de/mob/zuglaeufe/${query.lineDetails}/halte/by-abfahrt/${query.evaNumber}_${query.date}/wagenreihung`, {
37-
method: "GET",
38-
headers: {
39-
Accept: "application/x.db.vendo.mob.wagenreihung.v3+json",
40-
"Content-Type": "application/x.db.vendo.mob.wagenreihung.v3+json",
41-
"X-Correlation-ID": crypto.randomUUID() + "_" + crypto.randomUUID()
36+
const request = await fetch(
37+
`https://app.vendo.noncd.db.de/mob/zuglaeufe/${query.lineDetails}/halte/by-abfahrt/${query.evaNumber}_${query.date}/wagenreihung`,
38+
{
39+
method: "GET",
40+
headers: {
41+
Accept: "application/x.db.vendo.mob.wagenreihung.v3+json",
42+
"Content-Type": "application/x.db.vendo.mob.wagenreihung.v3+json",
43+
"X-Correlation-ID": crypto.randomUUID() + "_" + crypto.randomUUID()
44+
}
4245
}
43-
});
46+
);
4447

4548
if (!request.ok) {
4649
throw new Error("Failed to fetch coach sequence");
4750
}
4851

4952
return mapCoachSequence(await request.json());
50-
};
53+
};

backend/lib/mapping.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ const mapCoachSequence = (entry: any): Sequence => {
144144
direction: entry?.fahrtrichtung === "RECHTS" ? "RIGHT" : "LEFT",
145145
plannedTrack: entry?.gleisSoll,
146146
actualTrack: entry?.gleisVorschau
147-
}
148-
}
147+
};
148+
};
149149

150150
export { mapConnection, mapCoachSequence };

backend/models/sequence.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export interface VehicleGroup {
3030
export interface TripReference {
3131
type: string;
3232
line: string;
33-
destination: { name: string; };
33+
destination: { name: string };
3434
category: string;
3535
fahrtNr: number;
3636
}
@@ -82,4 +82,4 @@ export interface PositionOnTrack {
8282
export interface Equipment {
8383
type: string;
8484
status: string;
85-
}
85+
}

frontend/src/components/sequence/Sequence.svelte

+15-16
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,13 @@
3232
};
3333
};
3434
35-
const flattenVehicles = $derived(sequence.vehicleGroup
36-
?.flatMap(g => g.vehicles)
37-
.sort((a, b) => a.positionOnTrack.start.position - b.positionOnTrack.start.position)
38-
|| []);
35+
const flattenVehicles = $derived(
36+
sequence.vehicleGroup
37+
?.flatMap((g) => g.vehicles)
38+
.sort((a, b) => a.positionOnTrack.start.position - b.positionOnTrack.start.position) || []
39+
);
3940
const hasLocomotive = (currentVehicle: Vehicle, direction: "before" | "after") => {
40-
const index = flattenVehicles.findIndex(v => v === currentVehicle);
41+
const index = flattenVehicles.findIndex((v) => v === currentVehicle);
4142
if (index === -1) return false;
4243
4344
const adjacentIndex = direction === "before" ? index - 1 : index + 1;
@@ -62,25 +63,22 @@
6263
};
6364
</script>
6465

65-
<div class="overflow-x-auto h-full max-w-full bg-primary-darker content-end rounded-lg pb-4 md:px-16">
66+
<div class="h-full max-w-full content-end overflow-x-auto rounded-lg bg-primary-darker pb-4 md:px-16">
6667
<VehicleInfo track={sequence.track} vehicle={vehicleById} />
6768

6869
<!-- Track Visualization -->
69-
<div class="mt-12 w-full min-w-[800px] relative">
70+
<div class="relative mt-12 w-full min-w-[800px]">
7071
{#each sequence.track.sections as section}
7172
{@const style = calculateLength(section.start.position, section.end.position)}
72-
<div
73-
class="absolute h-full flex items-center justify-center"
74-
style="width: {style.width}; left: {style.left}"
75-
>
73+
<div class="absolute flex h-full items-center justify-center" style="width: {style.width}; left: {style.left}">
7674
<span class="font-medium">{section.name}</span>
7775
</div>
7876
{/each}
7977
</div>
8078

8179
<!-- Vehicle Groups Visualization -->
8280
{#if sequence.vehicleGroup}
83-
<div class="relative w-full min-w-[800px] h-20">
81+
<div class="relative h-20 w-full min-w-[800px]">
8482
{#each sequence.vehicleGroup as group, groupIndex (group)}
8583
<!-- Render each vehicle in its exact position on the track -->
8684
{#each group.vehicles as vehicle, vehicleIndex (vehicle)}
@@ -89,9 +87,10 @@
8987
vehicle.positionOnTrack.end.position
9088
)}
9189
{@const vehicleType = vehicle.vehicleType}
92-
{@const isSelected = selectedVehicle.groupIndex === groupIndex && selectedVehicle.vehicleIndex === vehicleIndex}
90+
{@const isSelected =
91+
selectedVehicle.groupIndex === groupIndex && selectedVehicle.vehicleIndex === vehicleIndex}
9392
<button
94-
class="h-full absolute cursor-pointer hover:scale-110 transition-transform"
93+
class="absolute h-full cursor-pointer transition-transform hover:scale-110"
9594
style="width: {style.width}; left: {style.left}; min-width: {style.minWidth}"
9695
class:scale-110={isSelected}
9796
onclick={() => selectVehicle(groupIndex, vehicleIndex)}
@@ -115,8 +114,8 @@
115114
</div>
116115
{/if}
117116

118-
<div class="flex flex-col mt-4">
117+
<div class="mt-4 flex flex-col">
119118
<span class="text-text">{tripReference().referenceId}</span>
120119
<span class="font-semibold">{tripReference().destination}</span>
121120
</div>
122-
</div>
121+
</div>

frontend/src/components/sequence/VehicleInfo.svelte

+17-13
Original file line numberDiff line numberDiff line change
@@ -4,30 +4,34 @@
44
import DoubleDeck from "$components/sequence/coaches/big/DoubleDeck.svelte";
55
import SingleFloor from "$components/sequence/coaches/big/SingleFloor.svelte";
66
7-
let { track, vehicle }: { track?: Track, vehicle?: Vehicle } = $props();
7+
let { track, vehicle }: { track?: Track; vehicle?: Vehicle } = $props();
88
99
const sectionInfo = (): string => {
1010
const vehicleStart = vehicle?.positionOnTrack.start.position ?? 0;
1111
const vehicleEnd = vehicle?.positionOnTrack.end.position ?? 0;
1212
13-
const sections = track?.sections.filter(section => !(vehicleEnd < section.start.position || vehicleStart > section.end.position)) ?? [];
13+
const sections =
14+
track?.sections.filter(
15+
(section) => !(vehicleEnd < section.start.position || vehicleStart > section.end.position)
16+
) ?? [];
1417
1518
if (sections.length === 1) {
1619
return `Stops in section ${sections[0].name}`;
1720
} else if (sections.length > 1) {
18-
return `Stops between sections ${sections.map(section => section.name).join(" & ")}`;
21+
return `Stops between sections ${sections.map((section) => section.name).join(" & ")}`;
1922
} else {
2023
return "No valid section";
2124
}
2225
};
2326
</script>
2427

2528
{#if !vehicle}{:else}
26-
<div class="flex flex-col w-full py-8 text-lg font-medium"
27-
class:border-b={!vehicle?.vehicleType?.firstClass}
28-
class:border-gray-700={!vehicle?.vehicleType?.firstClass}
29-
class:border-b-4={vehicle?.vehicleType?.firstClass}
30-
class:border-accent={vehicle?.vehicleType?.firstClass}
29+
<div
30+
class="flex w-full flex-col py-8 text-lg font-medium"
31+
class:border-b={!vehicle?.vehicleType?.firstClass}
32+
class:border-gray-700={!vehicle?.vehicleType?.firstClass}
33+
class:border-b-4={vehicle?.vehicleType?.firstClass}
34+
class:border-accent={vehicle?.vehicleType?.firstClass}
3135
>
3236
{#if vehicle?.orderNumber}
3337
<div class="flex flex-row gap-x-6">
@@ -48,13 +52,13 @@
4852
{:else if vehicle?.vehicleType?.category?.includes("POWERCAR")}
4953
<span class="font-bold">Powercar</span>
5054
{:else if vehicle?.vehicleType?.firstClass && vehicle?.vehicleType?.secondClass}
51-
<div class="flex flex-row font-bold gap-x-1">
55+
<div class="flex flex-row gap-x-1 font-bold">
5256
<span class="text-[#f9c523]">1.</span>
5357
<span>/</span>
5458
<span>2. Class</span>
5559
</div>
5660
{:else if vehicle?.vehicleType?.firstClass}
57-
<span class="text-[#f9c523] font-bold">1. Class</span>
61+
<span class="font-bold text-[#f9c523]">1. Class</span>
5862
{:else}
5963
<span class="font-bold">2. Class</span>
6064
{/if}
@@ -79,13 +83,13 @@
7983
{:else if vehicle?.vehicleType?.category?.includes("POWERCAR")}
8084
<span class="font-bold">Powercar</span>
8185
{:else if vehicle?.vehicleType?.firstClass && vehicle?.vehicleType?.secondClass}
82-
<div class="flex flex-row font-bold gap-x-1">
86+
<div class="flex flex-row gap-x-1 font-bold">
8387
<span class="text-[#f9c523]">1.</span>
8488
<span>/</span>
8589
<span>2. Class</span>
8690
</div>
8791
{:else if vehicle?.vehicleType?.firstClass}
88-
<span class="text-[#f9c523] font-bold">1. Class</span>
92+
<span class="font-bold text-[#f9c523]">1. Class</span>
8993
{:else}
9094
<span class="font-bold">2. Class</span>
9195
{/if}
@@ -94,4 +98,4 @@
9498
</div>
9599
{/if}
96100
</div>
97-
{/if}
101+
{/if}
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
<script lang="ts">
2-
let { height = "75px", width = "75px" }: { height?: string, width?: string } = $props();
2+
let { height = "75px", width = "75px" }: { height?: string; width?: string } = $props();
33
</script>
44

5-
<svg id="coach-sequence" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024"
6-
{height}
7-
{width}
8-
class="shrink-0">
5+
<svg id="coach-sequence" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024" {height} {width} class="shrink-0">
96
<g id="coaches-big">
107
<g id="double-decker">
11-
<path class="cls-1" d="M871.58,297.18H137.28c-24.85,0-45,20.15-45,45v298.46h45.75l.03,47.25c0,5.52,4.48,9.99,10,9.99h163.15c5.52,0,10-4.48,10-10v-47.24h366.36l-.36,47.17c-.04,5.55,4.45,10.08,10,10.08h163.54c5.52,0,10-4.48,10-10v-47.24h45.84v-298.46c0-24.85-20.15-45-45-45ZM819.11,549.05c0,6.9-5.6,12.5-12.5,12.5H190.49c-6.9,0-12.5-5.6-12.5-12.5v-60c0-6.9,5.6-12.5,12.5-12.5h616.13c6.9,0,12.5,5.6,12.5,12.5v60ZM819.11,425.96c0,6.9-5.6,12.5-12.5,12.5H190.49c-6.9,0-12.5-5.6-12.5-12.5v-60c0-6.9,5.6-12.5,12.5-12.5h616.13c6.9,0,12.5,5.6,12.5,12.5v60Z"/>
8+
<path
9+
class="cls-1"
10+
d="M871.58,297.18H137.28c-24.85,0-45,20.15-45,45v298.46h45.75l.03,47.25c0,5.52,4.48,9.99,10,9.99h163.15c5.52,0,10-4.48,10-10v-47.24h366.36l-.36,47.17c-.04,5.55,4.45,10.08,10,10.08h163.54c5.52,0,10-4.48,10-10v-47.24h45.84v-298.46c0-24.85-20.15-45-45-45ZM819.11,549.05c0,6.9-5.6,12.5-12.5,12.5H190.49c-6.9,0-12.5-5.6-12.5-12.5v-60c0-6.9,5.6-12.5,12.5-12.5h616.13c6.9,0,12.5,5.6,12.5,12.5v60ZM819.11,425.96c0,6.9-5.6,12.5-12.5,12.5H190.49c-6.9,0-12.5-5.6-12.5-12.5v-60c0-6.9,5.6-12.5,12.5-12.5h616.13c6.9,0,12.5,5.6,12.5,12.5v60Z"
11+
/>
1212
</g>
1313
</g>
1414
</svg>
1515

1616
<style lang="postcss">
17-
.cls-1 {
18-
@apply fill-text;
19-
}
20-
</style>
17+
.cls-1 {
18+
@apply fill-text;
19+
}
20+
</style>
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,20 @@
11
<script lang="ts">
2-
let { height = "75px", width = "75px" }: { height?: string, width?: string } = $props();
2+
let { height = "75px", width = "75px" }: { height?: string; width?: string } = $props();
33
</script>
44

5-
<svg id="coach-sequence" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024"
6-
{height}
7-
{width}
8-
class="shrink-0">
5+
<svg id="coach-sequence" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024" {height} {width} class="shrink-0">
96
<g id="coaches-big">
107
<g id="locomotive">
11-
<path class="cls-1"
12-
d="M912.59,265.92H178.29c-24.85,0-45,20.15-45,45v298.46h45.75l.03,47.25c0,5.52,4.48,9.99,10,9.99h163.15c5.52,0,10-4.48,10-10v-47.24h366.36l-.36,47.17c-.04,5.55,4.45,10.08,10,10.08h163.54c5.52,0,10-4.48,10-10v-47.24h45.84v-298.46c0-24.85-20.15-45-45-45ZM866,525.51c0,6.9-5.6,12.5-12.5,12.5H237.38c-6.9,0-12.5-5.6-12.5-12.5v-20c0-6.9,5.6-12.5,12.5-12.5h616.13c6.9,0,12.5,5.6,12.5,12.5v20ZM866,442.51c0,6.9-5.6,12.5-12.5,12.5H237.38c-6.9,0-12.5-5.6-12.5-12.5v-20c0-6.9,5.6-12.5,12.5-12.5h616.13c6.9,0,12.5,5.6,12.5,12.5v20ZM866,359.5c0,6.9-5.6,12.5-12.5,12.5H237.38c-6.9,0-12.5-5.6-12.5-12.5v-20c0-6.9,5.6-12.5,12.5-12.5h616.13c6.9,0,12.5,5.6,12.5,12.5v20Z" />
8+
<path
9+
class="cls-1"
10+
d="M912.59,265.92H178.29c-24.85,0-45,20.15-45,45v298.46h45.75l.03,47.25c0,5.52,4.48,9.99,10,9.99h163.15c5.52,0,10-4.48,10-10v-47.24h366.36l-.36,47.17c-.04,5.55,4.45,10.08,10,10.08h163.54c5.52,0,10-4.48,10-10v-47.24h45.84v-298.46c0-24.85-20.15-45-45-45ZM866,525.51c0,6.9-5.6,12.5-12.5,12.5H237.38c-6.9,0-12.5-5.6-12.5-12.5v-20c0-6.9,5.6-12.5,12.5-12.5h616.13c6.9,0,12.5,5.6,12.5,12.5v20ZM866,442.51c0,6.9-5.6,12.5-12.5,12.5H237.38c-6.9,0-12.5-5.6-12.5-12.5v-20c0-6.9,5.6-12.5,12.5-12.5h616.13c6.9,0,12.5,5.6,12.5,12.5v20ZM866,359.5c0,6.9-5.6,12.5-12.5,12.5H237.38c-6.9,0-12.5-5.6-12.5-12.5v-20c0-6.9,5.6-12.5,12.5-12.5h616.13c6.9,0,12.5,5.6,12.5,12.5v20Z"
11+
/>
1312
</g>
1413
</g>
1514
</svg>
1615

1716
<style lang="postcss">
18-
.cls-1 {
19-
@apply fill-text;
20-
}
21-
</style>
17+
.cls-1 {
18+
@apply fill-text;
19+
}
20+
</style>
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
<script lang="ts">
2-
let { height = "75px", width = "75px" }: { height?: string, width?: string } = $props();
2+
let { height = "75px", width = "75px" }: { height?: string; width?: string } = $props();
33
</script>
44

5-
<svg id="coach-sequence" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024"
6-
{height}
7-
{width}
8-
class="shrink-0">
5+
<svg id="coach-sequence" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024" {height} {width} class="shrink-0">
96
<g id="coaches-big">
107
<g id="single-floor">
11-
<path class="cls-1" d="M879.15,311.65H144.85c-24.85,0-45,20.15-45,45v298.46h45.75l.03,47.25c0,5.52,4.48,9.99,10,9.99h163.15c5.52,0,10-4.48,10-10v-47.24h366.36l-.36,47.17c-.04,5.55,4.45,10.08,10,10.08h163.54c5.52,0,10-4.48,10-10v-47.24h45.84v-298.46c0-24.85-20.15-45-45-45ZM832.56,505.22c0,6.9-5.6,12.5-12.5,12.5H203.94c-6.9,0-12.5-5.6-12.5-12.5v-112.38c0-6.9,5.6-12.5,12.5-12.5h616.13c6.9,0,12.5,5.6,12.5,12.5v112.38Z"/>
8+
<path
9+
class="cls-1"
10+
d="M879.15,311.65H144.85c-24.85,0-45,20.15-45,45v298.46h45.75l.03,47.25c0,5.52,4.48,9.99,10,9.99h163.15c5.52,0,10-4.48,10-10v-47.24h366.36l-.36,47.17c-.04,5.55,4.45,10.08,10,10.08h163.54c5.52,0,10-4.48,10-10v-47.24h45.84v-298.46c0-24.85-20.15-45-45-45ZM832.56,505.22c0,6.9-5.6,12.5-12.5,12.5H203.94c-6.9,0-12.5-5.6-12.5-12.5v-112.38c0-6.9,5.6-12.5,12.5-12.5h616.13c6.9,0,12.5,5.6,12.5,12.5v112.38Z"
11+
/>
1212
</g>
1313
</g>
1414
</svg>
1515

1616
<style lang="postcss">
17-
.cls-1 {
18-
@apply fill-text;
19-
}
20-
</style>
17+
.cls-1 {
18+
@apply fill-text;
19+
}
20+
</style>

frontend/src/components/sequence/coaches/small/CoachEnd.svelte

+23-18
Original file line numberDiff line numberDiff line change
@@ -2,32 +2,37 @@
22
let { firstClass }: { firstClass: boolean } = $props();
33
</script>
44

5-
<svg id="coach-sequence" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024"
6-
class="shrink-0 h-full w-full"
7-
preserveAspectRatio="xMidYMid meet">
5+
<svg
6+
id="coach-sequence"
7+
xmlns="http://www.w3.org/2000/svg"
8+
viewBox="0 0 1024 1024"
9+
class="h-full w-full shrink-0"
10+
preserveAspectRatio="xMidYMid meet"
11+
>
812
<g id="coaches-small">
913
<g id="coach-end">
10-
<polyline class="cls-1" points="75 762 887 762 887 162 75 162"/>
14+
<polyline class="cls-1" points="75 762 887 762 887 162 75 162" />
1115
{#if firstClass}
12-
<line class="cls-2" x1="75" y1="924" x2="913.2" y2="924"/>
16+
<line class="cls-2" x1="75" y1="924" x2="913.2" y2="924" />
1317
{/if}
1418
</g>
1519
</g>
1620
</svg>
1721

1822
<style lang="postcss">
19-
.cls-1 {
20-
@apply stroke-text;
21-
stroke-width: 50px;
22-
}
23+
.cls-1 {
24+
@apply stroke-text;
25+
stroke-width: 50px;
26+
}
2327
24-
.cls-1, .cls-2 {
25-
@apply fill-none;
26-
stroke-miterlimit: 10;
27-
}
28+
.cls-1,
29+
.cls-2 {
30+
@apply fill-none;
31+
stroke-miterlimit: 10;
32+
}
2833
29-
.cls-2 {
30-
@apply stroke-accent;
31-
stroke-width: 75px;
32-
}
33-
</style>
34+
.cls-2 {
35+
@apply stroke-accent;
36+
stroke-width: 75px;
37+
}
38+
</style>

0 commit comments

Comments
 (0)