"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 = { enabled: false, bars: 2, use_first_section_tempo: true }, sections, } = ctpDoc; return (
| Label | Start Bar | BPM | Time Sig | Transition |
|---|---|---|---|---|
| {section.label} | {section.start_bar} | {bpmLabel(section)} | {timeSigLabel(section.time_signature)} | {section.transition} |
Interactive editor coming soon — contribute via the{" "} community registry {" "} in the meantime.
)}