From 0112c7152f7688a085e86969960eb62db1fb2397 Mon Sep 17 00:00:00 2001 From: Nicolas Cantu Date: Sat, 27 Dec 2025 23:26:39 +0100 Subject: [PATCH] Update presentation page: show ConnectButton when not connected and user name in form title - Replace 'NotConnected' message with ConnectButton component - Display user name (or shortened pubkey) in form title when connected - Update ConnectButton styling to match dark theme - Improve UX by allowing direct connection from presentation page --- components/AuthorPresentationEditor.tsx | 26 +++++++++++++++++++------ components/ConnectButton.tsx | 4 ++-- components/LanguageSelector.tsx | 1 - 3 files changed, 22 insertions(+), 9 deletions(-) diff --git a/components/AuthorPresentationEditor.tsx b/components/AuthorPresentationEditor.tsx index 3a0bffd..ee5a677 100644 --- a/components/AuthorPresentationEditor.tsx +++ b/components/AuthorPresentationEditor.tsx @@ -3,6 +3,7 @@ import { useNostrConnect } from '@/hooks/useNostrConnect' import { useAuthorPresentation } from '@/hooks/useAuthorPresentation' import { ArticleField } from './ArticleField' import { ArticleFormButtons } from './ArticleFormButtons' +import { ConnectButton } from './ConnectButton' import { t } from '@/lib/i18n' interface AuthorPresentationDraft { @@ -16,9 +17,12 @@ const ADDRESS_PATTERN = /^(1|3|bc1)[a-zA-Z0-9]{25,62}$/ function NotConnected() { return (
-

- {t('presentation.notConnected')} -

+
+

+ {t('presentation.notConnected')} +

+ +
) } @@ -131,6 +135,7 @@ function PresentationForm({ error, loading, handleSubmit, + userName, }: { draft: AuthorPresentationDraft setDraft: (next: AuthorPresentationDraft) => void @@ -138,6 +143,7 @@ function PresentationForm({ error: string | null loading: boolean handleSubmit: (e: React.FormEvent) => Promise + userName: string }) { return (
-

{t('presentation.title')}

+

+ {t('presentation.title')} - {userName} +

{t('presentation.description')}

@@ -189,9 +197,11 @@ function useAuthorPresentationState(pubkey: string | null) { function AuthorPresentationFormView({ pubkey, connected, + profile, }: { pubkey: string | null connected: boolean + profile: { name?: string; pubkey: string } | null }) { const state = useAuthorPresentationState(pubkey) @@ -202,6 +212,9 @@ function AuthorPresentationFormView({ return } + // Get user name or fallback to shortened pubkey + const userName = profile?.name ?? (pubkey ? `${pubkey.substring(0, 16)}...` : 'Utilisateur') + return ( ) } export function AuthorPresentationEditor() { - const { connected, pubkey } = useNostrConnect() - return + const { connected, pubkey, profile } = useNostrConnect() + return } diff --git a/components/ConnectButton.tsx b/components/ConnectButton.tsx index 8f190bc..7ec9871 100644 --- a/components/ConnectButton.tsx +++ b/components/ConnectButton.tsx @@ -13,11 +13,11 @@ function ConnectForm({ onConnect, loading, error }: { void onConnect() }} disabled={loading} - className="px-6 py-2 bg-blue-600 hover:bg-blue-700 text-white rounded-lg font-medium transition-colors disabled:opacity-50" + 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'} - {error &&

{error}

} + {error &&

{error}

}
) } diff --git a/components/LanguageSelector.tsx b/components/LanguageSelector.tsx index 9d5fafe..4fbda83 100644 --- a/components/LanguageSelector.tsx +++ b/components/LanguageSelector.tsx @@ -50,4 +50,3 @@ export function LanguageSelector() { ) } -