diff --git a/CLAUDE.md b/CLAUDE.md
index 9d69ffe..e8276ac 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -438,7 +438,12 @@ Two independent apps that talk over HTTP:
`OverviewWaveform`, which frames the main view's visible range around the
playhead (it takes `secPerView` for exactly that). **Controls**: play, CUE, `LoopControls`, then EITHER
`HotcueBar` OR — in **Grid mode** — `GridEditStrip`, then `TempoControls`
- (±0.01 / ±0.25, ÷2 ×2, tap, lock) and the Grid toggle. Every grid control acts
+ (±0.01 / ±0.25, ÷2 ×2, tap, lock) and the Grid toggle. The row is a
+ **container** and gives way in stages instead of overlapping: each pad
+ queries its own width and drops its name below 4rem (the bank never goes
+ below `PAD_MIN` per pad), then the tempo group folds into `TempoFold`'s
+ portalled popover, then Grid keeps only its icon. The two row breakpoints
+ are measured widths — move them if controls are added to the row. Every grid control acts
on the marker **governing the playhead**, since a beatgrid is a marker list
and there is no separate marker selection; see "Beatgrid" below.
- **One size for loops AND beat jump** (`beatSize`, 1/32–32, persisted as
diff --git a/frontend/src/components/GridControls.tsx b/frontend/src/components/GridControls.tsx
index fa434f0..1b87d26 100644
--- a/frontend/src/components/GridControls.tsx
+++ b/frontend/src/components/GridControls.tsx
@@ -1,4 +1,5 @@
-import { useEffect, useRef, useState } from 'react'
+import { useEffect, useRef, useState, type ReactNode } from 'react'
+import { createPortal } from 'react-dom'
import { askConfirm } from '../lib/confirm'
import { Icon } from '../lib/icons'
import { MIN_TAPS, RESET_MS, TapTempo } from '../lib/tapTempo'
@@ -8,7 +9,8 @@ import { MIN_TAPS, RESET_MS, TapTempo } from '../lib/tapTempo'
// BpmReadout — the header's BPM: shows the governing marker's tempo, and
// is where an exact BPM is typed (click it).
// TempoControls — the everyday tempo tools, always on the control row:
-// nudge ±0.01 / ±0.25, ÷2 ×2, tap tempo, lock.
+// nudge ±0.01 / ±0.25, ÷2 ×2, tap tempo, lock. On a
+// narrow window they fold into TempoFold's popover.
// GridEditStrip — only in Grid mode, in place of the hotcue pads: step
// between markers, nudge the marker ±1 / ±10 ms, add or
// delete a marker, delete the grid, reset it.
@@ -129,6 +131,7 @@ export function TempoControls({
onHalve,
onDouble,
onToggleLock,
+ className = '',
}: {
bpm: number | null
locked: boolean
@@ -143,6 +146,7 @@ export function TempoControls({
onHalve: () => void
onDouble: () => void
onToggleLock: () => void
+ className?: string
}) {
// One run of taps; its reading is shown on the button, so a press that is
// not yet enough to commit still visibly counts.
@@ -169,7 +173,7 @@ export function TempoControls({
const off = bpm == null
const of = flexible ? ` of marker ${markerIndex + 1}` : ''
return (
-
+
@@ -200,6 +204,81 @@ export function TempoControls({
)
}
+/**
+ * TempoControls folded into one button, for a control row too narrow to hold
+ * them beside the pads. The popover holds the same controls rather than a
+ * reduced set, and stays open while you tap — only a click elsewhere, Esc, or
+ * a window resize (which can unfold the row under it) closes it. Portalled,
+ * like every overlay: the deck's panel is a stacking context.
+ */
+export function TempoFold({
+ locked,
+ className = '',
+ children,
+}: {
+ locked: boolean
+ className?: string
+ children: ReactNode
+}) {
+ const [pos, setPos] = useState<{ x: number; y: number } | null>(null)
+ const buttonRef = useRef(null)
+ const popRef = useRef(null)
+ useEffect(() => {
+ if (!pos) return
+ const close = () => setPos(null)
+ const onDown = (e: MouseEvent) => {
+ const t = e.target as Node
+ if (!popRef.current?.contains(t) && !buttonRef.current?.contains(t)) close()
+ }
+ const onKey = (e: KeyboardEvent) => e.key === 'Escape' && close()
+ document.addEventListener('mousedown', onDown)
+ window.addEventListener('keydown', onKey)
+ window.addEventListener('resize', close)
+ return () => {
+ document.removeEventListener('mousedown', onDown)
+ window.removeEventListener('keydown', onKey)
+ window.removeEventListener('resize', close)
+ }
+ }, [pos])
+ const toggle = () => {
+ if (pos) return setPos(null)
+ const r = buttonRef.current!.getBoundingClientRect()
+ // Right-aligned under the button: it sits near the row's right end, so
+ // hanging left keeps the popover on screen.
+ setPos({ x: window.innerWidth - r.right, y: r.bottom + 6 })
+ }
+ return (
+ <>
+
+ {pos &&
+ createPortal(
+
+ {children}
+
,
+ document.body,
+ )}
+ >
+ )
+}
+
/** Grid mode: everything that fixes a grid, in place of the pads. */
export function GridEditStrip({
markerIndex,
diff --git a/frontend/src/components/HotcueBar.tsx b/frontend/src/components/HotcueBar.tsx
index 89de0f6..d4995e4 100644
--- a/frontend/src/components/HotcueBar.tsx
+++ b/frontend/src/components/HotcueBar.tsx
@@ -20,6 +20,10 @@ interface Props {
onRenameCancel: () => void
}
+// The narrowest a pad gets (a letter-only square) and the gap between pads.
+const PAD_MIN = 40
+const PAD_GAP = 6
+
const READONLY_LABELS: Record = {
platform_managed: 'Managed by the DJ app — not editable here',
}
@@ -51,8 +55,13 @@ export function HotcueBar({
return (
// The group takes the row's spare width; each pad is capped, so on a wide
// window the pads keep a pad's proportions and the space is left empty
- // rather than stretching them into bars.
-
+ // rather than stretching them into bars. It never goes below a bank of
+ // PAD_MIN pads: squeezed further, the pads' padding spilled them out of
+ // the group and over the tempo controls.
+
{Array.from({ length: slotCount }, (_, i) => i).map((slot) => {
const cue = cues.find((c) => c.role === 'hotcue' && c.slot === slot) ?? null
// Gate on `editable`, never on why: a platform-owned cue is a read-only
@@ -91,7 +100,11 @@ export function HotcueBar({
}
style={color ? padStyle(color, selected) : undefined}
className={
- 'relative flex h-11 min-w-0 max-w-[7.5rem] flex-1 flex-col items-start justify-center gap-1 rounded-xl px-2.5 text-left transition-[filter,background-color] ' +
+ // Each pad is a container, so it decides for itself when it is
+ // too narrow for a name — under 4rem wide (2.75rem inside its
+ // padding, which is what a container query measures) it is a
+ // letter-only square, whatever the bank size or the rest of the row.
+ '@container relative flex h-11 min-w-0 max-w-[7.5rem] flex-1 flex-col items-start justify-center gap-1 rounded-xl px-2.5 text-left transition-[filter,background-color] ' +
(color
? 'hover:brightness-115'
: // An empty pad gets the same dark ground, so the row reads as
@@ -101,7 +114,7 @@ export function HotcueBar({
}
>
{locked ? : slotLabel(slot)}
@@ -116,7 +129,7 @@ export function HotcueBar({
// A cue without a name shows its type, dimmed, rather than a
// blank line — the pad still says what it holds.
@@ -126,7 +139,7 @@ export function HotcueBar({
{/* The type icon, top right on the number's line — the name below
is free to run the full width. */}
{icon && color && (
-
+
)}
diff --git a/frontend/src/components/PrepStrip.tsx b/frontend/src/components/PrepStrip.tsx
index 85cc221..9f9310d 100644
--- a/frontend/src/components/PrepStrip.tsx
+++ b/frontend/src/components/PrepStrip.tsx
@@ -24,7 +24,7 @@ import { ScratchEngine } from '../lib/scratchEngine'
import { PlaybackEngine } from '../lib/playbackEngine'
import { AutoCueDialog, eventLabel } from './AutoCueDialog'
import { ContextMenu, type MenuItem } from './ContextMenu'
-import { BpmReadout, GridEditStrip, TempoControls } from './GridControls'
+import { BpmReadout, GridEditStrip, TempoControls, TempoFold } from './GridControls'
import { HotcueBar } from './HotcueBar'
import { LoopControls, LOOP_SIZES, type LoopMode } from './LoopControls'
import { MainWaveform, MIN_SEC, MAX_SEC, DEFAULT_SEC } from './MainWaveform'
@@ -1158,6 +1158,20 @@ export function PrepStrip({
}
const DIVIDER =
+ // Rendered twice — inline on a wide row, inside TempoFold on a narrow one.
+ const tempoProps = {
+ bpm: activeMarker?.bpm ?? null,
+ locked: cueData?.grid_locked ?? false,
+ lockable: caps.grid.lockable,
+ flexible: markerCount > 1,
+ markerIndex: activeMarkerIndex,
+ onTapStart: tapStart,
+ onTapBpm: (bpm: number) => commitBpm(bpm, tapAnchorRef.current),
+ onNudgeBpm: nudgeBpm,
+ onHalve: halveBpm,
+ onDouble: doubleBpm,
+ onToggleLock: toggleLock,
+ }
return (
@@ -1311,8 +1325,15 @@ export function PrepStrip({
>
)}
- {/* ---- Controls: transport · loop/jump · pads or grid · tempo ---- */}
-
+ {/* ---- Controls: transport · loop/jump · pads or grid · tempo ----
+ A container, so the row gives way in stages as the window narrows
+ instead of the pads sliding under the tempo group: the pads drop
+ their names first (each pad queries its own width, see HotcueBar),
+ then below 74rem the tempo group folds into one BPM button, and below
+ 60rem the Grid toggle keeps only its icon. Those are the row's
+ measured widths just before the pad bank would hit its minimum (with
+ a lockable grid's extra Lock button), so move them with the controls. */}
+