diff --git a/src/components/OnboardingDialog.tsx b/src/components/OnboardingDialog.tsx index 9a754a76..14c6834c 100644 --- a/src/components/OnboardingDialog.tsx +++ b/src/components/OnboardingDialog.tsx @@ -1,5 +1,5 @@ import { Decimal } from 'decimal.js'; -import { useState, useEffect } from 'react'; +import { useState, useEffect, useRef } from 'react'; import { generateSecretKey } from 'nostr-tools'; import { nip19 } from 'nostr-tools'; import { Bot, Check, Sparkles, ArrowRight, ArrowLeft } from 'lucide-react'; @@ -36,6 +36,9 @@ export function OnboardingDialog({ open, onOpenChange }: OnboardingDialogProps) const [showCreditsDialog, setShowCreditsDialog] = useState(false); const [agreedToTerms, setAgreedToTerms] = useState(false); + // Ref for the scrollable content area + const scrollableContentRef = useRef(null); + const { setProvider, addRecentlyUsedModel } = useAISettings(); const { user } = useCurrentUser(); const login = useLoginActions(); @@ -126,10 +129,17 @@ export function OnboardingDialog({ open, onOpenChange }: OnboardingDialogProps) } }, [open]); + // Scroll to top when step changes + useEffect(() => { + if (scrollableContentRef.current) { + scrollableContentRef.current.scrollTop = 0; + } + }, [step]); + return ( <> - + {step === 'open-source' && ( @@ -168,7 +178,7 @@ export function OnboardingDialog({ open, onOpenChange }: OnboardingDialogProps) -
+
{step === 'welcome' && (