diff options
| author | Ariel Costas Guerrero <ariel@costas.dev> | 2025-12-12 20:30:44 +0100 |
|---|---|---|
| committer | Ariel Costas Guerrero <ariel@costas.dev> | 2025-12-12 20:30:44 +0100 |
| commit | 5e9f1094a50bbcdd514e958dcd67d0f0a844589d (patch) | |
| tree | 6df6dd2f589d18d60df33b82456305b04c6b8688 /src/frontend/app/routes/planner.tsx | |
| parent | c3363ee0e3808d826c4e4797ffa7207647435e08 (diff) | |
feat: implement favourites management, add recent places functionality, and enhance planner features
Diffstat (limited to 'src/frontend/app/routes/planner.tsx')
| -rw-r--r-- | src/frontend/app/routes/planner.tsx | 28 |
1 files changed, 27 insertions, 1 deletions
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> |
