import React from 'react' import WorldStatusBadge from './WorldStatusBadge' import { trackWorldSourceClick, withWorldSource } from '../../lib/worldAnalytics' export default function ChallengeWorldLinkBadge({ world, className = '' }) { if (!world?.public_url || !world?.title) { return null } const badges = Array.isArray(world.status_badges) ? world.status_badges.filter((badge) => badge?.label).slice(0, 3) : [] const metaItems = [ world.campaign_label, world.timeframe_label, Number(world.live_submission_count || 0) > 0 ? `${world.live_submission_count} live submissions` : null, ].filter(Boolean) const worldHref = withWorldSource(world.public_url, 'challenge_page', 'linked_world') return (
Linked world
{badges.length > 0 ?
{badges.map((badge) => )}
: null}

Continue in {world.title}

{world.summary ?

{world.summary}

: null} {metaItems.length > 0 ?
{metaItems.map((item) => {item})}
: null}
trackWorldSourceClick({ worldId: world.id, worldTitle: world.title, sourceSurface: 'challenge_page', sourceDetail: 'linked_world' })} className="inline-flex items-center gap-2 rounded-full bg-white px-4 py-2 text-sm font-semibold text-slate-950 transition hover:bg-sky-100"> Open world {world.challenge_cta_url ? {world.challenge_cta_label || 'Challenge update'} : null}
) }