mirror of
https://github.com/MrPatben8/konduktor.git
synced 2026-11-27 10:22:51 +01:00
Improve performance mode symmetry
This commit is contained in:
1 parent
1b1ed7e2b3
commit
352aa3e956
6 files changed
+46
-26
No files matched your search
@@ -3,7 +3,6 @@ import { useQuery } from '@tanstack/react-query'
|
||||
import { api, type Capabilities, type Track, type TrackOrigin } from '../api'
|
||||
import { useDeckKeys, type DeckKeyTargets } from '../lib/deckKeys'
|
||||
import { useDropTarget, type DragPayload } from '../lib/drag'
|
||||
import { Icon } from '../lib/icons'
|
||||
import { usePrefsWriter } from '../lib/prefs'
|
||||
import { mixer } from '../lib/audio/mixer'
|
||||
import { setMixer } from '../lib/audio/mixerState'
|
||||
@@ -48,6 +47,7 @@ interface Props {
|
||||
caps: Record<DeckId, Capabilities>
|
||||
/** Performance mode: deck B, stacked waveforms (decided 2026-11-02). */
|
||||
performance: boolean
|
||||
/** P (the button is the track list toolbar's). */
|
||||
onTogglePerformance: () => void
|
||||
/** The deck keys and loads go to (in performance mode). */
|
||||
focused: DeckId
|
||||
@@ -97,7 +97,8 @@ function useDeckView(): DeckView {
|
||||
* state, audio, every action — are `useDeck` (components/deck/); this lays
|
||||
* them out and routes the keyboard to them.
|
||||
*
|
||||
* One deck normally. PERFORMANCE MODE (P, or the button beside Auto hotcues)
|
||||
* One deck normally. PERFORMANCE MODE (P, or the Performance button at the
|
||||
* right of the track list's toolbar)
|
||||
* adds deck B: the two headers side by side, the two main waveforms stacked at
|
||||
* one zoom past one playhead line, the overviews side by side, then each
|
||||
* deck's controls with the mixer between them. Keys go to the FOCUSED deck
|
||||
@@ -281,24 +282,10 @@ export function PrepStrip({
|
||||
}
|
||||
useDeckKeys(keys)
|
||||
|
||||
const toggle = (
|
||||
<button
|
||||
onClick={onTogglePerformance}
|
||||
aria-pressed={performance}
|
||||
aria-label="Performance mode"
|
||||
title={performance ? 'Leave performance mode (P)' : 'Performance mode — a second deck to try transitions (P)'}
|
||||
className={`flex h-9 w-9 shrink-0 items-center justify-center rounded-full ${
|
||||
performance ? 'is-selected text-text' : 'btn-glass text-muted'
|
||||
}`}
|
||||
>
|
||||
<Icon name="decks" size={18} />
|
||||
</button>
|
||||
)
|
||||
|
||||
if (!performance) {
|
||||
return (
|
||||
<div className="glass flex h-[19.75rem] shrink-0 flex-col gap-2 p-4">
|
||||
<DeckHeader deck={a} actions={toggle} />
|
||||
<DeckHeader deck={a} />
|
||||
<DeckMainWave deck={a} view={view} />
|
||||
<DeckOverview deck={a} view={view} />
|
||||
<DeckControls deck={a} />
|
||||
@@ -328,7 +315,8 @@ export function PrepStrip({
|
||||
<div className="glass flex h-[32rem] shrink-0 flex-col gap-2 p-4">
|
||||
<div className="flex shrink-0 items-center gap-3">
|
||||
{pane('A', <DeckHeader deck={a} compact badge={badge('A')} />)}
|
||||
{toggle}
|
||||
{/* Where deck A's header ends and B's begins: a wider gap and a rule. */}
|
||||
<span aria-hidden className="mx-3 h-9 w-px shrink-0 bg-line" />
|
||||
{pane('B', <DeckHeader deck={b} compact badge={badge('B')} />)}
|
||||
</div>
|
||||
{DECK_IDS.map((id) => (
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { useRef } from 'react'
|
||||
import { useRef, type ReactNode } from 'react'
|
||||
import { useQuery } from '@tanstack/react-query'
|
||||
import { api } from '../api'
|
||||
import { useCaps } from '../lib/capabilities'
|
||||
@@ -27,6 +27,8 @@ export const emptyFilters: Filters = {
|
||||
interface Props {
|
||||
filters: Filters
|
||||
onChange: (f: Filters) => void
|
||||
/** At the far right, after Clear filters (the Performance button). */
|
||||
trailing?: ReactNode
|
||||
}
|
||||
|
||||
const selectCls =
|
||||
@@ -35,6 +37,7 @@ const selectCls =
|
||||
export function Toolbar({
|
||||
filters,
|
||||
onChange,
|
||||
trailing,
|
||||
}: Props) {
|
||||
const caps = useCaps()
|
||||
const { data: facets } = useQuery({ queryKey: ['facets'], queryFn: api.facets })
|
||||
@@ -60,7 +63,7 @@ export function Toolbar({
|
||||
onChange={(e) => set({ search: e.target.value })}
|
||||
ref={searchRef}
|
||||
placeholder="Artist, title, album, comment…"
|
||||
className="well w-72 rounded-full py-1.5 pl-9 pr-8 text-sm text-text outline-none placeholder:text-faint focus:ring-1 focus:ring-accent"
|
||||
className="well w-64 rounded-full py-1.5 pl-9 pr-8 text-sm text-text outline-none placeholder:text-faint focus:ring-1 focus:ring-accent"
|
||||
/>
|
||||
{filters.search && (
|
||||
<button
|
||||
@@ -81,7 +84,10 @@ export function Toolbar({
|
||||
<select
|
||||
value={filters.genre}
|
||||
onChange={(e) => set({ genre: e.target.value })}
|
||||
className={selectCls}
|
||||
// A select is as wide as its longest option — one long genre name
|
||||
// made it ~300 px and wrapped the toolbar. The chosen one shows in full
|
||||
// in the open list.
|
||||
className={`${selectCls} max-w-44`}
|
||||
>
|
||||
<option value="">All genres</option>
|
||||
{facets?.genres.map((g) => (
|
||||
@@ -152,6 +158,7 @@ export function Toolbar({
|
||||
Clear filters
|
||||
</button>
|
||||
)}
|
||||
{trailing}
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
import { Icon } from '../../lib/icons'
|
||||
|
||||
/** Performance mode on / off — at the right of the track list's toolbar
|
||||
* (decided 2026-11-03), lit while on. P does the same. */
|
||||
export function PerformanceButton({ on, onToggle }: { on: boolean; onToggle: () => void }) {
|
||||
return (
|
||||
<button
|
||||
onClick={onToggle}
|
||||
aria-pressed={on}
|
||||
aria-label="Performance mode"
|
||||
title={on ? 'Leave performance mode (P)' : 'Performance mode — a second deck and a mixer, to try transitions (P)'}
|
||||
className={`flex shrink-0 items-center gap-2 rounded-full px-3.5 py-1.5 text-sm font-medium ${
|
||||
on ? 'is-selected text-text' : 'btn-glass text-text'
|
||||
}`}
|
||||
>
|
||||
<Icon name="decks" size={16} />
|
||||
Performance
|
||||
</button>
|
||||
)
|
||||
}
|
||||
Reference in new issue
Block a user