@@ -71,8 +71,17 @@ export function OnboardingFlow({ onComplete, onSkip }: OnboardingProps) {
7171 const [ isVisible , setIsVisible ] = useState ( false )
7272
7373 useEffect ( ( ) => {
74- // Fade in animation
75- setTimeout ( ( ) => setIsVisible ( true ) , 100 )
74+ // Check if user has already seen onboarding
75+ const hasSeenOnboarding = localStorage . getItem ( "lab68dev_has_seen_onboarding" )
76+
77+ if ( ! hasSeenOnboarding ) {
78+ // Fade in animation if they haven't seen it
79+ setTimeout ( ( ) => setIsVisible ( true ) , 100 )
80+ } else {
81+ // Skip automatically if already seen
82+ onSkip ( )
83+ }
84+ // eslint-disable-next-line react-hooks/exhaustive-deps
7685 } , [ ] )
7786
7887 const handleNext = ( ) => {
@@ -90,20 +99,21 @@ export function OnboardingFlow({ onComplete, onSkip }: OnboardingProps) {
9099 }
91100
92101 const handleComplete = ( ) => {
102+ localStorage . setItem ( "lab68dev_has_seen_onboarding" , "true" )
93103 setIsVisible ( false )
94104 setTimeout ( ( ) => onComplete ( ) , 300 )
95105 }
96106
97107 const handleSkipOnboarding = ( ) => {
108+ localStorage . setItem ( "lab68dev_has_seen_onboarding" , "true" )
98109 setIsVisible ( false )
99110 setTimeout ( ( ) => onSkip ( ) , 300 )
100111 }
101112
102113 return (
103114 < div
104- className = { `fixed inset-0 z-50 flex items-center justify-center px-4 transition-opacity duration-300 ${
105- isVisible ? "opacity-100" : "opacity-0"
106- } `}
115+ className = { `fixed inset-0 z-50 flex items-center justify-center px-4 transition-opacity duration-300 ${ isVisible ? "opacity-100" : "opacity-0"
116+ } `}
107117 >
108118 { /* Backdrop */ }
109119 < div className = "absolute inset-0 bg-background/95 backdrop-blur-sm" />
@@ -127,9 +137,8 @@ export function OnboardingFlow({ onComplete, onSkip }: OnboardingProps) {
127137 { steps . map ( ( _ , index ) => (
128138 < div
129139 key = { index }
130- className = { `h-1 flex-1 transition-colors ${
131- index <= currentStep ? "bg-primary" : "bg-border"
132- } `}
140+ className = { `h-1 flex-1 transition-colors ${ index <= currentStep ? "bg-primary" : "bg-border"
141+ } `}
133142 />
134143 ) ) }
135144 </ div >
0 commit comments