"use client"; /** * TempoMapEditor * * Renders a read-only or editable view of a CTP document's sections. * The full interactive editor (drag-to-resize bars, BPM knob, etc.) * is a future milestone — this version is a structured table view * with inline editing stubs. */ import type { CTPDocument, CTPSection } from "@/lib/ctp/schema"; import { isRampSection, sectionStartBpm } from "@/lib/ctp/schema"; interface TempoMapEditorProps { ctpDoc: CTPDocument; /** When true, all inputs are disabled. */ readOnly?: boolean; onChange?: (doc: CTPDocument) => void; } function timeSigLabel(ts: CTPSection["time_signature"]): string { return `${ts.numerator}/${ts.denominator}`; } function bpmLabel(section: CTPSection): string { if (isRampSection(section)) { return `${section.bpm_start} → ${section.bpm_end}`; } return String(section.bpm); } export default function TempoMapEditor({ ctpDoc, readOnly = false, }: TempoMapEditorProps) { const { metadata, count_in, sections } = ctpDoc; return (
{/* Metadata strip */}
Contributed by{" "} {metadata.contributed_by} {metadata.verified && ( ✓ Verified )} CTP v{ctpDoc.version} {metadata.mbid && ( MusicBrainz )}
{/* Count-in */}
Count-in: {count_in.enabled ? `${count_in.bars} bar${count_in.bars !== 1 ? "s" : ""}` : "Disabled"}
{/* Sections table */}
{sections.map((section, i) => ( ))}
Label Start Bar BPM Time Sig Transition
{section.label} {section.start_bar} {bpmLabel(section)} {timeSigLabel(section.time_signature)} {section.transition}
{!readOnly && (

Interactive editor coming soon — contribute via the{" "} community registry {" "} in the meantime.

)}
); }