import React, { useEffect, useRef } from 'react' import { usePage } from '@inertiajs/react' import SeoHead from '../../components/seo/SeoHead' import WorldArchiveNotice from '../../components/worlds/WorldArchiveNotice' import WorldChallengeEntriesRail from '../../components/worlds/WorldChallengeEntriesRail' import WorldChallengeFinalistsGrid from '../../components/worlds/WorldChallengeFinalistsGrid' import WorldChallengePanel from '../../components/worlds/WorldChallengePanel' import WorldChallengeWinnersPanel from '../../components/worlds/WorldChallengeWinnersPanel' import WorldHero from '../../components/worlds/WorldHero' import WorldCommunitySubmissionsSection from '../../components/worlds/WorldCommunitySubmissionsSection' import WorldRecapArticleCard from '../../components/worlds/WorldRecapArticleCard' import WorldRecapCommunityHighlights from '../../components/worlds/WorldRecapCommunityHighlights' import WorldRecapCreatorsPanel from '../../components/worlds/WorldRecapCreatorsPanel' import WorldRecapFeaturedArtworks from '../../components/worlds/WorldRecapFeaturedArtworks' import WorldRecapHero from '../../components/worlds/WorldRecapHero' import WorldRecapStatsGrid from '../../components/worlds/WorldRecapStatsGrid' import WorldRecapSummaryCard from '../../components/worlds/WorldRecapSummaryCard' import WorldSection from '../../components/worlds/WorldSection' import WorldCard from '../../components/worlds/WorldCard' import WorldFamilyCard from '../../components/worlds/WorldFamilyCard' import { resolveWorldLandingSource, trackWorldAnalytics, trackWorldSourceClick, withWorldSource } from '../../lib/worldAnalytics' function SupportingRail({ title, description, items, sourceDetail = 'navigation_rail' }) { if (!Array.isArray(items) || items.length === 0) { return null } return (

{title}

{description ?

{description}

: null}
{items.map((item) => )}
) } function EditionNavigation({ previousEdition, nextEdition }) { if (!previousEdition && !nextEdition) { return null } return (

Edition Navigation

Move through adjacent editions in this recurring world family without losing the archive context.

previousEdition && trackWorldSourceClick({ worldId: previousEdition.id, worldTitle: previousEdition.title, sourceSurface: 'navigation', sourceDetail: 'previous_edition' })} className={`rounded-[24px] border border-white/10 bg-black/20 p-4 ${previousEdition ? 'text-white hover:bg-white/[0.06]' : 'pointer-events-none text-slate-500'}`}>
Previous edition
{previousEdition?.title || 'No earlier edition'}
{previousEdition?.edition_year ?
{previousEdition.edition_year}
: null}
nextEdition && trackWorldSourceClick({ worldId: nextEdition.id, worldTitle: nextEdition.title, sourceSurface: 'navigation', sourceDetail: 'next_edition' })} className={`rounded-[24px] border border-white/10 bg-black/20 p-4 ${nextEdition ? 'text-white hover:bg-white/[0.06]' : 'pointer-events-none text-slate-500'}`}>
Next edition
{nextEdition?.title || 'No newer archive edition'}
{nextEdition?.edition_year ?
{nextEdition.edition_year}
: null}
) } function RewardedContributors({ section, world }) { const items = Array.isArray(section?.items) ? section.items : [] const counts = section?.counts || {} const summaryChips = [ section?.creator_count ? `${section.creator_count} rewarded creators` : null, world?.live_submission_count ? `${world.live_submission_count} live submissions` : null, world?.featured_submission_count ? `${world.featured_submission_count} featured artworks` : null, ].filter(Boolean) const rewardTypeChips = [ counts.winner ? `${counts.winner} winner${counts.winner === 1 ? '' : 's'}` : null, counts.finalist ? `${counts.finalist} finalist${counts.finalist === 1 ? '' : 's'}` : null, counts.spotlight ? `${counts.spotlight} spotlight` : null, counts.featured ? `${counts.featured} featured` : null, counts.participant ? `${counts.participant} participant` : null, ].filter(Boolean) if (items.length === 0) { return null } return (

Rewarded Contributors

Creators who earned visible recognition in this edition. Live participation builds history here, while featured and editorial selections raise the level of recognition.

{summaryChips.length > 0 || rewardTypeChips.length > 0 || world?.cta_url ? (
{summaryChips.length > 0 ? (
{summaryChips.map((item) => ( {item} ))}
) : null} {rewardTypeChips.length > 0 ? (
{rewardTypeChips.map((item) => ( {item} ))}
) : null} {world?.cta_url ? (
{world.cta_label || 'Join this world'}
) : null}
) : null}

This edition’s rewards are edition-aware, so recognition here remains part of each creator’s recurring world history.

{items.map((item) => (
{item.creator?.avatar_url ? {item.creator.username :
}
{item.creator?.name || item.creator?.username || 'Creator'}
{item.badge_label}
{item.artwork?.title ?
{item.artwork.title}
: null}
))}
) } export default function WorldShow() { const { props } = usePage() const world = props.world const recap = props.recap || null const sections = Array.isArray(props.sections) ? props.sections : [] const linkedChallenge = props.linkedChallenge || null const linkedChallengeEntries = props.linkedChallengeEntries || null const linkedChallengeWinners = props.linkedChallengeWinners || null const linkedChallengeFinalists = props.linkedChallengeFinalists || null const communitySubmissions = props.communitySubmissions || null const rewardedContributors = props.rewardedContributors || null const previewMode = Boolean(props.previewMode) const archiveNotice = props.archiveNotice || null const familySummary = props.familySummary || null const currentEdition = props.currentEdition || null const previousEdition = props.previousEdition || null const nextEdition = props.nextEdition || null const archiveTitle = currentEdition ? 'Previous Editions' : 'Archive Editions' const archiveDescription = currentEdition ? 'Earlier editions remain public so the recurring family keeps its full history accessible.' : 'Past iterations remain accessible so recurring worlds can build continuity over time.' const rootRef = useRef(null) useEffect(() => { if (previewMode || !world?.id) { return } const landing = resolveWorldLandingSource() trackWorldAnalytics('world_viewed', { world_id: world.id, source_surface: landing.sourceSurface, source_detail: landing.sourceDetail, }) }, [previewMode, world?.id]) useEffect(() => { if (previewMode || !world?.id || !rootRef.current) { return } const landing = resolveWorldLandingSource() const container = rootRef.current const clickHandler = (event) => { const target = event.target.closest('[data-world-event], [data-world-section-key]') if (!target || !container.contains(target)) { return } const sectionKey = target.dataset.worldSectionKey || '' const challengeId = Number(target.dataset.worldChallengeId || 0) const entityId = Number(target.dataset.worldEntityId || 0) const payload = { world_id: world.id, source_surface: landing.sourceSurface, source_detail: landing.sourceDetail, ...(sectionKey ? { section_key: sectionKey } : {}), ...(target.dataset.worldCtaKey ? { cta_key: target.dataset.worldCtaKey } : {}), ...(target.dataset.worldEntityType ? { entity_type: target.dataset.worldEntityType } : {}), ...(entityId > 0 ? { entity_id: entityId } : {}), ...(target.dataset.worldEntityTitle ? { entity_title: target.dataset.worldEntityTitle } : {}), ...(challengeId > 0 ? { challenge_id: challengeId } : {}), } if (sectionKey) { trackWorldAnalytics('world_section_clicked', payload) } if (target.dataset.worldEvent) { trackWorldAnalytics(target.dataset.worldEvent, payload) } } container.addEventListener('click', clickHandler) return () => { container.removeEventListener('click', clickHandler) } }, [previewMode, world?.id]) return (
{previewMode ? (
Studio preview
You are viewing the editorial preview version of this world before or alongside public release.
{world?.public_url ? Open canonical page : null}
) : null} {recap ? : } {recap ? ( <> ) : } {familySummary ? (

Recurring Family

Each edition stays public, but the family route always resolves to the canonical current or latest edition.

) : null} {sections.length > 0 ? sections.map((section) => ) : null} {recap ? : } {recap ? : } {currentEdition ? ( ) : null}
) }