import type { Article } from '@/types/nostr'
import { AuthorCard } from './AuthorCard'
import { ErrorState, EmptyState, Skeleton } from './ui'
import { t } from '@/lib/i18n'
interface AuthorsListProps {
authors: Article[]
allAuthors: Article[]
loading: boolean
error: string | null
}
function AuthorCardSkeleton(): React.ReactElement {
return (
)
}
function LoadingState(): React.ReactElement {
return (
{Array.from({ length: 4 }).map((_, index) => (
))}
)
}
function AuthorsEmptyState({ hasAny }: { hasAny: boolean }): React.ReactElement {
return (
)
}
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) => (
))}
>
)
}