mirror of
https://github.com/MrPatben8/konduktor.git
synced 2026-11-27 10:22:51 +01:00
Improved cue/grid button switch layout and style
This commit is contained in:
1 parent
667068c2f1
commit
5d059c7604
3 files changed
+30
-31
No files matched your search
@@ -1333,13 +1333,14 @@ Two independent apps that talk over HTTP:
|
|||||||
`OverviewWaveform`, which frames the main view's visible range around the
|
`OverviewWaveform`, which frames the main view's visible range around the
|
||||||
playhead (it takes `secPerView` for exactly that). **Controls**: play, CUE, `LoopControls`, then
|
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
|
(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`
|
`HotcueBar`, `MemoryCueStrip` (Mem) OR — in **Grid mode** — `GridEditStrip`, then the
|
||||||
(±0.01 / ±0.25, ÷2 ×2, tap, lock) and the Grid toggle. The row is a
|
**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
|
**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
|
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
|
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
|
portalled popover. That breakpoint is a measured width — move them if controls are added to the row. Every grid control acts
|
||||||
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
|
on the marker **governing the playhead**, since a beatgrid is a marker list
|
||||||
and there is no separate marker selection; see "Beatgrid" below.
|
and there is no separate marker selection; see "Beatgrid" below.
|
||||||
- **One size for loops AND beat jump** (`beatSize`, 1/32–32, persisted as
|
- **One size for loops AND beat jump** (`beatSize`, 1/32–32, persisted as
|
||||||
|
|||||||
@@ -8,27 +8,31 @@ export function ModeSwitch<T extends string>({
|
|||||||
label,
|
label,
|
||||||
value,
|
value,
|
||||||
options,
|
options,
|
||||||
|
disabled = false,
|
||||||
onChange,
|
onChange,
|
||||||
}: {
|
}: {
|
||||||
/** Names the group for assistive tech ("Loop mode", "Cue bank"). */
|
/** Names the group for assistive tech ("Loop mode", "Cue bank"). */
|
||||||
label: string
|
label: string
|
||||||
value: T
|
value: T
|
||||||
options: { value: T; text: string; title: string }[]
|
options: { value: T; text: string; title: string }[]
|
||||||
|
disabled?: boolean
|
||||||
onChange: (value: T) => void
|
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 (
|
return (
|
||||||
<div
|
<div
|
||||||
role="group"
|
role="group"
|
||||||
aria-label={label}
|
aria-label={label}
|
||||||
onClick={other ? () => onChange(other.value) : undefined}
|
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) => (
|
{options.map((o) => (
|
||||||
<button
|
<button
|
||||||
key={o.value}
|
key={o.value}
|
||||||
onClick={other ? undefined : () => onChange(o.value)}
|
onClick={other ? undefined : () => onChange(o.value)}
|
||||||
title={o.title}
|
title={o.title}
|
||||||
|
disabled={disabled}
|
||||||
aria-pressed={value === o.value}
|
aria-pressed={value === o.value}
|
||||||
className={`h-[17px] rounded-[7px] px-[7px] text-[9px] font-bold tracking-[0.08em] transition-colors ${
|
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'
|
value === o.value ? 'btn-primary' : 'text-faint hover:text-text'
|
||||||
|
|||||||
@@ -1625,11 +1625,10 @@ export function PrepStrip({
|
|||||||
A container, so the row gives way in stages as the window narrows
|
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
|
instead of the pads sliding under the tempo group: the pads drop
|
||||||
their names first (each pad queries its own width, see HotcueBar),
|
their names first (each pad queries its own width, see HotcueBar),
|
||||||
then below 77rem the tempo group folds into one BPM button, and below
|
then below 77rem the tempo group folds into one BPM button. That is
|
||||||
63rem the Grid toggle keeps only its icon. Those are the row's
|
the row's measured width just before the pad bank would hit its
|
||||||
measured widths just before the pad bank would hit its minimum (with
|
minimum (with a lockable grid's extra Lock button, and the Hot / Mem
|
||||||
a lockable grid's extra Lock button, and the Hot / Mem toggle's
|
toggle's ~3rem with its gap), so move it with the controls. */}
|
||||||
~3rem with its gap), so move them with the controls. */}
|
|
||||||
<div className="@container flex h-11 shrink-0 items-center gap-3">
|
<div className="@container flex h-11 shrink-0 items-center gap-3">
|
||||||
<button
|
<button
|
||||||
onClick={toggle}
|
onClick={toggle}
|
||||||
@@ -1752,31 +1751,26 @@ export function PrepStrip({
|
|||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
{DIVIDER}
|
{DIVIDER}
|
||||||
<TempoControls {...tempoProps} className="@max-[77rem]:hidden" />
|
<ModeSwitch
|
||||||
<TempoFold locked={tempoProps.locked} className="hidden @max-[77rem]:flex">
|
label="Deck mode"
|
||||||
<TempoControls {...tempoProps} />
|
value={gridMode ? 'grid' : 'cues'}
|
||||||
</TempoFold>
|
options={[
|
||||||
<button
|
{ value: 'cues', text: 'CUES', title: 'Cues: the hotcue pads or memory cues' },
|
||||||
onClick={() => {
|
{ value: 'grid', text: 'GRID', title: 'Edit the beatgrid: markers, phase, reset' },
|
||||||
setGridMode((g) => !g)
|
]}
|
||||||
|
disabled={!track}
|
||||||
|
onChange={(m) => {
|
||||||
|
setGridMode(m === 'grid')
|
||||||
setPadMenu(null)
|
setPadMenu(null)
|
||||||
setRenamingSlot(null)
|
setRenamingSlot(null)
|
||||||
setMemoryMenu(null)
|
setMemoryMenu(null)
|
||||||
setRenamingMemory(null)
|
setRenamingMemory(null)
|
||||||
}}
|
}}
|
||||||
aria-pressed={gridMode}
|
/>
|
||||||
disabled={!track}
|
<TempoControls {...tempoProps} className="@max-[77rem]:hidden" />
|
||||||
title={gridMode ? 'Back to the hotcue pads' : 'Edit the beatgrid: markers, phase, reset'}
|
<TempoFold locked={tempoProps.locked} className="hidden @max-[77rem]:flex">
|
||||||
aria-label="Grid"
|
<TempoControls {...tempoProps} />
|
||||||
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 ${
|
</TempoFold>
|
||||||
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>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{memoryMenu && (
|
{memoryMenu && (
|
||||||
|
|||||||
Reference in new issue
Block a user