aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorcopilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>2026-03-01 09:50:14 +0000
committercopilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>2026-03-01 09:50:14 +0000
commit2da4fb594f1433ddd1a26e267bbc7e917145b3b5 (patch)
tree9af73c1ff6128643c48216dd75a7ffa58cd98d2a /src
parentdc7fc11085773a030bc9109e8c435a62a3567051 (diff)
Polish selected-stop realtime display in route details
Co-authored-by: arielcostas <94913521+arielcostas@users.noreply.github.com>
Diffstat (limited to 'src')
-rw-r--r--src/frontend/app/routes/routes-$id.tsx7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/frontend/app/routes/routes-$id.tsx b/src/frontend/app/routes/routes-$id.tsx
index 79997b5..d563cdc 100644
--- a/src/frontend/app/routes/routes-$id.tsx
+++ b/src/frontend/app/routes/routes-$id.tsx
@@ -56,10 +56,13 @@ export default function RouteDetailsPage() {
() => formatDateKey(selectedWeekDate),
[selectedWeekDate]
);
+ const ONE_HOUR_SECONDS = 3600;
const isTodaySelectedDate = selectedDateKey === formatDateKey(new Date());
const now = new Date();
const nowSeconds =
now.getHours() * 3600 + now.getMinutes() * 60 + now.getSeconds();
+ const formatDelayMinutes = (delayMinutes: number) =>
+ ` (${delayMinutes > 0 ? "+" : ""}${delayMinutes})`;
const { data: route, isLoading } = useQuery({
queryKey: ["route", id, selectedDateKey],
@@ -597,7 +600,7 @@ export default function RouteDetailsPage() {
.get(stop.id)
?.filter((item) =>
isTodaySelectedDate
- ? item.departure >= nowSeconds - 3600
+ ? item.departure >= nowSeconds - ONE_HOUR_SECONDS
: true
) ?? []
).map((item, i) => (
@@ -640,7 +643,7 @@ export default function RouteDetailsPage() {
>
{arrival.estimate.minutes}′
{arrival.delay?.minutes
- ? ` (${arrival.delay.minutes > 0 ? "+" : ""}${arrival.delay.minutes})`
+ ? formatDelayMinutes(arrival.delay.minutes)
: ""}
</span>
)