This commit is contained in:
Antoine M 2024-03-13 17:50:47 +01:00
parent b4e364948e
commit 1763c1105a

View File

@ -1,46 +1,37 @@
import "./assets/css/App.scss";
import Welcome from "./pages/Welcome.jsx";
import Home from "./pages/Home.jsx";
import Single from "./pages/Single.jsx";
import Profile from "./pages/Profile.jsx";
import Country from "./pages/Country.jsx";
import Results from "./pages/Results.jsx";
import Test from "./pages/Test.jsx";
import { v4 as uuidv4 } from "uuid";
import Game from "./pages/Game.jsx";
import Rating from "./pages/Rating.jsx";
import Lottie from "lottie-react";
import About from "./pages/About.jsx";
import ConditionsOfUse from "./pages/ConditionsOfUse.jsx";
import Cookies from "./pages/Cookies.jsx";
import Confidentiality from "./pages/Confidentiality.jsx";
import { useLocation, Routes, Route } from "react-router-dom";
import { AnimatePresence } from "framer-motion";
import cloudPageTransition from "./assets/animations/transition-nuages-pages";
import React, { useEffect, useRef } from "react";
function App() {
const location = useLocation();
const playerRef = useRef(Lottie);
// const playerRef = useRef(Lottie);
const playAnimation = () => {
playerRef.current.goToAndPlay(0);
};
// const playAnimation = () => {
// playerRef.current.goToAndPlay(0);
// };
useEffect(() => {
playAnimation();
}, [location]);
// useEffect(() => {
// playAnimation();
// }, [location]);
return (
<>
{/* <button onClick={playAnimation}>qsdqsd</button> */}
<Lottie
lottieRef={playerRef}
className='test-load-animation'
animationData={cloudPageTransition}
speed={21}
// loop={false}
loop={false}
autoplay
/>
<AnimatePresence mode='wait'>
<Routes location={location} key={location.pathname}>
@ -51,6 +42,10 @@ function App() {
<Route path='/play' element={<Game />} />
<Route path='/results' element={<Results />} />
<Route path='/rating' element={<Rating />} />
<Route path='/about' element={<About />} />
<Route path='/conditions' element={<ConditionsOfUse />} />
<Route path='/cookies' element={<Cookies />} />
<Route path='/confidentiality' element={<Confidentiality />} />
<Route path='/test' element={<Test />} />
</Routes>
</AnimatePresence>