import React from 'react'
import ActiveWorldSpotlight from '../../components/worlds/ActiveWorldSpotlight'

export default function HomeWorldSpotlight({ world }) {
  if (!world) {
    return null
  }

  const spotlight = world.primary || world
  const secondary = Array.isArray(world.secondary) ? world.secondary : []

  return (
    <section className="mt-14 px-4 sm:px-6 lg:px-8">
      <ActiveWorldSpotlight
        spotlight={spotlight}
        secondary={secondary}
        indexUrl={world.index_url || '/worlds'}
        eyebrow="Homepage spotlight"
        secondaryTitle="More live worlds"
        sourceSurface="homepage_spotlight"
        sourceDetail="primary"
        secondarySourceSurface="homepage_worlds_rail"
        secondarySourceDetail="secondary"
      />
    </section>
  )
}