@@ -22,8 +22,10 @@ import Tracks from "./(TracksSectionComponents)/TracksTabNavigation/Tracks";
2222import { Track } from "@/src/util/dataTypes" ;
2323
2424import LivePoll from "./(AboutSectionComponents)/LivePoll" ;
25+ import { ReadonlyRequestCookies } from "next/dist/server/web/spec-extension/adapters/request-cookies" ;
26+ import { actionSetTracksAnimation } from "@/src/util/actions/animation" ;
2527
26- const TracksSection = ( ) => {
28+ const TracksSection = ( { noTrackAnimation } : { noTrackAnimation : boolean } ) => {
2729 const panelMargin = "mt-12 md:mt-16" ;
2830
2931 // tracks contains all relevant information about each of the 6 tracks
@@ -34,13 +36,10 @@ const TracksSection = () => {
3436 const selectedTrackRef = useRef < HTMLDivElement | null > ( null ) ;
3537 const livePollRef = useRef < HTMLDivElement | null > ( null ) ;
3638
37- const [ noAnimation , setNoAnimation ] = useState < boolean > (
38- sessionStorage . getItem ( "hackathonTracksShown" ) !== null ,
39- ) ;
4039 const [ startAnimation , setStartAnimation ] = useState ( false ) ;
4140
4241 useEffect ( ( ) => {
43- if ( noAnimation ) {
42+ if ( noTrackAnimation ) {
4443 return ;
4544 }
4645
@@ -129,13 +128,12 @@ const TracksSection = () => {
129128 duration : 0.3 ,
130129 opacity : 1 ,
131130 onComplete : ( ) => {
132- // set session storage to prevent animation from playing again
133- sessionStorage . setItem ( "hackathonTracksShown" , "true" ) ;
134- setNoAnimation ( true ) ;
131+ // set cookies storage to prevent animation from playing again
132+ actionSetTracksAnimation ( ) ;
135133 } ,
136134 } ) ;
137135 }
138- } , [ showTracks , noAnimation ] ) ;
136+ } , [ showTracks , noTrackAnimation ] ) ;
139137
140138 return (
141139 < Panel id = "tracksPanel" className = { panelMargin } panelColor = "white" >
@@ -149,7 +147,7 @@ const TracksSection = () => {
149147 </ PanelHeader >
150148
151149 < div ref = { panelContentRef } >
152- { ! noAnimation && (
150+ { ! noTrackAnimation && (
153151 < PanelContent
154152 parentPanelId = "tracksPanel"
155153 className = "relative flex flex-col items-center"
0 commit comments