" or just use profile name
let authorName = presentation.title.replace(/^Présentation de /, '').trim()
if (!authorName || authorName === 'Présentation') {
authorName = profile?.name || 'Auteur'
}
// Extract picture from presentation (bannerUrl or from JSON metadata) or profile
const picture = presentation.bannerUrl || profile?.picture
return (
{picture ? (
) : (
{authorName.charAt(0).toUpperCase()}
)}
{authorName}
)
}
export function ConditionalPublishButton() {
const { connected, pubkey, profile } = useNostrAuth()
const { checkPresentationExists } = useAuthorPresentation(pubkey ?? null)
const [presentation, setPresentation] = useState(null)
useEffect(() => {
const check = async () => {
if (!connected || !pubkey) {
setPresentation(null)
return
}
// Check for presentation asynchronously, but don't show loading state
const pres = await checkPresentationExists()
setPresentation(pres)
}
void check()
}, [connected, pubkey, checkPresentationExists])
if (!connected || !pubkey) {
return
}
// If presentation exists, show author profile link with image/fallback
if (presentation) {
return
}
// Otherwise, show create author page button immediately (no loading state)
return
}