diff --git a/client/src/components/flami/FlamiShow.tsx b/client/src/components/flami/FlamiShow.tsx index 06db6ac..c6a7a7e 100644 --- a/client/src/components/flami/FlamiShow.tsx +++ b/client/src/components/flami/FlamiShow.tsx @@ -9,11 +9,11 @@ const FlamiShow = ({ flami }: { flami: FlamiData }) => { useEffect(() => { setCurrentAnimation("Jump"); - setCurrentKeptAnimation("Atchoum"); + setCurrentKeptAnimation("Jump"); setTimeout(() => { setCurrentAnimation("Idle"); setCurrentKeptAnimation("Idle"); - }, 3200); + }, 1300); }, [setCurrentAnimation]); return ( diff --git a/client/src/components/map/Map.tsx b/client/src/components/map/Map.tsx index 154a260..d315a41 100644 --- a/client/src/components/map/Map.tsx +++ b/client/src/components/map/Map.tsx @@ -8,12 +8,13 @@ import { } from "react-leaflet"; import { Icon, LatLng } from "leaflet"; import { Step } from "../../interfaces/step.interface"; -import { useEffect } from "react"; +import { useEffect, useState } from "react"; import { Button } from "../ui"; import { APIHandler } from "../../utils/api/api-handler"; import { useAuth } from "../../hooks/useAuth"; import toast from "react-hot-toast"; import { GenericResponse } from "../../interfaces/api-response/generic-response"; +import { SearchIcon } from "react-line-awesome"; const Map = ({ currentStep, @@ -41,12 +42,11 @@ const Map = ({ iconSize: [40, 40], }); - const geolocalisation = currentStep - ? new LatLng( - currentStep.geolocalisation.latitude, - currentStep.geolocalisation.longitude - ) - : new LatLng(43.282, 5.405); + const [geolocalisation, setGeolocation] = useState(new LatLng(43.282, 5.405)); + + useEffect(() => { + if(currentStep) setGeolocation(new LatLng(currentStep.geolocalisation.latitude, currentStep.geolocalisation.longitude)) + }, [currentStep, setGeolocation]) const MapRecenter = ({ lat, @@ -66,7 +66,17 @@ const Map = ({ }; return ( -
+
+ { currentStep ? () : null } + { flamiPosition ? () : null } + {steps && @@ -112,8 +123,8 @@ const Map = ({ }, }); })}>Récupérer le badge - ) : null - } + ) : null + } ))} diff --git a/client/src/pages/flami/CosmeticPage.tsx b/client/src/pages/flami/CosmeticPage.tsx index 7fa9705..2808b4b 100644 --- a/client/src/pages/flami/CosmeticPage.tsx +++ b/client/src/pages/flami/CosmeticPage.tsx @@ -42,6 +42,8 @@ const CosmeticPage = () => { }); }, [token]); + const [currentAnimation, setCurrentAnimation] = useState("Idle"); + const changeCosmetic = useCallback( (id: string, category: string) => { if ( @@ -77,11 +79,15 @@ const CosmeticPage = () => { token ).then((res) => { setFlami(res.data.my_flami); + setCurrentAnimation("Atchoum"); + setTimeout(() => { + setCurrentAnimation("Idle"); + }, 1); }); } } }, - [token, flami] + [token, flami, setCurrentAnimation] ); const selectIconDisplay = useCallback(() => { @@ -144,7 +150,9 @@ const CosmeticPage = () => { return (
- {flami ? : null} + {flami ? ( + + ) : null}