Skip to content

Commit

Permalink
style: update a lot of things
Browse files Browse the repository at this point in the history
  • Loading branch information
AkekoChan committed Mar 13, 2024
1 parent d98998c commit 00da3f8
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 12 deletions.
File renamed without changes
File renamed without changes
41 changes: 32 additions & 9 deletions client/src/components/map/Map.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};
Expand All @@ -51,7 +64,11 @@ const Map = ({
scrollWheelZoom={false}
attributionControl={false}
>
<MapRecenter lat={geolocalisation.lat} lng={geolocalisation.lng} zoomLevel={12} />
<MapRecenter
lat={geolocalisation.lat}
lng={geolocalisation.lng}
zoomLevel={12}
/>
<TileLayer url="https://tiles.stadiamaps.com/tiles/alidade_smooth/{z}/{x}/{y}{r}.png" />

{steps &&
Expand All @@ -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}
>
<Popup>
Expand Down
6 changes: 3 additions & 3 deletions client/src/components/navigation/Navigation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const Navigation = () => {
: ""
}`}
>
<img src="../../../public/assets/img/icons/user.svg" alt="" />
<img src="/assets/img/icons/user.svg" alt="" />
</NavLink>
</li>
<li className="inline-flex items-center justify-center">
Expand All @@ -32,7 +32,7 @@ const Navigation = () => {
: ""
}`}
>
<img src="../../../public/assets/img/icons/flame.svg" alt="" />
<img src="/assets/img/icons/flame.svg" alt="" />
</NavLink>
</li>
<li className="inline-flex items-center justify-center">
Expand All @@ -45,7 +45,7 @@ const Navigation = () => {
: ""
}`}
>
<img src="../../../public/assets/img/icons/map.svg" alt="" />
<img src="/assets/img/icons/map.svg" alt="" />
</NavLink>
</li>
</ul>
Expand Down

0 comments on commit 00da3f8

Please sign in to comment.