import type { Page } from '@/types/nostr'
import { t } from '@/lib/i18n'
import { useNostrAuth } from '@/hooks/useNostrAuth'
import { useEffect, useState } from 'react'
import { objectCache } from '@/lib/objectCache'
interface ArticlePagesProps {
pages: Page[]
articleId: string
}
export function ArticlePages({ pages, articleId }: ArticlePagesProps): React.ReactElement | null {
const { pubkey } = useNostrAuth()
const hasPurchased = useHasPurchasedArticle({ pubkey, articleId })
if (!pages || pages.length === 0) {
return null
}
if (!pubkey || !hasPurchased) {
return
{t('article.pages.locked.title')}
{t('article.pages.locked.message', { count: pagesCount })}