From 93dacfa69ac9c4c1e53b977e7f74defe8e9c63f2 Mon Sep 17 00:00:00 2001
From: 7222e800-c703-472d-a787-71b6b5cba4ef <mem@estrogen.zone>
Date: Sun, 14 Sep 2025 17:22:36 +0000
Subject: refactor: maybe also move notices out

---
 src/lib/Timetable.svelte | 28 ++--------------------------
 1 file changed, 2 insertions(+), 26 deletions(-)

(limited to 'src/lib/Timetable.svelte')

diff --git a/src/lib/Timetable.svelte b/src/lib/Timetable.svelte
index 1ed0900..868050e 100644
--- a/src/lib/Timetable.svelte
+++ b/src/lib/Timetable.svelte
@@ -9,6 +9,7 @@
   import { m } from './paraglide/messages';
   import {
     blacklistedAgencyURLs,
+    getNotices,
     getPictogram,
     stopTimeShouldRenderGlyph,
     stopTimeToShortName,
@@ -167,32 +168,7 @@
     {@const delayMinutes = receivedTime - expectedTime}
     {@const routeShortName = stopTimeToShortName(departure)}
     {@const pictogram = getPictogram(departure.mode)}
-    {@const notices = (() => {
-      let notices = [] as [pictogram: string[], content: string][];
-      if (departure.cancelled)
-        notices.push([['Cancellation', 'Attention'], m.connection_cancelled()]);
-      if (delayMinutes < -0.5) {
-        notices.push([
-          ['Hint'],
-          m.connection_early({
-            minutes: -delayMinutes,
-            arrival: isArrivals.toString(),
-          }),
-        ]);
-      } else if (delayMinutes >= 1) {
-        notices.push([
-          delayMinutes >= 3
-            ? ['Delay', 'Attention']
-            : delayMinutes >= 2
-              ? ['Delay', 'Hint']
-              : ['Hint'],
-          m.connection_delayed({
-            minutes: delayMinutes.toFixed(0),
-          }),
-        ]);
-      }
-      return notices;
-    })()}
+    {@const notices = getNotices(departure, delayMinutes, isArrivals)}
     {@const situationIsBad = notices.find((v) => v[0].includes('Attention'))}
     <div
       class={{
-- 
cgit v1.2.3

