From 5e9f1094a50bbcdd514e958dcd67d0f0a844589d Mon Sep 17 00:00:00 2001
From: Ariel Costas Guerrero <ariel@costas.dev>
Date: Fri, 12 Dec 2025 20:30:44 +0100
Subject: feat: implement favourites management, add recent places
 functionality, and enhance planner features

---
 src/frontend/app/routes/planner.tsx | 28 +++++++++++++++++++++++++++-
 1 file changed, 27 insertions(+), 1 deletion(-)

(limited to 'src/frontend/app/routes/planner.tsx')

diff --git a/src/frontend/app/routes/planner.tsx b/src/frontend/app/routes/planner.tsx
index 5121dce..55d1553 100644
--- a/src/frontend/app/routes/planner.tsx
+++ b/src/frontend/app/routes/planner.tsx
@@ -754,6 +754,8 @@ export default function PlannerPage() {
     selectedItineraryIndex,
     selectItinerary,
     deselectItinerary,
+    setOrigin,
+    setDestination,
   } = usePlanner();
   const [selectedItinerary, setSelectedItinerary] = useState<Itinerary | null>(
     null
@@ -839,7 +841,31 @@ export default function PlannerPage() {
                 </p>
               )}
             </div>
-            <button onClick={clearRoute} className="text-sm text-red-500">
+            <button
+              onClick={() => {
+                clearRoute();
+                setDestination(null);
+                if (navigator.geolocation) {
+                  navigator.geolocation.getCurrentPosition(
+                    async (pos) => {
+                      const initial = {
+                        name: t("planner.current_location"),
+                        label: "GPS",
+                        lat: pos.coords.latitude,
+                        lon: pos.coords.longitude,
+                        layer: "current-location",
+                      } as any;
+                      setOrigin(initial);
+                    },
+                    () => {
+                      // If geolocation fails, just keep origin empty
+                    },
+                    { enableHighAccuracy: true, timeout: 10000 }
+                  );
+                }
+              }}
+              className="text-sm text-red-500"
+            >
               {t("planner.clear")}
             </button>
           </div>
-- 
cgit v1.3

