import type { CreateSeriesModalProps } from './createSeriesModal/createSeriesModalTypes'
import { CreateSeriesModalView } from './createSeriesModal/CreateSeriesModalView'
import { useCreateSeriesModalController } from './createSeriesModal/useCreateSeriesModalController'

export function CreateSeriesModal({ isOpen, onClose, onSuccess, authorPubkey }: CreateSeriesModalProps): React.ReactElement | null {
  const ctrl = useCreateSeriesModalController({ authorPubkey, onClose, onSuccess, isOpen })
  if (!isOpen) {
    return null
  }
  return <CreateSeriesModalView ctrl={ctrl} />
}
