import React from 'react' function formatDateTime(value) { if (!value) return 'Not set' const date = new Date(value) if (Number.isNaN(date.getTime())) return 'Not set' return new Intl.DateTimeFormat('en', { dateStyle: 'medium', timeStyle: 'short' }).format(date) } function typeLabel(value) { const labels = { seasonal: 'Seasonal', event: 'Event', campaign: 'Campaign', tribute: 'Tribute', } return labels[value] || value || 'Seasonal' } function promotionState(world, state) { if (!world?.is_active_campaign) { return { label: 'Public page only', message: 'This world will live at its own URL, but it is not currently marked as an active campaign for stronger discovery surfaces.', tone: 'slate', } } if (world?.is_homepage_featured && state.label === 'Live') { return { label: 'Homepage spotlight ready', message: 'This campaign is active and flagged for homepage spotlight, so it is eligible for the strongest public placement.', tone: 'emerald', } } if (state.label === 'Live') { return { label: 'Active campaign', message: 'Campaign activation is enabled and the world is currently live across promotion-aware surfaces.', tone: 'emerald', } } return { label: world?.is_homepage_featured ? 'Homepage promotion queued' : 'Campaign promotion queued', message: world?.is_homepage_featured ? 'Homepage spotlight is enabled. Once the campaign goes live, it can occupy the main homepage promotion slot.' : 'Campaign activation is enabled. Once the world goes live, upload and worlds surfaces can prioritize it.', tone: 'sky', } } function workflowState(world) { const now = Date.now() const publishedAt = world?.published_at ? new Date(world.published_at).getTime() : null const startsAt = world?.starts_at ? new Date(world.starts_at).getTime() : null const endsAt = world?.ends_at ? new Date(world.ends_at).getTime() : null if (world?.status === 'archived') { return { label: 'Archived', message: 'This world has ended and is no longer part of the active campaign cycle.', tone: 'amber' } } if (world?.status !== 'published') { return { label: 'Draft', message: 'Editors can keep refining this world before it becomes publicly visible.', tone: 'slate' } } if (publishedAt && publishedAt > now) { return { label: 'Scheduled', message: `This world will publish automatically on ${formatDateTime(world.published_at)}.`, tone: 'sky' } } if (startsAt && startsAt > now) { return { label: 'Scheduled', message: `This world is published and will go live automatically on ${formatDateTime(world.starts_at)}.`, tone: 'sky' } } if (endsAt && endsAt < now) { return { label: 'Ended', message: 'The campaign window has passed. Archive it or create a new edition to continue the lineage.', tone: 'amber' } } return { label: 'Live', message: 'This world is currently active on public surfaces.', tone: 'emerald' } } const tones = { slate: 'border-white/10 bg-white/[0.04] text-slate-100', sky: 'border-sky-300/20 bg-sky-400/10 text-sky-100', emerald: 'border-emerald-300/20 bg-emerald-400/10 text-emerald-100', amber: 'border-amber-300/20 bg-amber-400/10 text-amber-100', } export default function WorldSummaryCard({ world, themeLabel, relationCount, enabledSectionsCount }) { const state = workflowState(world) const promotion = promotionState(world, state) return (
See the world lifecycle, promotion state, and editorial readiness without parsing the whole form.