import { useState } from 'react' import { ArticleCard } from './ArticleCard' import type { Article } from '@/types/nostr' interface UserArticlesProps { articles: Article[] loading: boolean error: string | null onLoadContent: (articleId: string, authorPubkey: string) => Promise
showEmptyMessage?: boolean } export function UserArticles({ articles, loading, error, onLoadContent, showEmptyMessage = true, }: UserArticlesProps) { const [unlockedArticles, setUnlockedArticles] = useState>(new Set()) const handleUnlock = async (article: Article) => { const fullArticle = await onLoadContent(article.id, article.pubkey) if (fullArticle && fullArticle.paid) { setUnlockedArticles((prev) => new Set([...prev, article.id])) } } if (loading) { return (

Loading articles...

) } if (error) { return (

{error}

) } if (articles.length === 0 && showEmptyMessage) { return (

No articles published yet.

) } return (
{articles.map((article) => ( ))}
) }