import type { CuePoint } from '../api' import { cueColor, cueIcon } from '../lib/cues' import { Icon } from '../lib/icons' import { lighten, padStyle } from './HotcueBar' import { RenameField } from './RenameField' interface Props { /** The track's cues; only the memory cues are shown, in time order. */ cues: CuePoint[] /** The deck's CUE point, so the memory cue it sits on reads as selected. */ cuePoint: number onCall: (cue: CuePoint) => void /** Right-click: the deck opens its Rename / Colour / Delete menu. */ onMenu: (cue: CuePoint, x: number, y: number) => void onAdd: () => void /** Why + MEMORY cannot add one (read-only library, the platform's cap), or null. */ addRefusal: string | null /** The memory cue whose name is being edited in place, if any. */ renamingId: string | null onRenameCommit: (cue: CuePoint, name: string) => void onRenameCancel: () => void } /** `m:ss.s` — a chip's label when the cue has no name. */ function shortTime(secs: number): string { const m = Math.floor(secs / 60) const s = secs - m * 60 return `${m}:${s.toFixed(1).padStart(4, '0')}` } /** `m:ss.mmm` — the full position, for the chip's tooltip. */ function fullTime(secs: number): string { const m = Math.floor(secs / 60) const s = secs - m * 60 return `${m}:${s.toFixed(3).padStart(6, '0')}` } const named = (cue: CuePoint) => !!cue.name && cue.name !== 'n.n.' /** * The memory-cue bank: what the hot cue pads become in Memory mode. Memory cues * have no pads, so this is + Memory, then a strip of chips in TIME order, * scrolling sideways when it outgrows the row. * * Clicking a chip CALLS the cue, CDJ-style: the deck jumps there and makes it * the CUE point (a memory loop also engages) — unlike a hot cue pad, it is not * a trigger to perform with. Right-click edits it, as on a pad. */ export function MemoryCueStrip({ cues, cuePoint, onCall, onMenu, onAdd, addRefusal, renamingId, onRenameCommit, onRenameCancel, }: Props) { const memory = cues.filter((c) => c.role === 'memory').sort((a, b) => a.start - b.start) return ( // At least one chip always shows (~6rem): the row's breakpoints fold the // tempo group before the strip gets that narrow.