import Link from 'next/link'
import { SeriesSection } from './SeriesSection'

interface ProfileSeriesBlockProps {
  currentPubkey: string
  onSelectSeries: (seriesId: string | undefined) => void
  selectedSeriesId?: string | undefined
}

export function ProfileSeriesBlock({ currentPubkey, onSelectSeries, selectedSeriesId }: ProfileSeriesBlockProps) {
  return (
    <div className="mb-6">
      <h3 className="text-lg font-semibold mb-2">Séries</h3>
      <SeriesSection
        authorPubkey={currentPubkey}
        onSelect={onSelectSeries}
        {...(selectedSeriesId ? { selectedId: selectedSeriesId } : {})}
      />
      {selectedSeriesId && (
        <div className="mt-2 text-sm text-blue-600">
          <Link href={`/series/${selectedSeriesId}`} className="underline">
            Ouvrir la page de la série sélectionnée
          </Link>
        </div>
      )}
    </div>
  )
}
