From 821183f42cf8ac696ea6db07740c4a6f2cd9bab7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Niklas=20Schr=C3=B6tler?= <niklas@allround.digital>
Date: Sat, 9 Dec 2023 16:55:22 +0100
Subject: [PATCH] PlanElement: Now selectively removing Dortmund from strings

---
 src/panels/Fahrplan/components/PlanElement.tsx | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

diff --git a/src/panels/Fahrplan/components/PlanElement.tsx b/src/panels/Fahrplan/components/PlanElement.tsx
index 7f366b5..0f34b18 100644
--- a/src/panels/Fahrplan/components/PlanElement.tsx
+++ b/src/panels/Fahrplan/components/PlanElement.tsx
@@ -22,8 +22,8 @@ const PlanElement = (props: {
         )}>
           {props.trainIdentifier}
         </div>
-        <h3 className={"text-xl"}>
-          {props.trainHeading}
+        <h3 className={"text-xl leading-9"}>
+          {deDortmund(props.trainHeading)}
         </h3>
       </div>
 
@@ -34,8 +34,9 @@ const PlanElement = (props: {
             <ProgressIndicator
               first={index === 0}
               id={stop.name}
-              name={stop.name}
+              name={deDortmund(stop.name)}
               arrival={stop.arrival}
+              delay={stop.delay}
             />
           ))
         }
@@ -63,3 +64,13 @@ const trainIdentifierToColor = (identifier: string): string => {
 
   return "bg-zinc-700";
 }
+
+const deDortmund = (input: string): string => {
+  // Don't remove the city from central station location
+  if(input.toLowerCase().includes("HBf")) {
+    return input;
+  }
+
+  // In all other cases, remove dortmund
+  return input.replaceAll("Dortmund ", "");
+}
-- 
GitLab