@@ -116,7 +116,9 @@ function Mission() {
116116 ( ) => ! getStorage ( MISSION_GUIDE_COMPLETED_KEY )
117117 ) ;
118118
119- const { emblaRef, selectedIndex } = useCarousel ( ) ;
119+ const { emblaRef, selectedIndex, scrollTo } = useCarousel ( ) ;
120+
121+ console . log ( "selectedIndex:" , selectedIndex ) ;
120122
121123 const handleGuideComplete = useCallback ( ( ) => {
122124 setShowGuide ( false ) ;
@@ -194,7 +196,10 @@ function Mission() {
194196 "bg-neutral-600" : filter === type && isSessionStarted ,
195197 } )
196198 ) }
197- onClick = { ( ) => setFilter ( type ) }
199+ onClick = { ( ) => {
200+ setFilter ( type ) ;
201+ scrollTo ( 0 ) ;
202+ } }
198203 >
199204 { getFilterLabels ( recommendations , filter ) [ type ] }
200205 </ button >
@@ -224,13 +229,15 @@ function Mission() {
224229 filteredRecommendations . map ( ( mission , index ) => (
225230 < div
226231 key = { mission . missionId }
227- className = "flex-[0_0_80vw] flex items-center justify-center"
228- style = { {
229- transform :
230- index === selectedIndex ? "scale(1)" : "scale(0.9)" ,
231- opacity : index === selectedIndex ? 1 : 0.5 ,
232- transition : "transform 0.3s ease" ,
233- } }
232+ className = { cn (
233+ "flex-[0_0_80vw] flex items-center justify-center transition-transform duration-300 ease-in-out" ,
234+ index === selectedIndex
235+ ? "scale-100 opacity-100"
236+ : "scale-90 opacity-50"
237+ ) }
238+ data-selected = { index === selectedIndex }
239+ data-index = { index }
240+ data-selected-index = { selectedIndex }
234241 >
235242 < MissionGridCard
236243 { ...createMissionCardProps ( mission ) }
0 commit comments