diff --git a/CLAUDE.md b/CLAUDE.md index 5ba50d4..f5903d5 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -893,7 +893,7 @@ Two independent apps that talk over HTTP: / Try again (`backend_restart`). The shell has no timeout of its own. Before ready it answers quit requests itself — nothing can be unsaved — and stops at ready so it never races `QuitGuard`), `SaveBar` (+ "Discard changes…" when - dirty, and the settings gear beside it, whose menu (or `?` anywhere) opens `ShortcutsDialog` — a KEYBOARD MAP (decided 2026-10-15): keys lit in the colour of what they do, a caption explaining the key pointed at or pressed (pressing explains, it never acts: a capture-phase listener keeps the deck's and table's keys from firing), holding or picking ⇧ / Cmd-Ctrl relights it with that layer, mouse gestures listed beneath. It shrinks to fit the dialog and drops the words on the keys when too small. Its content is `lib/shortcuts.ts`, written out BY HAND, so a new or changed shortcut in `PrepStrip` / `TrackTable` must be added there too — and `AppSettings` ("Konduktor Settings…": app-level prefs, each with its default in `APP_SETTING_DEFAULTS` and read through `useAppSetting`; today `expandPlaylistFolders` and `exportRootFolder`, both default off — the latter read by the backend at `run_export` and passed down as `ExportPayload.root_folder`. The Sidebar holds folder open state as per-id overrides of that setting, reset on a new library or a change of the setting, and carried to the new ids when a rename/move changes a folder's path id)), `Toolbar` (search/filters; columns are chosen by right-clicking the table header), + dirty, and the settings gear beside it, whose menu (or `?` anywhere) opens `ShortcutsDialog` — a KEYBOARD MAP (decided 2026-10-15): keys lit in the colour of what they do, a caption explaining the key pointed at or pressed (pressing explains, it never acts: a capture-phase listener keeps the deck's and table's keys from firing), holding or picking ⇧ / Cmd-Ctrl relights it with that layer, mouse gestures listed beneath. It shrinks to fit the dialog and drops the words on the keys when too small. Its content is `lib/shortcuts.ts`, written out BY HAND, so a new or changed shortcut in `PrepStrip` / `TrackTable` must be added there too — and `AppSettings` ("Konduktor Settings…": app-level prefs, each with its default in `APP_SETTING_DEFAULTS` and read through `useAppSetting`; today `expandPlaylistFolders` and `exportRootFolder`, both default off — the latter read by the backend at `run_export` and passed down as `ExportPayload.root_folder` — and `timeReadoutDecimals` (0–3, default 1: the deck's ELAPSED / REMAIN, truncated, never rounded). The Sidebar holds folder open state as per-id overrides of that setting, reset on a new library or a change of the setting, and carried to the new ids when a rename/move changes a folder's path id)), `Toolbar` (search/filters; columns are chosen by right-clicking the table header), `TrackTable` (**the one track list** — All Tracks, playlists, exports and devices. TanStack Table + **virtualized** grid; per-row play button, configurable columns, header sorting, inline double-click editing, and diff --git a/frontend/src/components/AppSettings.tsx b/frontend/src/components/AppSettings.tsx index d1d6b00..1dbbb60 100644 --- a/frontend/src/components/AppSettings.tsx +++ b/frontend/src/components/AppSettings.tsx @@ -14,6 +14,8 @@ export const APP_SETTING_DEFAULTS = { expandPlaylistFolders: false, /** Read by the backend when an export runs (`main.run_export`). */ exportRootFolder: false, + /** Decimal places on the deck's ELAPSED / REMAIN readouts (0–3). */ + timeReadoutDecimals: 1, } type AppSettingKey = keyof typeof APP_SETTING_DEFAULTS @@ -29,6 +31,7 @@ export function AppSettings({ onClose }: { onClose: () => void }) { const qc = useQueryClient() const expandFolders = useAppSetting('expandPlaylistFolders') const exportRootFolder = useAppSetting('exportRootFolder') + const timeDecimals = useAppSetting('timeReadoutDecimals') const [error, setError] = useState(null) useEffect(() => { @@ -95,6 +98,28 @@ export function AppSettings({ onClose }: { onClose: () => void }) { +
+

Deck

+ +
{error &&
{error}
}
diff --git a/frontend/src/components/PrepStrip.tsx b/frontend/src/components/PrepStrip.tsx index 6b703c0..94d5ddc 100644 --- a/frontend/src/components/PrepStrip.tsx +++ b/frontend/src/components/PrepStrip.tsx @@ -35,6 +35,7 @@ import { HotcueBar } from './HotcueBar' import { LoopControls, LOOP_SIZES, type LoopMode } from './LoopControls' import { MainWaveform, MIN_SEC, MAX_SEC, DEFAULT_SEC, type StemLane } from './MainWaveform' import { OverviewWaveform } from './OverviewWaveform' +import { useAppSetting } from './AppSettings' import { usePrefsWriter } from '../lib/prefs' /** Keys that mute stems 1-4 (Shift = solo), by `KeyboardEvent.code`. */ @@ -66,13 +67,19 @@ interface Props { onEditTags?: (track: Track) => void } -/** m:ss.t — the deck's readouts show tenths, as a CDJ does. */ -function fmtTenths(secs: number): string { +/** mm:ss.f — tenths by default, as a CDJ does; `places` is the + * `timeReadoutDecimals` setting (0 drops the fraction). Truncates, never + * rounds, so the readout never shows a second before it has been reached. */ +function fmtTime(secs: number, places: number): string { if (!isFinite(secs) || secs < 0) secs = 0 - const tenths = Math.floor(secs * 10) - const m = Math.floor(tenths / 600) - const s = Math.floor((tenths % 600) / 10) - return `${m.toString().padStart(2, '0')}:${s.toString().padStart(2, '0')}.${tenths % 10}` + const scale = 10 ** places + // The epsilon keeps e.g. 0.3 s from reading 0.299 at 3 places. + const units = Math.floor(secs * scale + 1e-6) + const whole = Math.floor(units / scale) + const m = Math.floor(whole / 60) + const s = whole % 60 + const frac = places > 0 ? `.${(units % scale).toString().padStart(places, '0')}` : '' + return `${m.toString().padStart(2, '0')}:${s.toString().padStart(2, '0')}${frac}` } /** @@ -117,6 +124,7 @@ export function PrepStrip({ // which the pointer's :active alone cannot, since the key never touches it. const [cueHeld, setCueHeld] = useState(false) const [current, setCurrent] = useState(0) + const timeDecimals = useAppSetting('timeReadoutDecimals') const [duration, setDuration] = useState(0) const [ready, setReady] = useState(false) const [cols, setCols] = useState(null) @@ -1338,12 +1346,12 @@ export function PrepStrip({
ELAPSED - {fmtTenths(current)} + {fmtTime(current, timeDecimals)}
REMAIN - −{fmtTenths(Math.max(0, duration - current))} + −{fmtTime(Math.max(0, duration - current), timeDecimals)}