From 00da3f8722cdf29cd74292daed5521e64a8bc95d Mon Sep 17 00:00:00 2001 From: Akeko Date: Wed, 13 Mar 2024 11:51:22 +0100 Subject: [PATCH] style: update a lot of things --- .../assets/img/map}/pin-ghost.svg | 0 .../img => public/assets/img/map}/pin.svg | 0 client/src/components/map/Map.tsx | 41 +++++++++++++++---- .../src/components/navigation/Navigation.tsx | 6 +-- 4 files changed, 35 insertions(+), 12 deletions(-) rename client/{src/assets/img => public/assets/img/map}/pin-ghost.svg (100%) rename client/{src/assets/img => public/assets/img/map}/pin.svg (100%) diff --git a/client/src/assets/img/pin-ghost.svg b/client/public/assets/img/map/pin-ghost.svg similarity index 100% rename from client/src/assets/img/pin-ghost.svg rename to client/public/assets/img/map/pin-ghost.svg diff --git a/client/src/assets/img/pin.svg b/client/public/assets/img/map/pin.svg similarity index 100% rename from client/src/assets/img/pin.svg rename to client/public/assets/img/map/pin.svg diff --git a/client/src/components/map/Map.tsx b/client/src/components/map/Map.tsx index 30f0659..b39a060 100644 --- a/client/src/components/map/Map.tsx +++ b/client/src/components/map/Map.tsx @@ -22,22 +22,35 @@ const Map = ({ const polylineOptions = { color: "orange", dashArray: "10,25", weight: 3 }; const customIcon = new Icon({ - iconUrl: "/src/assets/img/pin.svg", + iconUrl: "/assets/img/map/pin.svg", iconSize: [40, 40], }); const customIconGhost = new Icon({ - iconUrl: "/src/assets/img/pin-ghost.svg", + iconUrl: "/assets/img/map/pin.svg", iconSize: [40, 40], }); - const geolocalisation = currentStep ? new LatLng(currentStep.geolocalisation.latitude, currentStep.geolocalisation.longitude) : new LatLng(43.282, 5.405); - - const MapRecenter= ({ lat, lng, zoomLevel }: { lat: number; lng: number; zoomLevel: number }) => { + const geolocalisation = currentStep + ? new LatLng( + currentStep.geolocalisation.latitude, + currentStep.geolocalisation.longitude + ) + : new LatLng(43.282, 5.405); + + const MapRecenter = ({ + lat, + lng, + zoomLevel, + }: { + lat: number; + lng: number; + zoomLevel: number; + }) => { const map = useMap(); - + useEffect(() => { - map.flyTo([lat, lng], zoomLevel ); + map.flyTo([lat, lng], zoomLevel); }, [lat, lng]); return null; }; @@ -51,7 +64,11 @@ const Map = ({ scrollWheelZoom={false} attributionControl={false} > - + {steps && @@ -61,7 +78,13 @@ const Map = ({ marker.geolocalisation.latitude, marker.geolocalisation.longitude, ]} - icon={!currentStep ? customIconGhost : (currentStep.etape_numero < marker.etape_numero ? customIconGhost : customIcon)} + icon={ + !currentStep + ? customIconGhost + : currentStep.etape_numero < marker.etape_numero + ? customIconGhost + : customIcon + } key={index} > diff --git a/client/src/components/navigation/Navigation.tsx b/client/src/components/navigation/Navigation.tsx index 2fd130b..1a8614b 100644 --- a/client/src/components/navigation/Navigation.tsx +++ b/client/src/components/navigation/Navigation.tsx @@ -19,7 +19,7 @@ const Navigation = () => { : "" }`} > - +
  • @@ -32,7 +32,7 @@ const Navigation = () => { : "" }`} > - +
  • @@ -45,7 +45,7 @@ const Navigation = () => { : "" }`} > - +