From f6adaa6777bfc7e1f384bfd90719392e7dba0c49 Mon Sep 17 00:00:00 2001 From: David Abell <79927957+david-abell@users.noreply.github.com> Date: Mon, 22 Apr 2024 14:58:20 +0100 Subject: [PATCH 1/7] fix: reenable board here and set destination stopmarker buttons --- src/components/Map/StopPopup.tsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/components/Map/StopPopup.tsx b/src/components/Map/StopPopup.tsx index 71ff278..434b0c0 100644 --- a/src/components/Map/StopPopup.tsx +++ b/src/components/Map/StopPopup.tsx @@ -144,19 +144,19 @@ function StopPopup({ )}
- {/* */} + - {/* {isValidDestination && ( + {isValidDestination && ( - )} */} + )} + + {!!userLocation && ( + <> + {radius > 100 && ( + + )} + + + )} + + + ); +} + +export default UserLocation; From 71895168dfca9b41b560af4f5687816838830d86 Mon Sep 17 00:00:00 2001 From: David Abell <79927957+david-abell@users.noreply.github.com> Date: Tue, 23 Apr 2024 16:28:35 +0100 Subject: [PATCH 5/7] fix: Location button position when footer visible --- src/components/Map/MapContentLayer.tsx | 4 +++- src/components/Map/UserLocation.tsx | 7 +++++-- src/pages/index.tsx | 5 ++++- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/components/Map/MapContentLayer.tsx b/src/components/Map/MapContentLayer.tsx index 1a9cb95..2cf464d 100644 --- a/src/components/Map/MapContentLayer.tsx +++ b/src/components/Map/MapContentLayer.tsx @@ -55,6 +55,7 @@ type Props = { center: LatLngTuple; routesById: Map; shape: Position[] | undefined; + showFooter: boolean; stopsById: Map; stopTimes: StopTime[] | undefined; stopTimesByStopId: Map; @@ -77,6 +78,7 @@ function MapContentLayer({ stopTimesByStopId, setShowSavedStops, shape, + showFooter, stops, stopsById, selectedStopId, @@ -312,7 +314,7 @@ function MapContentLayer({ {/* User Location dot */} - + {/* Trip line shape */} {!!shape && ( diff --git a/src/components/Map/UserLocation.tsx b/src/components/Map/UserLocation.tsx index aeed352..b6386c1 100644 --- a/src/components/Map/UserLocation.tsx +++ b/src/components/Map/UserLocation.tsx @@ -4,8 +4,11 @@ import { Locate } from "lucide-react"; import LeafletControl from "./LeafletControl"; import { Button } from "../ui/button"; import { LocationEvent } from "leaflet"; +import { cn } from "@/lib/utils"; -function UserLocation() { +type Props = { className?: string }; + +function UserLocation({ className = "" }: Props) { const map = useMap(); const [userLocation, setUserLocation] = useState(null); const [radius, setRadius] = useState(0); @@ -51,7 +54,7 @@ function UserLocation() { } }} size={"icon"} - className="mb-4 mr-2 lg:mb-10 lg:mr-10" + className={cn(className, "mb-4 mr-2 lg:mb-10 lg:mr-10")} > diff --git a/src/pages/index.tsx b/src/pages/index.tsx index 461145d..990d215 100644 --- a/src/pages/index.tsx +++ b/src/pages/index.tsx @@ -278,6 +278,8 @@ export default function Home() { setDestId(null); }; + const showFooter = useMemo(() => !!routeId, [routeId]); + return (
@@ -366,6 +368,7 @@ export default function Home() { selectedDateTime={selectedDateTime} selectedStopId={stopId} selectedDestinationStopId={destId} + showFooter={showFooter} stopTimes={stopTimes} stopTimesByStopId={stopTimesByStopId} setShowSavedStops={setShowSavedStops} @@ -431,7 +434,7 @@ export default function Home() { /> )} - {!!routeId && ( + {!!showFooter && (