Improved cue/grid button switch layout and style

This commit is contained in:
patben8 committed 2026-10-22 11:48:00 +02:00
1 parent 667068c2f1
commit 5d059c7604
3 files changed
+30 -31

No files matched your search

+5 -4
View File
@@ -1333,13 +1333,14 @@ 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
(where `cues.memory_cues`) the **Hot / Mem** switch (`ModeSwitch`, the same component as BEAT / MAN), then
`HotcueBar`, `MemoryCueStrip` (Mem) OR — in **Grid mode** — `GridEditStrip`, then `TempoControls`
(±0.01 / ±0.25, ÷2 ×2, tap, lock) and the Grid toggle. The row is a
`HotcueBar`, `MemoryCueStrip` (Mem) OR — in **Grid mode** — `GridEditStrip`, then the
**CUES / GRID** switch (also a `ModeSwitch`) and `TempoControls`
(±0.01 / ±0.25, ÷2 ×2, tap, lock). A two-option `ModeSwitch` flips on a
click anywhere on it. 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
portalled popover. That breakpoint is a measured width — 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
+6 -2
View File
@@ -8,27 +8,31 @@ export function ModeSwitch<T extends string>({
label,
value,
options,
disabled = false,
onChange,
}: {
/** Names the group for assistive tech ("Loop mode", "Cue bank"). */
label: string
value: T
options: { value: T; text: string; title: string }[]
disabled?: boolean
onChange: (value: T) => void
}) {
const other = options.length === 2 ? options.find((o) => o.value !== value) : undefined
const other =
options.length === 2 && !disabled ? options.find((o) => o.value !== value) : undefined
return (
<div
role="group"
aria-label={label}
onClick={other ? () => onChange(other.value) : undefined}
className={`well ${other ? 'cursor-pointer ' : ''}flex h-10 shrink-0 flex-col justify-center gap-0.5 rounded-[10px] p-0.5`}
className={`well ${other ? 'cursor-pointer ' : ''}${disabled ? 'opacity-40 ' : ''}flex h-10 shrink-0 flex-col justify-center gap-0.5 rounded-[10px] p-0.5`}
>
{options.map((o) => (
<button
key={o.value}
onClick={other ? undefined : () => onChange(o.value)}
title={o.title}
disabled={disabled}
aria-pressed={value === o.value}
className={`h-[17px] rounded-[7px] px-[7px] text-[9px] font-bold tracking-[0.08em] transition-colors ${
value === o.value ? 'btn-primary' : 'text-faint hover:text-text'
+19 -25
View File
@@ -1625,11 +1625,10 @@ export function PrepStrip({
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 77rem the tempo group folds into one BPM button, and below
63rem 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, and the Hot / Mem toggle's
~3rem with its gap), so move them with the controls. */}
then below 77rem the tempo group folds into one BPM button. That is
the row's measured width just before the pad bank would hit its
minimum (with a lockable grid's extra Lock button, and the Hot / Mem
toggle's ~3rem with its gap), so move it with the controls. */}
<div className="@container flex h-11 shrink-0 items-center gap-3">
<button
onClick={toggle}
@@ -1752,31 +1751,26 @@ export function PrepStrip({
/>
)}
{DIVIDER}
<TempoControls {...tempoProps} className="@max-[77rem]:hidden" />
<TempoFold locked={tempoProps.locked} className="hidden @max-[77rem]:flex">
<TempoControls {...tempoProps} />
</TempoFold>
<button
onClick={() => {
setGridMode((g) => !g)
<ModeSwitch
label="Deck mode"
value={gridMode ? 'grid' : 'cues'}
options={[
{ value: 'cues', text: 'CUES', title: 'Cues: the hotcue pads or memory cues' },
{ value: 'grid', text: 'GRID', title: 'Edit the beatgrid: markers, phase, reset' },
]}
disabled={!track}
onChange={(m) => {
setGridMode(m === 'grid')
setPadMenu(null)
setRenamingSlot(null)
setMemoryMenu(null)
setRenamingMemory(null)
}}
aria-pressed={gridMode}
disabled={!track}
title={gridMode ? 'Back to the hotcue pads' : 'Edit the beatgrid: markers, phase, reset'}
aria-label="Grid"
className={`flex h-10 shrink-0 items-center gap-1.5 rounded-xl px-3 text-xs font-semibold transition-colors disabled:opacity-40 @max-[63rem]:w-10 @max-[63rem]:justify-center @max-[63rem]:px-0 ${
gridMode
? 'bg-gold/15 text-gold shadow-[inset_0_0_0_1px_rgb(255_200_97/0.5),0_0_16px_-4px_rgb(255_200_97/0.6)]'
: 'btn-glass text-text'
}`}
>
<Icon name="grid" size={14} />
<span className="@max-[63rem]:hidden">Grid</span>
</button>
/>
<TempoControls {...tempoProps} className="@max-[77rem]:hidden" />
<TempoFold locked={tempoProps.locked} className="hidden @max-[77rem]:flex">
<TempoControls {...tempoProps} />
</TempoFold>
</div>
{memoryMenu && (