From 695c7a65a1e9ab3b95beeaf02a1e3b10bb16996b Mon Sep 17 00:00:00 2001 From: Copilot <198982749+Copilot@users.noreply.github.com> Date: Tue, 24 Mar 2026 20:32:17 +0100 Subject: feat: client-side trip tracking with browser notifications (#151) Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: arielcostas <94913521+arielcostas@users.noreply.github.com> --- .../app/components/arrivals/ArrivalCard.tsx | 43 ++++++- .../app/components/arrivals/ArrivalList.tsx | 11 +- .../app/components/journey/ActiveJourneyBanner.tsx | 136 +++++++++++++++++++++ src/frontend/app/components/layout/AppShell.tsx | 6 + 4 files changed, 193 insertions(+), 3 deletions(-) create mode 100644 src/frontend/app/components/journey/ActiveJourneyBanner.tsx (limited to 'src/frontend/app/components') diff --git a/src/frontend/app/components/arrivals/ArrivalCard.tsx b/src/frontend/app/components/arrivals/ArrivalCard.tsx index bdd20a5..9c68a97 100644 --- a/src/frontend/app/components/arrivals/ArrivalCard.tsx +++ b/src/frontend/app/components/arrivals/ArrivalCard.tsx @@ -1,4 +1,4 @@ -import { AlertTriangle, BusFront, LocateIcon } from "lucide-react"; +import { AlertTriangle, BusFront, LocateIcon, Navigation } from "lucide-react"; import React, { useEffect, useMemo, useRef, useState } from "react"; import Marquee from "react-fast-marquee"; import { useTranslation } from "react-i18next"; @@ -9,6 +9,8 @@ import "./ArrivalCard.css"; interface ArrivalCardProps { arrival: Arrival; onClick?: () => void; + onTrack?: () => void; + isTracked?: boolean; } const AutoMarquee = ({ text }: { text: string }) => { @@ -57,6 +59,8 @@ const AutoMarquee = ({ text }: { text: string }) => { export const ArrivalCard: React.FC = ({ arrival, onClick, + onTrack, + isTracked = false, }) => { const { t } = useTranslation(); const { @@ -287,6 +291,43 @@ export const ArrivalCard: React.FC = ({ ); })} + + {onTrack && estimate.precision !== "past" && ( + // Use a instead of a + + ); +} diff --git a/src/frontend/app/components/layout/AppShell.tsx b/src/frontend/app/components/layout/AppShell.tsx index 50f5742..6bb5e34 100644 --- a/src/frontend/app/components/layout/AppShell.tsx +++ b/src/frontend/app/components/layout/AppShell.tsx @@ -4,6 +4,8 @@ import { PageTitleProvider, usePageTitleContext, } from "~/contexts/PageTitleContext"; +import { ActiveJourneyBanner } from "~/components/journey/ActiveJourneyBanner"; +import { useJourneyTracker } from "~/hooks/useJourneyTracker"; import { ThemeColorManager } from "../ThemeColorManager"; import "./AppShell.css"; import { Drawer } from "./Drawer"; @@ -15,6 +17,9 @@ const AppShellContent: React.FC = () => { const [isDrawerOpen, setIsDrawerOpen] = useState(false); const location = useLocation(); + // Mount journey tracker at shell level so tracking persists across navigation + useJourneyTracker(); + return (
@@ -29,6 +34,7 @@ const AppShellContent: React.FC = () => {
+ -- cgit v1.3