Skip to content

Commit

Permalink
ui: show backend error msgs, compact transfer display
Browse files Browse the repository at this point in the history
  • Loading branch information
traines-source committed Jan 19, 2025
1 parent 636154f commit eaa2053
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 8 deletions.
2 changes: 1 addition & 1 deletion ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
6 changes: 3 additions & 3 deletions ui/src/lib/ConnectionDetail.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,8 @@
<div class="w-full flex justify-between items-center space-x-1">
<Route {onClickTrip} {l} />
{#if pred && (pred.from.track || pred.duration !== 0)}
<div class="border-t w-full h-0"></div>
<div class="text-sm text-muted-foreground text-nowrap px-2">
<div class="border-t h-0 grow shrink"></div>
<div class="text-sm text-muted-foreground leading-none px-2">
{#if pred.from.track}
{t.arrivalOnTrack} {pred.from.track}{pred.duration ? ',' : ''}
{/if}
Expand All @@ -102,7 +102,7 @@
{/if}
</div>
{/if}
<div class="border-t w-full h-0"></div>
<div class="border-t h-0 grow shrink"></div>
{#if l.from.track}
<div class="text-nowrap border rounded-xl px-2">
{t.track}
Expand Down
2 changes: 1 addition & 1 deletion ui/src/lib/ErrorMessage.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
} = $props();
</script>

<div class="m-4 text-red-600">{e}</div>
<div class="m-4 text-red-600"><div class="min-w-0">{e}</div></div>
6 changes: 5 additions & 1 deletion ui/src/lib/ItineraryList.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,11 @@
const throwOnError = (promise: RequestResult<PlanResponse, PlanError, false>) =>
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<string, unknown>).error ?? response.error)
);
return response.data!;
});
</script>
Expand Down
3 changes: 2 additions & 1 deletion ui/src/lib/i18n/pl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
3 changes: 2 additions & 1 deletion ui/src/routes/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -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<string, unknown>).error ?? error));
return;
}
pushStateWithQueryString({ tripId }, { selectedItinerary: itinerary, tripId: tripId }, replace);
Expand Down

0 comments on commit eaa2053

Please sign in to comment.