diff --git a/src/components/auth/LoginArea.tsx b/src/components/auth/LoginArea.tsx index b7aacb53..1bd7c128 100644 --- a/src/components/auth/LoginArea.tsx +++ b/src/components/auth/LoginArea.tsx @@ -70,13 +70,6 @@ export function LoginArea({ className }: LoginAreaProps) { {t('help')} - setLoginDialogOpen(true)} - className='flex items-center gap-2 cursor-pointer p-2 rounded-md' - > - - {t('logIn')} - setSignupDialogOpen(true)} className='flex items-center gap-2 cursor-pointer p-2 rounded-md' @@ -84,6 +77,13 @@ export function LoginArea({ className }: LoginAreaProps) { {t('signUp')} + setLoginDialogOpen(true)} + className='flex items-center gap-2 cursor-pointer p-2 rounded-md' + > + + {t('logIn')} + )} diff --git a/src/components/auth/SimpleLoginDialog.tsx b/src/components/auth/SimpleLoginDialog.tsx index bd5bc00a..9b272307 100644 --- a/src/components/auth/SimpleLoginDialog.tsx +++ b/src/components/auth/SimpleLoginDialog.tsx @@ -1,13 +1,13 @@ import React, { useState, useEffect } from 'react'; -import { Shield, Key, Cloud, AlertTriangle } from 'lucide-react'; +import { Key, Cloud } from 'lucide-react'; import { Button } from '@/components/ui/button'; import { Input } from '@/components/ui/input'; import { Dialog, DialogContent, DialogHeader, DialogTitle } from "@/components/ui/dialog"; -import { Alert, AlertDescription } from '@/components/ui/alert'; +// Alert components removed as they're not used in the simplified design import { useLoginActions } from '@/hooks/useLoginActions'; import { cn } from '@/lib/utils'; -type Step = 'extension' | 'key-add'; +// Only using key-add step now interface SimpleLoginDialogProps { isOpen: boolean; @@ -24,13 +24,13 @@ const validateBunkerUri = (uri: string) => { return uri.startsWith('bunker://'); }; -const SimpleLoginDialog: React.FC = ({ - isOpen, - onClose, - onLogin, - onSignup +const SimpleLoginDialog: React.FC = ({ + isOpen, + onClose, + onLogin, + onSignup }) => { - const [step, setStep] = useState('extension'); + // Removed step state - we only have one step now const [isLoading, setIsLoading] = useState(false); const [nsec, setNsec] = useState(''); const [bunkerUri, setBunkerUri] = useState(''); @@ -40,13 +40,12 @@ const SimpleLoginDialog: React.FC = ({ bunker?: string; extension?: string; }>({}); - + const login = useLoginActions(); // Reset state when dialog opens/closes useEffect(() => { if (isOpen) { - setStep(window.nostr ? 'extension' : 'key-add'); setIsLoading(false); setNsec(''); setBunkerUri(''); @@ -139,82 +138,19 @@ const SimpleLoginDialog: React.FC = ({ } }; - if (step === 'extension') { - return ( - - - - Log in - - - - - Welcome to Shakespeare - - - - - - - {errors.extension && ( - - - {errors.extension} - - )} - - - - {isLoading ? 'Logging in...' : 'Log in with extension'} - - - - - - - - or - - - - setStep('key-add')} - className="w-full" - > - - Log in with key - - - - New on Shakespeare? - - Sign Up - - - - - - - ); - } - return ( - Import Key + Log in - + + + Welcome back to Shakespeare + Sign in to your existing account + + @@ -226,8 +162,8 @@ const SimpleLoginDialog: React.FC = ({ onClick={() => setActiveTab('nsec')} className={cn( "flex-1 px-3 py-2 text-sm font-medium rounded-md transition-colors", - activeTab === 'nsec' - ? "bg-background text-foreground shadow-sm" + activeTab === 'nsec' + ? "bg-background text-foreground shadow-sm" : "text-muted-foreground hover:text-foreground" )} > @@ -237,8 +173,8 @@ const SimpleLoginDialog: React.FC = ({ onClick={() => setActiveTab('bunker')} className={cn( "flex-1 px-3 py-2 text-sm font-medium rounded-md transition-colors", - activeTab === 'bunker' - ? "bg-background text-foreground shadow-sm" + activeTab === 'bunker' + ? "bg-background text-foreground shadow-sm" : "text-muted-foreground hover:text-foreground" )} > @@ -313,21 +249,29 @@ const SimpleLoginDialog: React.FC = ({ - {/* Extension indicator */} - - - {window.nostr ? ( - + + Sign in with browser extension - ) : ( - 'Browser extension not found.' - )} - + + + )} + + + New to Shakespeare? + + Create Account + diff --git a/src/components/auth/SimpleSignupDialog.tsx b/src/components/auth/SimpleSignupDialog.tsx index 78d48f60..12f792be 100644 --- a/src/components/auth/SimpleSignupDialog.tsx +++ b/src/components/auth/SimpleSignupDialog.tsx @@ -1,5 +1,5 @@ import React, { useState, useEffect, useMemo } from 'react'; -import { Key, Download, UserPlus, Shield } from 'lucide-react'; +import { Key, Download, UserPlus } from 'lucide-react'; import { Button } from '@/components/ui/button'; import { Input } from '@/components/ui/input'; import { Dialog, DialogContent, DialogHeader, DialogTitle } from "@/components/ui/dialog"; @@ -8,7 +8,7 @@ import { useLoginActions } from '@/hooks/useLoginActions'; import { generateSecretKey, nip19 } from 'nostr-tools'; import { cn } from '@/lib/utils'; -type Step = 'extension' | 'key' | 'keygen'; +type Step = 'key' | 'keygen'; interface SimpleSignupDialogProps { isOpen: boolean; @@ -16,15 +16,15 @@ interface SimpleSignupDialogProps { onComplete?: () => void; } -const SimpleSignupDialog: React.FC = ({ - isOpen, - onClose, - onComplete +const SimpleSignupDialog: React.FC = ({ + isOpen, + onClose, + onComplete }) => { const [step, setStep] = useState('key'); const [isLoading, setIsLoading] = useState(false); const [downloaded, setDownloaded] = useState(false); - + const login = useLoginActions(); // Generate key once and keep it stable @@ -34,7 +34,8 @@ const SimpleSignupDialog: React.FC = ({ // Reset state when dialog opens/closes useEffect(() => { if (isOpen) { - setStep(window.nostr ? 'extension' : 'key'); + // Always start with key generation as the default experience + setStep('key'); setIsLoading(false); setDownloaded(false); } @@ -96,10 +97,10 @@ const SimpleSignupDialog: React.FC = ({ setIsLoading(true); try { login.nsec(nsec); - + // Mark signup completion time for fallback welcome modal localStorage.setItem('signup_completed', Date.now().toString()); - + onClose(); if (onComplete) { setTimeout(() => { @@ -124,66 +125,6 @@ const SimpleSignupDialog: React.FC = ({ // we'll rely on the parent component to handle this }; - if (step === 'extension') { - return ( - - - - Sign up - - - - - Welcome to Shakespeare - - - - - - - - - {isLoading ? 'Signing up...' : 'Sign up with extension'} - - - - - - - - or - - - - setStep('key')} - className="w-full" - > - Don't have an extension? - - - - New on Shakespeare? - - Sign Up - - - - - - - ); - } - if (step === 'key') { return ( @@ -191,10 +132,11 @@ const SimpleSignupDialog: React.FC = ({ Sign up - + - You need a key to continue + Welcome to Shakespeare + Create your account to get started @@ -202,49 +144,49 @@ const SimpleSignupDialog: React.FC = ({ - setStep('keygen')} className="w-full" > - Generate key + Create New Account - - I already have a key + I already have an account - - - - - - or - - + {/* Extension indicator - only show if extension is detected */} + {window.nostr && ( + <> + + + + + + or + + - {/* Extension indicator */} - - - {window.nostr ? ( - - Sign up with browser extension - - ) : ( - 'Browser extension not found.' - )} - - + + + + Sign up with browser extension + + + + > + )} @@ -257,7 +199,7 @@ const SimpleSignupDialog: React.FC = ({ Your new key - + @@ -276,15 +218,15 @@ const SimpleSignupDialog: React.FC = ({ - Back up your secret key in a secure place. If lost, your account cannot be recovered. + Back up your secret key in a secure place. If lost, your account cannot be recovered. Never share your secret key with anyone. -
Sign in to your existing account
- {window.nostr ? ( - + + Sign in with browser extension - ) : ( - 'Browser extension not found.' - )} - +
+ Sign in with browser extension - ) : ( - 'Browser extension not found.' - )} -
Create your account to get started
- {window.nostr ? ( - - Sign up with browser extension - - ) : ( - 'Browser extension not found.' - )} -
+ + Sign up with browser extension + +
- Back up your secret key in a secure place. If lost, your account cannot be recovered. + Back up your secret key in a secure place. If lost, your account cannot be recovered. Never share your secret key with anyone.