import React, { useDeferredValue, useEffect, useMemo, useRef, useState } from 'react' import { Head, Link, router, useForm } from '@inertiajs/react' import AdminLayout from '../../../Layouts/AdminLayout' import RichTextEditor from '../../../components/forum/RichTextEditor' import WorldMediaUploadField from '../../../components/worlds/editor/WorldMediaUploadField' import DateTimePicker from '../../../components/ui/DateTimePicker' import NovaSelect from '../../../components/ui/NovaSelect' const COURSE_EDITOR_TABS = [ { id: 'overview', label: 'Overview', description: 'Title, slug, positioning, and the short summary shown on course cards.', icon: 'fa-compass-drafting', sections: ['course-identity'], }, { id: 'content', label: 'Content', description: 'Use the richer WYSIWYG surface for the main course description and learning pitch.', icon: 'fa-pen-nib', sections: ['course-description'], }, { id: 'media', label: 'Media', description: 'Upload and tune the cover and teaser visuals used across the public course surfaces.', icon: 'fa-images', sections: ['course-media'], }, { id: 'lessons', label: 'Lessons', description: 'Build the lesson sequence, drag to reorder, and add or remove lessons without opening the full builder.', icon: 'fa-list-ol', sections: ['course-lessons-manager'], }, { id: 'publish', label: 'Publish', description: 'Control access, status, ordering, scheduling, and featured placement.', icon: 'fa-rocket-launch', sections: ['course-publishing', 'course-seo'], }, { id: 'preview', label: 'Preview', description: 'Scan the public-facing course card, media, and rendered long description before publishing.', icon: 'fa-eye', sections: ['course-preview'], }, ] const COURSE_FIELD_TAB_MAP = { title: 'overview', slug: 'overview', subtitle: 'overview', excerpt: 'overview', description: 'content', cover_image: 'media', teaser_image: 'media', access_level: 'publish', difficulty: 'publish', status: 'publish', order_num: 'publish', estimated_minutes: 'publish', published_at: 'publish', is_featured: 'publish', seo_title: 'publish', seo_description: 'publish', meta_keywords: 'publish', og_title: 'publish', og_description: 'publish', og_image: 'publish', } function getField(fields, name) { return fields.find((field) => field.name === name) || null } function FieldError({ message }) { if (!message) return null return

{message}

} function SectionCard({ id, eyebrow, title, description, actions, children, tone = 'default', className = '', contentClassName = '' }) { const toneClass = tone === 'feature' ? 'bg-[radial-gradient(circle_at_top_left,rgba(56,189,248,0.16),transparent_38%),linear-gradient(180deg,rgba(15,23,42,0.96),rgba(2,6,23,0.92))] shadow-[0_24px_70px_rgba(2,6,23,0.28)]' : 'bg-white/[0.03]' return (
{eyebrow ?

{eyebrow}

: null}

{title}

{description ?

{description}

: null}
{actions ?
{actions}
: null}
{children}
) } function EditorWorkspaceTabs({ tabs, activeTab, onChange, errorCounts }) { const activeMeta = tabs.find((tab) => tab.id === activeTab) || tabs[0] return (
{tabs.map((tab) => { const isActive = tab.id === activeTab const errorCount = Number(errorCounts?.[tab.id] || 0) return ( ) })}

{activeMeta.description}

{activeMeta.sections.map((section) => ( {section.replace('course-', '').replace(/-/g, ' ')} ))}
) } function TextField({ label, value, onChange, error, hint, ...rest }) { return ( ) } function TextAreaField({ label, value, onChange, error, rows = 4, hint }) { return (