From 4fb2fe683b75464917dec4b1a0aaee63830f3b9a Mon Sep 17 00:00:00 2001 From: Ariel Costas Guerrero Date: Sun, 28 Dec 2025 15:59:32 +0100 Subject: feat: Refactor NavBar and Planner components; update geocoding services - Removed unused Navigation2 icon from NavBar. - Updated usePlanner hook to manage route history and improve local storage handling. - Enhanced PlannerApi with new fare properties and improved itinerary handling. - Added recent routes feature in StopList with navigation to planner. - Implemented NominatimGeocodingService for autocomplete and reverse geocoding. - Updated UI components for better user experience and accessibility. - Added translations for recent routes in multiple languages. - Improved CSS styles for map controls and overall layout. --- src/frontend/app/routes/home.tsx | 74 ++++++++++++++++++++++++++++++++++++++-- 1 file changed, 72 insertions(+), 2 deletions(-) (limited to 'src/frontend/app/routes/home.tsx') diff --git a/src/frontend/app/routes/home.tsx b/src/frontend/app/routes/home.tsx index a20ba64..b20a349 100644 --- a/src/frontend/app/routes/home.tsx +++ b/src/frontend/app/routes/home.tsx @@ -1,7 +1,11 @@ import Fuse from "fuse.js"; +import { History } from "lucide-react"; import { useCallback, useEffect, useMemo, useRef, useState } from "react"; import { useTranslation } from "react-i18next"; +import { useNavigate } from "react-router"; +import { PlannerOverlay } from "~/components/PlannerOverlay"; import { usePageTitle } from "~/contexts/PageTitleContext"; +import { usePlanner } from "~/hooks/usePlanner"; import StopGallery from "../components/StopGallery"; import StopItem from "../components/StopItem"; import StopItemSkeleton from "../components/StopItemSkeleton"; @@ -11,6 +15,8 @@ import "../tailwind-full.css"; export default function StopList() { const { t } = useTranslation(); usePageTitle(t("navbar.stops", "Paradas")); + const navigate = useNavigate(); + const { history, searchRoute, loadRoute } = usePlanner({ autoLoad: false }); const [data, setData] = useState(null); const [loading, setLoading] = useState(true); const [searchResults, setSearchResults] = useState(null); @@ -239,9 +245,73 @@ export default function StopList() { return (
+ {/* Planner Section */} +
+
+ +
+
+ + + {t("planner.where_to", "¿A dónde quieres ir?")} + +
+
+ ↓ +
+
+
+ + { + searchRoute(origin, destination, time, arriveBy); + }} + onNavigateToPlanner={() => navigate("/planner")} + /> +
+ + {history.length > 0 && ( +
+

+ {t("planner.recent_routes", "Rutas recientes")} +

+
+ {history.map((route, idx) => ( + + ))} +
+
+ )} +
+ {/* Search Section */}
-

+

{t("stoplist.search_label", "Buscar paradas")}