Nicolas Cantu cb7ee0cfd4 Replace nos2x and NostrConnect with Alby authentication
- Remove nos2x and NostrConnect support
- Create new NostrAuthService using Alby (window.nostr NIP-07)
- Replace useNostrConnect with useNostrAuth in all components
- Update NostrRemoteSigner to use Alby for signing
- Delete NostrConnect-related files (nostrconnect.ts, handlers, etc.)
- Update documentation to reflect Alby-only authentication
- Remove NOSTRCONNECT_BRIDGE environment variable
- All TypeScript checks pass
2025-12-27 23:54:34 +01:00

51 lines
1.2 KiB
TypeScript

import { useNostrAuth } from '@/hooks/useNostrAuth'
import { ConnectedUserMenu } from './ConnectedUserMenu'
function ConnectForm({ onConnect, loading, error }: {
onConnect: () => void
loading: boolean
error: string | null
}) {
return (
<div className="flex flex-col gap-2">
<button
onClick={() => {
void onConnect()
}}
disabled={loading}
className="px-6 py-2 bg-neon-cyan/20 hover:bg-neon-cyan/30 text-neon-cyan rounded-lg font-medium transition-all border border-neon-cyan/50 hover:shadow-glow-cyan disabled:opacity-50"
>
{loading ? 'Connecting...' : 'Connect with Nostr'}
</button>
{error && <p className="text-sm text-red-400">{error}</p>}
</div>
)
}
export function ConnectButton() {
const { connected, pubkey, profile, loading, error, connect, disconnect } = useNostrAuth()
if (connected && pubkey) {
return (
<ConnectedUserMenu
pubkey={pubkey}
profile={profile}
onDisconnect={() => {
void disconnect()
}}
loading={loading}
/>
)
}
return (
<ConnectForm
onConnect={() => {
void connect()
}}
loading={loading}
error={error}
/>
)
}