import { useUserArticlesController } from './controller'
import { UserArticlesLayout } from './layout'
import type { UserArticlesProps } from './types'

export function UserArticles(props: UserArticlesProps): React.ReactElement {
  const controller = useUserArticlesController({ articles: props.articles, onLoadContent: props.onLoadContent, currentPubkey: props.currentPubkey })
  return (
    <UserArticlesLayout
      controller={controller}
      loading={props.loading}
      error={props.error}
      showEmptyMessage={props.showEmptyMessage ?? true}
      currentPubkey={props.currentPubkey}
      onSelectSeries={props.onSelectSeries}
    />
  )
}
