diff --git a/web/pages/onboarding/index.tsx b/web/pages/onboarding/index.tsx index b3d1411..51ab678 100644 --- a/web/pages/onboarding/index.tsx +++ b/web/pages/onboarding/index.tsx @@ -1,4 +1,4 @@ -import {useState} from 'react' +import {useEffect, useState} from 'react' import {Col} from 'web/components/layout/col' import Router from 'next/router' import {Button} from 'web/components/buttons/button' @@ -32,6 +32,17 @@ function OnboardingScreen({ welcomeTitle }: OnboardingScreenProps) { const t = useT() + const [showWelcome, setShowWelcome] = useState(!!welcomeTitle) + + useEffect(() => { + if (welcomeTitle) { + const timer = setTimeout(() => { + setShowWelcome(false) + }, 3000) + return () => clearTimeout(timer) + } + }, [welcomeTitle]) + return ( {onBack && ( @@ -45,14 +56,9 @@ function OnboardingScreen({ )} - {welcomeTitle && ( -

- {welcomeTitle} -

- )} - -

- {title} +

+ {showWelcome && welcomeTitle ? welcomeTitle : title}

@@ -184,10 +190,12 @@ export default function OnboardingPage() { const [currentStep, setCurrentStep] = useState(0) const handleNext = () => { + window.scrollTo(0, 0) setCurrentStep(currentStep + 1) } const handleBack = () => { + window.scrollTo(0, 0) setCurrentStep(currentStep - 1) }