From 3d42d93ef1fba92fe828d9345bc084c7ab536095 Mon Sep 17 00:00:00 2001 From: Mary Kate Fain Date: Sun, 21 Sep 2025 19:05:40 -0500 Subject: [PATCH] Fix 'I already have an account' button to properly open login dialog - Add onLogin prop to SimpleSignupDialog interface - Connect handleLoginClick to onLogin callback - Update LoginArea and NostrSettings to handle signup->login transition - Now clicking 'I already have an account' properly closes signup and opens login - All tests passing --- src/components/auth/LoginArea.tsx | 4 ++++ src/components/auth/SimpleSignupDialog.tsx | 10 ++++++---- src/pages/NostrSettings.tsx | 4 ++++ 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/components/auth/LoginArea.tsx b/src/components/auth/LoginArea.tsx index 1bd7c128..2a102f5b 100644 --- a/src/components/auth/LoginArea.tsx +++ b/src/components/auth/LoginArea.tsx @@ -98,6 +98,10 @@ export function LoginArea({ className }: LoginAreaProps) { setSignupDialogOpen(false)} + onLogin={() => { + setSignupDialogOpen(false); + setLoginDialogOpen(true); + }} /> ); diff --git a/src/components/auth/SimpleSignupDialog.tsx b/src/components/auth/SimpleSignupDialog.tsx index 12f792be..916c6fff 100644 --- a/src/components/auth/SimpleSignupDialog.tsx +++ b/src/components/auth/SimpleSignupDialog.tsx @@ -14,12 +14,14 @@ interface SimpleSignupDialogProps { isOpen: boolean; onClose: () => void; onComplete?: () => void; + onLogin?: () => void; } const SimpleSignupDialog: React.FC = ({ isOpen, onClose, - onComplete + onComplete, + onLogin }) => { const [step, setStep] = useState('key'); const [isLoading, setIsLoading] = useState(false); @@ -120,9 +122,9 @@ const SimpleSignupDialog: React.FC = ({ const handleLoginClick = () => { onClose(); - // This would typically open the login modal - // Since we don't have direct access to the login modal state here, - // we'll rely on the parent component to handle this + if (onLogin) { + onLogin(); + } }; if (step === 'key') { diff --git a/src/pages/NostrSettings.tsx b/src/pages/NostrSettings.tsx index 9996b9c5..cf8112a9 100644 --- a/src/pages/NostrSettings.tsx +++ b/src/pages/NostrSettings.tsx @@ -222,6 +222,10 @@ export function NostrSettings() { isOpen={showSignupDialog} onClose={() => setShowSignupDialog(false)} onComplete={handleSignupComplete} + onLogin={() => { + setShowSignupDialog(false); + setShowLoginDialog(true); + }} /> );