From be8b0f535812d0fe1a1694d5f6bf637713acfcd3 Mon Sep 17 00:00:00 2001 From: Traines Date: Thu, 16 Jan 2025 16:02:02 +0000 Subject: [PATCH 1/9] ui: move components to lib --- ui/src/{routes => lib}/ConnectionDetail.svelte | 2 +- ui/src/{routes => lib}/Debug.svelte | 0 ui/src/{routes => lib}/ItineraryGeoJSON.svelte | 0 ui/src/{routes => lib}/ItineraryList.svelte | 0 ui/src/{routes => lib}/LevelSelect.svelte | 0 ui/src/{routes => lib}/RailViz.svelte | 0 ui/src/{routes => lib}/SearchMask.svelte | 0 ui/src/{routes => lib}/StopTimes.svelte | 0 ui/src/routes/+page.svelte | 16 ++++++++-------- 9 files changed, 9 insertions(+), 9 deletions(-) rename ui/src/{routes => lib}/ConnectionDetail.svelte (99%) rename ui/src/{routes => lib}/Debug.svelte (100%) rename ui/src/{routes => lib}/ItineraryGeoJSON.svelte (100%) rename ui/src/{routes => lib}/ItineraryList.svelte (100%) rename ui/src/{routes => lib}/LevelSelect.svelte (100%) rename ui/src/{routes => lib}/RailViz.svelte (100%) rename ui/src/{routes => lib}/SearchMask.svelte (100%) rename ui/src/{routes => lib}/StopTimes.svelte (100%) diff --git a/ui/src/routes/ConnectionDetail.svelte b/ui/src/lib/ConnectionDetail.svelte similarity index 99% rename from ui/src/routes/ConnectionDetail.svelte rename to ui/src/lib/ConnectionDetail.svelte index e6386fd8e..599a61039 100644 --- a/ui/src/routes/ConnectionDetail.svelte +++ b/ui/src/lib/ConnectionDetail.svelte @@ -1,7 +1,7 @@ -
+
{#if variant == 'schedule'} {formatTime(scheduled)} {:else if variant === 'realtime-show-always' || (variant === 'realtime' && isRealtime)} diff --git a/ui/src/lib/components/ui/card/card.svelte b/ui/src/lib/components/ui/card/card.svelte index c7531d50c..823ff02c7 100644 --- a/ui/src/lib/components/ui/card/card.svelte +++ b/ui/src/lib/components/ui/card/card.svelte @@ -13,7 +13,7 @@
{@render children?.()} diff --git a/ui/src/lib/components/ui/radio-group/radio-group.svelte b/ui/src/lib/components/ui/radio-group/radio-group.svelte index 47172bdbd..3a8b95a76 100644 --- a/ui/src/lib/components/ui/radio-group/radio-group.svelte +++ b/ui/src/lib/components/ui/radio-group/radio-group.svelte @@ -12,4 +12,4 @@ export { className as class }; - + diff --git a/ui/src/lib/map/Control.svelte b/ui/src/lib/map/Control.svelte index 03bbb7a39..42dbcfd68 100644 --- a/ui/src/lib/map/Control.svelte +++ b/ui/src/lib/map/Control.svelte @@ -42,7 +42,7 @@
{#if children} diff --git a/ui/src/routes/+page.svelte b/ui/src/routes/+page.svelte index 57a77c848..311eba32f 100644 --- a/ui/src/routes/+page.svelte +++ b/ui/src/routes/+page.svelte @@ -236,9 +236,9 @@ {#if !selectedItinerary && routingResponses.length !== 0} - + @@ -246,8 +246,8 @@ {/if} {#if selectedItinerary && !selectedStop} - - + +

{t.journeyDetails}

-
+
{ From 8551887aa22376e3e807a7355d121177b16c932a Mon Sep 17 00:00:00 2001 From: Traines Date: Fri, 17 Jan 2025 14:27:29 +0000 Subject: [PATCH 3/9] ui: more compact layout --- ui/src/lib/ConnectionDetail.svelte | 24 ++++++++++++------------ ui/src/lib/SearchMask.svelte | 4 ++-- ui/src/lib/StopTimes.svelte | 10 ++++------ ui/src/lib/map/Control.svelte | 2 +- ui/src/routes/+page.svelte | 10 +++++----- 5 files changed, 24 insertions(+), 26 deletions(-) diff --git a/ui/src/lib/ConnectionDetail.svelte b/ui/src/lib/ConnectionDetail.svelte index 4c897d37c..806fe19de 100644 --- a/ui/src/lib/ConnectionDetail.svelte +++ b/ui/src/lib/ConnectionDetail.svelte @@ -31,7 +31,7 @@ )}
-
+
{@render stopTimes( l.startTime, l.scheduledStartTime, @@ -120,12 +120,12 @@ {l.headsign}
{#if l.intermediateStops?.length === 0} -
+
{t.tripIntermediateStops(0)}
{:else}
- + - + {t.tripIntermediateStops(l.intermediateStops?.length ?? 0)} ({formatDurationSec(l.duration)}) -
+
{#each l.intermediateStops! as s} {@render stopTimes(s.arrival!, s.scheduledArrival!, l.realTime, s.name!, s.stopId)} {/each} @@ -153,7 +153,7 @@ {/if} {#if !isLast && !(isLastPred && next!.duration === 0)} -
+
{@render stopTimes( l.endTime!, l.scheduledEndTime!, @@ -172,7 +172,7 @@ {:else if !(isLast && l.duration === 0) && ((i == 0 && l.duration !== 0) || !next || !next.routeShortName || l.mode != 'WALK' || (pred && (pred.mode == 'BIKE' || pred.mode == 'RENTAL')))}
-
+
{@render stopTimes( l.startTime, l.scheduledStartTime, @@ -183,7 +183,7 @@
{@render streetLeg(l)} {#if !isLast} -
+
{@render stopTimes(l.endTime, l.scheduledEndTime, l.realTime, l.to.name, l.to.stopId)}
{/if} @@ -192,7 +192,7 @@ {/each}
-
+
{@render stopTimes( lastLeg!.endTime, lastLeg!.scheduledEndTime, diff --git a/ui/src/lib/SearchMask.svelte b/ui/src/lib/SearchMask.svelte index 15092861e..98dfb678a 100644 --- a/ui/src/lib/SearchMask.svelte +++ b/ui/src/lib/SearchMask.svelte @@ -31,11 +31,11 @@ let toItems = $state>([]); -
+
-
+
{ @@ -275,8 +275,8 @@ {/if} {#if selectedStop} - - + +

{#if stopArriveBy} @@ -296,7 +296,7 @@

-
+
Date: Fri, 17 Jan 2025 14:54:40 +0000 Subject: [PATCH 4/9] ui: i18n fixes --- ui/src/lib/ItineraryList.svelte | 4 ++-- ui/src/lib/StopTimes.svelte | 4 ++-- ui/src/lib/i18n/en.ts | 2 +- ui/src/lib/i18n/fr.ts | 10 +++++----- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/ui/src/lib/ItineraryList.svelte b/ui/src/lib/ItineraryList.svelte index 155ab1dcd..c32956aaf 100644 --- a/ui/src/lib/ItineraryList.svelte +++ b/ui/src/lib/ItineraryList.svelte @@ -78,7 +78,7 @@ }).then((x) => x.data!) ); }} - class="px-2 py-1 bg-blue-600 hover:!bg-blue-700 text-white font-bold text-sm border rounded-lg" + class="px-2 py-1 bg-blue-600 hover:!bg-blue-700 text-white font-bold text-sm border rounded-lg text-nowrap" > {t.earlier} @@ -145,7 +145,7 @@ ) ); }} - class="px-2 py-1 bg-blue-600 hover:!bg-blue-700 text-white text-sm font-bold border rounded-lg" + class="px-2 py-1 bg-blue-600 hover:!bg-blue-700 text-white text-sm font-bold border rounded-lg text-nowrap" > {t.later} diff --git a/ui/src/lib/StopTimes.svelte b/ui/src/lib/StopTimes.svelte index b988524d0..efe80c7b1 100644 --- a/ui/src/lib/StopTimes.svelte +++ b/ui/src/lib/StopTimes.svelte @@ -61,7 +61,7 @@ ) ); }} - class="px-2 py-1 bg-blue-600 hover:!bg-blue-700 text-white font-bold text-sm border rounded-lg" + class="px-2 py-1 bg-blue-600 hover:!bg-blue-700 text-white font-bold text-sm border rounded-lg text-nowrap" > {t.earlier} @@ -108,7 +108,7 @@ ) ); }} - class="px-2 py-1 bg-blue-600 hover:!bg-blue-700 text-white text-sm font-bold border rounded-lg" + class="px-2 py-1 bg-blue-600 hover:!bg-blue-700 text-white text-sm font-bold border rounded-lg text-nowrap" > {t.later} diff --git a/ui/src/lib/i18n/en.ts b/ui/src/lib/i18n/en.ts index 83b78da00..7214b0c8b 100644 --- a/ui/src/lib/i18n/en.ts +++ b/ui/src/lib/i18n/en.ts @@ -30,7 +30,7 @@ const translations: Translations = { case 1: return '1 intermediate stop'; default: - return `${n} intermediate stops`; + return `${n} intermediate stops`; } }, sharingProvider: 'Provider', diff --git a/ui/src/lib/i18n/fr.ts b/ui/src/lib/i18n/fr.ts index 41cdd6087..2ba94e213 100644 --- a/ui/src/lib/i18n/fr.ts +++ b/ui/src/lib/i18n/fr.ts @@ -2,7 +2,7 @@ import type { Translations } from './translation'; const translations: Translations = { journeyDetails: 'Détails du voyage', - walk: 'Marche', + walk: 'à pied', bike: 'Vélo', cargoBike: 'Vélo Cargo', scooterStanding: 'Trottinette', @@ -17,9 +17,9 @@ const translations: Translations = { arrivals: 'Arrivées', later: 'plus tard', earlier: 'plus tôt', - departures: 'Départ', - switchToArrivals: 'Basculer vers les arrivées', - switchToDepartures: 'Basculer vers les départs', + departures: 'Départs', + switchToArrivals: 'Afficher les arrivées', + switchToDepartures: 'Afficher les départs', track: 'Voie', arrivalOnTrack: 'Arrivée sur la voie', tripIntermediateStops: (n: number) => { @@ -33,7 +33,7 @@ const translations: Translations = { } }, sharingProvider: 'Fournisseur', - transfers: 'Transferts', + transfers: 'correspondances', roundtripStationReturnConstraint: 'Le véhicule doit être retourné à la station de départ.' }; From 522a080cd741d9c2d14394188d49d02a7f1c5cc5 Mon Sep 17 00:00:00 2001 From: Traines Date: Fri, 17 Jan 2025 15:02:09 +0000 Subject: [PATCH 5/9] ui: make toggle button state more visible --- ui/src/lib/components/ui/toggle/toggle.svelte | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/src/lib/components/ui/toggle/toggle.svelte b/ui/src/lib/components/ui/toggle/toggle.svelte index 9c76a8600..9f20638fe 100644 --- a/ui/src/lib/components/ui/toggle/toggle.svelte +++ b/ui/src/lib/components/ui/toggle/toggle.svelte @@ -2,7 +2,7 @@ import { type VariantProps, tv } from "tailwind-variants"; export const toggleVariants = tv({ - base: "hover:bg-muted hover:text-muted-foreground focus-visible:ring-ring data-[state=on]:bg-accent data-[state=on]:text-accent-foreground inline-flex items-center justify-center gap-2 rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0", + base: "hover:bg-muted hover:text-muted-foreground focus-visible:ring-ring data-[state=on]:bg-accent data-[state=on]:text-blue-600 inline-flex items-center justify-center gap-2 rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0", variants: { variant: { default: "bg-transparent", From e82df5470c8821819f8dc2f2f55c2cf49187de7b Mon Sep 17 00:00:00 2001 From: Traines Date: Fri, 17 Jan 2025 22:16:32 +0000 Subject: [PATCH 6/9] ui: error handling, avoid repeated effect triggering --- ui/src/lib/ErrorMessage.svelte | 9 ++++++ ui/src/lib/ItineraryList.svelte | 37 +++++++++++++++++++----- ui/src/lib/RailViz.svelte | 12 ++++---- ui/src/lib/StopTimes.svelte | 51 ++++++++++++++++----------------- ui/src/lib/i18n/de.ts | 3 +- ui/src/lib/i18n/en.ts | 3 +- ui/src/lib/i18n/fr.ts | 3 +- ui/src/lib/i18n/translation.ts | 1 + ui/src/lib/map/Map.svelte | 3 +- ui/src/routes/+page.svelte | 5 +++- 10 files changed, 84 insertions(+), 43 deletions(-) create mode 100644 ui/src/lib/ErrorMessage.svelte diff --git a/ui/src/lib/ErrorMessage.svelte b/ui/src/lib/ErrorMessage.svelte new file mode 100644 index 000000000..18c023121 --- /dev/null +++ b/ui/src/lib/ErrorMessage.svelte @@ -0,0 +1,9 @@ + + +
{e}
diff --git a/ui/src/lib/ItineraryList.svelte b/ui/src/lib/ItineraryList.svelte index c32956aaf..af8945994 100644 --- a/ui/src/lib/ItineraryList.svelte +++ b/ui/src/lib/ItineraryList.svelte @@ -1,13 +1,22 @@ {#snippet legSummary(l: Leg)} @@ -73,9 +88,11 @@ routingResponses.splice( 0, 0, - plan({ - query: { ...baseQuery.query, pageCursor: r.previousPageCursor } - }).then((x) => x.data!) + throwOnError( + plan({ + query: { ...baseQuery.query, pageCursor: r.previousPageCursor } + }) + ) ); }} class="px-2 py-1 bg-blue-600 hover:!bg-blue-700 text-white font-bold text-sm border rounded-lg text-nowrap" @@ -140,8 +157,10 @@
{/if} {:catch e} -
Error: {e}
+ {/await} {/each}
+ {:else if r.direct.length === 0} + {/if} + {:catch e} + {/await} {/if} diff --git a/ui/src/lib/RailViz.svelte b/ui/src/lib/RailViz.svelte index a85db2ef9..788cb4534 100644 --- a/ui/src/lib/RailViz.svelte +++ b/ui/src/lib/RailViz.svelte @@ -10,7 +10,7 @@ import { formatTime } from '$lib/toDateTime'; import { lngLatToStr } from '$lib/lngLatToStr'; import maplibregl from 'maplibre-gl'; - import { onDestroy } from 'svelte'; + import { onDestroy, untrack } from 'svelte'; import Control from '$lib/map/Control.svelte'; import { Button } from '$lib/components/ui/button'; import Palette from 'lucide-svelte/icons/palette'; @@ -29,6 +29,7 @@ } = $props(); let colorMode = $state<'rt' | 'route'>('route'); + let railvizError = $state(); type RGBA = [number, number, number, number]; @@ -203,7 +204,6 @@ }); }; - let railvizError = $state(); let animation: number | null = null; const updateRailvizLayer = async () => { try { @@ -272,14 +272,16 @@ map.addControl(overlay); console.log('updateRailviz: init'); - updateRailviz(); + untrack(() => updateRailviz()); } }); $effect(() => { if (overlay && bounds && zoom && colorMode) { - console.log(`updateRailviz: effect ${overlay} ${bounds} ${zoom} ${colorMode}`); - updateRailviz(); + untrack(() => { + console.log(`updateRailviz: effect ${overlay} ${bounds} ${zoom} ${colorMode}`); + updateRailviz(); + }); } }); diff --git a/ui/src/lib/StopTimes.svelte b/ui/src/lib/StopTimes.svelte index efe80c7b1..b45ff3635 100644 --- a/ui/src/lib/StopTimes.svelte +++ b/ui/src/lib/StopTimes.svelte @@ -1,11 +1,13 @@ -
+
{/if} + {:catch e} +
+ +
{/await} {/each}
diff --git a/ui/src/lib/i18n/de.ts b/ui/src/lib/i18n/de.ts index 243917484..12e4f01e5 100644 --- a/ui/src/lib/i18n/de.ts +++ b/ui/src/lib/i18n/de.ts @@ -35,7 +35,8 @@ const translations: Translations = { }, sharingProvider: 'Anbieter', roundtripStationReturnConstraint: - 'Das Fahrzeug muss wieder an der Abfahrtsstation abgestellt werden.' + 'Das Fahrzeug muss wieder an der Abfahrtsstation abgestellt werden.', + noItinerariesFound: 'Keine Verbindungen gefunden.' }; export default translations; diff --git a/ui/src/lib/i18n/en.ts b/ui/src/lib/i18n/en.ts index 7214b0c8b..9d50650ea 100644 --- a/ui/src/lib/i18n/en.ts +++ b/ui/src/lib/i18n/en.ts @@ -34,7 +34,8 @@ const translations: Translations = { } }, sharingProvider: 'Provider', - roundtripStationReturnConstraint: 'The vehicle must be returned to the departure station.' + roundtripStationReturnConstraint: 'The vehicle must be returned to the departure station.', + noItinerariesFound: 'No itineraries found.' }; export default translations; diff --git a/ui/src/lib/i18n/fr.ts b/ui/src/lib/i18n/fr.ts index 2ba94e213..27124c09d 100644 --- a/ui/src/lib/i18n/fr.ts +++ b/ui/src/lib/i18n/fr.ts @@ -34,7 +34,8 @@ const translations: Translations = { }, sharingProvider: 'Fournisseur', transfers: 'correspondances', - roundtripStationReturnConstraint: 'Le véhicule doit être retourné à la station de départ.' + roundtripStationReturnConstraint: 'Le véhicule doit être retourné à la station de départ.', + noItinerariesFound: 'Aucun itinéraire trouvé.' }; export default translations; diff --git a/ui/src/lib/i18n/translation.ts b/ui/src/lib/i18n/translation.ts index 6aa91b58e..d2e220249 100644 --- a/ui/src/lib/i18n/translation.ts +++ b/ui/src/lib/i18n/translation.ts @@ -30,6 +30,7 @@ export type Translations = { tripIntermediateStops: (n: number) => string; sharingProvider: string; roundtripStationReturnConstraint: string; + noItinerariesFound: string; }; const translations: Map = new Map( diff --git a/ui/src/lib/map/Map.svelte b/ui/src/lib/map/Map.svelte index d783c908f..619ae60a9 100644 --- a/ui/src/lib/map/Map.svelte +++ b/ui/src/lib/map/Map.svelte @@ -64,8 +64,9 @@ }); tmp.on('moveend', async () => { - bounds = tmp.getBounds(); zoom = tmp.getZoom(); + currentZoom = zoom; + bounds = tmp.getBounds(); }); return { diff --git a/ui/src/routes/+page.svelte b/ui/src/routes/+page.svelte index 20cfde219..cb8829ba3 100644 --- a/ui/src/routes/+page.svelte +++ b/ui/src/routes/+page.svelte @@ -127,7 +127,10 @@ if (baseQuery) { clearTimeout(searchDebounceTimer); searchDebounceTimer = setTimeout(() => { - const base = plan(baseQuery).then((response) => response.data); + const base = plan(baseQuery).then((response) => { + if (response.error) throw new Error(String(response.error)); + return response.data!; + }); baseResponse = base; routingResponses = [base]; selectedItinerary = undefined; From a97cd0cf3b9fe41f151b278ebbef3e315e41b8da Mon Sep 17 00:00:00 2001 From: Traines Date: Fri, 17 Jan 2025 22:32:37 +0000 Subject: [PATCH 7/9] ui: more small screen adjustments --- ui/src/lib/ConnectionDetail.svelte | 6 +++--- ui/src/lib/ItineraryList.svelte | 2 +- ui/src/lib/RailViz.svelte | 3 ++- ui/src/lib/map/Control.svelte | 2 +- ui/src/routes/+page.svelte | 15 +++++++++------ 5 files changed, 16 insertions(+), 12 deletions(-) diff --git a/ui/src/lib/ConnectionDetail.svelte b/ui/src/lib/ConnectionDetail.svelte index 806fe19de..bb7781197 100644 --- a/ui/src/lib/ConnectionDetail.svelte +++ b/ui/src/lib/ConnectionDetail.svelte @@ -39,7 +39,7 @@
-
+
{l.headsign}
@@ -124,7 +124,7 @@ {t.tripIntermediateStops(0)}
{:else} -
+
+
{#each routingResponses as r, rI} {#await r}
diff --git a/ui/src/lib/RailViz.svelte b/ui/src/lib/RailViz.svelte index 788cb4534..907ec764e 100644 --- a/ui/src/lib/RailViz.svelte +++ b/ui/src/lib/RailViz.svelte @@ -15,6 +15,7 @@ import { Button } from '$lib/components/ui/button'; import Palette from 'lucide-svelte/icons/palette'; import Rss from 'lucide-svelte/icons/rss'; + import { browser } from '$app/environment' let { map, @@ -296,7 +297,7 @@ }); - +
-
+
{#each l.intermediateStops! as s} {@render stopTimes(s.arrival!, s.scheduledArrival!, l.realTime, s.name!, s.stopId)} {/each} @@ -153,7 +161,9 @@ {/if} {#if !isLast && !(isLastPred && next!.duration === 0)} -
+
{@render stopTimes( l.endTime!, l.scheduledEndTime!, @@ -183,7 +193,9 @@
{@render streetLeg(l)} {#if !isLast} -
+
{@render stopTimes(l.endTime, l.scheduledEndTime, l.realTime, l.to.name, l.to.stopId)}
{/if} @@ -191,8 +203,13 @@ {/if} {/each}
-
-
+
+
{@render stopTimes( lastLeg!.endTime, lastLeg!.scheduledEndTime, diff --git a/ui/src/lib/ItineraryList.svelte b/ui/src/lib/ItineraryList.svelte index 1c6d70e1f..bc647acc8 100644 --- a/ui/src/lib/ItineraryList.svelte +++ b/ui/src/lib/ItineraryList.svelte @@ -22,12 +22,12 @@ routingResponses, baseResponse, baseQuery, - selectedItinerary = $bindable() + selectItinerary }: { routingResponses: Array>; baseResponse: Promise | undefined; baseQuery: PlanData | undefined; - selectedItinerary: Itinerary | undefined; + selectItinerary: (it: Itinerary) => void; } = $props(); const throwOnError = (promise: RequestResult) => @@ -65,7 +65,7 @@ { - selectedItinerary = d; + selectItinerary(d); }} /> {/each} @@ -105,7 +105,7 @@ {#each r.itineraries as it}
- { - stopArriveBy = false; - selectedStop = { name, stopId, time }; - }} - {onClickTrip} - /> +
- + {/if} - {#if selectedStop} + {#if page.state.selectedStop}

- {#if stopArriveBy} + {#if page.state.stopArriveBy} {t.arrivals} {:else} {t.departures} {/if} in - {selectedStop.name} + {stopNameFromResponse}

+ onClickStop( + page.state.selectedStop!.name, + page.state.selectedStop!.stopId, + page.state.selectedStop!.time, + arriveBy + )} {onClickTrip} />
From eaa2053ab786af32d835af413f97e280486c50a4 Mon Sep 17 00:00:00 2001 From: Traines Date: Sun, 19 Jan 2025 00:15:14 +0000 Subject: [PATCH 9/9] ui: show backend error msgs, compact transfer display --- ui/package.json | 2 +- ui/src/lib/ConnectionDetail.svelte | 6 +++--- ui/src/lib/ErrorMessage.svelte | 2 +- ui/src/lib/ItineraryList.svelte | 6 +++++- ui/src/lib/i18n/pl.ts | 3 ++- ui/src/routes/+page.svelte | 3 ++- 6 files changed, 14 insertions(+), 8 deletions(-) diff --git a/ui/package.json b/ui/package.json index 9d46afd4c..c75621b5e 100644 --- a/ui/package.json +++ b/ui/package.json @@ -3,7 +3,7 @@ "version": "0.0.1", "private": true, "scripts": { - "dev": "vite dev --host 0.0.0.0 --port 3000", + "dev": "vite dev", "build": "vite build", "preview": "vite preview", "test": "npm run test:integration && npm run test:unit", diff --git a/ui/src/lib/ConnectionDetail.svelte b/ui/src/lib/ConnectionDetail.svelte index 978bd2e62..767cd6450 100644 --- a/ui/src/lib/ConnectionDetail.svelte +++ b/ui/src/lib/ConnectionDetail.svelte @@ -89,8 +89,8 @@
{#if pred && (pred.from.track || pred.duration !== 0)} - -
+ +
{#if pred.from.track} {t.arrivalOnTrack} {pred.from.track}{pred.duration ? ',' : ''} {/if} @@ -102,7 +102,7 @@ {/if}
{/if} - + {#if l.from.track}
{t.track} diff --git a/ui/src/lib/ErrorMessage.svelte b/ui/src/lib/ErrorMessage.svelte index 18c023121..9e3c56c64 100644 --- a/ui/src/lib/ErrorMessage.svelte +++ b/ui/src/lib/ErrorMessage.svelte @@ -6,4 +6,4 @@ } = $props(); -
{e}
+
{e}
diff --git a/ui/src/lib/ItineraryList.svelte b/ui/src/lib/ItineraryList.svelte index bc647acc8..fa9e40853 100644 --- a/ui/src/lib/ItineraryList.svelte +++ b/ui/src/lib/ItineraryList.svelte @@ -32,7 +32,11 @@ const throwOnError = (promise: RequestResult) => promise.then((response) => { - if (response.error) throw new Error(String(response.error)); + console.log(response.error); + if (response.error) + throw new Error( + String((response.error as Record).error ?? response.error) + ); return response.data!; }); diff --git a/ui/src/lib/i18n/pl.ts b/ui/src/lib/i18n/pl.ts index b40395795..fc52016a8 100644 --- a/ui/src/lib/i18n/pl.ts +++ b/ui/src/lib/i18n/pl.ts @@ -34,7 +34,8 @@ const translations: Translations = { } }, sharingProvider: 'Dostawca', - roundtripStationReturnConstraint: 'Pojazd musi zostać zwrócony do stacji początkowej.' + roundtripStationReturnConstraint: 'Pojazd musi zostać zwrócony do stacji początkowej.', + noItinerariesFound: 'No itineraries found.' }; export default translations; diff --git a/ui/src/routes/+page.svelte b/ui/src/routes/+page.svelte index 8823b1544..aa5c8428c 100644 --- a/ui/src/routes/+page.svelte +++ b/ui/src/routes/+page.svelte @@ -224,7 +224,8 @@ const onClickTrip = async (tripId: string, replace: boolean = false) => { const { data: itinerary, error } = await trip({ query: { tripId } }); if (error) { - alert(error); + console.log(error); + alert(String((error as Record).error ?? error)); return; } pushStateWithQueryString({ tripId }, { selectedItinerary: itinerary, tripId: tripId }, replace);