diff --git a/src/components/auth/LoginDialog.tsx b/src/components/auth/LoginDialog.tsx index 3f3398f..3f81221 100644 --- a/src/components/auth/LoginDialog.tsx +++ b/src/components/auth/LoginDialog.tsx @@ -3,7 +3,7 @@ import React, { useCallback, useEffect, useRef, useState } from 'react'; import { QRCodeSVG } from 'qrcode.react'; -import { Shield, Upload, AlertTriangle, UserPlus, KeyRound, Sparkles, Loader2, Copy, Check, ChevronDown, ChevronUp, Link } from 'lucide-react'; +import { Shield, Upload, AlertTriangle, UserPlus, KeyRound, Sparkles, Loader2, Copy, Check, ChevronDown, ChevronUp, Link, ExternalLink } from 'lucide-react'; import { Button } from '@/components/ui/button'; import { Input } from '@/components/ui/input'; import { Dialog, DialogContent, DialogHeader, DialogDescription } from "@/components/ui/dialog"; @@ -15,6 +15,7 @@ import { generateNostrConnectURI, type NostrConnectParams, } from '@/hooks/useLoginActions'; +import { useIsMobile } from '@/hooks/useIsMobile'; import { cn } from '@/lib/utils'; interface LoginDialogProps { @@ -53,6 +54,8 @@ const LoginDialog: React.FC = ({ isOpen, onClose, onLogin, onS const abortControllerRef = useRef(null); const login = useLoginActions(); + // Check if on mobile device + const isMobile = useIsMobile(); // Check if extension is available const hasExtension = 'nostr' in window; @@ -128,6 +131,13 @@ const LoginDialog: React.FC = ({ isOpen, onClose, onLogin, onS setTimeout(() => setCopied(false), 2000); }; + // Open the nostrconnect URI in the system - this will launch a signer app like Amber if installed + const handleOpenSignerApp = () => { + if (!nostrConnectUri) return; + // On mobile, this will trigger the system to find an app that handles nostrconnect:// URIs + window.location.href = nostrConnectUri; + }; + const handleExtensionLogin = async () => { setIsLoading(true); setErrors(prev => ({ ...prev, extension: undefined })); @@ -356,15 +366,17 @@ const LoginDialog: React.FC = ({ isOpen, onClose, onLogin, onS ) : nostrConnectUri ? ( <> - {/* QR Code */} -
- -
+ {/* QR Code - only show on desktop */} + {!isMobile && ( +
+ +
+ )} {/* Status message */}
@@ -374,15 +386,26 @@ const LoginDialog: React.FC = ({ isOpen, onClose, onLogin, onS Waiting for connection... ) : ( - Scan with your signer app + {isMobile ? 'Open your signer app to connect' : 'Scan with your signer app'} )}
+ {/* Open Signer App button - primary action on mobile */} + {isMobile && ( + + )} + {/* Copy button */}