@@ -15,65 +15,17 @@ import PastProgramsPage from "./pages/PastProgramsPage";
1515import StudentDashboard from "./pages/StudentDashboard" ;
1616import RegistrationForm from "./pages/RegistrationForm" ;
1717import Snowfall from "react-snowfall" ;
18- import Lottie from "lottie-react" ;
19- import { CSSProperties , useState , useEffect } from "react" ;
2018import { Header } from "./components/Header" ;
2119import Footer from "./components/Footer" ;
2220
23-
24- const santaAnimationStyle : CSSProperties = {
25- position : "fixed" ,
26- top : "40%" ,
27- width : "500px" ,
28- height : "500px" ,
29- zIndex : 1 ,
30- pointerEvents : "none" ,
31- animation : "santa-fly 20s linear infinite" ,
32- } ;
33-
34- const santaMirrorAnimationStyle : CSSProperties = {
35- position : "fixed" ,
36- top : "40%" ,
37- width : "500px" ,
38- height : "500px" ,
39- zIndex : 1 ,
40- pointerEvents : "none" ,
41- animation : "santa-fly-mirror 20s linear infinite" , // Ensure the same duration for uniformity
42- } ;
43-
4421function App ( ) {
45- const [ santaAnimationData , setSantaAnimationData ] = useState ( null ) ;
46- const [ isLeftToRight , setIsLeftToRight ] = useState ( true ) ; // State to toggle between animations
47-
48- useEffect ( ( ) => {
49- const fetchAnimation = async ( ) => {
50- try {
51- const response = await fetch (
52- "https://lottie.host/205b9306-eb12-4261-b310-bcbe2d44dfaf/8fIFkoFeKd.json"
53- ) ;
54- const data = await response . json ( ) ;
55- setSantaAnimationData ( data ) ;
56- } catch ( error ) {
57- console . error ( "Error fetching the animation data:" , error ) ;
58- }
59- } ;
60-
61- fetchAnimation ( ) ;
62-
63- const interval = setInterval ( ( ) => {
64- setIsLeftToRight ( ( prev ) => ! prev ) ; // Toggle between left to right and right to left every time
65- } , 20000 ) ; // Change direction every 20 seconds (matching animation duration)
66-
67- return ( ) => clearInterval ( interval ) ; // Cleanup the interval on component unmount
68- } , [ ] ) ;
69-
7022 return (
7123 < div className = "App" >
7224 < BrowserRouter >
7325 < AuthProvider >
7426 < Header />
7527 < Snowfall // the image can be edited into anything we want, feel free to change
76- snowflakeCount = { 150 }
28+ snowflakeCount = { 75 }
7729 speed = { [ 0.5 , 1 ] } // array takes [min, max]
7830 wind = { [ - 0.5 , 0.5 ] }
7931 radius = { [ 2 , 4 ] }
@@ -82,20 +34,9 @@ function App() {
8234 width : "100vw" ,
8335 height : "100vh" ,
8436 opacity : 0.5 ,
37+ zIndex : 0 ,
8538 } }
8639 />
87- { santaAnimationData && (
88- < Lottie
89- animationData = { santaAnimationData }
90- loop = { true }
91- autoplay = { true }
92- style = {
93- ( isLeftToRight
94- ? santaAnimationStyle
95- : santaMirrorAnimationStyle ) as React . CSSProperties
96- }
97- />
98- ) }
9940 < Routes >
10041 < Route index element = { < Home /> } />
10142 < Route
@@ -131,7 +72,7 @@ function App() {
13172 path = { ROUTER_PATHS . PASTPROGRAMS }
13273 element = { < PastProgramsPage /> }
13374 />
134- < Route path = "*" element = { < NotFoundPage /> } />
75+ < Route path = "*" element = { < NotFoundPage /> } />
13576 </ Routes >
13677 < Footer />
13778 </ AuthProvider >
0 commit comments