import type { Article } from '@/types/nostr'
import { AuthorCard } from './AuthorCard'
import { t } from '@/lib/i18n'
interface AuthorsListProps {
authors: Article[]
allAuthors: Article[]
loading: boolean
error: string | null
}
function LoadingState(): React.ReactElement {
return (
{t('common.loading.authors')}
)
}
function ErrorState({ message }: { message: string }): React.ReactElement {
return (
)
}
function EmptyState({ hasAny }: { hasAny: boolean }): React.ReactElement {
return (
{hasAny ? t('common.empty.authors.filtered') : t('common.empty.authors')}
)
}
export function AuthorsList({ authors, allAuthors, loading, error }: AuthorsListProps): React.ReactElement {
if (loading) {
return
}
if (error) {
return
}
if (authors.length === 0) {
return 0} />
}
return (
<>
Showing {authors.length} of {allAuthors.length} author{allAuthors.length !== 1 ? 's' : ''}
{authors.map((author) => (
))}
>
)
}