mirror of
https://github.com/MrPatben8/konduktor.git
synced 2026-11-27 18:22:53 +01:00
Changed theme to liquid glass
This commit is contained in:
1 parent
950352f7ec
commit
2810f24563
52 files changed
+1353
-529
No files matched your search
@@ -427,7 +427,8 @@ Two independent apps that talk over HTTP:
|
||||
- Data flow: the whole library is fetched once (`/api/tracks?limit=20000`);
|
||||
filtering and sorting happen **client-side** for instant interaction. Edits
|
||||
apply in-memory (server holds them) and the sidebar **Save to Traktor**
|
||||
button flushes to disk. Styling is Tailwind v4 with tokens in `src/index.css`.
|
||||
button flushes to disk. Styling is Tailwind v4 with tokens in `src/index.css`
|
||||
— see "Theme" below.
|
||||
Library column layout (visibility/order/width) persists to `userprefs.json`
|
||||
via `GET`/`PATCH /api/prefs` (debounced; hydrated on launch, merged against
|
||||
defaults so newly-added columns still appear). The prep deck's main-waveform
|
||||
@@ -648,8 +649,48 @@ frontend at `http://localhost:5173`.
|
||||
- Backend: type hints, Pydantic models for all responses, keep query logic in
|
||||
`collection_service.py` (routes stay thin).
|
||||
- Frontend: functional components, TanStack Query for fetching, Tailwind
|
||||
utility classes with the `ink-*`/`accent`/`gold`/`mint`/`pink` tokens from
|
||||
`index.css`. Keep `api.ts` types aligned with `schemas.py`.
|
||||
utility classes with the `ink-*`/`well`/`accent`/`gold`/`mint`/`pink` tokens
|
||||
and the material classes from `index.css` (see "Theme"). Icons come from
|
||||
`lib/icons.tsx`, never emoji. Keep `api.ts` types aligned with `schemas.py`.
|
||||
|
||||
## Theme — "dark liquid glass"
|
||||
|
||||
Floating frosted panels (12 px gutters) over a drifting wash of colour sampled
|
||||
from the loaded track's cover art. Colour is reserved for MEANING — cue types,
|
||||
key, playhead, the one primary action; chrome stays neutral. The rules that are
|
||||
easy to break:
|
||||
|
||||
- **`ink-900`…`ink-600` are translucent WHITE overlays, not greys**, so they
|
||||
read on any panel. Only `ink-950` is opaque: it is the dark text on light
|
||||
buttons and the page base. Recessed things (inputs, waveforms, readouts,
|
||||
progress tracks) use `well` / the `.well` class — never `bg-ink-950`.
|
||||
- **Materials are classes in `index.css`**: `.glass` (panel), `.glass-overlay`
|
||||
(menus, dialogs, toasts — denser), `.well`, `.btn-glass`, `.btn-primary`
|
||||
(white→accent pill, one per view), `.is-selected`. The rim light is a
|
||||
`::before`, so these set `position: relative`; Tailwind's `fixed`/`absolute`
|
||||
utilities win because utilities outrank the components layer.
|
||||
- **Never put `backdrop-filter` (or `filter`/`transform`) on an element that can
|
||||
contain a popup.** It makes that element the containing block for every
|
||||
`position: fixed` descendant, so a context menu or dialog opened inside it is
|
||||
placed relative to the panel, not the window — the sidebar's playlist menu
|
||||
opened far from the cursor. `.glass`'s blur and tint therefore live on its
|
||||
`::after` (z-index -1 under `isolation: isolate`), not on the panel.
|
||||
- **The accent is `oklch(0.8 0.11 var(--accent-hue))`** — the cover's hue at a
|
||||
FIXED lightness and chroma, so dark text on it keeps its contrast whatever is
|
||||
loaded. `lib/ambient.ts` sets `--accent-hue` and `--amb-1..4` on `<html>`;
|
||||
they are `@property`-registered so a track change glides, and nothing in React
|
||||
state depends on them (no re-render on a track change). The art is fetched as
|
||||
a blob → `createImageBitmap`, because a cross-origin `<img>` (the API under
|
||||
Tauri) taints the canvas. A device track, or greyscale art, gets the default.
|
||||
- `AmbientBackdrop` is mounted in `main.tsx`, behind the picker too; so no root
|
||||
container may set an opaque background, or the glass has nothing behind it.
|
||||
- **Canvas drawing glows instead of outlining** (`cues.ts`): a black outline on
|
||||
glass reads as a gap in the waveform. The playhead is `drawPlayhead`, shared
|
||||
by both waveforms.
|
||||
- The table's Cues column draws one dot per occupied slot from
|
||||
`Track.hotcues` (`HotcueChip`: slot, type, colour), which every adapter
|
||||
projects with the SAME slot test its `track_cues()` uses, so the dots cannot
|
||||
disagree with the pads. OneLibrary fills it lazily, like `hotcue_count`.
|
||||
- Python 3.14 note: pin dependencies loosely enough to get prebuilt wheels
|
||||
(older `pydantic-core` pins force a from-source Rust build that fails).
|
||||
|
||||
@@ -929,9 +970,14 @@ The prep strip plays every track through the **Web Audio API** (a plain
|
||||
playback buffer's views). Playback and scratch also run on **separate
|
||||
`AudioContext`s** — sharing one goes silent after a source has played.
|
||||
- `waveform.ts` — decodes once (buffer reused by both engines, no re-decode),
|
||||
splits into 3 bands via `OfflineAudioContext` biquads, and colors each column
|
||||
by blending three palette targets (bass→orange, mids→violet, highs→cyan — no
|
||||
green, matching Traktor's Spectrum). Height = amplitude.
|
||||
splits into 3 bands via `OfflineAudioContext` biquads, and paints them as
|
||||
**three layers**, not one blended colour per column: bass (orange) first and
|
||||
tallest, then mids (violet) and highs (cyan) with a `screen` blend — no green,
|
||||
matching Traktor's Spectrum. Each band is normalised to its own 99.5th
|
||||
percentile and then EXPANDED (bass steepest): dance music holds its bass near
|
||||
full scale for whole sections, so a linear map draws a solid orange wall
|
||||
instead of the kick pulse. The main view draws 2 px bars with a 1 px gap,
|
||||
**binned in track space** so bars scroll rather than flicker.
|
||||
- `cues.ts` — canvas drawers for cue markers (type-colored), the active loop
|
||||
band, the beatgrid (per-segment white beats/brighter downbeats, plus marker
|
||||
lines — gold for the one governing the playhead, accent otherwise, with the
|
||||
|
||||
@@ -24,7 +24,7 @@ from pathlib import Path
|
||||
|
||||
from ...core.adapter import Unsupported
|
||||
from ...core.capabilities import Capabilities
|
||||
from ...core.model import PlaylistNode, Track, TrackCues
|
||||
from ...core.model import HotcueChip, PlaylistNode, Track, TrackCues
|
||||
from ...core.pathmap import PathMapping, common_dir_prefix
|
||||
from ...core.query import TrackIndex
|
||||
from . import capabilities as caps
|
||||
@@ -125,7 +125,15 @@ class OneLibraryAdapter:
|
||||
if track is not None:
|
||||
track.grid_marker_count = len(result.grid_markers)
|
||||
track.cue_count = len(result.cues)
|
||||
track.hotcue_count = sum(1 for c in result.cues if c.role == "hotcue")
|
||||
track.hotcues = sorted(
|
||||
(
|
||||
HotcueChip(slot=c.slot, type=c.type, color=c.color)
|
||||
for c in result.cues
|
||||
if c.role == "hotcue" and c.slot is not None
|
||||
),
|
||||
key=lambda chip: chip.slot,
|
||||
)
|
||||
track.hotcue_count = len(track.hotcues)
|
||||
return result
|
||||
|
||||
# ---- playlists -------------------------------------------------------
|
||||
|
||||
@@ -43,10 +43,10 @@ class RekordboxAdapter:
|
||||
|
||||
# ---- projection maintenance -----------------------------------------
|
||||
def _rebuild(self) -> None:
|
||||
counts = self._store.cue_counts()
|
||||
kinds = self._store.cue_kinds()
|
||||
self._index.rebuild(
|
||||
[
|
||||
projection.to_track(row, counts.get(str(row.ID), (0, 0)))
|
||||
projection.to_track(row, kinds.get(str(row.ID), ()))
|
||||
for row in self._store.iter_content()
|
||||
]
|
||||
)
|
||||
@@ -66,9 +66,9 @@ class RekordboxAdapter:
|
||||
Every mutating command must end in this — a forgotten refresh is a
|
||||
silently stale projection that no byte- or row-level test would catch.
|
||||
"""
|
||||
counts = self._store.cue_counts()
|
||||
kinds = self._store.cue_kinds()
|
||||
row = self._store.content(track_id)
|
||||
self._index.replace(projection.to_track(row, counts.get(str(row.ID), (0, 0))))
|
||||
self._index.replace(projection.to_track(row, kinds.get(str(row.ID), ())))
|
||||
|
||||
def close(self) -> None:
|
||||
"""Release the database connection.
|
||||
|
||||
@@ -7,7 +7,7 @@ from __future__ import annotations
|
||||
|
||||
import re
|
||||
|
||||
from ...core.model import CuePoint, GridMarker, Track, TrackCues
|
||||
from ...core.model import CuePoint, GridMarker, HotcueChip, Track, TrackCues
|
||||
from . import beatgrid
|
||||
from .cue_types import cue_type, role_and_slot
|
||||
|
||||
@@ -97,12 +97,14 @@ def _name_of(related) -> str | None:
|
||||
return None
|
||||
|
||||
|
||||
def to_track(row, cue_counts: tuple[int, int] = (0, 0)) -> Track:
|
||||
def to_track(row, cue_kinds=()) -> Track:
|
||||
"""Project one ``DjmdContent`` row.
|
||||
|
||||
`cue_counts` is ``(total, hotcues)`` from the store's single aggregate
|
||||
`cue_kinds` is this track's ``(Kind, OutMsec)`` pairs from the store's single
|
||||
query — passed in rather than read off the row, which would be a per-track
|
||||
round trip.
|
||||
round trip. "Is this a hot cue, and on which pad?" is `role_and_slot`, the
|
||||
same definition `to_track_cues` uses, so the table's count and dots agree
|
||||
with the pads shown in the deck (it also rules out the reserved Kind).
|
||||
|
||||
**`grid_marker_count` is an approximation here**: the real count needs the
|
||||
track's ANLZ file, which is far too slow to read for every track at open
|
||||
@@ -115,7 +117,14 @@ def to_track(row, cue_counts: tuple[int, int] = (0, 0)) -> Track:
|
||||
On the reference library the two sets agree exactly: all 22 tracks with no
|
||||
BPM are precisely the 22 with no grid.
|
||||
"""
|
||||
total_cues, hotcues = cue_counts
|
||||
chips: list[HotcueChip] = []
|
||||
for kind, out_msec in cue_kinds:
|
||||
role, slot = role_and_slot(kind)
|
||||
if role == "hotcue" and slot is not None:
|
||||
# Rekordbox's colour is a palette index nobody has decoded yet (see
|
||||
# `_cue_color`), so no colour is claimed and the UI uses the type's.
|
||||
chips.append(HotcueChip(slot=slot, type=cue_type(out_msec), color=None))
|
||||
chips.sort(key=lambda chip: chip.slot)
|
||||
key_name = _name_of(getattr(row, "Key", None))
|
||||
wheel, mode = parse_key(key_name)
|
||||
return Track(
|
||||
@@ -142,8 +151,9 @@ def to_track(row, cue_counts: tuple[int, int] = (0, 0)) -> Track:
|
||||
last_played=None, # not modelled as a date in master.db
|
||||
release_date=_iso_date(getattr(row, "ReleaseDate", None)),
|
||||
filepath=str(getattr(row, "FolderPath", "") or "") or None,
|
||||
cue_count=total_cues,
|
||||
hotcue_count=hotcues,
|
||||
cue_count=len(cue_kinds),
|
||||
hotcue_count=len(chips),
|
||||
hotcues=chips,
|
||||
grid_marker_count=1 if (_bpm(row) and getattr(row, "AnalysisDataPath", None)) else 0,
|
||||
grid_locked=False, # Rekordbox has no per-track grid lock
|
||||
media_kind="audio",
|
||||
|
||||
@@ -171,23 +171,22 @@ class RekordboxStore:
|
||||
raise NotFound(f"No track {track_id!r}")
|
||||
return row
|
||||
|
||||
def cue_counts(self) -> dict[str, tuple[int, int]]:
|
||||
"""``{track_id: (total_cues, hotcue_count)}`` in one aggregate query."""
|
||||
def cue_kinds(self) -> dict[str, list[tuple[int | None, int | None]]]:
|
||||
"""``{track_id: [(Kind, OutMsec), ...]}`` for every live cue, in one query.
|
||||
|
||||
Just enough per cue for the library table's count and hotcue dots,
|
||||
without a per-track round trip. What a ``Kind`` means is decided in the
|
||||
projection, by the same `role_and_slot` the deck's cues use, so the
|
||||
table and the pads cannot disagree.
|
||||
"""
|
||||
t = self._tables
|
||||
rows = self._db.session.execute(
|
||||
select(t.DjmdCue.ContentID, t.DjmdCue.Kind, func.count())
|
||||
select(t.DjmdCue.ContentID, t.DjmdCue.Kind, t.DjmdCue.OutMsec)
|
||||
.where(t.DjmdCue.rb_local_deleted == 0)
|
||||
.group_by(t.DjmdCue.ContentID, t.DjmdCue.Kind)
|
||||
).all()
|
||||
out: dict[str, tuple[int, int]] = {}
|
||||
for content_id, kind, n in rows:
|
||||
total, hot = out.get(str(content_id), (0, 0))
|
||||
# "Is this a hot cue?" must mean the same here as in the projection,
|
||||
# or the count in the library table disagrees with the pads shown in
|
||||
# the deck. `role_and_slot` is the single definition — it also rules
|
||||
# out the reserved Kind, which occupies no pad.
|
||||
is_hotcue = role_and_slot(kind)[0] == "hotcue"
|
||||
out[str(content_id)] = (total + n, hot + (n if is_hotcue else 0))
|
||||
out: dict[str, list[tuple[int | None, int | None]]] = {}
|
||||
for content_id, kind, out_msec in rows:
|
||||
out.setdefault(str(content_id), []).append((kind, out_msec))
|
||||
return out
|
||||
|
||||
def cues(self, track_id: str) -> list:
|
||||
|
||||
@@ -7,7 +7,7 @@ from __future__ import annotations
|
||||
|
||||
import re
|
||||
|
||||
from ...core.model import CuePoint, GridMarker, Track, TrackCues
|
||||
from ...core.model import CuePoint, GridMarker, HotcueChip, Track, TrackCues
|
||||
from . import beatgrid
|
||||
from .cue_types import NATIVE_TO_CUE_TYPE
|
||||
|
||||
@@ -83,8 +83,19 @@ def to_track(e) -> Track:
|
||||
# question, two answers.
|
||||
markers = beatgrid.grid_markers(e)
|
||||
cues = [c for c in (e.cue_v2 or []) if getattr(c, "grid", None) is None]
|
||||
hotcues = sum(
|
||||
1 for c in cues if c.hotcue is not None and c.hotcue >= 0
|
||||
# The same "is this in the bank" test as `to_track_cues`' slot, so the
|
||||
# table's dots and the deck's pads cannot disagree.
|
||||
chips = sorted(
|
||||
(
|
||||
HotcueChip(
|
||||
slot=c.hotcue,
|
||||
type=NATIVE_TO_CUE_TYPE.get(c.type, "cue"),
|
||||
color=c.color or None,
|
||||
)
|
||||
for c in cues
|
||||
if c.hotcue is not None and c.hotcue >= 0
|
||||
),
|
||||
key=lambda chip: chip.slot,
|
||||
)
|
||||
wheel, mode = parse_key(info.key if info else None)
|
||||
return Track(
|
||||
@@ -111,7 +122,8 @@ def to_track(e) -> Track:
|
||||
release_date=iso_date(info.release_date if info else None),
|
||||
filepath=_display_path(loc) if loc else None,
|
||||
cue_count=len(cues),
|
||||
hotcue_count=hotcues,
|
||||
hotcue_count=len(chips),
|
||||
hotcues=chips,
|
||||
grid_marker_count=len(markers),
|
||||
grid_locked=bool(e.lock),
|
||||
media_kind="stem" if getattr(e, "stems", None) is not None else "audio",
|
||||
|
||||
@@ -16,6 +16,18 @@ from pydantic import BaseModel, ConfigDict, Field
|
||||
from .capabilities import CueRole, CueType, MediaKind, PlaylistKind
|
||||
|
||||
|
||||
class HotcueChip(BaseModel):
|
||||
"""One occupied hotcue slot, as the library table previews it.
|
||||
|
||||
Deliberately far smaller than a `CuePoint`: it rides on every `Track` in the
|
||||
whole-library fetch, and a row only needs enough to draw a coloured dot.
|
||||
"""
|
||||
|
||||
slot: int
|
||||
type: CueType = "cue"
|
||||
color: str | None = None # "#RRGGBB" as the platform stored it
|
||||
|
||||
|
||||
class Track(BaseModel):
|
||||
"""A single track in the library, as the app sees it."""
|
||||
|
||||
@@ -47,6 +59,10 @@ class Track(BaseModel):
|
||||
filepath: str | None = None # human-readable OS path
|
||||
cue_count: int = 0
|
||||
hotcue_count: int = 0
|
||||
# The occupied hotcue slots, ordered by slot. Where cues are parsed lazily
|
||||
# (OneLibrary) this is empty until `track_cues()` corrects it, exactly like
|
||||
# `hotcue_count` — the two must always agree.
|
||||
hotcues: list[HotcueChip] = Field(default_factory=list)
|
||||
# 0 = no beatgrid, 1 = constant tempo, >1 = a flexible (multi-tempo) grid.
|
||||
grid_marker_count: int = 0
|
||||
grid_locked: bool = False
|
||||
|
||||
@@ -314,6 +314,7 @@ from .core.model import ( # noqa: E402,F401
|
||||
Facets,
|
||||
GenreCount,
|
||||
GridMarker,
|
||||
HotcueChip,
|
||||
PlaylistNode,
|
||||
PrefixGroup,
|
||||
PrefixSuggestions,
|
||||
|
||||
Generated
+20
@@ -12,6 +12,8 @@
|
||||
"@dnd-kit/modifiers": "^9.0.0",
|
||||
"@dnd-kit/sortable": "^10.0.0",
|
||||
"@dnd-kit/utilities": "^3.2.2",
|
||||
"@fontsource-variable/geist": "^5.3.0",
|
||||
"@fontsource-variable/geist-mono": "^5.3.0",
|
||||
"@tanstack/react-query": "^5.101.2",
|
||||
"@tanstack/react-table": "^8.21.3",
|
||||
"@tanstack/react-virtual": "^3.14.5",
|
||||
@@ -150,6 +152,24 @@
|
||||
"tslib": "^2.4.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@fontsource-variable/geist": {
|
||||
"version": "5.3.0",
|
||||
"resolved": "https://registry.npmjs.org/@fontsource-variable/geist/-/geist-5.3.0.tgz",
|
||||
"integrity": "sha512-j0m+vLQuG5XAYoHtGCVu0spvlGreR3EzpECUVzkFmI1mTVnAO38l/NEPDCFgZ177JxzYJCLSmTQibIiYPilGrA==",
|
||||
"license": "OFL-1.1",
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ayuhito"
|
||||
}
|
||||
},
|
||||
"node_modules/@fontsource-variable/geist-mono": {
|
||||
"version": "5.3.0",
|
||||
"resolved": "https://registry.npmjs.org/@fontsource-variable/geist-mono/-/geist-mono-5.3.0.tgz",
|
||||
"integrity": "sha512-vBbuwDEo9AkrqADMXOrlAR3DFcJi4/JxeuU43FoiQERnNwsfXNnvxvReZG02cQKmyk4DZkZdBZX3oTDvy2zBAw==",
|
||||
"license": "OFL-1.1",
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ayuhito"
|
||||
}
|
||||
},
|
||||
"node_modules/@jridgewell/gen-mapping": {
|
||||
"version": "0.3.13",
|
||||
"resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.13.tgz",
|
||||
|
||||
@@ -15,6 +15,8 @@
|
||||
"@dnd-kit/modifiers": "^9.0.0",
|
||||
"@dnd-kit/sortable": "^10.0.0",
|
||||
"@dnd-kit/utilities": "^3.2.2",
|
||||
"@fontsource-variable/geist": "^5.3.0",
|
||||
"@fontsource-variable/geist-mono": "^5.3.0",
|
||||
"@tanstack/react-query": "^5.101.2",
|
||||
"@tanstack/react-table": "^8.21.3",
|
||||
"@tanstack/react-virtual": "^3.14.5",
|
||||
|
||||
+43
-35
@@ -24,6 +24,7 @@ import { PathMappingDialog } from './components/PathMappingDialog'
|
||||
import { HistoryPanel } from './components/HistoryPanel'
|
||||
import { PrepStrip } from './components/PrepStrip'
|
||||
import { ImportDialog } from './components/ImportDialog'
|
||||
import { Icon } from './lib/icons'
|
||||
|
||||
function applyFilters(tracks: Track[], f: Filters): Track[] {
|
||||
const q = f.search.trim().toLowerCase()
|
||||
@@ -506,7 +507,7 @@ export default function App() {
|
||||
|
||||
if (collection.isLoading || (loaded && !capabilities.data)) {
|
||||
return (
|
||||
<div className="flex h-screen w-screen items-center justify-center bg-ink-950 text-muted">
|
||||
<div className="flex h-screen w-screen items-center justify-center text-muted">
|
||||
Loading…
|
||||
</div>
|
||||
)
|
||||
@@ -759,7 +760,7 @@ export default function App() {
|
||||
{ heading: 'Exports', empty: exportSets.data?.length ? undefined : 'No exports yet' },
|
||||
...(exportSets.data ?? []).map((set) => ({
|
||||
label: set.name,
|
||||
icon: '◈',
|
||||
icon: <Icon name="export" size={13} />,
|
||||
onClick: () => addToExport(set.id, ids),
|
||||
})),
|
||||
]
|
||||
@@ -767,7 +768,9 @@ export default function App() {
|
||||
|
||||
return (
|
||||
<CapabilitiesContext.Provider value={capabilities.data!}>
|
||||
<div className="flex h-screen w-screen flex-col overflow-hidden bg-ink-950">
|
||||
{/* Floating glass panels with gaps between them: the ambient backdrop
|
||||
(main.tsx) shows through the gutters as well as through the glass. */}
|
||||
<div className="flex h-screen w-screen flex-col gap-3 overflow-hidden p-3">
|
||||
<Toast toast={toast} onClose={() => setToast(null)} />
|
||||
{menu && (
|
||||
<ContextMenu
|
||||
@@ -907,7 +910,7 @@ export default function App() {
|
||||
/>
|
||||
</CapabilitiesContext.Provider>
|
||||
|
||||
<div className="flex min-h-0 flex-1 overflow-hidden">
|
||||
<div className="flex min-h-0 flex-1 gap-3">
|
||||
<Sidebar
|
||||
source={source}
|
||||
onSelect={selectSource}
|
||||
@@ -920,20 +923,23 @@ export default function App() {
|
||||
/>
|
||||
|
||||
<CapabilitiesContext.Provider value={viewCaps}>
|
||||
<main className="relative flex min-w-0 flex-1 flex-col">
|
||||
<main className="glass relative flex min-w-0 flex-1 flex-col overflow-hidden">
|
||||
{/* Search / filters — always visible. Columns are chosen by right-clicking the header. */}
|
||||
<Toolbar
|
||||
filters={filters}
|
||||
onChange={setFilters}
|
||||
/>
|
||||
{(!isAll || viewingDevice) && (
|
||||
<div className="flex items-center gap-3 border-b border-line bg-ink-900 px-4 py-2">
|
||||
<div className="flex items-center gap-3 border-b border-line px-4 py-2">
|
||||
<span
|
||||
className={`text-[11px] ${
|
||||
className={`flex ${
|
||||
viewingDevice ? 'text-gold' : viewingExport ? 'text-gold' : 'text-accent'
|
||||
}`}
|
||||
>
|
||||
{viewingDevice ? '⬒' : viewingExport ? (source.kind === 'export' ? '◈' : '♫') : '♫'}
|
||||
<Icon
|
||||
name={viewingDevice ? 'drive' : viewingExport && source.kind === 'export' ? 'export' : 'playlist'}
|
||||
size={15}
|
||||
/>
|
||||
</span>
|
||||
<span className="font-semibold text-text">{viewName}</span>
|
||||
{viewingExport ? (
|
||||
@@ -949,7 +955,7 @@ export default function App() {
|
||||
: ' · live — what ships is whatever this playlist holds at export time'}
|
||||
</span>
|
||||
<span className="ml-auto flex items-center gap-2">
|
||||
<span className="rounded bg-ink-800 px-1.5 py-0.5 text-[10px] uppercase tracking-wide text-gold">
|
||||
<span className="rounded-full bg-gold/10 px-2 py-0.5 text-[10px] uppercase tracking-wide text-gold shadow-[inset_0_0_0_1px_rgb(255_200_97/0.3)]">
|
||||
Export
|
||||
</span>
|
||||
</span>
|
||||
@@ -962,12 +968,12 @@ export default function App() {
|
||||
: `${tracks.length} tracks`}
|
||||
</span>
|
||||
<span className="ml-auto flex items-center gap-2">
|
||||
<span className="rounded bg-ink-800 px-1.5 py-0.5 text-[10px] uppercase tracking-wide text-gold">
|
||||
<span className="rounded-full bg-gold/10 px-2 py-0.5 text-[10px] uppercase tracking-wide text-gold shadow-[inset_0_0_0_1px_rgb(255_200_97/0.3)]">
|
||||
Device · read-only
|
||||
</span>
|
||||
<button
|
||||
onClick={() => setImporting(true)}
|
||||
className="rounded-md bg-accent px-2 py-1 text-xs font-medium text-ink-950 hover:brightness-110"
|
||||
className="btn-primary rounded-full px-3 py-1 text-xs font-semibold"
|
||||
>
|
||||
Import{source.kind === 'device-playlist' ? ' this playlist' : ' everything'}…
|
||||
</button>
|
||||
@@ -1122,33 +1128,35 @@ export default function App() {
|
||||
|
||||
</div>
|
||||
|
||||
<StatusBar
|
||||
showing={filtered.length}
|
||||
total={tracks.length}
|
||||
sourceName={viewName}
|
||||
selected={viewingDevice ? 0 : selected.size}
|
||||
job={
|
||||
batchJob
|
||||
? {
|
||||
label: batchJob.kind === 'grid' ? 'Analyzing grids' : 'Placing hotcues',
|
||||
done: batchJobStatus.data?.done ?? 0,
|
||||
total: batchJobStatus.data?.total ?? 0,
|
||||
detail: batchJobStatus.data?.message,
|
||||
cancelling: batchCancelling,
|
||||
onCancel: () => {
|
||||
setBatchCancelling(true)
|
||||
api.cancelJob(batchJob.id).catch((e) => onError((e as Error).message))
|
||||
},
|
||||
}
|
||||
: null
|
||||
}
|
||||
loading={loading}
|
||||
collectionName={capabilities.data ? libraryName : null}
|
||||
onChangeCollection={() => setForcePicker(true)}
|
||||
/>
|
||||
</main>
|
||||
</CapabilitiesContext.Provider>
|
||||
</div>
|
||||
|
||||
{/* A slim capsule of its own under both columns, as on the deck above. */}
|
||||
<StatusBar
|
||||
showing={filtered.length}
|
||||
total={tracks.length}
|
||||
sourceName={viewName}
|
||||
selected={viewingDevice ? 0 : selected.size}
|
||||
job={
|
||||
batchJob
|
||||
? {
|
||||
label: batchJob.kind === 'grid' ? 'Analyzing grids' : 'Placing hotcues',
|
||||
done: batchJobStatus.data?.done ?? 0,
|
||||
total: batchJobStatus.data?.total ?? 0,
|
||||
detail: batchJobStatus.data?.message,
|
||||
cancelling: batchCancelling,
|
||||
onCancel: () => {
|
||||
setBatchCancelling(true)
|
||||
api.cancelJob(batchJob.id).catch((e) => onError((e as Error).message))
|
||||
},
|
||||
}
|
||||
: null
|
||||
}
|
||||
loading={loading}
|
||||
collectionName={capabilities.data ? libraryName : null}
|
||||
onChangeCollection={() => setForcePicker(true)}
|
||||
/>
|
||||
</div>
|
||||
</CapabilitiesContext.Provider>
|
||||
)
|
||||
|
||||
@@ -29,12 +29,23 @@ export interface Track {
|
||||
filepath: string | null
|
||||
cue_count: number
|
||||
hotcue_count: number
|
||||
/** The occupied hotcue slots, ordered by slot — what the table's Cues column
|
||||
* draws as dots. Empty until corrected where cues load lazily (OneLibrary),
|
||||
* exactly like `hotcue_count`. */
|
||||
hotcues: HotcueChip[]
|
||||
/** 0 = no beatgrid, 1 = constant tempo, >1 = a flexible (multi-tempo) grid. */
|
||||
grid_marker_count: number
|
||||
grid_locked: boolean
|
||||
media_kind: MediaKind
|
||||
}
|
||||
|
||||
/** One occupied hotcue slot, as the library table previews it. */
|
||||
export interface HotcueChip {
|
||||
slot: number
|
||||
type: CueType
|
||||
color: string | null // "#RRGGBB" as the platform stored it
|
||||
}
|
||||
|
||||
export interface TrackPage {
|
||||
total: number
|
||||
offset: number
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
/**
|
||||
* The drifting wash of colour every glass surface sits on. Its colours are CSS
|
||||
* custom properties set by `lib/ambient.ts` from the loaded track's cover art,
|
||||
* so this renders once and never re-renders on a track change.
|
||||
*
|
||||
* Fixed behind the whole app (and pointer-transparent). The drift is transform
|
||||
* only, so it stays on the compositor; reduced motion stops it.
|
||||
*/
|
||||
export function AmbientBackdrop() {
|
||||
return (
|
||||
<div aria-hidden className="ambient pointer-events-none fixed inset-0 -z-10 overflow-hidden bg-ink-950">
|
||||
<div className="ambient-wash" style={{ left: '-12%', top: '-30%', width: '58vw', height: '58vw', background: 'radial-gradient(circle, var(--amb-1) 0%, transparent 64%)', opacity: 0.75, animation: 'drift-a 28s ease-in-out infinite alternate' }} />
|
||||
<div className="ambient-wash" style={{ left: '42%', top: '-38%', width: '64vw', height: '54vw', background: 'radial-gradient(circle, var(--amb-2) 0%, transparent 62%)', opacity: 0.55, animation: 'drift-b 34s ease-in-out infinite alternate' }} />
|
||||
<div className="ambient-wash" style={{ left: '66%', top: '40%', width: '54vw', height: '54vw', background: 'radial-gradient(circle, var(--amb-3) 0%, transparent 62%)', opacity: 0.5, animation: 'drift-c 30s ease-in-out infinite alternate' }} />
|
||||
<div className="ambient-wash" style={{ left: '8%', top: '56%', width: '50vw', height: '44vw', background: 'radial-gradient(circle, var(--amb-4) 0%, transparent 64%)', opacity: 0.45, animation: 'drift-b 40s ease-in-out infinite alternate' }} />
|
||||
{/* Vignette: keeps the edges and the table's lower rows calm. */}
|
||||
<div className="absolute inset-0" style={{ background: 'radial-gradient(120% 90% at 50% 0%, rgb(5 6 10 / 0) 0%, rgb(5 6 10 / 0.55) 70%, rgb(5 6 10 / 0.85) 100%)' }} />
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@@ -26,11 +26,11 @@ export function AnalyzeGridDialog({ total, existing, locked, onChoose, onClose }
|
||||
return (
|
||||
<div
|
||||
aria-modal="true"
|
||||
className="fixed inset-0 z-40 flex items-center justify-center bg-black/60 p-6"
|
||||
className="fixed inset-0 z-40 flex items-center justify-center bg-black/40 backdrop-blur-[3px] p-6"
|
||||
onClick={onClose}
|
||||
>
|
||||
<div
|
||||
className="w-full max-w-sm overflow-hidden rounded-xl border border-line bg-ink-900 shadow-2xl"
|
||||
className="w-full max-w-sm overflow-hidden glass-overlay"
|
||||
onClick={(e) => e.stopPropagation()}
|
||||
>
|
||||
<div className="border-b border-line px-5 py-4">
|
||||
@@ -71,7 +71,7 @@ export function AnalyzeGridDialog({ total, existing, locked, onChoose, onClose }
|
||||
{canSkip && (
|
||||
<button
|
||||
onClick={() => onChoose(false)}
|
||||
className="rounded-md bg-accent px-4 py-1.5 text-sm font-medium text-ink-950 hover:brightness-110"
|
||||
className="rounded-full btn-primary px-4 py-1.5 text-sm font-semibold"
|
||||
>
|
||||
Skip {existing === 1 ? 'it' : 'them'}
|
||||
</button>
|
||||
|
||||
@@ -152,9 +152,9 @@ export function AutoCueDialog(props: Props) {
|
||||
}
|
||||
|
||||
return (
|
||||
<div aria-modal="true" className="fixed inset-0 z-40 flex items-center justify-center bg-black/60 p-6" onClick={() => !busy && onClose()}>
|
||||
<div aria-modal="true" className="fixed inset-0 z-40 flex items-center justify-center bg-black/40 backdrop-blur-[3px] p-6" onClick={() => !busy && onClose()}>
|
||||
<div
|
||||
className="flex max-h-[85vh] w-full max-w-xl flex-col overflow-hidden rounded-xl border border-line bg-ink-900 shadow-2xl"
|
||||
className="flex max-h-[85vh] w-full max-w-xl flex-col overflow-hidden glass-overlay"
|
||||
onClick={(e) => e.stopPropagation()}
|
||||
>
|
||||
<div className="border-b border-line px-5 py-4">
|
||||
@@ -281,7 +281,7 @@ export function AutoCueDialog(props: Props) {
|
||||
<button
|
||||
onClick={confirm}
|
||||
disabled={busy || rows === null || active === 0}
|
||||
className="rounded-md bg-accent px-4 py-1.5 text-sm font-semibold text-ink-950 hover:brightness-110 disabled:opacity-40"
|
||||
className="rounded-full btn-primary px-4 py-1.5 text-sm font-semibold disabled:opacity-40"
|
||||
>
|
||||
{busy
|
||||
? props.batch
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import { Icon } from '../lib/icons'
|
||||
|
||||
/** Jump-size cycle, in beats. Fractional sizes allow fine micro-nudging. */
|
||||
export const BEAT_JUMP_SIZES = [0.25, 0.5, 1, 2, 4, 8, 16, 32]
|
||||
|
||||
@@ -13,9 +15,8 @@ interface Props {
|
||||
}
|
||||
|
||||
const BTN =
|
||||
'flex h-7 w-7 shrink-0 items-center justify-center rounded border border-line bg-ink-850 ' +
|
||||
'text-xs font-semibold text-text transition-colors hover:border-accent disabled:opacity-30 ' +
|
||||
'disabled:hover:border-line'
|
||||
'btn-glass flex h-7 w-7 shrink-0 items-center justify-center rounded-lg ' +
|
||||
'font-mono text-xs font-semibold text-text disabled:opacity-30'
|
||||
|
||||
/** Beats-only readout: 0.25 → "1/4", 0.5 → "1/2", else the integer. */
|
||||
function sizeLabel(beats: number): string {
|
||||
@@ -46,7 +47,7 @@ export function BeatJumpControls({ beats, onStep, onJump, disabled }: Props) {
|
||||
>
|
||||
−
|
||||
</button>
|
||||
<span className="w-9 text-center text-xs font-semibold tabular-nums text-text">
|
||||
<span className="w-9 text-center font-mono text-xs font-semibold text-text">
|
||||
{sizeLabel(beats)}
|
||||
</span>
|
||||
<button
|
||||
@@ -64,7 +65,7 @@ export function BeatJumpControls({ beats, onStep, onJump, disabled }: Props) {
|
||||
disabled={disabled}
|
||||
title="Jump back (←)"
|
||||
>
|
||||
◀
|
||||
<Icon name="chevronLeft" size={14} strokeWidth={2.2} />
|
||||
</button>
|
||||
<button
|
||||
className={BTN}
|
||||
@@ -72,7 +73,7 @@ export function BeatJumpControls({ beats, onStep, onJump, disabled }: Props) {
|
||||
disabled={disabled}
|
||||
title="Jump forward (→)"
|
||||
>
|
||||
▶
|
||||
<Icon name="chevronRight" size={14} strokeWidth={2.2} />
|
||||
</button>
|
||||
</div>
|
||||
)
|
||||
|
||||
@@ -120,8 +120,8 @@ export function CollectionPicker({ onOpened, onCancel }: Props) {
|
||||
const openError = open.isError ? (open.error as Error).message : null
|
||||
|
||||
return (
|
||||
<div className="flex h-screen w-screen items-center justify-center bg-ink-950 p-6">
|
||||
<div className="flex h-[600px] w-full max-w-2xl flex-col overflow-hidden rounded-xl border border-line bg-ink-900 shadow-2xl">
|
||||
<div className="flex h-screen w-screen items-center justify-center p-6">
|
||||
<div className="glass flex h-[600px] w-full max-w-2xl flex-col overflow-hidden">
|
||||
{/* Header */}
|
||||
<div className="flex items-center gap-3 border-b border-line px-5 py-4">
|
||||
<div className="min-w-0 flex-1">
|
||||
@@ -274,7 +274,7 @@ export function CollectionPicker({ onOpened, onCancel }: Props) {
|
||||
<button
|
||||
disabled={!here || open.isPending}
|
||||
onClick={() => here && open.mutate(here)}
|
||||
className="shrink-0 rounded-md bg-accent px-3 py-1.5 text-sm font-medium text-ink-950 hover:brightness-110 disabled:cursor-not-allowed disabled:opacity-40"
|
||||
className="shrink-0 rounded-full btn-primary px-3 py-1.5 text-sm font-semibold disabled:cursor-not-allowed disabled:opacity-40"
|
||||
>
|
||||
{open.isPending ? 'Opening…' : 'Open this folder'}
|
||||
</button>
|
||||
@@ -302,12 +302,12 @@ export function CollectionPicker({ onOpened, onCancel }: Props) {
|
||||
? '…or paste a full path to the drive'
|
||||
: `…or paste a full path to ${platform!.library_label}`
|
||||
}
|
||||
className="min-w-0 flex-1 rounded-md border border-line bg-ink-850 px-3 py-2 font-mono text-xs text-text outline-none placeholder:text-faint focus:border-accent"
|
||||
className="min-w-0 flex-1 rounded-lg well px-3 py-2 font-mono text-xs text-text outline-none placeholder:text-faint focus:ring-1 focus:ring-accent"
|
||||
/>
|
||||
<button
|
||||
disabled={!manual.trim() || open.isPending}
|
||||
onClick={() => open.mutate(manual.trim())}
|
||||
className="rounded-md bg-accent px-4 py-2 text-sm font-medium text-ink-950 hover:brightness-110 disabled:cursor-not-allowed disabled:opacity-40"
|
||||
className="rounded-full btn-primary px-4 py-2 text-sm font-semibold disabled:cursor-not-allowed disabled:opacity-40"
|
||||
>
|
||||
{open.isPending ? 'Opening…' : 'Open'}
|
||||
</button>
|
||||
|
||||
@@ -46,11 +46,11 @@ export function ConfirmDialog({ title, body, confirmLabel, onConfirm, onClose }:
|
||||
return (
|
||||
<div
|
||||
aria-modal="true"
|
||||
className="fixed inset-0 z-40 flex items-center justify-center bg-black/60 p-6"
|
||||
className="fixed inset-0 z-40 flex items-center justify-center bg-black/40 backdrop-blur-[3px] p-6"
|
||||
onClick={() => !busy && onClose()}
|
||||
>
|
||||
<div
|
||||
className="w-full max-w-sm overflow-hidden rounded-xl border border-line bg-ink-900 shadow-2xl"
|
||||
className="w-full max-w-sm overflow-hidden glass-overlay"
|
||||
onClick={(e) => e.stopPropagation()}
|
||||
>
|
||||
<div className="border-b border-line px-5 py-4 text-[15px] font-semibold tracking-tight">
|
||||
@@ -68,7 +68,7 @@ export function ConfirmDialog({ title, body, confirmLabel, onConfirm, onClose }:
|
||||
<button
|
||||
onClick={() => void confirm()}
|
||||
disabled={busy}
|
||||
className="rounded-md bg-pink px-4 py-1.5 text-sm font-medium text-ink-950 hover:brightness-110 disabled:opacity-50"
|
||||
className="rounded-full bg-pink/15 shadow-[inset_0_1px_0_rgb(255_255_255/0.12),inset_0_0_0_1px_rgb(255_122_154/0.55)] hover:bg-pink/25 px-4 py-1.5 text-sm font-semibold text-[#ffd0da] disabled:opacity-50"
|
||||
>
|
||||
{confirmLabel}
|
||||
</button>
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
import type { ReactNode } from 'react'
|
||||
import { useEffect, useRef, useState } from 'react'
|
||||
import { Icon } from '../lib/icons'
|
||||
|
||||
/** One row of a menu: an action, a submenu (`label ▸`), or a section heading. */
|
||||
export type MenuItem =
|
||||
| { label: string; onClick: () => void; danger?: boolean; hint?: string; icon?: string; disabled?: boolean }
|
||||
| { label: string; onClick: () => void; danger?: boolean; hint?: string; icon?: ReactNode; disabled?: boolean }
|
||||
| { label: string; submenu: MenuItem[] }
|
||||
// Toggles in place and leaves the menu open, so several can be flipped in one go.
|
||||
| { label: string; checked: boolean; onToggle: () => void }
|
||||
@@ -54,7 +56,10 @@ export function ContextMenu({ x, y, items, onClose }: Props) {
|
||||
}, [])
|
||||
|
||||
return (
|
||||
<div ref={rootRef} role="menu" onClick={(e) => e.stopPropagation()}>
|
||||
// `contents`: the panels are fixed-positioned, so this wrapper must take no
|
||||
// part in layout. As an ordinary empty block it became one more item in
|
||||
// the app's gapped flex column and pushed every panel down by a gap.
|
||||
<div ref={rootRef} role="menu" className="contents" onClick={(e) => e.stopPropagation()}>
|
||||
<MenuPanel
|
||||
items={items}
|
||||
onClose={onClose}
|
||||
@@ -96,12 +101,12 @@ function MenuPanel({
|
||||
return (
|
||||
<>
|
||||
<div
|
||||
className={`fixed z-50 overflow-y-auto rounded-lg border border-line bg-ink-850 py-1 shadow-2xl ${className}`}
|
||||
className={`glass-overlay fixed z-50 overflow-y-auto rounded-2xl p-1.5 ${className}`}
|
||||
style={style}
|
||||
>
|
||||
{items.map((item, i) => {
|
||||
if ('separator' in item) {
|
||||
return <div key={i} className="my-1 border-t border-line" />
|
||||
return <div key={i} className="mx-2 my-1 border-t border-line" />
|
||||
}
|
||||
if ('checked' in item) {
|
||||
return (
|
||||
@@ -111,14 +116,14 @@ function MenuPanel({
|
||||
aria-checked={item.checked}
|
||||
onMouseEnter={() => setOpen(null)}
|
||||
onClick={item.onToggle}
|
||||
className="flex w-full items-center gap-2 px-3 py-1.5 text-left text-sm text-muted hover:bg-ink-800 hover:text-text"
|
||||
className="flex w-full items-center gap-2 rounded-[10px] px-3 py-1.5 text-left text-sm text-muted hover:bg-ink-800 hover:text-text"
|
||||
>
|
||||
<span
|
||||
className={`flex h-3.5 w-3.5 shrink-0 items-center justify-center rounded-sm border text-[10px] leading-none ${
|
||||
item.checked ? 'border-accent bg-accent text-ink-950' : 'border-ink-600'
|
||||
className={`flex h-3.5 w-3.5 shrink-0 items-center justify-center rounded border leading-none ${
|
||||
item.checked ? 'border-accent btn-primary' : 'border-ink-600'
|
||||
}`}
|
||||
>
|
||||
{item.checked ? '✓' : ''}
|
||||
{item.checked && <Icon name="check" size={10} strokeWidth={3.2} />}
|
||||
</span>
|
||||
<span className="min-w-0 flex-1 truncate">{item.label}</span>
|
||||
</button>
|
||||
@@ -140,12 +145,12 @@ function MenuPanel({
|
||||
key={i}
|
||||
onMouseEnter={(e) => openSubmenu(i, e.currentTarget)}
|
||||
onClick={(e) => openSubmenu(i, e.currentTarget)}
|
||||
className={`flex w-full items-center justify-between gap-4 px-3 py-1.5 text-left text-sm hover:bg-ink-800 hover:text-text ${
|
||||
className={`flex w-full items-center justify-between gap-4 rounded-[10px] px-3 py-1.5 text-left text-sm hover:bg-ink-800 hover:text-text ${
|
||||
open?.index === i ? 'bg-ink-800 text-text' : 'text-muted'
|
||||
}`}
|
||||
>
|
||||
<span>{item.label}</span>
|
||||
<span className="text-[10px] text-faint">▸</span>
|
||||
<Icon name="chevronRight" size={12} strokeWidth={2.4} className="text-faint" />
|
||||
</button>
|
||||
)
|
||||
}
|
||||
@@ -158,7 +163,7 @@ function MenuPanel({
|
||||
item.onClick()
|
||||
onClose()
|
||||
}}
|
||||
className={`flex w-full items-center gap-2 px-3 py-1.5 text-left text-sm ${
|
||||
className={`flex w-full items-center gap-2 rounded-[10px] px-3 py-1.5 text-left text-sm ${
|
||||
item.disabled
|
||||
? 'cursor-default text-faint'
|
||||
: item.danger
|
||||
@@ -166,10 +171,10 @@ function MenuPanel({
|
||||
: 'text-muted hover:bg-ink-800 hover:text-text'
|
||||
}`}
|
||||
>
|
||||
{item.icon && <span className="shrink-0 text-[11px] text-gold">{item.icon}</span>}
|
||||
{item.icon && <span className="flex shrink-0 text-gold">{item.icon}</span>}
|
||||
<span className="min-w-0 flex-1 truncate">{item.label}</span>
|
||||
{item.hint && (
|
||||
<span className="shrink-0 text-[10px] tabular-nums text-faint">{item.hint}</span>
|
||||
<span className="shrink-0 font-mono text-[10px] text-faint">{item.hint}</span>
|
||||
)}
|
||||
</button>
|
||||
)
|
||||
|
||||
@@ -2,6 +2,7 @@ import { useEffect } from 'react'
|
||||
import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query'
|
||||
import { api, type PlaylistNode } from '../api'
|
||||
import type { Source } from './Sidebar'
|
||||
import { Icon } from '../lib/icons'
|
||||
|
||||
/**
|
||||
* Plugged-in libraries, in the sidebar, the way rekordbox and Traktor show them.
|
||||
@@ -107,11 +108,11 @@ export function DevicesSection({ source, onSelect, onError, onImport }: Props) {
|
||||
}
|
||||
className={`flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left text-sm transition-colors ${
|
||||
isOpen && source.kind === 'device'
|
||||
? 'bg-accent-soft text-text'
|
||||
? 'is-selected text-text'
|
||||
: 'text-muted hover:bg-ink-800 hover:text-text'
|
||||
}`}
|
||||
>
|
||||
<span className="w-3 text-center text-[11px] text-gold">⬒</span>
|
||||
<span className="flex w-4 justify-center text-gold"><Icon name="drive" size={15} /></span>
|
||||
<span className="flex-1 truncate" title={d.path}>
|
||||
{d.label}
|
||||
</span>
|
||||
@@ -140,7 +141,7 @@ export function DevicesSection({ source, onSelect, onError, onImport }: Props) {
|
||||
{viewingDevice && openPath && (
|
||||
<button
|
||||
onClick={onImport}
|
||||
className="mt-2 mb-1 w-full rounded-md bg-accent px-2 py-1.5 text-sm font-medium text-ink-950 hover:brightness-110"
|
||||
className="mt-2 mb-1 w-full rounded-full btn-primary px-2 py-1.5 text-sm font-semibold"
|
||||
>
|
||||
Import to collection…
|
||||
</button>
|
||||
@@ -178,14 +179,14 @@ function DevicePlaylistRow({
|
||||
style={{ paddingLeft: 8 + depth * 12 }}
|
||||
className={`flex w-full items-center gap-2 rounded-md py-1 pr-2 text-left text-sm transition-colors ${
|
||||
selected
|
||||
? 'bg-accent-soft text-text'
|
||||
? 'is-selected text-text'
|
||||
: node.selectable
|
||||
? 'text-muted hover:bg-ink-800 hover:text-text'
|
||||
: 'text-faint'
|
||||
}`}
|
||||
>
|
||||
<span className="w-3 text-center text-[11px] text-faint">
|
||||
{isFolder ? '▸' : '♫'}
|
||||
<span className="flex w-4 justify-center text-faint">
|
||||
<Icon name={isFolder ? 'folder' : 'playlist'} size={14} />
|
||||
</span>
|
||||
<span className="flex-1 truncate">{node.name}</span>
|
||||
{!isFolder && <span className="text-[10px] text-faint">{node.count}</span>}
|
||||
|
||||
@@ -97,11 +97,11 @@ export function EditTagsDialog({ track, onClose, onApplied, onError }: Props) {
|
||||
|
||||
return (
|
||||
<div
|
||||
aria-modal="true" className="fixed inset-0 z-40 flex items-center justify-center bg-black/60 p-6"
|
||||
aria-modal="true" className="fixed inset-0 z-40 flex items-center justify-center bg-black/40 backdrop-blur-[3px] p-6"
|
||||
onClick={onClose}
|
||||
>
|
||||
<div
|
||||
className="flex max-h-[85vh] w-full max-w-lg flex-col overflow-hidden rounded-xl border border-line bg-ink-900 shadow-2xl"
|
||||
className="flex max-h-[85vh] w-full max-w-lg flex-col overflow-hidden glass-overlay"
|
||||
onClick={(e) => e.stopPropagation()}
|
||||
>
|
||||
<div className="border-b border-line px-5 py-4">
|
||||
@@ -173,14 +173,14 @@ export function EditTagsDialog({ track, onClose, onApplied, onError }: Props) {
|
||||
value={form[key]}
|
||||
onChange={(e) => setForm({ ...form, [key]: e.target.value })}
|
||||
rows={2}
|
||||
className="w-full resize-y rounded-md border border-line bg-ink-850 px-2.5 py-1.5 text-sm text-text outline-none focus:border-accent"
|
||||
className="w-full resize-y rounded-lg well px-2.5 py-1.5 text-sm text-text outline-none focus:ring-1 focus:ring-accent"
|
||||
/>
|
||||
) : (
|
||||
<input
|
||||
value={form[key]}
|
||||
onChange={(e) => setForm({ ...form, [key]: e.target.value })}
|
||||
list={key === 'genre' ? 'genre-suggestions' : undefined}
|
||||
className="w-full rounded-md border border-line bg-ink-850 px-2.5 py-1.5 text-sm text-text outline-none focus:border-accent"
|
||||
className="w-full rounded-lg well px-2.5 py-1.5 text-sm text-text outline-none focus:ring-1 focus:ring-accent"
|
||||
/>
|
||||
)}
|
||||
</label>
|
||||
@@ -241,7 +241,7 @@ export function EditTagsDialog({ track, onClose, onApplied, onError }: Props) {
|
||||
<button
|
||||
onClick={submit}
|
||||
disabled={apply.isPending}
|
||||
className="rounded-md bg-accent px-4 py-1.5 text-sm font-medium text-ink-950 hover:brightness-110 disabled:opacity-50"
|
||||
className="rounded-full btn-primary px-4 py-1.5 text-sm font-semibold disabled:opacity-50"
|
||||
>
|
||||
{apply.isPending ? 'Applying…' : 'Apply'}
|
||||
</button>
|
||||
|
||||
@@ -67,8 +67,8 @@ export function ExportDialog({ editing, onClose, onSaved, onError }: Props) {
|
||||
onClose={() => setBrowsing(false)}
|
||||
/>
|
||||
)}
|
||||
<div aria-modal="true" className="fixed inset-0 z-50 flex items-center justify-center bg-black/60 p-4">
|
||||
<div className="w-full max-w-lg rounded-lg border border-line bg-ink-900 shadow-xl">
|
||||
<div aria-modal="true" className="fixed inset-0 z-50 flex items-center justify-center bg-black/40 backdrop-blur-[3px] p-4">
|
||||
<div className="w-full max-w-lg glass-overlay">
|
||||
<div className="border-b border-line px-5 py-3">
|
||||
<h2 className="text-sm font-semibold text-text">
|
||||
{editing ? `Edit “${editing.name}”` : 'New export'}
|
||||
@@ -86,7 +86,7 @@ export function ExportDialog({ editing, onClose, onSaved, onError }: Props) {
|
||||
onKeyDown={(e) => {
|
||||
if (e.key === 'Enter' && valid && !busy) save()
|
||||
}}
|
||||
className="w-full rounded-md border border-line bg-ink-950 px-2 py-1.5 text-sm text-text outline-none focus:border-accent"
|
||||
className="w-full rounded-md well px-2 py-1.5 text-sm text-text outline-none focus:ring-1 focus:ring-accent"
|
||||
/>
|
||||
</div>
|
||||
|
||||
@@ -124,13 +124,13 @@ export function ExportDialog({ editing, onClose, onSaved, onError }: Props) {
|
||||
<span
|
||||
title={destination}
|
||||
dir="rtl"
|
||||
className="min-w-0 flex-1 truncate rounded-md border border-line bg-ink-950 px-2 py-1.5 font-mono text-xs text-text"
|
||||
className="min-w-0 flex-1 truncate rounded-md well px-2 py-1.5 font-mono text-xs text-text"
|
||||
>
|
||||
{destination || 'Choose a folder…'}
|
||||
</span>
|
||||
<button
|
||||
onClick={() => setBrowsing(true)}
|
||||
className="shrink-0 rounded-md border border-line px-3 py-1.5 text-sm text-muted hover:text-text"
|
||||
className="shrink-0 btn-glass rounded-full px-3 py-1.5 text-sm text-muted hover:text-text"
|
||||
>
|
||||
Browse…
|
||||
</button>
|
||||
@@ -140,7 +140,7 @@ export function ExportDialog({ editing, onClose, onSaved, onError }: Props) {
|
||||
every track, in your own folder structure.
|
||||
</div>
|
||||
{conflict && (
|
||||
<div className="mt-2 rounded border border-line bg-ink-950 px-3 py-2 text-xs text-gold">
|
||||
<div className="mt-2 rounded well px-3 py-2 text-xs text-gold">
|
||||
“{conflict}” already exports here. Exporting replaces whatever the other one
|
||||
wrote.
|
||||
</div>
|
||||
@@ -151,14 +151,14 @@ export function ExportDialog({ editing, onClose, onSaved, onError }: Props) {
|
||||
<div className="flex justify-end gap-2 border-t border-line px-5 py-3">
|
||||
<button
|
||||
onClick={onClose}
|
||||
className="rounded-md border border-line px-3 py-1.5 text-sm text-muted hover:text-text"
|
||||
className="btn-glass rounded-full px-3 py-1.5 text-sm text-muted hover:text-text"
|
||||
>
|
||||
Cancel
|
||||
</button>
|
||||
<button
|
||||
disabled={!valid || busy}
|
||||
onClick={save}
|
||||
className="rounded-md bg-accent px-3 py-1.5 text-sm font-medium text-ink-950 hover:brightness-110 disabled:opacity-40"
|
||||
className="rounded-full btn-primary px-3 py-1.5 text-sm font-semibold disabled:opacity-40"
|
||||
>
|
||||
{busy ? 'Saving…' : editing ? 'Save' : 'Create'}
|
||||
</button>
|
||||
|
||||
@@ -101,8 +101,8 @@ export function ExportRunDialog({ set, onClose, onDone, onError }: Props) {
|
||||
const blocked = p?.blocked ?? null
|
||||
|
||||
return (
|
||||
<div aria-modal="true" className="fixed inset-0 z-50 flex items-center justify-center bg-black/60 p-4">
|
||||
<div className="w-full max-w-lg rounded-lg border border-line bg-ink-900 shadow-xl">
|
||||
<div aria-modal="true" className="fixed inset-0 z-50 flex items-center justify-center bg-black/40 backdrop-blur-[3px] p-4">
|
||||
<div className="w-full max-w-lg glass-overlay">
|
||||
<div className="border-b border-line px-5 py-3">
|
||||
<h2 className="text-sm font-semibold text-text">Export “{set.name}”</h2>
|
||||
</div>
|
||||
@@ -115,7 +115,7 @@ export function ExportRunDialog({ set, onClose, onDone, onError }: Props) {
|
||||
<div
|
||||
dir="rtl"
|
||||
title={set.destination}
|
||||
className="truncate rounded-md border border-line bg-ink-950 px-2 py-1.5 font-mono text-xs text-text"
|
||||
className="truncate rounded-md well px-2 py-1.5 font-mono text-xs text-text"
|
||||
>
|
||||
{set.destination}
|
||||
</div>
|
||||
@@ -143,14 +143,14 @@ export function ExportRunDialog({ set, onClose, onDone, onError }: Props) {
|
||||
{/* Reported and skipped, not a failure halfway through a long
|
||||
copy. A gig stick short four tracks must never be silent. */}
|
||||
{p.missing.length > 0 && (
|
||||
<div className="rounded border border-line bg-ink-950 px-3 py-2 text-xs text-pink">
|
||||
<div className="rounded well px-3 py-2 text-xs text-pink">
|
||||
{p.missing.length} track{p.missing.length === 1 ? '' : 's'} will be skipped —
|
||||
the audio file is not on this disk:
|
||||
<div className="mt-1 text-faint">{p.missing.slice(0, 4).join(', ')}</div>
|
||||
</div>
|
||||
)}
|
||||
{p.replacing && (
|
||||
<div className="rounded border border-line bg-ink-950 px-3 py-2 text-xs text-gold">
|
||||
<div className="rounded well px-3 py-2 text-xs text-gold">
|
||||
This folder already holds an export. Its files will be replaced.
|
||||
</div>
|
||||
)}
|
||||
@@ -162,19 +162,19 @@ export function ExportRunDialog({ set, onClose, onDone, onError }: Props) {
|
||||
)}
|
||||
|
||||
{blocked === 'destination_not_empty' && (
|
||||
<div className="rounded border border-pink/40 bg-ink-950 px-3 py-2 text-xs text-pink">
|
||||
<div className="rounded border border-pink/40 bg-well px-3 py-2 text-xs text-pink">
|
||||
That folder already has files in it that Konduktor didn’t put there. An export
|
||||
replaces what it wrote last time, so it will only write into an empty folder or
|
||||
one of its own. Edit the export and choose somewhere else.
|
||||
</div>
|
||||
)}
|
||||
{blocked === 'nothing_to_export' && (
|
||||
<div className="rounded border border-line bg-ink-950 px-3 py-2 text-xs text-muted">
|
||||
<div className="rounded well px-3 py-2 text-xs text-muted">
|
||||
There’s nothing to export yet — add some tracks or a playlist.
|
||||
</div>
|
||||
)}
|
||||
{blocked === 'unsupported_target' && (
|
||||
<div className="rounded border border-pink/40 bg-ink-950 px-3 py-2 text-xs text-pink">
|
||||
<div className="rounded border border-pink/40 bg-well px-3 py-2 text-xs text-pink">
|
||||
Konduktor can’t write that kind of library yet.
|
||||
</div>
|
||||
)}
|
||||
@@ -184,7 +184,7 @@ export function ExportRunDialog({ set, onClose, onDone, onError }: Props) {
|
||||
{job && (
|
||||
<div className="space-y-3">
|
||||
<div className="text-text">{job.message || 'Working…'}</div>
|
||||
<div className="h-2 overflow-hidden rounded-full bg-ink-950">
|
||||
<div className="h-2 overflow-hidden rounded-full bg-well">
|
||||
<div
|
||||
className={`h-full transition-[width] duration-200 ${
|
||||
job.state === 'failed' ? 'bg-pink' : 'bg-accent'
|
||||
@@ -225,7 +225,7 @@ export function ExportRunDialog({ set, onClose, onDone, onError }: Props) {
|
||||
<>
|
||||
<button
|
||||
onClick={cancel}
|
||||
className="rounded-md border border-line px-3 py-1.5 text-sm text-muted hover:text-text"
|
||||
className="btn-glass rounded-full px-3 py-1.5 text-sm text-muted hover:text-text"
|
||||
>
|
||||
Cancel export
|
||||
</button>
|
||||
@@ -241,7 +241,7 @@ export function ExportRunDialog({ set, onClose, onDone, onError }: Props) {
|
||||
<>
|
||||
<button
|
||||
onClick={onClose}
|
||||
className="rounded-md border border-line px-3 py-1.5 text-sm text-muted hover:text-text"
|
||||
className="btn-glass rounded-full px-3 py-1.5 text-sm text-muted hover:text-text"
|
||||
>
|
||||
{finished ? 'Close' : 'Cancel'}
|
||||
</button>
|
||||
@@ -251,7 +251,7 @@ export function ExportRunDialog({ set, onClose, onDone, onError }: Props) {
|
||||
starting || !p || !!blocked || p.exportable === 0 || p.enough_space === false
|
||||
}
|
||||
onClick={start}
|
||||
className="rounded-md bg-accent px-3 py-1.5 text-sm font-medium text-ink-950 hover:brightness-110 disabled:opacity-40"
|
||||
className="rounded-full btn-primary px-3 py-1.5 text-sm font-semibold disabled:opacity-40"
|
||||
>
|
||||
{starting ? 'Starting…' : `Export ${p && !blocked ? p.exportable : ''}`.trim()}
|
||||
</button>
|
||||
|
||||
@@ -4,6 +4,7 @@ import { api, type ExportSet } from '../api'
|
||||
import { ExportDialog } from './ExportDialog'
|
||||
import { ExportRunDialog } from './ExportRunDialog'
|
||||
import type { Source } from './Sidebar'
|
||||
import { Icon } from '../lib/icons'
|
||||
|
||||
/**
|
||||
* Exports in the sidebar: each one a named, persisted slice of the library
|
||||
@@ -166,21 +167,21 @@ function ExportRow({
|
||||
<div>
|
||||
<div
|
||||
className={`group flex w-full items-center gap-1 rounded-md pr-1 transition-colors ${
|
||||
selected ? 'bg-accent-soft text-text' : 'text-muted hover:bg-ink-800 hover:text-text'
|
||||
selected ? 'is-selected text-text' : 'text-muted hover:bg-ink-800 hover:text-text'
|
||||
}`}
|
||||
>
|
||||
<button
|
||||
title={expanded ? 'Collapse' : 'Expand'}
|
||||
onClick={() => setOpen((o) => !o)}
|
||||
className="w-4 shrink-0 py-1.5 text-center text-[10px] text-faint hover:text-text"
|
||||
className="flex w-4 shrink-0 justify-center py-1.5 text-faint hover:text-text"
|
||||
>
|
||||
{expanded ? '▾' : '▸'}
|
||||
<Icon name={expanded ? 'chevronDown' : 'chevronRight'} size={12} strokeWidth={2.4} />
|
||||
</button>
|
||||
<button
|
||||
onClick={() => onSelect({ kind: 'export', id: set.id, name: set.name })}
|
||||
className="flex min-w-0 flex-1 items-center gap-2 py-1.5 text-left text-sm"
|
||||
>
|
||||
<span className="w-3 shrink-0 text-center text-[11px] text-gold">◈</span>
|
||||
<span className="flex w-4 shrink-0 justify-center text-gold"><Icon name="export" size={14} /></span>
|
||||
<span className="flex-1 truncate" title={set.destination}>
|
||||
{set.name}
|
||||
</span>
|
||||
@@ -193,14 +194,14 @@ function ExportRow({
|
||||
onClick={onEdit}
|
||||
className="shrink-0 px-1 text-xs text-faint opacity-0 hover:text-text group-hover:opacity-100"
|
||||
>
|
||||
⚙
|
||||
<Icon name="settings" size={13} />
|
||||
</button>
|
||||
<button
|
||||
title="Delete this export"
|
||||
onClick={onDelete}
|
||||
className="shrink-0 px-1 text-xs text-faint opacity-0 hover:text-pink group-hover:opacity-100"
|
||||
>
|
||||
✕
|
||||
<Icon name="close" size={13} />
|
||||
</button>
|
||||
</div>
|
||||
|
||||
@@ -212,7 +213,7 @@ function ExportRow({
|
||||
<div
|
||||
key={p.id}
|
||||
className={`group flex items-center gap-1 rounded-md pr-1 ${
|
||||
chosen ? 'bg-accent-soft text-text' : 'text-muted hover:bg-ink-800 hover:text-text'
|
||||
chosen ? 'is-selected text-text' : 'text-muted hover:bg-ink-800 hover:text-text'
|
||||
}`}
|
||||
>
|
||||
<button
|
||||
@@ -228,7 +229,7 @@ function ExportRow({
|
||||
style={{ paddingLeft: 24 }}
|
||||
className="flex min-w-0 flex-1 items-center gap-2 py-1 text-left text-sm disabled:cursor-not-allowed"
|
||||
>
|
||||
<span className="w-3 shrink-0 text-center text-[11px] text-faint">♫</span>
|
||||
<span className="flex w-4 shrink-0 justify-center text-faint"><Icon name="playlist" size={14} /></span>
|
||||
{/* A playlist deleted since curation is SHOWN, not dropped:
|
||||
the set records the user's intent, and losing part of it
|
||||
silently is worse than showing something broken. */}
|
||||
@@ -244,7 +245,7 @@ function ExportRow({
|
||||
onClick={() => dropPlaylist.mutate(p.id)}
|
||||
className="shrink-0 px-1 text-xs text-faint opacity-0 hover:text-pink group-hover:opacity-100"
|
||||
>
|
||||
✕
|
||||
<Icon name="close" size={13} />
|
||||
</button>
|
||||
</div>
|
||||
)
|
||||
@@ -256,11 +257,11 @@ function ExportRow({
|
||||
style={{ paddingLeft: 24 }}
|
||||
className={`flex w-full items-center gap-2 rounded-md py-1 pr-2 text-left text-sm transition-colors ${
|
||||
source.kind === 'export-other' && source.exportId === set.id
|
||||
? 'bg-accent-soft text-text'
|
||||
? 'is-selected text-text'
|
||||
: 'text-muted hover:bg-ink-800 hover:text-text'
|
||||
}`}
|
||||
>
|
||||
<span className="w-3 shrink-0 text-center text-[11px] text-faint">◇</span>
|
||||
<span className="flex w-4 shrink-0 justify-center text-faint"><Icon name="music" size={14} /></span>
|
||||
<span className="flex-1 truncate">Other</span>
|
||||
<span className="shrink-0 text-[10px] tabular-nums text-faint">{data.loose}</span>
|
||||
</button>
|
||||
@@ -287,7 +288,7 @@ function ExportRow({
|
||||
<button
|
||||
onClick={onRun}
|
||||
style={{ marginLeft: 24 }}
|
||||
className="mb-1 mt-1 rounded-md bg-accent px-2 py-1 text-xs font-medium text-ink-950 hover:brightness-110"
|
||||
className="mb-1 mt-1 rounded-full btn-primary px-2 py-1 text-xs font-semibold"
|
||||
>
|
||||
Export {data.tracks} track{data.tracks === 1 ? '' : 's'}…
|
||||
</button>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import type { ReactNode } from 'react'
|
||||
import { useQuery } from '@tanstack/react-query'
|
||||
import { api, type FsListing, type FsPlace } from '../api'
|
||||
import { Icon, type IconName } from '../lib/icons'
|
||||
|
||||
/**
|
||||
* The one file browser. A places rail, a path bar, a listing.
|
||||
@@ -36,14 +37,14 @@ export function useFsListing(path: string | undefined, platform?: string) {
|
||||
// the sidebar's device poll: this is a shortcut list, not the thing you came for.
|
||||
const PLACES_POLL_MS = 5000
|
||||
|
||||
const ICONS: Record<FsPlace['kind'], string> = {
|
||||
home: '⌂',
|
||||
music: '♫',
|
||||
desktop: '🖥',
|
||||
documents: '🗎',
|
||||
downloads: '⬇',
|
||||
volume: '⬒',
|
||||
library: '◈',
|
||||
const ICONS: Record<FsPlace['kind'], IconName> = {
|
||||
home: 'home',
|
||||
music: 'music',
|
||||
desktop: 'desktop',
|
||||
documents: 'file',
|
||||
downloads: 'download',
|
||||
volume: 'drive',
|
||||
library: 'playlist',
|
||||
}
|
||||
|
||||
interface Props {
|
||||
@@ -85,7 +86,7 @@ export function FileBrowser({ mode, platform, path, onNavigate, onPickFile, foot
|
||||
{/* ---- Places rail. Navigates, never selects: one click here must not be
|
||||
able to open a library or commit an import destination, because a
|
||||
sidebar does not look like something that does that. ---- */}
|
||||
<div className="w-44 shrink-0 overflow-y-auto border-r border-line bg-ink-950/40 py-2">
|
||||
<div className="w-44 shrink-0 overflow-y-auto border-r border-line bg-well py-2">
|
||||
{groups.map((g) => (
|
||||
<div key={g.label} className="mb-2">
|
||||
<div className="px-3 pb-1 text-[10px] font-semibold uppercase tracking-wider text-faint">
|
||||
@@ -98,13 +99,13 @@ export function FileBrowser({ mode, platform, path, onNavigate, onPickFile, foot
|
||||
key={p.path}
|
||||
onClick={() => onNavigate(p.path)}
|
||||
title={p.path}
|
||||
className={`flex w-full items-center gap-2 px-3 py-1.5 text-left text-xs transition-colors ${
|
||||
className={`mx-1.5 flex w-[calc(100%-0.75rem)] items-center gap-2 rounded-[10px] px-2.5 py-1.5 text-left text-xs transition-colors ${
|
||||
active
|
||||
? 'bg-accent-soft text-text'
|
||||
? 'is-selected text-text'
|
||||
: 'text-muted hover:bg-ink-800 hover:text-text'
|
||||
}`}
|
||||
>
|
||||
<span className="w-3 shrink-0 text-center text-faint">{ICONS[p.kind]}</span>
|
||||
<span className="flex shrink-0 text-faint"><Icon name={ICONS[p.kind]} size={14} /></span>
|
||||
<span className="truncate">{p.name}</span>
|
||||
</button>
|
||||
)
|
||||
@@ -115,13 +116,13 @@ export function FileBrowser({ mode, platform, path, onNavigate, onPickFile, foot
|
||||
|
||||
{/* ---- Path bar + listing ---- */}
|
||||
<div className="flex min-w-0 flex-1 flex-col">
|
||||
<div className="flex items-center gap-2 border-b border-line bg-ink-850 px-4 py-2">
|
||||
<div className="flex items-center gap-2 border-b border-line px-4 py-2">
|
||||
<button
|
||||
title="Home"
|
||||
onClick={() => data?.home && onNavigate(data.home)}
|
||||
className="rounded px-2 py-1 text-sm text-muted hover:bg-ink-800 hover:text-text"
|
||||
className="rounded-lg px-2 py-1 text-sm text-muted hover:bg-ink-800 hover:text-text"
|
||||
>
|
||||
⌂
|
||||
<Icon name="home" size={15} />
|
||||
</button>
|
||||
<button
|
||||
title="Up one level"
|
||||
@@ -149,7 +150,7 @@ export function FileBrowser({ mode, platform, path, onNavigate, onPickFile, foot
|
||||
onClick={() => onNavigate(d.path)}
|
||||
className="flex w-full items-center gap-2 rounded-md px-3 py-2 text-left text-sm text-muted hover:bg-ink-800 hover:text-text"
|
||||
>
|
||||
<span className="text-faint">📁</span>
|
||||
<span className="flex text-faint"><Icon name="folder" size={15} /></span>
|
||||
<span className="truncate">{d.name}</span>
|
||||
</button>
|
||||
))}
|
||||
@@ -163,7 +164,7 @@ export function FileBrowser({ mode, platform, path, onNavigate, onPickFile, foot
|
||||
onClick={() => onPickFile?.(f.path)}
|
||||
className="flex w-full items-center gap-2 rounded-md px-3 py-2 text-left text-sm text-text hover:bg-accent-soft"
|
||||
>
|
||||
<span className="text-accent">♫</span>
|
||||
<span className="flex text-accent"><Icon name="music" size={15} /></span>
|
||||
<span className="truncate">{f.name}</span>
|
||||
<span className="ml-auto text-[10px] uppercase tracking-wider text-faint">
|
||||
open
|
||||
|
||||
@@ -31,8 +31,8 @@ export function FolderPicker({ value, onChange, onClose }: Props) {
|
||||
}
|
||||
|
||||
return (
|
||||
<div aria-modal="true" className="fixed inset-0 z-[60] flex items-center justify-center bg-black/60 p-4">
|
||||
<div className="flex h-[70vh] w-full max-w-2xl flex-col overflow-hidden rounded-lg border border-line bg-ink-900 shadow-xl">
|
||||
<div aria-modal="true" className="fixed inset-0 z-[60] flex items-center justify-center bg-black/40 backdrop-blur-[3px] p-4">
|
||||
<div className="flex h-[70vh] w-full max-w-2xl flex-col overflow-hidden glass-overlay">
|
||||
<div className="border-b border-line px-5 py-3">
|
||||
<h2 className="text-sm font-semibold text-text">Choose a folder</h2>
|
||||
</div>
|
||||
@@ -53,7 +53,7 @@ export function FolderPicker({ value, onChange, onClose }: Props) {
|
||||
onKeyDown={(e) => {
|
||||
if (e.key === 'Enter' && newFolder.trim() && here) confirm()
|
||||
}}
|
||||
className="min-w-0 flex-1 rounded-md border border-line bg-ink-950 px-2 py-1 text-xs text-text outline-none focus:border-accent"
|
||||
className="min-w-0 flex-1 rounded-md well px-2 py-1 text-xs text-text outline-none focus:ring-1 focus:ring-accent"
|
||||
/>
|
||||
</div>
|
||||
}
|
||||
@@ -67,14 +67,14 @@ export function FolderPicker({ value, onChange, onClose }: Props) {
|
||||
</span>
|
||||
<button
|
||||
onClick={onClose}
|
||||
className="shrink-0 rounded-md border border-line px-3 py-1.5 text-sm text-muted hover:text-text"
|
||||
className="shrink-0 btn-glass rounded-full px-3 py-1.5 text-sm text-muted hover:text-text"
|
||||
>
|
||||
Cancel
|
||||
</button>
|
||||
<button
|
||||
disabled={!here}
|
||||
onClick={confirm}
|
||||
className="shrink-0 rounded-md bg-accent px-3 py-1.5 text-sm font-medium text-ink-950 hover:brightness-110 disabled:opacity-40"
|
||||
className="shrink-0 rounded-full btn-primary px-3 py-1.5 text-sm font-semibold disabled:opacity-40"
|
||||
>
|
||||
Use this folder
|
||||
</button>
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { memo, useRef, useState } from 'react'
|
||||
import { Icon } from '../lib/icons'
|
||||
|
||||
interface Props {
|
||||
/** Tempo of the marker governing the playhead — what the tempo controls act
|
||||
@@ -48,9 +49,8 @@ function markerTime(t: number): string {
|
||||
}
|
||||
|
||||
const BTN =
|
||||
'flex flex-1 items-center justify-center rounded border border-line bg-ink-850 py-1 text-xs ' +
|
||||
'font-semibold text-text transition-colors hover:border-accent disabled:opacity-30 ' +
|
||||
'disabled:hover:border-line'
|
||||
'btn-glass flex flex-1 items-center justify-center gap-1 rounded-lg py-1 font-mono text-[11px] ' +
|
||||
'font-semibold text-text disabled:opacity-30'
|
||||
|
||||
/**
|
||||
* Beatgrid / tempo panel (Traktor grid-control equivalent): editable BPM, BPM
|
||||
@@ -114,7 +114,7 @@ export const GridControls = memo(function GridControls({
|
||||
return (
|
||||
<div className="flex flex-col gap-2">
|
||||
{/* BPM readout / editor */}
|
||||
<div className="text-center">
|
||||
<div className="well rounded-2xl px-3 py-2 text-center">
|
||||
{editing ? (
|
||||
<input
|
||||
autoFocus
|
||||
@@ -125,7 +125,7 @@ export const GridControls = memo(function GridControls({
|
||||
if (e.key === 'Enter') commit()
|
||||
if (e.key === 'Escape') setEditing(false)
|
||||
}}
|
||||
className="w-28 rounded bg-ink-850 py-0.5 text-center text-2xl font-semibold tabular-nums text-text outline-none"
|
||||
className="w-32 rounded-lg bg-ink-800 py-0.5 text-center font-mono text-[26px] font-semibold text-accent outline-none"
|
||||
/>
|
||||
) : (
|
||||
<button
|
||||
@@ -133,7 +133,7 @@ export const GridControls = memo(function GridControls({
|
||||
setVal(bpm != null ? bpm.toFixed(3) : '')
|
||||
setEditing(true)
|
||||
}}
|
||||
className="text-2xl font-semibold tabular-nums text-text hover:text-accent"
|
||||
className="font-mono text-[26px] font-semibold leading-tight text-accent [text-shadow:0_0_18px_color-mix(in_oklab,var(--color-accent)_55%,transparent)] hover:brightness-110"
|
||||
title="Click to type an exact BPM"
|
||||
>
|
||||
{bpm != null ? bpm.toFixed(2) : '––'}
|
||||
@@ -302,13 +302,14 @@ export const GridControls = memo(function GridControls({
|
||||
onClick={onToggleLock}
|
||||
title={locked ? 'Unlock track' : 'Lock track'}
|
||||
className={
|
||||
'flex flex-1 items-center justify-center gap-1 rounded border py-1 text-xs font-semibold transition-colors ' +
|
||||
'flex flex-1 items-center justify-center gap-1.5 rounded-lg py-1 text-xs font-semibold transition-colors ' +
|
||||
(locked
|
||||
? 'border-gold bg-gold/15 text-gold'
|
||||
: 'border-line bg-ink-850 text-text hover:border-accent')
|
||||
? 'bg-gold/15 text-gold shadow-[inset_0_0_0_1px_rgb(255_200_97/0.45),0_0_16px_-4px_rgb(255_200_97/0.6)]'
|
||||
: 'btn-glass text-text')
|
||||
}
|
||||
>
|
||||
{locked ? '🔒 Locked' : '🔓 Lock'}
|
||||
<Icon name={locked ? 'lock' : 'unlock'} size={13} />
|
||||
{locked ? 'Locked' : 'Lock'}
|
||||
</button>
|
||||
{/* Only a marker you are standing on can be deleted, so one that is
|
||||
scrolled off-screen can never go by accident. Deleting the last
|
||||
@@ -325,7 +326,7 @@ export const GridControls = memo(function GridControls({
|
||||
: 'Park the playhead on a marker to delete it (‹ › to step)'
|
||||
}
|
||||
>
|
||||
🗑 Mrk
|
||||
<Icon name="trash" size={12} /> Mrk
|
||||
</button>
|
||||
<button
|
||||
className={BTN}
|
||||
@@ -343,7 +344,7 @@ export const GridControls = memo(function GridControls({
|
||||
disabled={!hasGrid}
|
||||
title="Delete beatgrid"
|
||||
>
|
||||
🗑 Grid
|
||||
<Icon name="trash" size={12} /> Grid
|
||||
</button>
|
||||
</div>
|
||||
|
||||
@@ -355,7 +356,8 @@ export const GridControls = memo(function GridControls({
|
||||
disabled={analyzing}
|
||||
title="Detect BPM and first beat, then set the grid + hotcue 1 (fix octave with ÷2 / ×2)"
|
||||
>
|
||||
{analyzing ? '…' : 'Analyze'}
|
||||
<Icon name="wave" size={13} />
|
||||
{analyzing ? 'Analyzing…' : 'Analyze'}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -80,11 +80,11 @@ export function HistoryPanel({ onClose, onNotify, onError }: Props) {
|
||||
|
||||
return (
|
||||
<div
|
||||
aria-modal="true" className="fixed inset-0 z-40 flex items-center justify-center bg-black/60 p-6"
|
||||
aria-modal="true" className="fixed inset-0 z-40 flex items-center justify-center bg-black/40 backdrop-blur-[3px] p-6"
|
||||
onClick={onClose}
|
||||
>
|
||||
<div
|
||||
className="flex max-h-[85vh] w-full max-w-xl flex-col overflow-hidden rounded-xl border border-line bg-ink-900 shadow-2xl"
|
||||
className="flex max-h-[85vh] w-full max-w-xl flex-col overflow-hidden glass-overlay"
|
||||
onClick={(e) => e.stopPropagation()}
|
||||
>
|
||||
<div className="border-b border-line px-5 py-4">
|
||||
@@ -152,7 +152,7 @@ export function HistoryPanel({ onClose, onNotify, onError }: Props) {
|
||||
onClick={() => setConfirmingId(e.id)}
|
||||
disabled={isCurrent}
|
||||
title={isCurrent ? 'This is the current version' : 'Restore this version'}
|
||||
className="mt-0.5 shrink-0 rounded-md border border-line px-2.5 py-1 text-xs text-muted opacity-0 transition-opacity hover:bg-ink-800 hover:text-text group-hover:opacity-100 disabled:cursor-not-allowed disabled:opacity-0"
|
||||
className="mt-0.5 shrink-0 btn-glass rounded-full px-2.5 py-1 text-xs text-muted opacity-0 transition-opacity hover:text-text group-hover:opacity-100 disabled:cursor-not-allowed disabled:opacity-0"
|
||||
>
|
||||
Restore
|
||||
</button>
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
import type { CSSProperties } from 'react'
|
||||
import type { CuePoint } from '../api'
|
||||
import { contrastText, cueColor, cueGlyph } from '../lib/cues'
|
||||
import { cueColor, cueGlyph, withAlpha } from '../lib/cues'
|
||||
import { Icon } from '../lib/icons'
|
||||
|
||||
interface Props {
|
||||
cues: CuePoint[]
|
||||
@@ -37,7 +39,7 @@ export function HotcueBar({
|
||||
onSlotRelease,
|
||||
}: Props) {
|
||||
return (
|
||||
<div className="flex flex-1 items-stretch gap-px">
|
||||
<div className="flex min-w-0 flex-1 items-stretch gap-1.5">
|
||||
{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
|
||||
@@ -68,16 +70,29 @@ export function HotcueBar({
|
||||
: `Hotcue ${slotLabel(slot)}`
|
||||
: `Hotcue ${slotLabel(slot)} — click to set at playhead`
|
||||
}
|
||||
style={color ? { backgroundColor: color, color: contrastText(color) } : undefined}
|
||||
style={color ? padStyle(color, selected) : undefined}
|
||||
className={
|
||||
'relative flex flex-1 items-center justify-center text-sm font-semibold transition-colors ' +
|
||||
(color ? 'hover:brightness-110' : 'bg-ink-900 text-faint hover:bg-ink-800') +
|
||||
(selected ? ' ring-2 ring-inset ring-white/80' : '')
|
||||
'relative flex min-w-0 flex-1 flex-col items-start justify-center rounded-[11px] px-2 text-left transition-[filter,background-color] ' +
|
||||
(color
|
||||
? 'hover:brightness-115'
|
||||
: 'bg-white/[0.035] text-faint shadow-[inset_0_0_0_1px_rgb(255_255_255/0.07)] hover:bg-ink-800') +
|
||||
(selected && !color ? ' ring-2 ring-inset ring-white/70' : '')
|
||||
}
|
||||
>
|
||||
{locked ? '🔒' : slotLabel(slot)}
|
||||
<span
|
||||
className="font-mono text-[11px] font-bold leading-none"
|
||||
style={color ? { color: color } : undefined}
|
||||
>
|
||||
{locked ? <Icon name="lock" size={11} strokeWidth={2.2} /> : slotLabel(slot)}
|
||||
</span>
|
||||
<span className="mt-1 w-full truncate text-[11px] leading-none text-text/85">
|
||||
{cue ? (cue.name && cue.name !== 'n.n.' ? cue.name : ' ') : ''}
|
||||
</span>
|
||||
{glyph && (
|
||||
<span className="absolute right-0.5 top-0 text-[9px] leading-none opacity-80">
|
||||
<span
|
||||
className="absolute right-1.5 top-1 text-[9px] leading-none opacity-90"
|
||||
style={{ color: color ?? undefined }}
|
||||
>
|
||||
{glyph}
|
||||
</span>
|
||||
)}
|
||||
@@ -87,3 +102,22 @@ export function HotcueBar({
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* A lit pad: tinted glass in the cue's colour with a soft glow of it, the way a
|
||||
* backlit controller pad reads. Selection brightens the tint and rings it in
|
||||
* the colour itself, so it stays legible whichever colour the cue is.
|
||||
*/
|
||||
function padStyle(color: string, selected: boolean): CSSProperties {
|
||||
return {
|
||||
background: `linear-gradient(180deg, ${withAlpha(color, selected ? 0.5 : 0.3)}, ${withAlpha(
|
||||
color,
|
||||
selected ? 0.24 : 0.1,
|
||||
)})`,
|
||||
boxShadow: [
|
||||
'inset 0 1px 0 rgba(255,255,255,0.22)',
|
||||
`inset 0 0 0 ${selected ? 2 : 1}px ${withAlpha(color, selected ? 0.95 : 0.55)}`,
|
||||
`0 0 ${selected ? 24 : 18}px -4px ${withAlpha(color, selected ? 0.8 : 0.55)}`,
|
||||
].join(', '),
|
||||
}
|
||||
}
|
||||
@@ -153,8 +153,8 @@ export function ImportDialog({ playlistId, deviceLabel, onClose, onDone, onError
|
||||
onClose={() => setBrowsing(false)}
|
||||
/>
|
||||
)}
|
||||
<div aria-modal="true" className="fixed inset-0 z-50 flex items-center justify-center bg-black/60 p-4">
|
||||
<div className="w-full max-w-lg rounded-lg border border-line bg-ink-900 shadow-xl">
|
||||
<div aria-modal="true" className="fixed inset-0 z-50 flex items-center justify-center bg-black/40 backdrop-blur-[3px] p-4">
|
||||
<div className="w-full max-w-lg glass-overlay">
|
||||
<div className="border-b border-line px-5 py-3">
|
||||
<h2 className="text-sm font-semibold text-text">
|
||||
Import from {deviceLabel}
|
||||
@@ -170,14 +170,14 @@ export function ImportDialog({ playlistId, deviceLabel, onClose, onDone, onError
|
||||
<div className="flex items-center gap-2">
|
||||
<span
|
||||
title={baseFolder}
|
||||
className="min-w-0 flex-1 truncate rounded-md border border-line bg-ink-950 px-2 py-1.5 font-mono text-xs text-text"
|
||||
className="min-w-0 flex-1 truncate rounded-md well px-2 py-1.5 font-mono text-xs text-text"
|
||||
dir="rtl"
|
||||
>
|
||||
{baseFolder || 'Loading…'}
|
||||
</span>
|
||||
<button
|
||||
onClick={() => setBrowsing(true)}
|
||||
className="shrink-0 rounded-md border border-line px-3 py-1.5 text-sm text-muted hover:text-text"
|
||||
className="shrink-0 btn-glass rounded-full px-3 py-1.5 text-sm text-muted hover:text-text"
|
||||
>
|
||||
Browse…
|
||||
</button>
|
||||
@@ -228,7 +228,7 @@ export function ImportDialog({ playlistId, deviceLabel, onClose, onDone, onError
|
||||
{/* Reported and then skipped, rather than failing the whole
|
||||
import halfway through a multi-minute copy. */}
|
||||
{p.missing.length > 0 && (
|
||||
<div className="rounded border border-line bg-ink-950 px-3 py-2 text-xs text-pink">
|
||||
<div className="rounded well px-3 py-2 text-xs text-pink">
|
||||
{p.missing.length} track{p.missing.length === 1 ? '' : 's'} will be skipped —
|
||||
the audio file is not on the drive:
|
||||
<div className="mt-1 text-faint">{p.missing.slice(0, 4).join(', ')}</div>
|
||||
@@ -238,7 +238,7 @@ export function ImportDialog({ playlistId, deviceLabel, onClose, onDone, onError
|
||||
{/* A warning, not a block: everything is imported as a new
|
||||
entry, so a re-import legitimately duplicates. */}
|
||||
{p.duplicates.length > 0 && (
|
||||
<div className="rounded border border-line bg-ink-950 px-3 py-2 text-xs text-gold">
|
||||
<div className="rounded well px-3 py-2 text-xs text-gold">
|
||||
{p.duplicates.length} of these look like tracks your collection already has.
|
||||
They will be added again as new entries.
|
||||
</div>
|
||||
@@ -255,7 +255,7 @@ export function ImportDialog({ playlistId, deviceLabel, onClose, onDone, onError
|
||||
{job && (
|
||||
<div className="space-y-3">
|
||||
<div className="text-text">{job.message || 'Working…'}</div>
|
||||
<div className="h-2 overflow-hidden rounded-full bg-ink-950">
|
||||
<div className="h-2 overflow-hidden rounded-full bg-well">
|
||||
<div
|
||||
className={`h-full transition-[width] duration-200 ${
|
||||
job.state === 'failed' ? 'bg-pink' : 'bg-accent'
|
||||
@@ -286,7 +286,7 @@ export function ImportDialog({ playlistId, deviceLabel, onClose, onDone, onError
|
||||
<>
|
||||
<button
|
||||
onClick={cancel}
|
||||
className="rounded-md border border-line px-3 py-1.5 text-sm text-muted hover:text-text"
|
||||
className="btn-glass rounded-full px-3 py-1.5 text-sm text-muted hover:text-text"
|
||||
>
|
||||
Cancel import
|
||||
</button>
|
||||
@@ -302,7 +302,7 @@ export function ImportDialog({ playlistId, deviceLabel, onClose, onDone, onError
|
||||
<>
|
||||
<button
|
||||
onClick={onClose}
|
||||
className="rounded-md border border-line px-3 py-1.5 text-sm text-muted hover:text-text"
|
||||
className="btn-glass rounded-full px-3 py-1.5 text-sm text-muted hover:text-text"
|
||||
>
|
||||
{finished ? 'Close' : 'Cancel'}
|
||||
</button>
|
||||
@@ -312,7 +312,7 @@ export function ImportDialog({ playlistId, deviceLabel, onClose, onDone, onError
|
||||
starting || !p || p.importable === 0 || p.enough_space === false
|
||||
}
|
||||
onClick={start}
|
||||
className="rounded-md bg-accent px-3 py-1.5 text-sm font-medium text-ink-950 hover:brightness-110 disabled:opacity-40"
|
||||
className="rounded-full btn-primary px-3 py-1.5 text-sm font-semibold disabled:opacity-40"
|
||||
>
|
||||
{starting ? 'Starting…' : `Import ${p?.importable ?? ''}`.trim()}
|
||||
</button>
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import { Icon } from '../lib/icons'
|
||||
|
||||
interface Props {
|
||||
hasGrid: boolean // beat-loops need a beatgrid; buttons disable without one
|
||||
active: boolean // a loop is currently engaged
|
||||
@@ -18,9 +20,13 @@ function label(size: number): string {
|
||||
return size < 1 ? `1/${Math.round(1 / size)}` : String(size)
|
||||
}
|
||||
|
||||
const CELL = 'flex items-center justify-center text-sm font-semibold transition-colors select-none'
|
||||
const IDLE = 'bg-ink-900 text-text hover:bg-ink-800'
|
||||
const OFF = 'disabled:opacity-30 disabled:hover:bg-ink-900'
|
||||
const CELL =
|
||||
'flex items-center justify-center rounded-lg font-mono text-xs font-semibold transition-colors select-none'
|
||||
const IDLE = 'btn-glass text-text'
|
||||
const OFF = 'disabled:opacity-30'
|
||||
// A lit green key: an engaged loop should read as ON from across the room.
|
||||
const LIT =
|
||||
'bg-gradient-to-b from-[#7bf0ad] to-mint text-ink-950 shadow-[inset_0_1px_0_rgb(255_255_255/0.6),0_0_14px_rgb(61_220_132/0.55)]'
|
||||
|
||||
export function LoopControls({
|
||||
hasGrid,
|
||||
@@ -36,11 +42,12 @@ export function LoopControls({
|
||||
}: Props) {
|
||||
|
||||
return (
|
||||
<div className="flex h-10 shrink-0 items-stretch gap-px border-t border-line bg-ink-950">
|
||||
<span className="flex w-16 items-center justify-center bg-ink-900 text-[10px] font-semibold uppercase tracking-wider text-faint">
|
||||
<div className="flex h-10 shrink-0 items-center gap-1.5 pt-2">
|
||||
<span className="flex w-12 shrink-0 items-center text-[10px] font-semibold uppercase tracking-wider text-faint">
|
||||
Loop
|
||||
</span>
|
||||
|
||||
<div className="well flex h-full min-w-0 flex-1 items-stretch gap-0.5 rounded-xl p-[3px]">
|
||||
{SIZES.map((size) => {
|
||||
const isActive = active && activeBeats === size
|
||||
return (
|
||||
@@ -49,32 +56,35 @@ export function LoopControls({
|
||||
onClick={() => onSetLoop(size)}
|
||||
disabled={!hasGrid}
|
||||
title={hasGrid ? `${label(size)}-beat loop` : 'No beatgrid'}
|
||||
className={`${CELL} ${OFF} flex-1 ${isActive ? 'bg-mint text-ink-950' : IDLE}`}
|
||||
className={`${CELL} ${OFF} flex-1 ${
|
||||
isActive ? LIT : 'text-muted hover:bg-ink-800 hover:text-text'
|
||||
}`}
|
||||
>
|
||||
{label(size)}
|
||||
</button>
|
||||
)
|
||||
})}
|
||||
</div>
|
||||
|
||||
<button onClick={onLoopIn} className={`${CELL} ${IDLE} w-12`} title="Loop in at playhead">
|
||||
<button onClick={onLoopIn} className={`${CELL} ${IDLE} h-full w-11`} title="Loop in at playhead">
|
||||
IN
|
||||
</button>
|
||||
<button onClick={onLoopOut} className={`${CELL} ${IDLE} w-12`} title="Loop out at playhead">
|
||||
<button onClick={onLoopOut} className={`${CELL} ${IDLE} h-full w-11`} title="Loop out at playhead">
|
||||
OUT
|
||||
</button>
|
||||
<button
|
||||
onClick={onToggleActive}
|
||||
disabled={!canToggle}
|
||||
title={active ? 'Disable loop' : 'Enable loop'}
|
||||
className={`${CELL} ${OFF} w-12 text-base ${active ? 'bg-mint text-ink-950' : IDLE}`}
|
||||
className={`${CELL} ${OFF} h-full w-11 ${active ? LIT : IDLE}`}
|
||||
>
|
||||
⟳
|
||||
<Icon name="loop" size={15} />
|
||||
</button>
|
||||
<button
|
||||
onClick={onToggleSnap}
|
||||
title="Snap to the nearest beat"
|
||||
className={`${CELL} w-16 text-[11px] uppercase tracking-wider ${
|
||||
snap ? 'bg-accent text-ink-950' : `${IDLE} text-muted`
|
||||
className={`${CELL} h-full w-14 font-sans text-[11px] uppercase tracking-wider ${
|
||||
snap ? 'is-selected text-text' : `${IDLE} text-muted`
|
||||
}`}
|
||||
>
|
||||
Snap
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { useEffect, useRef } from 'react'
|
||||
import type { CuePoint } from '../api'
|
||||
import type { BeatGrid } from '../lib/beatgrid'
|
||||
import { drawBeatgrid, drawCuePoint, drawCues, drawLoop } from '../lib/cues'
|
||||
import { drawBeatgrid, drawCuePoint, drawCues, drawLoop, drawPlayhead } from '../lib/cues'
|
||||
import { paintWave, type WaveColumn } from '../lib/waveform'
|
||||
|
||||
interface Props {
|
||||
@@ -79,7 +79,12 @@ export function MainWaveform({
|
||||
const half = secPerView / 2
|
||||
const startSec = currentTime - half
|
||||
const endSec = currentTime + half
|
||||
paintWave(ctx, cols, w, h, startSec / duration, endSec / duration)
|
||||
// 2 px bars with a 1 px gap: the texture that makes the scrolling view
|
||||
// read as discrete energy rather than a smear.
|
||||
paintWave(ctx, cols, w, h, startSec / duration, endSec / duration, {
|
||||
bar: Math.max(1, Math.round(2 * dpr)),
|
||||
gap: Math.max(1, Math.round(dpr)),
|
||||
})
|
||||
|
||||
const timeToX = (t: number) => ((t - startSec) / secPerView) * w
|
||||
// Loop band (under the grid/cues), then beatgrid, then cue markers.
|
||||
@@ -97,32 +102,7 @@ export function MainWaveform({
|
||||
}
|
||||
}
|
||||
|
||||
// Fixed centre playhead — red core with a translucent black outline so it
|
||||
// separates from the waveform, plus inward-pointing triangle caps top and
|
||||
// bottom that anchor the eye in the quiet margins.
|
||||
const core = Math.max(2, Math.round(2 * dpr))
|
||||
const edge = Math.max(1, Math.round(dpr))
|
||||
const cx = Math.floor(w / 2)
|
||||
const px = cx - Math.floor(core / 2)
|
||||
ctx.fillStyle = 'rgba(0,0,0,0.5)'
|
||||
ctx.fillRect(px - edge, 0, core + edge * 2, h)
|
||||
ctx.fillStyle = '#ff3b30'
|
||||
ctx.fillRect(px, 0, core, h)
|
||||
|
||||
const cap = Math.round(6 * dpr)
|
||||
ctx.fillStyle = '#ff3b30'
|
||||
ctx.beginPath()
|
||||
ctx.moveTo(cx - cap, 0)
|
||||
ctx.lineTo(cx + cap, 0)
|
||||
ctx.lineTo(cx, cap)
|
||||
ctx.closePath()
|
||||
ctx.fill()
|
||||
ctx.beginPath()
|
||||
ctx.moveTo(cx - cap, h)
|
||||
ctx.lineTo(cx + cap, h)
|
||||
ctx.lineTo(cx, h - cap)
|
||||
ctx.closePath()
|
||||
ctx.fill()
|
||||
drawPlayhead(ctx, Math.floor(w / 2), h, dpr, true)
|
||||
}
|
||||
|
||||
const drawRef = useRef(draw)
|
||||
@@ -199,7 +179,7 @@ export function MainWaveform({
|
||||
onPointerDown={(e) => e.stopPropagation()}
|
||||
onClick={zoomIn}
|
||||
disabled={secPerView <= MIN_SEC}
|
||||
className="flex h-6 w-6 items-center justify-center rounded border border-line bg-ink-950/70 text-sm text-text hover:border-accent disabled:opacity-30"
|
||||
className="btn-glass flex h-6 w-6 items-center justify-center rounded-lg text-sm text-text backdrop-blur-md disabled:opacity-30"
|
||||
title="Zoom in"
|
||||
>
|
||||
+
|
||||
@@ -208,7 +188,7 @@ export function MainWaveform({
|
||||
onPointerDown={(e) => e.stopPropagation()}
|
||||
onClick={zoomOut}
|
||||
disabled={secPerView >= MAX_SEC}
|
||||
className="flex h-6 w-6 items-center justify-center rounded border border-line bg-ink-950/70 text-sm text-text hover:border-accent disabled:opacity-30"
|
||||
className="btn-glass flex h-6 w-6 items-center justify-center rounded-lg text-sm text-text backdrop-blur-md disabled:opacity-30"
|
||||
title="Zoom out"
|
||||
>
|
||||
−
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { useCallback, useEffect, useRef } from 'react'
|
||||
import type { CuePoint } from '../api'
|
||||
import { drawCuePoint, drawCues, drawLoop } from '../lib/cues'
|
||||
import { drawCuePoint, drawCues, drawLoop, drawPlayhead } from '../lib/cues'
|
||||
import { paintWave, type WaveColumn } from '../lib/waveform'
|
||||
|
||||
interface Props {
|
||||
@@ -63,7 +63,7 @@ export function OverviewWaveform({
|
||||
const dur = durRef.current
|
||||
if (dur > 0) {
|
||||
const px = Math.round((timeRef.current / dur) * w)
|
||||
ctx.fillStyle = 'rgba(10,11,15,0.55)'
|
||||
ctx.fillStyle = 'rgba(5,6,10,0.5)'
|
||||
ctx.fillRect(0, 0, px, h)
|
||||
const dpr = window.devicePixelRatio || 1
|
||||
const lp = loopRef.current
|
||||
@@ -72,13 +72,7 @@ export function OverviewWaveform({
|
||||
drawCues(ctx, cuesRef.current, w, h, dpr, (t) => (t / dur) * w, false)
|
||||
const cp = cuePointRef.current
|
||||
if (cp != null) drawCuePoint(ctx, Math.round((cp / dur) * w), h, dpr)
|
||||
const pw = Math.max(2, Math.round(2 * dpr))
|
||||
const px0 = px - Math.floor(pw / 2)
|
||||
const po = Math.max(1, Math.round(dpr))
|
||||
ctx.fillStyle = 'rgba(0,0,0,0.6)'
|
||||
ctx.fillRect(px0 - po, 0, pw + po * 2, h)
|
||||
ctx.fillStyle = '#ff3b30'
|
||||
ctx.fillRect(px0, 0, pw, h)
|
||||
drawPlayhead(ctx, px, h, dpr, false)
|
||||
}
|
||||
}, [])
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ import { useEffect, useRef, useState } from 'react'
|
||||
import { useQuery, useQueryClient } from '@tanstack/react-query'
|
||||
import { api, type RemapPreview } from '../api'
|
||||
import type { ToastMsg } from './Toast'
|
||||
import { Icon } from '../lib/icons'
|
||||
|
||||
interface Props {
|
||||
onClose: () => void
|
||||
@@ -103,11 +104,11 @@ export function PathMappingDialog({ onClose, onNotify, onError }: Props) {
|
||||
|
||||
return (
|
||||
<div
|
||||
aria-modal="true" className="fixed inset-0 z-40 flex items-center justify-center bg-black/60 p-6"
|
||||
aria-modal="true" className="fixed inset-0 z-40 flex items-center justify-center bg-black/40 backdrop-blur-[3px] p-6"
|
||||
onClick={onClose}
|
||||
>
|
||||
<div
|
||||
className="flex max-h-[85vh] w-full max-w-xl flex-col overflow-hidden rounded-xl border border-line bg-ink-900 shadow-2xl"
|
||||
className="flex max-h-[85vh] w-full max-w-xl flex-col overflow-hidden glass-overlay"
|
||||
onClick={(e) => e.stopPropagation()}
|
||||
>
|
||||
<div className="border-b border-line px-5 py-4">
|
||||
@@ -159,7 +160,7 @@ export function PathMappingDialog({ onClose, onNotify, onError }: Props) {
|
||||
/>
|
||||
<button
|
||||
onClick={() => setBrowsing((b) => !b)}
|
||||
className="shrink-0 rounded-md border border-line px-3 py-1.5 text-sm text-muted hover:bg-ink-800 hover:text-text"
|
||||
className="shrink-0 btn-glass rounded-full px-3 py-1.5 text-sm text-muted hover:text-text"
|
||||
>
|
||||
{browsing ? 'Close' : 'Browse…'}
|
||||
</button>
|
||||
@@ -239,7 +240,7 @@ export function PathMappingDialog({ onClose, onNotify, onError }: Props) {
|
||||
<button
|
||||
onClick={saveMapping}
|
||||
disabled={saving}
|
||||
className="rounded-md bg-accent px-3 py-1.5 text-sm font-medium text-ink-950 hover:brightness-110 disabled:opacity-50"
|
||||
className="rounded-full btn-primary px-3 py-1.5 text-sm font-semibold disabled:opacity-50"
|
||||
>
|
||||
{saving ? 'Saving…' : 'Save mapping'}
|
||||
</button>
|
||||
@@ -289,7 +290,7 @@ function FolderBrowser({
|
||||
onClick={() => setDir(d.path)}
|
||||
className="flex w-full items-center gap-2 px-3 py-1.5 text-left text-sm text-text hover:bg-ink-800"
|
||||
>
|
||||
<span className="text-faint">📁</span>
|
||||
<span className="flex text-faint"><Icon name="folder" size={15} /></span>
|
||||
<span className="truncate">{d.name}</span>
|
||||
</button>
|
||||
))
|
||||
|
||||
@@ -14,6 +14,8 @@ import { slotLabeller, useCaps } from '../lib/capabilities'
|
||||
import { CUE_TYPE_LABELS } from '../lib/cues'
|
||||
import { readOnlyShort, readOnlyNotice } from '../lib/platformCopy'
|
||||
import { analyzeWaveform, type WaveColumn } from '../lib/waveform'
|
||||
import { setAmbientFromArt } from '../lib/ambient'
|
||||
import { Icon } from '../lib/icons'
|
||||
import { ScratchEngine } from '../lib/scratchEngine'
|
||||
import { PlaybackEngine } from '../lib/playbackEngine'
|
||||
import { AutoCueDialog, eventLabel } from './AutoCueDialog'
|
||||
@@ -226,6 +228,12 @@ export function PrepStrip({
|
||||
setPreviewing(false)
|
||||
}, [trackId])
|
||||
|
||||
// Recolour the whole app from this track's cover art. A device's art is not
|
||||
// served (only its audio is), so a device track keeps the default look.
|
||||
useEffect(() => {
|
||||
void setAmbientFromArt(trackId && !fromDevice ? api.artUrl(trackId) : null)
|
||||
}, [trackId, fromDevice])
|
||||
|
||||
// Analyse once per track; the decoded buffer feeds both the playback and
|
||||
// scratch engines (no re-decode) and both waveform views share the columns.
|
||||
useEffect(() => {
|
||||
@@ -970,13 +978,15 @@ export function PrepStrip({
|
||||
const activeLoop = loopActive && loopRegion ? loopRegion : null
|
||||
|
||||
return (
|
||||
<div className="flex h-[25.5rem] shrink-0 items-stretch gap-px border-b border-line bg-ink-950">
|
||||
<div className="glass flex h-[25.5rem] shrink-0 items-stretch gap-3 p-3">
|
||||
{/* Controls */}
|
||||
<div className="flex w-72 shrink-0 flex-col gap-3 bg-ink-900 px-4 py-3">
|
||||
<div className="min-w-0">
|
||||
<div className="flex w-72 shrink-0 flex-col gap-3 px-1 py-1">
|
||||
<div className="flex min-w-0 items-center gap-3">
|
||||
<CoverThumb trackId={track && !fromDevice ? track.id : null} />
|
||||
<div className="min-w-0 flex-1">
|
||||
{track ? (
|
||||
<>
|
||||
<div className="truncate text-sm font-semibold text-text" title={track.title ?? ''}>
|
||||
<div className="truncate text-[15px] font-semibold tracking-tight text-text" title={track.title ?? ''}>
|
||||
{track.title ?? 'Untitled'}
|
||||
</div>
|
||||
<div className="truncate text-xs text-muted" title={track.artist ?? ''}>
|
||||
@@ -987,7 +997,7 @@ export function PrepStrip({
|
||||
live. The controls themselves report the reason when pressed. */}
|
||||
{readOnlyShort(caps) && (
|
||||
<div
|
||||
className="mt-1 inline-block rounded bg-ink-800 px-1.5 py-0.5 text-[10px] uppercase tracking-wider text-faint"
|
||||
className="mt-1 inline-block rounded-md bg-ink-800 px-1.5 py-0.5 text-[10px] uppercase tracking-wider text-muted"
|
||||
title={readOnlyNotice(caps) ?? ''}
|
||||
>
|
||||
{readOnlyShort(caps)}
|
||||
@@ -997,6 +1007,7 @@ export function PrepStrip({
|
||||
) : (
|
||||
<div className="text-xs uppercase tracking-wider text-faint">No track loaded</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{track && (
|
||||
@@ -1036,7 +1047,7 @@ export function PrepStrip({
|
||||
onPointerUp={onCueRelease}
|
||||
onPointerCancel={onCueRelease}
|
||||
disabled={!ready}
|
||||
className="flex h-11 items-center justify-center rounded-xl border border-line bg-ink-850 px-4 text-sm font-bold tracking-wide text-gold transition-colors hover:border-gold disabled:cursor-not-allowed disabled:opacity-40 disabled:hover:border-line"
|
||||
className="flex h-11 items-center justify-center rounded-xl bg-gold/10 px-4 font-mono text-sm font-semibold tracking-wider text-gold shadow-[inset_0_1px_0_rgb(255_255_255/0.12),inset_0_0_0_1px_rgb(255_200_97/0.4)] transition-colors hover:bg-gold/15 disabled:cursor-not-allowed disabled:opacity-40"
|
||||
title="Cue — set the cue point (paused), hold to preview from it, or jump back to it (playing)"
|
||||
>
|
||||
CUE
|
||||
@@ -1045,27 +1056,18 @@ export function PrepStrip({
|
||||
onClick={toggle}
|
||||
disabled={!ready}
|
||||
className={
|
||||
'flex h-11 w-11 items-center justify-center rounded-xl transition-all active:scale-95 disabled:cursor-not-allowed disabled:opacity-40 ' +
|
||||
'flex h-11 w-11 shrink-0 items-center justify-center rounded-full transition-all active:scale-95 disabled:cursor-not-allowed disabled:opacity-40 ' +
|
||||
(previewing
|
||||
? 'bg-gold text-ink-950 shadow-lg shadow-gold/20 hover:brightness-110'
|
||||
? 'bg-gradient-to-b from-white to-gold text-ink-950 shadow-[0_0_0_4px_rgb(255_200_97/0.22),0_8px_24px_-4px_var(--color-gold)]'
|
||||
: playing
|
||||
? 'bg-mint text-ink-950 shadow-lg shadow-mint/20 hover:brightness-110'
|
||||
: 'border border-line bg-ink-850 text-text hover:border-accent disabled:hover:border-line')
|
||||
? 'btn-primary shadow-[0_0_0_4px_color-mix(in_oklab,var(--color-accent)_22%,transparent),0_8px_24px_-4px_var(--color-accent)]'
|
||||
: 'btn-glass text-text')
|
||||
}
|
||||
title={playing ? 'Pause' : 'Play'}
|
||||
>
|
||||
{playing ? (
|
||||
<svg width="18" height="18" viewBox="0 0 24 24" fill="currentColor" aria-hidden>
|
||||
<rect x="6" y="5" width="4" height="14" rx="1" />
|
||||
<rect x="14" y="5" width="4" height="14" rx="1" />
|
||||
</svg>
|
||||
) : (
|
||||
<svg width="18" height="18" viewBox="0 0 24 24" fill="currentColor" aria-hidden>
|
||||
<path d="M8 5.14v13.72a1 1 0 0 0 1.54.84l10.29-6.86a1 1 0 0 0 0-1.68L9.54 4.3A1 1 0 0 0 8 5.14z" />
|
||||
</svg>
|
||||
)}
|
||||
<Icon name={playing ? 'pause' : 'play'} size={18} />
|
||||
</button>
|
||||
<div className="tabular-nums text-lg font-medium text-muted">
|
||||
<div className="font-mono text-[15px] font-medium text-muted">
|
||||
{fmt(current)} / {fmt(duration)}
|
||||
</div>
|
||||
</div>
|
||||
@@ -1079,18 +1081,18 @@ export function PrepStrip({
|
||||
</div>
|
||||
|
||||
{/* Waveforms + loop/hotcue controls. */}
|
||||
<div className="relative flex min-w-0 flex-1 flex-col bg-ink-900">
|
||||
<div className="relative flex min-w-0 flex-1 flex-col">
|
||||
{!track ? (
|
||||
<div className="flex flex-1 items-center justify-center text-xs text-faint">
|
||||
<div className="well flex flex-1 items-center justify-center rounded-2xl text-xs text-faint">
|
||||
Load a track to prep it
|
||||
</div>
|
||||
) : waveStatus === 'error' ? (
|
||||
<div className="flex flex-1 items-center justify-center text-xs text-pink">
|
||||
<div className="well flex flex-1 items-center justify-center rounded-2xl text-xs text-pink">
|
||||
Could not load audio — file may be missing or an unsupported format.
|
||||
</div>
|
||||
) : (
|
||||
<>
|
||||
<div className="relative min-h-0 flex-1">
|
||||
<div className="well relative min-h-0 flex-1 overflow-hidden rounded-2xl">
|
||||
{showWaves ? (
|
||||
<MainWaveform
|
||||
cols={cols}
|
||||
@@ -1114,7 +1116,7 @@ export function PrepStrip({
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
<div className="h-10 shrink-0 border-t border-line">
|
||||
<div className="well mt-2 h-10 shrink-0 overflow-hidden rounded-xl">
|
||||
{showWaves && (
|
||||
<OverviewWaveform
|
||||
cols={cols}
|
||||
@@ -1142,8 +1144,8 @@ export function PrepStrip({
|
||||
/>
|
||||
|
||||
{/* Hotcue row: label · 8 slots · type of selected cue · delete. */}
|
||||
<div className="flex h-10 shrink-0 items-stretch gap-px border-t border-line bg-ink-950">
|
||||
<span className="flex w-16 items-center justify-center bg-ink-900 text-[10px] font-semibold uppercase tracking-wider text-faint">
|
||||
<div className="flex h-12 shrink-0 items-stretch gap-1.5 pt-2">
|
||||
<span className="flex w-12 shrink-0 items-center text-[10px] font-semibold uppercase tracking-wider text-faint">
|
||||
Cues
|
||||
</span>
|
||||
<HotcueBar
|
||||
@@ -1154,7 +1156,7 @@ export function PrepStrip({
|
||||
onSlotPress={onSlotPress}
|
||||
onSlotRelease={onSlotRelease}
|
||||
/>
|
||||
<div className="flex w-28 items-center justify-center bg-ink-900 px-1">
|
||||
<div className="btn-glass flex w-28 shrink-0 items-center justify-center rounded-lg px-1">
|
||||
{selectedCue && selectedCue.type === 'loop' ? (
|
||||
<span className="text-sm font-semibold text-mint">Loop</span>
|
||||
) : pointCueTypes.length < 2 ? (
|
||||
@@ -1187,17 +1189,19 @@ export function PrepStrip({
|
||||
? 'Place hotcues on the track\'s drops, breakdowns and other sections'
|
||||
: 'Set a beatgrid first'
|
||||
}
|
||||
className="flex w-16 items-center justify-center gap-1 bg-ink-900 text-[11px] font-semibold uppercase tracking-wider text-muted transition-colors hover:bg-ink-800 hover:text-accent disabled:opacity-30 disabled:hover:bg-ink-900 disabled:hover:text-muted"
|
||||
className="btn-glass flex w-[4.5rem] shrink-0 items-center justify-center gap-1.5 rounded-lg text-[11px] font-semibold uppercase tracking-wider text-muted hover:text-accent disabled:opacity-30 disabled:hover:text-muted"
|
||||
>
|
||||
✨ Auto
|
||||
<Icon name="sparkle" size={14} />
|
||||
Auto
|
||||
</button>
|
||||
<button
|
||||
onClick={deleteSelected}
|
||||
disabled={!selectedCue}
|
||||
title="Delete selected hotcue"
|
||||
className="flex w-12 items-center justify-center bg-ink-900 text-muted transition-colors hover:bg-ink-800 hover:text-pink disabled:opacity-30 disabled:hover:bg-ink-900 disabled:hover:text-muted"
|
||||
aria-label="Delete selected hotcue"
|
||||
className="btn-glass flex w-11 shrink-0 items-center justify-center rounded-lg text-muted hover:text-pink disabled:opacity-30 disabled:hover:text-muted"
|
||||
>
|
||||
🗑
|
||||
<Icon name="trash" size={15} />
|
||||
</button>
|
||||
</div>
|
||||
</>
|
||||
@@ -1217,3 +1221,29 @@ export function PrepStrip({
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* The loaded track's sleeve. Until it loads — and for a track with no art — a
|
||||
* swatch of the ambient colours stands in, so the header never has a hole in it.
|
||||
*/
|
||||
function CoverThumb({ trackId }: { trackId: string | null }) {
|
||||
const [failed, setFailed] = useState<string | null>(null)
|
||||
const showArt = trackId != null && failed !== trackId
|
||||
return (
|
||||
<div
|
||||
aria-hidden
|
||||
className="relative h-11 w-11 shrink-0 overflow-hidden rounded-xl shadow-[inset_0_1px_0_rgb(255_255_255/0.35),0_8px_24px_-6px_var(--amb-2)]"
|
||||
style={{ background: 'linear-gradient(135deg, var(--amb-1), var(--amb-2) 55%, var(--amb-3))' }}
|
||||
>
|
||||
{showArt && (
|
||||
<img
|
||||
key={trackId}
|
||||
src={api.artUrl(trackId)}
|
||||
alt=""
|
||||
className="absolute inset-0 h-full w-full object-cover"
|
||||
onError={() => setFailed(trackId)}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@@ -8,6 +8,21 @@ interface Props {
|
||||
onChange?: (value: number) => void
|
||||
}
|
||||
|
||||
function Star({ className }: { className?: string }) {
|
||||
return (
|
||||
<svg
|
||||
width="13"
|
||||
height="13"
|
||||
viewBox="0 0 24 24"
|
||||
aria-hidden
|
||||
className={className}
|
||||
fill="currentColor"
|
||||
>
|
||||
<path d="M12 3.5l2.6 5.3 5.9.9-4.3 4.1 1 5.8-5.2-2.7-5.2 2.7 1-5.8-4.3-4.1 5.9-.9z" />
|
||||
</svg>
|
||||
)
|
||||
}
|
||||
|
||||
// Compact star rating. Read-only by default (shows a dash when unrated). When
|
||||
// `onChange` is given it's interactive: hollow (☆) above the rating, solid gold
|
||||
// (★) up to it, with hover preview. Clicking a star sets that rating; clicking
|
||||
@@ -19,11 +34,9 @@ export function RatingStars({ value, max = 5, onChange }: Props) {
|
||||
if (!onChange) {
|
||||
if (!value) return <span className="text-faint">—</span>
|
||||
return (
|
||||
<span className="whitespace-nowrap tracking-tight" title={`${value} / ${max}`}>
|
||||
<span className="flex items-center gap-0.5" title={`${value} / ${max}`}>
|
||||
{stars.map((i) => (
|
||||
<span key={i} className={i <= value ? 'text-gold' : 'text-ink-600'}>
|
||||
{i <= value ? '★' : '☆'}
|
||||
</span>
|
||||
<Star key={i} className={i <= value ? 'text-gold' : 'text-white/15'} />
|
||||
))}
|
||||
</span>
|
||||
)
|
||||
@@ -31,7 +44,7 @@ export function RatingStars({ value, max = 5, onChange }: Props) {
|
||||
|
||||
const shown = hover || value
|
||||
return (
|
||||
<span className="whitespace-nowrap tracking-tight" title={`${value} / ${max}`}>
|
||||
<span className="flex items-center gap-0.5" title={`${value} / ${max}`}>
|
||||
{stars.map((i) => (
|
||||
<button
|
||||
key={i}
|
||||
@@ -41,10 +54,10 @@ export function RatingStars({ value, max = 5, onChange }: Props) {
|
||||
}}
|
||||
onMouseEnter={() => setHover(i)}
|
||||
onMouseLeave={() => setHover(0)}
|
||||
className={`transition-colors ${i <= shown ? 'text-gold' : 'text-ink-600 hover:text-gold/60'}`}
|
||||
className={`transition-colors ${i <= shown ? 'text-gold' : 'text-white/15 hover:text-gold/60'}`}
|
||||
title={i === value ? 'Clear rating' : `Set ${i} star${i > 1 ? 's' : ''}`}
|
||||
>
|
||||
{i <= shown ? '★' : '☆'}
|
||||
<Star />
|
||||
</button>
|
||||
))}
|
||||
</span>
|
||||
|
||||
@@ -3,6 +3,7 @@ import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query'
|
||||
import { api } from '../api'
|
||||
import { useCaps } from '../lib/capabilities'
|
||||
import { overwriteWarning, readOnlyNotice, saveLabel } from '../lib/platformCopy'
|
||||
import { Icon } from '../lib/icons'
|
||||
|
||||
interface Props {
|
||||
onError: (msg: string) => void
|
||||
@@ -39,9 +40,9 @@ export function SaveBar({ onError, trailing }: Props) {
|
||||
// point: a greyed-out button with no explanation reads as a bug.
|
||||
if (readOnly) {
|
||||
return (
|
||||
<div className="flex items-stretch gap-2 border-t border-line bg-ink-900 px-3 py-3">
|
||||
<div className="min-w-0 flex-1 rounded-md bg-ink-800 px-2 py-2 text-[11px] leading-snug text-faint">
|
||||
<span className="font-medium text-ink-200">Read-only</span>
|
||||
<div className="flex items-stretch gap-2 border-t border-line px-3 py-3">
|
||||
<div className="min-w-0 flex-1 rounded-xl bg-ink-800 px-2.5 py-2 text-[11px] leading-snug text-faint">
|
||||
<span className="font-medium text-text">Read-only</span>
|
||||
<div className="mt-1">{readOnly}</div>
|
||||
</div>
|
||||
{trailing}
|
||||
@@ -50,27 +51,26 @@ export function SaveBar({ onError, trailing }: Props) {
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="border-t border-line bg-ink-900 px-3 py-3">
|
||||
<div className="border-t border-line px-3 py-3">
|
||||
{dirty && warning && (
|
||||
<div className="mb-2 rounded-md bg-gold/10 px-2 py-1.5 text-[11px] leading-snug text-gold">
|
||||
⚠ {warning}
|
||||
<div className="mb-2 flex gap-1.5 rounded-xl bg-gold/10 px-2.5 py-1.5 text-[11px] leading-snug text-gold">
|
||||
<Icon name="warning" size={13} className="mt-px shrink-0" />
|
||||
<span>{warning}</span>
|
||||
</div>
|
||||
)}
|
||||
<div className="flex items-stretch gap-2">
|
||||
<button
|
||||
disabled={!dirty || save.isPending}
|
||||
onClick={() => save.mutate()}
|
||||
className={`flex min-w-0 flex-1 items-center justify-center gap-2 rounded-md px-3 py-2 text-sm font-medium transition-colors ${
|
||||
dirty
|
||||
? 'bg-accent text-ink-950 hover:brightness-110'
|
||||
: 'cursor-not-allowed bg-ink-800 text-faint'
|
||||
className={`flex h-10 min-w-0 flex-1 items-center justify-center gap-2 rounded-full px-3 text-sm font-semibold transition-colors ${
|
||||
dirty ? 'btn-primary' : 'cursor-not-allowed bg-ink-800 font-medium text-faint'
|
||||
}`}
|
||||
>
|
||||
{save.isPending ? (
|
||||
'Saving…'
|
||||
) : dirty ? (
|
||||
<>
|
||||
<span className="h-1.5 w-1.5 rounded-full bg-ink-950/60" />
|
||||
<span className="h-1.5 w-1.5 rounded-full bg-well" />
|
||||
{saveLabel(caps.save)}
|
||||
</>
|
||||
) : (
|
||||
|
||||
@@ -25,13 +25,13 @@ export function SettingsMenu({ onOpenPathMapping, up = false }: Props) {
|
||||
}, [open])
|
||||
|
||||
const item =
|
||||
'flex w-full flex-col items-start rounded px-2 py-1.5 text-left hover:bg-ink-800'
|
||||
'flex w-full flex-col items-start rounded-[10px] px-2.5 py-1.5 text-left hover:bg-ink-800'
|
||||
|
||||
return (
|
||||
<div ref={ref} className="relative">
|
||||
<button
|
||||
onClick={() => setOpen((o) => !o)}
|
||||
className="flex h-full items-center justify-center rounded-md border border-line bg-ink-850 px-2 py-1.5 text-muted transition-colors hover:border-ink-600 hover:text-text"
|
||||
className="btn-glass flex h-10 w-10 items-center justify-center rounded-full text-muted hover:text-text"
|
||||
title="Settings"
|
||||
aria-label="Settings"
|
||||
>
|
||||
@@ -39,10 +39,10 @@ export function SettingsMenu({ onOpenPathMapping, up = false }: Props) {
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
strokeWidth="2"
|
||||
strokeWidth="1.8"
|
||||
strokeLinecap="round"
|
||||
strokeLinejoin="round"
|
||||
className="h-5 w-5"
|
||||
className="h-[18px] w-[18px]"
|
||||
>
|
||||
<circle cx="12" cy="12" r="3" />
|
||||
<path d="M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 1 1-2.83 2.83l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-4 0v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 1 1-2.83-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1 0-4h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 1 1 2.83-2.83l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 1 1 2.83 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1z" />
|
||||
@@ -50,7 +50,7 @@ export function SettingsMenu({ onOpenPathMapping, up = false }: Props) {
|
||||
</button>
|
||||
{open && (
|
||||
<div
|
||||
className={`absolute right-0 z-30 w-56 rounded-md border border-line bg-ink-850 p-1 shadow-2xl ${
|
||||
className={`glass-overlay absolute right-0 z-30 w-60 !rounded-2xl p-1.5 ${
|
||||
up ? 'bottom-full mb-1' : 'mt-1'
|
||||
}`}
|
||||
>
|
||||
|
||||
@@ -97,11 +97,11 @@ export function ShortcutsDialog({ onClose }: Props) {
|
||||
return (
|
||||
<div
|
||||
aria-modal="true"
|
||||
className="fixed inset-0 z-40 flex items-center justify-center bg-black/60 p-6"
|
||||
className="fixed inset-0 z-40 flex items-center justify-center bg-black/40 backdrop-blur-[3px] p-6"
|
||||
onClick={onClose}
|
||||
>
|
||||
<div
|
||||
className="flex max-h-full w-full max-w-lg flex-col overflow-hidden rounded-xl border border-line bg-ink-900 shadow-2xl"
|
||||
className="flex max-h-full w-full max-w-lg flex-col overflow-hidden glass-overlay"
|
||||
onClick={(e) => e.stopPropagation()}
|
||||
>
|
||||
<div className="flex items-center justify-between border-b border-line px-5 py-4">
|
||||
|
||||
@@ -8,6 +8,7 @@ import { DevicesSection } from './DevicesSection'
|
||||
import { ExportsSection } from './ExportsSection'
|
||||
import { ConfirmDialog, type ConfirmRequest } from './ConfirmDialog'
|
||||
import { ContextMenu, type MenuItem } from './ContextMenu'
|
||||
import { Icon, type IconName } from '../lib/icons'
|
||||
|
||||
/**
|
||||
* Which view the main table is showing.
|
||||
@@ -74,10 +75,10 @@ function deleteRequest(node: PlaylistNode) {
|
||||
}
|
||||
}
|
||||
|
||||
const icons: Record<PlaylistKind, string> = {
|
||||
folder: '▸',
|
||||
playlist: '♫',
|
||||
smart: '✦',
|
||||
const icons: Record<PlaylistKind, IconName> = {
|
||||
folder: 'chevronRight',
|
||||
playlist: 'playlist',
|
||||
smart: 'smart',
|
||||
}
|
||||
|
||||
/** What the sidebar is naming in place: a new node, and the folder it goes in
|
||||
@@ -120,11 +121,11 @@ function DraftRow({
|
||||
style={{ paddingLeft: `${8 + depth * 14}px` }}
|
||||
>
|
||||
<span
|
||||
className={`w-3 shrink-0 text-center text-[11px] ${
|
||||
className={`flex w-4 shrink-0 justify-center ${
|
||||
draft.kind === 'folder' ? 'text-faint' : 'text-accent'
|
||||
}`}
|
||||
>
|
||||
{icons[draft.kind]}
|
||||
<Icon name={icons[draft.kind]} size={draft.kind === 'folder' ? 12 : 15} />
|
||||
</span>
|
||||
<input
|
||||
autoFocus
|
||||
@@ -136,7 +137,7 @@ function DraftRow({
|
||||
else if (e.key === 'Escape') finish(false)
|
||||
}}
|
||||
onBlur={() => finish(true)}
|
||||
className="min-w-0 flex-1 rounded border border-accent bg-ink-950 px-1 py-0 text-sm text-text outline-none"
|
||||
className="min-w-0 flex-1 rounded-md bg-well px-1 py-0 text-sm text-text outline-none ring-1 ring-accent"
|
||||
/>
|
||||
</div>
|
||||
)
|
||||
@@ -184,8 +185,8 @@ function NodeRow({
|
||||
<div>
|
||||
<div
|
||||
onContextMenu={(e) => actions.onContextMenu(e, node)}
|
||||
className={`group flex items-center gap-1 rounded-md pr-1 text-sm transition-colors ${
|
||||
selected ? 'bg-accent-soft text-text' : 'text-muted hover:bg-ink-800 hover:text-text'
|
||||
className={`group flex items-center gap-1 rounded-[10px] pr-1 text-sm transition-colors ${
|
||||
selected ? 'is-selected font-medium text-text' : 'text-muted hover:bg-ink-800 hover:text-text'
|
||||
}`}
|
||||
>
|
||||
<button
|
||||
@@ -199,12 +200,21 @@ function NodeRow({
|
||||
style={{ paddingLeft: `${8 + depth * 14}px` }}
|
||||
>
|
||||
<span
|
||||
className={`w-3 shrink-0 text-center text-[11px] ${
|
||||
isFolder ? 'text-faint' : node.kind === 'smart' ? 'text-pink' : 'text-accent'
|
||||
className={`flex w-4 shrink-0 justify-center ${
|
||||
isFolder ? 'text-faint' : node.kind === 'smart' ? 'text-pink' : selected ? 'text-accent' : 'text-muted'
|
||||
} ${expanded ? 'rotate-90' : ''} transition-transform`}
|
||||
>
|
||||
{icons[node.kind]}
|
||||
<Icon
|
||||
name={icons[node.kind]}
|
||||
size={isFolder ? 12 : 15}
|
||||
strokeWidth={isFolder ? 2.4 : 1.8}
|
||||
/>
|
||||
</span>
|
||||
{isFolder && (
|
||||
<span className="-ml-1 flex shrink-0 text-muted">
|
||||
<Icon name={expanded ? 'folderOpen' : 'folder'} size={15} />
|
||||
</span>
|
||||
)}
|
||||
{renaming ? (
|
||||
<input
|
||||
autoFocus
|
||||
@@ -221,7 +231,7 @@ function NodeRow({
|
||||
}
|
||||
}}
|
||||
onBlur={() => setRenamingId(null)}
|
||||
className="min-w-0 flex-1 rounded border border-accent bg-ink-950 px-1 py-0 text-sm text-text outline-none"
|
||||
className="min-w-0 flex-1 rounded-md bg-well px-1 py-0 text-sm text-text outline-none ring-1 ring-accent"
|
||||
/>
|
||||
) : (
|
||||
<span className="flex-1 truncate">{node.name}</span>
|
||||
@@ -239,12 +249,12 @@ function NodeRow({
|
||||
<button
|
||||
title="Add to an export"
|
||||
onClick={() => setAdding((a) => !a)}
|
||||
className="hidden rounded px-1 text-xs text-faint hover:text-gold group-hover:block"
|
||||
className="hidden rounded px-1 text-faint hover:text-gold group-hover:block"
|
||||
>
|
||||
◈
|
||||
<Icon name="export" size={13} />
|
||||
</button>
|
||||
{adding && (
|
||||
<div className="absolute right-0 top-full z-30 mt-1 w-48 rounded-md border border-line bg-ink-850 p-1 shadow-2xl">
|
||||
<div className="glass-overlay absolute right-0 top-full z-30 mt-1 w-48 !rounded-2xl p-1.5">
|
||||
{exportSets.map((set) => (
|
||||
<button
|
||||
key={set.id}
|
||||
@@ -252,9 +262,9 @@ function NodeRow({
|
||||
setAdding(false)
|
||||
actions.onAddToExport(node, set.id)
|
||||
}}
|
||||
className="flex w-full items-center gap-2 rounded px-2 py-1.5 text-left text-sm text-muted hover:bg-ink-800 hover:text-text"
|
||||
className="flex w-full items-center gap-2 rounded-[10px] px-2 py-1.5 text-left text-sm text-muted hover:bg-ink-800 hover:text-text"
|
||||
>
|
||||
<span className="shrink-0 text-[11px] text-gold">◈</span>
|
||||
<span className="shrink-0 text-gold"><Icon name="export" size={13} /></span>
|
||||
<span className="truncate">{set.name}</span>
|
||||
</button>
|
||||
))}
|
||||
@@ -266,23 +276,23 @@ function NodeRow({
|
||||
<button
|
||||
title="Rename"
|
||||
onClick={startRename}
|
||||
className="hidden shrink-0 rounded px-1 text-xs text-faint hover:text-text group-hover:block"
|
||||
className="hidden shrink-0 rounded px-1 text-faint hover:text-text group-hover:block"
|
||||
>
|
||||
✎
|
||||
<Icon name="pencil" size={13} />
|
||||
</button>
|
||||
)}
|
||||
{!renaming && node.can_delete && (
|
||||
<button
|
||||
title={isFolder ? 'Delete folder' : 'Delete playlist'}
|
||||
onClick={() => actions.onDelete(node)}
|
||||
className="hidden shrink-0 rounded px-1 text-xs text-faint hover:text-pink group-hover:block"
|
||||
className="hidden shrink-0 rounded px-1 text-faint hover:text-pink group-hover:block"
|
||||
>
|
||||
×
|
||||
<Icon name="close" size={13} />
|
||||
</button>
|
||||
)}
|
||||
{!renaming && !isFolder && (
|
||||
<span
|
||||
className={`shrink-0 rounded bg-ink-800 px-1.5 py-0.5 text-[10px] tabular-nums text-faint ${
|
||||
className={`shrink-0 px-1.5 font-mono text-[11px] text-faint ${
|
||||
node.can_rename || node.can_delete ? 'group-hover:hidden' : ''
|
||||
}`}
|
||||
>
|
||||
@@ -420,9 +430,9 @@ export function Sidebar({
|
||||
const createItems = (parentId: string | null): MenuItem[] =>
|
||||
canCreate
|
||||
? [
|
||||
{ label: 'New Playlist', icon: '♫', onClick: () => startDraft('playlist', parentId) },
|
||||
{ label: 'New Playlist', icon: <Icon name="playlist" size={13} />, onClick: () => startDraft('playlist', parentId) },
|
||||
...(foldersSupported
|
||||
? [{ label: 'New Folder', icon: '▸', onClick: () => startDraft('folder', parentId) }]
|
||||
? [{ label: 'New Folder', icon: <Icon name="folder" size={13} />, onClick: () => startDraft('folder', parentId) }]
|
||||
: []),
|
||||
]
|
||||
: []
|
||||
@@ -439,7 +449,7 @@ export function Sidebar({
|
||||
label: 'Add to export',
|
||||
submenu: exportSets.map((set) => ({
|
||||
label: set.name,
|
||||
icon: '◈',
|
||||
icon: <Icon name="export" size={13} />,
|
||||
onClick: () => addToExport.mutate({ node, setId: set.id }),
|
||||
})),
|
||||
},
|
||||
@@ -484,7 +494,7 @@ export function Sidebar({
|
||||
}
|
||||
|
||||
return (
|
||||
<aside className="flex h-full w-64 shrink-0 flex-col border-r border-line bg-ink-900">
|
||||
<aside className="glass flex h-full w-64 shrink-0 flex-col overflow-hidden">
|
||||
{/* Which library is open — and the way to open a different one. Until
|
||||
this existed the picker was a one-way door: it ran once at startup and
|
||||
nothing could summon it again, so changing library meant restarting.
|
||||
@@ -492,8 +502,15 @@ export function Sidebar({
|
||||
<button
|
||||
onClick={switchLibrary}
|
||||
title={library ? `${library.path} — click to open a different library` : undefined}
|
||||
className="group flex items-center gap-2 border-b border-line px-3 py-2.5 text-left hover:bg-ink-800"
|
||||
className="btn-glass group m-2.5 mb-0 flex items-center gap-2.5 rounded-[14px] px-2.5 py-2 text-left"
|
||||
>
|
||||
<span
|
||||
aria-hidden
|
||||
className="flex h-7 w-7 shrink-0 items-center justify-center rounded-lg text-[13px] font-bold text-white shadow-[inset_0_1px_0_rgb(255_255_255/0.4)]"
|
||||
style={{ background: 'linear-gradient(135deg, var(--amb-1), var(--amb-3))' }}
|
||||
>
|
||||
{(library?.name ?? 'K').slice(0, 1).toUpperCase()}
|
||||
</span>
|
||||
<div className="min-w-0 flex-1">
|
||||
<div className="truncate text-sm font-medium text-text">
|
||||
{library?.display_name ?? 'No library'}
|
||||
@@ -504,27 +521,29 @@ export function Sidebar({
|
||||
: 'Choose one'}
|
||||
</div>
|
||||
</div>
|
||||
<span className="shrink-0 text-xs text-faint transition-colors group-hover:text-accent">
|
||||
⇄
|
||||
<span className="shrink-0 text-faint transition-colors group-hover:text-accent">
|
||||
<Icon name="switch" size={14} strokeWidth={2} />
|
||||
</span>
|
||||
</button>
|
||||
|
||||
<div className="px-2 pt-3">
|
||||
<button
|
||||
onClick={() => onSelect({ kind: 'all' })}
|
||||
className={`flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left text-sm transition-colors ${
|
||||
className={`flex w-full items-center gap-2 rounded-[10px] px-2 py-1.5 text-left text-sm transition-colors ${
|
||||
source.kind === 'all'
|
||||
? 'bg-accent-soft text-text'
|
||||
? 'is-selected font-medium text-text'
|
||||
: 'text-muted hover:bg-ink-800 hover:text-text'
|
||||
}`}
|
||||
>
|
||||
<span className="w-3 text-center text-[11px] text-mint">◈</span>
|
||||
<span className={`flex w-4 justify-center ${source.kind === 'all' ? 'text-accent' : ''}`}>
|
||||
<Icon name="music" size={15} />
|
||||
</span>
|
||||
<span className="flex-1">All Tracks</span>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div className="mt-3 px-4">
|
||||
<span className="text-[10px] font-semibold uppercase tracking-wider text-faint">
|
||||
<span className="text-[11px] font-semibold uppercase tracking-wider text-faint">
|
||||
Playlists
|
||||
</span>
|
||||
</div>
|
||||
@@ -569,6 +588,7 @@ export function Sidebar({
|
||||
onClick={onOpenHistory}
|
||||
className="flex items-center justify-center gap-2 border-t border-line px-4 py-2 text-center text-xs text-muted hover:bg-ink-800 hover:text-text"
|
||||
>
|
||||
<Icon name="history" size={13} />
|
||||
Collection Version History
|
||||
</button>
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { Icon } from '../lib/icons'
|
||||
/** A background job's progress, shown at the right of the bar. */
|
||||
export interface StatusJob {
|
||||
label: string
|
||||
@@ -33,7 +34,7 @@ export function StatusBar({
|
||||
onChangeCollection,
|
||||
}: Props) {
|
||||
return (
|
||||
<div className="flex items-center gap-3 border-t border-line bg-ink-900 px-4 py-2 text-xs text-muted">
|
||||
<div className="glass flex h-7 shrink-0 items-center gap-3 !rounded-full px-4 text-[11px] text-muted">
|
||||
<span className="font-medium text-text">{sourceName}</span>
|
||||
<span className="text-faint">·</span>
|
||||
{loading ? (
|
||||
@@ -61,9 +62,9 @@ export function StatusBar({
|
||||
{job.cancelling ? 'Cancelling…' : job.label}
|
||||
{job.total > 0 && ` ${Math.min(job.done + 1, job.total)}/${job.total}`}
|
||||
</span>
|
||||
<span className="h-1.5 w-32 shrink-0 overflow-hidden rounded-full bg-ink-800">
|
||||
<span className="well h-1.5 w-32 shrink-0 overflow-hidden rounded-full">
|
||||
<span
|
||||
className={`block h-full rounded-full bg-accent transition-[width] duration-300 ${
|
||||
className={`block h-full rounded-full bg-gradient-to-r from-[var(--amb-1)] to-accent shadow-[0_0_8px_var(--color-accent)] transition-[width] duration-300 ${
|
||||
job.total > 0 ? '' : 'w-1/3 animate-pulse'
|
||||
}`}
|
||||
style={job.total > 0 ? { width: `${(job.done / job.total) * 100}%` } : undefined}
|
||||
@@ -86,7 +87,7 @@ export function StatusBar({
|
||||
className={`${job ? '' : 'ml-auto '}flex items-center gap-1.5 rounded px-2 py-0.5 text-faint hover:bg-ink-800 hover:text-text`}
|
||||
title="Change collection"
|
||||
>
|
||||
<span className="text-[11px]">⎘</span>
|
||||
<Icon name="link" size={12} />
|
||||
<span className="max-w-[220px] truncate font-mono text-[11px]">{collectionName}</span>
|
||||
</button>
|
||||
)}
|
||||
|
||||
@@ -7,9 +7,9 @@ export interface ToastMsg {
|
||||
}
|
||||
|
||||
const KIND_CLS: Record<ToastMsg['kind'], string> = {
|
||||
error: 'border-pink/40 bg-ink-800 text-pink',
|
||||
warning: 'border-gold/40 bg-ink-800 text-gold',
|
||||
success: 'border-mint/40 bg-ink-800 text-mint',
|
||||
error: 'bg-pink shadow-[0_0_14px_rgb(255_122_154/0.6)]',
|
||||
warning: 'bg-gold shadow-[0_0_14px_rgb(255_200_97/0.6)]',
|
||||
success: 'bg-mint shadow-[0_0_14px_rgb(61_220_132/0.6)]',
|
||||
}
|
||||
|
||||
export function Toast({ toast, onClose }: { toast: ToastMsg | null; onClose: () => void }) {
|
||||
@@ -23,8 +23,10 @@ export function Toast({ toast, onClose }: { toast: ToastMsg | null; onClose: ()
|
||||
return (
|
||||
<div className="pointer-events-none fixed inset-x-0 top-4 z-50 flex justify-center">
|
||||
<div
|
||||
className={`pointer-events-auto max-w-lg rounded-lg border px-4 py-2.5 text-sm shadow-xl ${KIND_CLS[toast.kind]}`}
|
||||
className="glass-overlay pointer-events-auto flex max-w-lg items-center gap-3 !rounded-full px-5 py-2.5 text-sm text-text"
|
||||
>
|
||||
{/* The glass carries no colour; a lit dot says which kind this is. */}
|
||||
<span className={`h-2 w-2 shrink-0 rounded-full ${KIND_CLS[toast.kind]}`} />
|
||||
{toast.text}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { useQuery } from '@tanstack/react-query'
|
||||
import { api } from '../api'
|
||||
import { useCaps } from '../lib/capabilities'
|
||||
import { Icon } from '../lib/icons'
|
||||
|
||||
export interface Filters {
|
||||
search: string
|
||||
@@ -28,7 +29,7 @@ interface Props {
|
||||
}
|
||||
|
||||
const selectCls =
|
||||
'rounded-md border border-line bg-ink-850 px-2.5 py-1.5 text-sm text-text outline-none focus:border-accent hover:border-ink-600 transition-colors'
|
||||
'btn-glass rounded-full px-3 py-1.5 text-sm text-text outline-none focus:ring-1 focus:ring-accent'
|
||||
|
||||
export function Toolbar({
|
||||
filters,
|
||||
@@ -47,16 +48,16 @@ export function Toolbar({
|
||||
filters.hasCues !== 'any'
|
||||
|
||||
return (
|
||||
<div className="flex flex-wrap items-center gap-2 border-b border-line bg-ink-900 px-4 py-3">
|
||||
<div className="flex flex-wrap items-center gap-2 border-b border-line px-4 py-3">
|
||||
<div className="relative">
|
||||
<span className="pointer-events-none absolute left-2.5 top-1/2 -translate-y-1/2 text-faint">
|
||||
⌕
|
||||
<span className="pointer-events-none absolute left-3 top-1/2 -translate-y-1/2 text-faint">
|
||||
<Icon name="search" size={15} />
|
||||
</span>
|
||||
<input
|
||||
value={filters.search}
|
||||
onChange={(e) => set({ search: e.target.value })}
|
||||
placeholder="Search artist, title, album…"
|
||||
className="w-64 rounded-md border border-line bg-ink-850 py-1.5 pl-8 pr-3 text-sm text-text outline-none placeholder:text-faint focus:border-accent"
|
||||
className="well w-72 rounded-full py-1.5 pl-9 pr-3 text-sm text-text outline-none placeholder:text-faint focus:ring-1 focus:ring-accent"
|
||||
/>
|
||||
</div>
|
||||
|
||||
@@ -91,14 +92,14 @@ export function Toolbar({
|
||||
value={filters.bpmMin}
|
||||
onChange={(e) => set({ bpmMin: e.target.value.replace(/[^\d.]/g, '') })}
|
||||
placeholder="min"
|
||||
className="w-14 rounded-md border border-line bg-ink-850 px-2 py-1.5 text-center text-sm tabular-nums outline-none focus:border-accent placeholder:text-faint"
|
||||
className="well w-14 rounded-full px-2 py-1.5 text-center font-mono text-sm outline-none focus:ring-1 focus:ring-accent placeholder:text-faint"
|
||||
/>
|
||||
<span className="text-xs text-faint">BPM</span>
|
||||
<input
|
||||
value={filters.bpmMax}
|
||||
onChange={(e) => set({ bpmMax: e.target.value.replace(/[^\d.]/g, '') })}
|
||||
placeholder="max"
|
||||
className="w-14 rounded-md border border-line bg-ink-850 px-2 py-1.5 text-center text-sm tabular-nums outline-none focus:border-accent placeholder:text-faint"
|
||||
className="well w-14 rounded-full px-2 py-1.5 text-center font-mono text-sm outline-none focus:ring-1 focus:ring-accent placeholder:text-faint"
|
||||
/>
|
||||
</div>
|
||||
|
||||
@@ -129,7 +130,7 @@ export function Toolbar({
|
||||
{active && (
|
||||
<button
|
||||
onClick={() => onChange(emptyFilters)}
|
||||
className="rounded-md px-2.5 py-1.5 text-sm text-muted hover:bg-ink-800 hover:text-text"
|
||||
className="rounded-full px-3 py-1.5 text-sm text-muted hover:bg-ink-800 hover:text-text"
|
||||
>
|
||||
Clear filters
|
||||
</button>
|
||||
|
||||
@@ -148,11 +148,11 @@ export function UpdateCheck() {
|
||||
|
||||
return (
|
||||
<div
|
||||
aria-modal="true" className="fixed inset-0 z-50 flex items-center justify-center bg-black/60 p-6"
|
||||
aria-modal="true" className="fixed inset-0 z-50 flex items-center justify-center bg-black/40 backdrop-blur-[3px] p-6"
|
||||
onClick={close}
|
||||
>
|
||||
<div
|
||||
className="flex max-h-[80vh] w-full max-w-md flex-col overflow-hidden rounded-xl border border-line bg-ink-900 shadow-2xl"
|
||||
className="flex max-h-[80vh] w-full max-w-md flex-col overflow-hidden glass-overlay"
|
||||
onClick={(e) => e.stopPropagation()}
|
||||
>
|
||||
<div className="border-b border-line px-5 py-4">
|
||||
@@ -200,7 +200,7 @@ export function UpdateCheck() {
|
||||
</button>
|
||||
<button
|
||||
onClick={download}
|
||||
className="rounded-md bg-accent px-3 py-1.5 text-sm font-medium text-ink-950 hover:brightness-110"
|
||||
className="rounded-full btn-primary px-3 py-1.5 text-sm font-semibold"
|
||||
>
|
||||
Download
|
||||
</button>
|
||||
|
||||
+237
-20
@@ -1,24 +1,81 @@
|
||||
@import 'tailwindcss';
|
||||
|
||||
/* Konduktor design tokens — a dark, deck-friendly palette. */
|
||||
/* Konduktor design tokens — "dark liquid glass".
|
||||
|
||||
Surfaces are translucent layers over a slowly drifting wash of colour
|
||||
(`AmbientBackdrop`) sampled from the loaded track's cover art. So the ink
|
||||
scale is no longer a set of opaque greys: 900 → 600 are increasingly strong
|
||||
WHITE overlays, which read correctly on any glass panel they sit on. Only
|
||||
`ink-950` stays opaque — it is the dark text on light (accent, mint, gold)
|
||||
buttons, and the page's base colour. Recessed things (inputs, waveforms,
|
||||
readouts, progress tracks) use `well`.
|
||||
|
||||
Colour is reserved for meaning: cue types, key, the playhead, the one
|
||||
primary action. Chrome stays neutral. */
|
||||
@theme {
|
||||
--color-ink-950: #0a0b0f;
|
||||
--color-ink-900: #101218;
|
||||
--color-ink-850: #161922;
|
||||
--color-ink-800: #1c2029;
|
||||
--color-ink-700: #262b37;
|
||||
--color-ink-600: #333a49;
|
||||
--color-line: #2a2f3b;
|
||||
--font-sans: 'Geist Variable', system-ui, -apple-system, 'Segoe UI', sans-serif;
|
||||
--font-mono: 'Geist Mono Variable', ui-monospace, 'SF Mono', Menlo, monospace;
|
||||
|
||||
--color-text: #e6e9ef;
|
||||
--color-muted: #8b93a3;
|
||||
--color-faint: #5a6172;
|
||||
--color-ink-950: #05060a;
|
||||
--color-ink-900: rgb(255 255 255 / 0.03);
|
||||
--color-ink-850: rgb(255 255 255 / 0.05);
|
||||
--color-ink-800: rgb(255 255 255 / 0.075);
|
||||
--color-ink-700: rgb(255 255 255 / 0.11);
|
||||
--color-ink-600: rgb(255 255 255 / 0.16);
|
||||
--color-line: rgb(255 255 255 / 0.085);
|
||||
--color-well: rgb(0 0 0 / 0.32);
|
||||
|
||||
--color-accent: #4f8cff;
|
||||
--color-accent-soft: #2b3a5c;
|
||||
--color-gold: #ffb020;
|
||||
--color-mint: #34d399;
|
||||
--color-pink: #f472b6;
|
||||
--color-text: #f4f6fb;
|
||||
--color-muted: rgb(235 240 255 / 0.68);
|
||||
--color-faint: rgb(235 240 255 / 0.54);
|
||||
|
||||
/* The accent follows the cover art's dominant hue at a FIXED lightness and
|
||||
chroma, so dark text on an accent button always has the same contrast
|
||||
whatever track is loaded. */
|
||||
--color-accent: oklch(0.8 0.11 var(--accent-hue));
|
||||
--color-accent-soft: color-mix(in oklab, var(--color-accent) 20%, transparent);
|
||||
--color-gold: #ffc861;
|
||||
--color-mint: #3ddc84;
|
||||
--color-pink: #ff7a9a;
|
||||
}
|
||||
|
||||
/* Registered so they interpolate: the accent and the backdrop glide to a new
|
||||
track's colours instead of snapping. */
|
||||
@property --accent-hue {
|
||||
syntax: '<number>';
|
||||
inherits: true;
|
||||
initial-value: 275;
|
||||
}
|
||||
@property --amb-1 {
|
||||
syntax: '<color>';
|
||||
inherits: true;
|
||||
initial-value: #6d4aff;
|
||||
}
|
||||
@property --amb-2 {
|
||||
syntax: '<color>';
|
||||
inherits: true;
|
||||
initial-value: #e0409a;
|
||||
}
|
||||
@property --amb-3 {
|
||||
syntax: '<color>';
|
||||
inherits: true;
|
||||
initial-value: #12b5c9;
|
||||
}
|
||||
@property --amb-4 {
|
||||
syntax: '<color>';
|
||||
inherits: true;
|
||||
initial-value: #2f3fe0;
|
||||
}
|
||||
|
||||
:root {
|
||||
color-scheme: dark;
|
||||
--glass-blur: blur(28px) saturate(180%);
|
||||
transition:
|
||||
--accent-hue 1.4s ease,
|
||||
--amb-1 1.8s ease,
|
||||
--amb-2 1.8s ease,
|
||||
--amb-3 1.8s ease,
|
||||
--amb-4 1.8s ease;
|
||||
}
|
||||
|
||||
html,
|
||||
@@ -31,8 +88,7 @@ body {
|
||||
margin: 0;
|
||||
background: var(--color-ink-950);
|
||||
color: var(--color-text);
|
||||
font-family:
|
||||
'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
|
||||
font-family: var(--font-sans);
|
||||
font-feature-settings: 'tnum' 1; /* tabular numbers for BPM columns */
|
||||
-webkit-font-smoothing: antialiased;
|
||||
/* An app, not a document: clicks and drags must not paint a text selection.
|
||||
@@ -48,7 +104,18 @@ textarea,
|
||||
user-select: text;
|
||||
}
|
||||
|
||||
/* Thin, dark scrollbars that fit the deck aesthetic. */
|
||||
input::placeholder,
|
||||
textarea::placeholder {
|
||||
color: var(--color-faint);
|
||||
}
|
||||
|
||||
/* Native dropdown lists cannot be glass; give them a solid dark ground. */
|
||||
option {
|
||||
background: #14161f;
|
||||
color: var(--color-text);
|
||||
}
|
||||
|
||||
/* Thin, translucent scrollbars that sit on glass. */
|
||||
* {
|
||||
scrollbar-width: thin;
|
||||
scrollbar-color: var(--color-ink-600) transparent;
|
||||
@@ -64,6 +131,156 @@ textarea,
|
||||
background-clip: padding-box;
|
||||
}
|
||||
*::-webkit-scrollbar-thumb:hover {
|
||||
background: var(--color-ink-700);
|
||||
background: rgb(255 255 255 / 0.26);
|
||||
background-clip: padding-box;
|
||||
}
|
||||
|
||||
/* ---- Materials ---------------------------------------------------------
|
||||
Plain classes rather than utilities: each is a whole material (fill, blur,
|
||||
rim light, shadow), and the rim needs a pseudo-element. */
|
||||
@layer components {
|
||||
/* A floating panel: frosted, tinted dark so text holds contrast over bright
|
||||
colour, with a light-catching rim.
|
||||
|
||||
The blur and the tint live on ::after, NEVER on the element itself: an
|
||||
element with `backdrop-filter` becomes the containing block for every
|
||||
`position: fixed` descendant, so a context menu or dialog opened from inside
|
||||
a panel would be positioned against the panel instead of the window (the
|
||||
sidebar's playlist menu opened far from the cursor). `isolation` keeps the
|
||||
z-index:-1 layer behind this panel's content without escaping the panel,
|
||||
and unlike a filter it does not capture fixed descendants. */
|
||||
.glass,
|
||||
.glass-overlay {
|
||||
position: relative;
|
||||
isolation: isolate;
|
||||
border-radius: 22px;
|
||||
}
|
||||
.glass {
|
||||
--glass-tint:
|
||||
linear-gradient(180deg, rgb(255 255 255 / 0.1), rgb(255 255 255 / 0.06)),
|
||||
rgb(12 14 24 / 0.42);
|
||||
--glass-filter: var(--glass-blur);
|
||||
box-shadow:
|
||||
inset 0 1px 0 rgb(255 255 255 / 0.14),
|
||||
0 30px 80px -30px rgb(0 0 0 / 0.8);
|
||||
}
|
||||
|
||||
/* Menus, dialogs, toasts: denser so they read over busy content beneath. */
|
||||
.glass-overlay {
|
||||
--glass-tint:
|
||||
linear-gradient(180deg, rgb(255 255 255 / 0.12), rgb(255 255 255 / 0.08)),
|
||||
rgb(14 16 26 / 0.78);
|
||||
--glass-filter: blur(40px) saturate(180%);
|
||||
box-shadow:
|
||||
inset 0 1px 0 rgb(255 255 255 / 0.16),
|
||||
0 40px 90px -20px rgb(0 0 0 / 0.9);
|
||||
}
|
||||
|
||||
.glass::after,
|
||||
.glass-overlay::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
z-index: -1;
|
||||
border-radius: inherit;
|
||||
pointer-events: none;
|
||||
background: var(--glass-tint);
|
||||
backdrop-filter: var(--glass-filter);
|
||||
-webkit-backdrop-filter: var(--glass-filter);
|
||||
}
|
||||
|
||||
.glass::before,
|
||||
.glass-overlay::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
border-radius: inherit;
|
||||
padding: 1px;
|
||||
pointer-events: none;
|
||||
background: linear-gradient(
|
||||
155deg,
|
||||
rgb(255 255 255 / 0.42),
|
||||
rgb(255 255 255 / 0.07) 32%,
|
||||
rgb(255 255 255 / 0) 58%,
|
||||
rgb(255 255 255 / 0.14)
|
||||
);
|
||||
-webkit-mask:
|
||||
linear-gradient(#000 0 0) content-box,
|
||||
linear-gradient(#000 0 0);
|
||||
-webkit-mask-composite: xor;
|
||||
mask-composite: exclude;
|
||||
}
|
||||
|
||||
/* Recessed: waveforms, readouts, the loop-size selector. */
|
||||
.well {
|
||||
background: rgb(0 0 0 / 0.36);
|
||||
box-shadow:
|
||||
inset 0 2px 6px rgb(0 0 0 / 0.55),
|
||||
inset 0 0 0 1px rgb(255 255 255 / 0.06);
|
||||
}
|
||||
|
||||
/* A raised glass control. */
|
||||
.btn-glass {
|
||||
background: rgb(255 255 255 / 0.07);
|
||||
box-shadow:
|
||||
inset 0 1px 0 rgb(255 255 255 / 0.14),
|
||||
inset 0 0 0 1px rgb(255 255 255 / 0.08);
|
||||
transition:
|
||||
background-color 120ms,
|
||||
box-shadow 120ms,
|
||||
filter 120ms;
|
||||
}
|
||||
.btn-glass:hover:not(:disabled) {
|
||||
background: rgb(255 255 255 / 0.12);
|
||||
}
|
||||
|
||||
/* THE primary action: a lit pill, white into the accent. One per view. */
|
||||
.btn-primary {
|
||||
color: var(--color-ink-950);
|
||||
background: linear-gradient(180deg, #ffffff 0%, var(--color-accent) 100%);
|
||||
box-shadow:
|
||||
inset 0 1px 0 rgb(255 255 255 / 0.9),
|
||||
inset 0 -2px 6px rgb(0 0 0 / 0.12),
|
||||
0 10px 26px -8px var(--color-accent);
|
||||
transition: filter 120ms;
|
||||
}
|
||||
.btn-primary:hover:not(:disabled) {
|
||||
filter: brightness(1.06);
|
||||
}
|
||||
|
||||
/* Selected / toggled-on state for chips and list rows. */
|
||||
.is-selected {
|
||||
background: color-mix(in oklab, var(--color-accent) 18%, transparent);
|
||||
box-shadow:
|
||||
inset 0 1px 0 rgb(255 255 255 / 0.1),
|
||||
inset 0 0 0 1px color-mix(in oklab, var(--color-accent) 36%, transparent);
|
||||
}
|
||||
}
|
||||
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
:root {
|
||||
transition: none;
|
||||
}
|
||||
}
|
||||
|
||||
/* ---- Ambient backdrop (see AmbientBackdrop.tsx) ------------------------ */
|
||||
.ambient-wash {
|
||||
position: absolute;
|
||||
border-radius: 50%;
|
||||
will-change: transform;
|
||||
}
|
||||
@keyframes drift-a {
|
||||
from { transform: translate(0, 0) scale(1); }
|
||||
to { transform: translate(8vw, 6vh) scale(1.12); }
|
||||
}
|
||||
@keyframes drift-b {
|
||||
from { transform: translate(0, 0) scale(1.05); }
|
||||
to { transform: translate(-9vw, -4vh) scale(0.94); }
|
||||
}
|
||||
@keyframes drift-c {
|
||||
from { transform: translate(0, 0); }
|
||||
to { transform: translate(5vw, -9vh); }
|
||||
}
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
.ambient-wash { animation: none !important; }
|
||||
}
|
||||
@@ -0,0 +1,128 @@
|
||||
// The app's ambient colour: the backdrop's four washes and the accent hue,
|
||||
// sampled from the loaded track's cover art.
|
||||
//
|
||||
// Everything is written as CSS custom properties on <html> (registered with
|
||||
// @property in index.css, so a change GLIDES rather than snaps). Nothing in
|
||||
// React state depends on it, which is what lets a new track recolour the whole
|
||||
// app without a single re-render.
|
||||
|
||||
/** Used when there is no track, no art, or art with no real colour in it. */
|
||||
const FALLBACK = {
|
||||
washes: ['#6d4aff', '#e0409a', '#12b5c9', '#2f3fe0'],
|
||||
hue: 275,
|
||||
}
|
||||
|
||||
// Below this share of saturated pixels an image is treated as greyscale: an
|
||||
// accent pulled from a black-and-white sleeve would be an accident of JPEG noise.
|
||||
const MIN_COLOURFUL = 0.06
|
||||
|
||||
function apply(washes: string[], hue: number): void {
|
||||
const root = document.documentElement.style
|
||||
washes.forEach((c, i) => root.setProperty(`--amb-${i + 1}`, c))
|
||||
root.setProperty('--accent-hue', hue.toFixed(1))
|
||||
}
|
||||
|
||||
export function resetAmbient(): void {
|
||||
apply(FALLBACK.washes, FALLBACK.hue)
|
||||
}
|
||||
|
||||
function rgbToHsl(r: number, g: number, b: number): [number, number, number] {
|
||||
const mx = Math.max(r, g, b)
|
||||
const mn = Math.min(r, g, b)
|
||||
const l = (mx + mn) / 2
|
||||
if (mx === mn) return [0, 0, l]
|
||||
const d = mx - mn
|
||||
const s = l > 0.5 ? d / (2 - mx - mn) : d / (mx + mn)
|
||||
let h: number
|
||||
if (mx === r) h = (g - b) / d + (g < b ? 6 : 0)
|
||||
else if (mx === g) h = (b - r) / d + 2
|
||||
else h = (r - g) / d + 4
|
||||
return [h * 60, s, l]
|
||||
}
|
||||
|
||||
/**
|
||||
* The image's dominant colours, as backdrop washes plus an accent hue.
|
||||
*
|
||||
* Pixels are binned by hue (12 bins) and weighted by how colourful they are, so
|
||||
* a large dull background loses to a smaller vivid subject — which is what the
|
||||
* eye picks out of a sleeve. Each wash is then pushed to a fixed saturation and
|
||||
* a mid lightness: the backdrop should carry the art's HUES, never its
|
||||
* brightness, or a white sleeve would wash the whole app out.
|
||||
*/
|
||||
function palette(data: Uint8ClampedArray): { washes: string[]; hue: number } | null {
|
||||
const BINS = 12
|
||||
const weight = new Float64Array(BINS)
|
||||
const sumX = new Float64Array(BINS) // hue averaged as a vector, so 350° + 10° = 0°
|
||||
const sumY = new Float64Array(BINS)
|
||||
let colourful = 0
|
||||
let total = 0
|
||||
for (let i = 0; i < data.length; i += 4) {
|
||||
if (data[i + 3] < 128) continue
|
||||
total++
|
||||
const [h, s, l] = rgbToHsl(data[i] / 255, data[i + 1] / 255, data[i + 2] / 255)
|
||||
const vivid = s * (1 - Math.abs(2 * l - 1))
|
||||
if (vivid < 0.12) continue
|
||||
colourful++
|
||||
const bin = Math.floor(h / (360 / BINS)) % BINS
|
||||
const w = vivid * vivid
|
||||
weight[bin] += w
|
||||
sumX[bin] += Math.cos((h * Math.PI) / 180) * w
|
||||
sumY[bin] += Math.sin((h * Math.PI) / 180) * w
|
||||
}
|
||||
if (!total || colourful / total < MIN_COLOURFUL) return null
|
||||
|
||||
const ranked = Array.from({ length: BINS }, (_, i) => i)
|
||||
.filter((i) => weight[i] > 0)
|
||||
.sort((a, b) => weight[b] - weight[a])
|
||||
const hues = ranked.map((i) => {
|
||||
const deg = (Math.atan2(sumY[i], sumX[i]) * 180) / Math.PI
|
||||
return (deg + 360) % 360
|
||||
})
|
||||
// Fewer than four distinct hues (a duotone sleeve): rotate the strongest ones
|
||||
// slightly so the washes still move against each other instead of merging.
|
||||
while (hues.length < 4) hues.push((hues[0] + 28 * hues.length) % 360)
|
||||
|
||||
const lightness = [52, 50, 46, 40]
|
||||
const washes = hues.slice(0, 4).map((h, i) => `hsl(${h.toFixed(0)} 78% ${lightness[i]}%)`)
|
||||
return { washes, hue: hues[0] }
|
||||
}
|
||||
|
||||
let generation = 0
|
||||
|
||||
/**
|
||||
* Recolour the app from a cover-art URL (or reset it with null). Failures are
|
||||
* silent — a track without art, or art that cannot be decoded, keeps the
|
||||
* default look rather than surfacing an error for decoration.
|
||||
*
|
||||
* The image is fetched as a blob and decoded with createImageBitmap rather than
|
||||
* drawn from an <img>: the API is cross-origin under Tauri, and a cross-origin
|
||||
* <img> would taint the canvas and make its pixels unreadable.
|
||||
*/
|
||||
export async function setAmbientFromArt(url: string | null): Promise<void> {
|
||||
const mine = ++generation
|
||||
if (!url) {
|
||||
resetAmbient()
|
||||
return
|
||||
}
|
||||
try {
|
||||
const resp = await fetch(url)
|
||||
if (!resp.ok) throw new Error(String(resp.status))
|
||||
const bitmap = await createImageBitmap(await resp.blob(), {
|
||||
resizeWidth: 40,
|
||||
resizeHeight: 40,
|
||||
resizeQuality: 'low',
|
||||
})
|
||||
const canvas = document.createElement('canvas')
|
||||
canvas.width = 40
|
||||
canvas.height = 40
|
||||
const ctx = canvas.getContext('2d', { willReadFrequently: true })!
|
||||
ctx.drawImage(bitmap, 0, 0)
|
||||
bitmap.close()
|
||||
const found = palette(ctx.getImageData(0, 0, 40, 40).data)
|
||||
if (mine !== generation) return // a newer track was loaded meanwhile
|
||||
if (found) apply(found.washes, found.hue)
|
||||
else resetAmbient()
|
||||
} catch {
|
||||
if (mine === generation) resetAmbient()
|
||||
}
|
||||
}
|
||||
+112
-51
@@ -3,13 +3,13 @@ import { BEATS_PER_BAR, type BeatGrid } from './beatgrid'
|
||||
|
||||
// Fallback colour by cue type, used when the platform stored none.
|
||||
const TYPE_COLORS: Record<CueType, string> = {
|
||||
cue: '#3b82f6', // blue
|
||||
fade_in: '#ff8c2f', // orange
|
||||
fade_out: '#ff8c2f', // orange
|
||||
load: '#ffd60a', // yellow
|
||||
loop: '#22c55e', // green
|
||||
cue: '#4d94ff', // blue
|
||||
fade_in: '#ff9a3d', // orange
|
||||
fade_out: '#ff9a3d', // orange
|
||||
load: '#ffd23d', // yellow
|
||||
loop: '#3ddc84', // green
|
||||
}
|
||||
const MEMORY_COLOR = '#8b93a3' // gray
|
||||
const MEMORY_COLOR = '#9aa1b2' // gray
|
||||
|
||||
export const CUE_TYPE_LABELS: Record<CueType, string> = {
|
||||
cue: 'Cue',
|
||||
@@ -53,7 +53,7 @@ export function cueGlyph(cue: CuePoint): string {
|
||||
return TYPE_GLYPHS[cue.type] ?? ''
|
||||
}
|
||||
|
||||
function withAlpha(hex: string, a: number): string {
|
||||
export function withAlpha(hex: string, a: number): string {
|
||||
const r = parseInt(hex.slice(1, 3), 16)
|
||||
const g = parseInt(hex.slice(3, 5), 16)
|
||||
const b = parseInt(hex.slice(5, 7), 16)
|
||||
@@ -70,8 +70,13 @@ export function contrastText(hex: string): string {
|
||||
|
||||
/**
|
||||
* Draw cue/loop markers onto a canvas. `timeToX` maps a time (seconds) to a
|
||||
* device-pixel x. With `labels`, a small numbered flag is drawn at the top for
|
||||
* hotcues (used on the main waveform); the overview passes labels=false.
|
||||
* device-pixel x. With `labels`, a rounded flag is drawn at the top for each
|
||||
* cue carrying its slot label — and its name, where the cue has one (used on
|
||||
* the main waveform); the overview passes labels=false.
|
||||
*
|
||||
* Lines glow in their own colour rather than sitting on a black outline: on the
|
||||
* glass deck a dark outline reads as a gap in the waveform, where a glow reads
|
||||
* as the line being lit.
|
||||
*/
|
||||
export function drawCues(
|
||||
ctx: CanvasRenderingContext2D,
|
||||
@@ -85,10 +90,13 @@ export function drawCues(
|
||||
slotLabel: (slot: number) => string = (slot) => String(slot + 1),
|
||||
): void {
|
||||
const lineW = Math.max(2, Math.round(2 * dpr))
|
||||
const outline = Math.max(1, Math.round(dpr))
|
||||
const flagW = Math.round(12 * dpr)
|
||||
const flagH = Math.round(14 * dpr)
|
||||
const half = Math.floor(lineW / 2)
|
||||
const tabH = Math.round(17 * dpr)
|
||||
const pad = Math.round(6 * dpr)
|
||||
const radius = Math.round(8 * dpr)
|
||||
const inset = Math.round(5 * dpr)
|
||||
ctx.font = `600 ${Math.round(11 * dpr)}px 'Geist Variable', system-ui, sans-serif`
|
||||
ctx.textBaseline = 'middle'
|
||||
for (const cue of cues) {
|
||||
const color = cueColor(cue)
|
||||
const x = Math.round(timeToX(cue.start))
|
||||
@@ -97,43 +105,50 @@ export function drawCues(
|
||||
if (cue.length > 0) {
|
||||
const x2 = Math.round(timeToX(cue.start + cue.length))
|
||||
if (x2 > 0 && x < w) {
|
||||
ctx.fillStyle = withAlpha(color, 0.2)
|
||||
ctx.fillStyle = withAlpha(color, 0.16)
|
||||
ctx.fillRect(x, 0, Math.max(1, x2 - x), h)
|
||||
}
|
||||
}
|
||||
|
||||
if (x < -flagW || x > w + flagW) continue
|
||||
// A flag can extend well to the right of its line; keep drawing while any
|
||||
// of it could be on screen.
|
||||
if (x < -w || x > w + lineW) continue
|
||||
|
||||
// Dark outline behind the line so it reads on any waveform colour.
|
||||
ctx.fillStyle = 'rgba(0,0,0,0.7)'
|
||||
ctx.fillRect(x - half - outline, 0, lineW + outline * 2, h)
|
||||
ctx.save()
|
||||
ctx.shadowColor = color
|
||||
ctx.shadowBlur = 10 * dpr
|
||||
ctx.fillStyle = color
|
||||
ctx.fillRect(x - half, 0, lineW, h)
|
||||
ctx.restore()
|
||||
|
||||
if (labels) {
|
||||
// A flag tab at the top for every cue (outlined). A banked cue carries its
|
||||
// slot label; one without a slot (a memory cue) gets a half-height tab, so
|
||||
// it still reads as a real object rather than an anonymous line.
|
||||
// A banked cue's flag carries its slot label (plus its name when it has
|
||||
// a meaningful one); a cue without a slot (a memory cue) gets a short,
|
||||
// unlabelled flag, so it still reads as a real object rather than an
|
||||
// anonymous line.
|
||||
const banked = cue.slot != null
|
||||
const tabH = banked ? flagH : Math.round(flagH / 2)
|
||||
ctx.fillStyle = 'rgba(0,0,0,0.7)'
|
||||
ctx.fillRect(x - half - outline, 0, flagW + outline * 2, tabH + outline * 2)
|
||||
ctx.fillStyle = color
|
||||
ctx.fillRect(x - half, 0, flagW, tabH)
|
||||
if (banked) {
|
||||
const slotText = banked ? slotLabel(cue.slot!) : ''
|
||||
const name = cue.name && cue.name !== 'n.n.' ? cue.name : ''
|
||||
const text = slotText && name ? `${slotText} ${name}` : slotText
|
||||
const tw = text ? Math.ceil(ctx.measureText(text).width) : 0
|
||||
const fw = text ? tw + pad * 2 : Math.round(8 * dpr)
|
||||
const fh = banked ? tabH : Math.round(tabH / 2)
|
||||
ctx.fillStyle = withAlpha(color, 0.9)
|
||||
ctx.beginPath()
|
||||
ctx.roundRect(x - half, inset, fw, fh, [0, radius, radius, 0])
|
||||
ctx.fill()
|
||||
if (text) {
|
||||
ctx.fillStyle = contrastText(color)
|
||||
ctx.font = `bold ${Math.round(10 * dpr)}px system-ui, sans-serif`
|
||||
ctx.textBaseline = 'top'
|
||||
ctx.fillText(slotLabel(cue.slot!), x - half + Math.round(2 * dpr), Math.round(2 * dpr))
|
||||
ctx.fillText(text, x - half + pad, inset + fh / 2 + dpr * 0.5)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Draw the floating "CUE" point: a gold vertical line with a dark outline and a
|
||||
* solid downward triangle tab at the top, distinct from numbered hotcue flags,
|
||||
* the white beatgrid, and the red playhead.
|
||||
* Draw the floating "CUE" point: a gold vertical line with a solid downward
|
||||
* triangle tab at the top, distinct from hotcue flags, the white beatgrid, and
|
||||
* the red playhead.
|
||||
*/
|
||||
export function drawCuePoint(
|
||||
ctx: CanvasRenderingContext2D,
|
||||
@@ -143,11 +158,11 @@ export function drawCuePoint(
|
||||
): void {
|
||||
const lw = Math.max(2, Math.round(2 * dpr))
|
||||
const half = Math.floor(lw / 2)
|
||||
const outline = Math.max(1, Math.round(dpr))
|
||||
const tab = Math.round(8 * dpr)
|
||||
ctx.fillStyle = 'rgba(0,0,0,0.6)'
|
||||
ctx.fillRect(x - half - outline, 0, lw + outline * 2, h)
|
||||
ctx.fillStyle = '#ffb020'
|
||||
const tab = Math.round(7 * dpr)
|
||||
ctx.save()
|
||||
ctx.shadowColor = '#ffc861'
|
||||
ctx.shadowBlur = 10 * dpr
|
||||
ctx.fillStyle = '#ffc861'
|
||||
ctx.fillRect(x - half, 0, lw, h)
|
||||
ctx.beginPath()
|
||||
ctx.moveTo(x - tab, 0)
|
||||
@@ -155,9 +170,10 @@ export function drawCuePoint(
|
||||
ctx.lineTo(x, tab)
|
||||
ctx.closePath()
|
||||
ctx.fill()
|
||||
ctx.restore()
|
||||
}
|
||||
|
||||
/** Draw the active loop region: a translucent green band with bright edges. */
|
||||
/** Draw the active loop region: a green band, brightest at the top, with lit edges. */
|
||||
export function drawLoop(
|
||||
ctx: CanvasRenderingContext2D,
|
||||
startX: number,
|
||||
@@ -165,18 +181,62 @@ export function drawLoop(
|
||||
h: number,
|
||||
dpr: number,
|
||||
): void {
|
||||
const edge = Math.max(1, Math.round(2 * dpr))
|
||||
ctx.fillStyle = 'rgba(34,197,94,0.18)'
|
||||
const edge = Math.max(1, Math.round(1.5 * dpr))
|
||||
const band = ctx.createLinearGradient(0, 0, 0, h)
|
||||
band.addColorStop(0, 'rgba(61,220,132,0.22)')
|
||||
band.addColorStop(1, 'rgba(61,220,132,0.08)')
|
||||
ctx.fillStyle = band
|
||||
ctx.fillRect(startX, 0, Math.max(1, endX - startX), h)
|
||||
ctx.fillStyle = 'rgba(34,197,94,0.95)'
|
||||
ctx.save()
|
||||
ctx.shadowColor = '#3ddc84'
|
||||
ctx.shadowBlur = 8 * dpr
|
||||
ctx.fillStyle = 'rgba(61,220,132,0.9)'
|
||||
ctx.fillRect(startX, 0, edge, h)
|
||||
ctx.fillRect(endX - edge, 0, edge, h)
|
||||
ctx.restore()
|
||||
}
|
||||
|
||||
/**
|
||||
* The main waveform's fixed centre playhead: a red line with a soft red glow
|
||||
* and inward-pointing caps top and bottom that anchor the eye in the quiet
|
||||
* margins. Shared with the overview so the two can never drift apart in look.
|
||||
*/
|
||||
export function drawPlayhead(
|
||||
ctx: CanvasRenderingContext2D,
|
||||
x: number,
|
||||
h: number,
|
||||
dpr: number,
|
||||
caps: boolean,
|
||||
): void {
|
||||
const core = Math.max(2, Math.round(2 * dpr))
|
||||
const px = x - Math.floor(core / 2)
|
||||
ctx.save()
|
||||
ctx.shadowColor = '#ff4d5e'
|
||||
ctx.shadowBlur = 12 * dpr
|
||||
ctx.fillStyle = '#ff4d5e'
|
||||
ctx.fillRect(px, 0, core, h)
|
||||
if (caps) {
|
||||
const cap = Math.round(6 * dpr)
|
||||
ctx.beginPath()
|
||||
ctx.moveTo(x - cap, 0)
|
||||
ctx.lineTo(x + cap, 0)
|
||||
ctx.lineTo(x, cap)
|
||||
ctx.closePath()
|
||||
ctx.fill()
|
||||
ctx.beginPath()
|
||||
ctx.moveTo(x - cap, h)
|
||||
ctx.lineTo(x + cap, h)
|
||||
ctx.lineTo(x, h - cap)
|
||||
ctx.closePath()
|
||||
ctx.fill()
|
||||
}
|
||||
ctx.restore()
|
||||
}
|
||||
|
||||
/** Grid marker line colours. Markers are structural, so they are never culled
|
||||
* by the density check the way ordinary beat lines are. */
|
||||
export const GRID_MARKER_COLOR = '#4f8cff' // accent — an inactive marker
|
||||
export const GRID_MARKER_ACTIVE_COLOR = '#ffb020' // gold — governs the playhead
|
||||
export const GRID_MARKER_COLOR = '#9fb0ff' // periwinkle — an inactive marker
|
||||
export const GRID_MARKER_ACTIVE_COLOR = '#ffc861' // gold — governs the playhead
|
||||
|
||||
/**
|
||||
* Draw the beatgrid across the visible window [startSec, endSec].
|
||||
@@ -199,7 +259,6 @@ export function drawBeatgrid(
|
||||
if (endSec <= startSec) return
|
||||
const span = endSec - startSec
|
||||
const toX = (t: number) => Math.round(((t - startSec) / span) * w)
|
||||
const outline = Math.max(1, Math.round(dpr))
|
||||
const beatW = Math.max(1, Math.round(dpr))
|
||||
const barW = Math.max(2, Math.round(2 * dpr))
|
||||
|
||||
@@ -210,7 +269,7 @@ export function drawBeatgrid(
|
||||
if (seg && seg.start < endSec && seg.end > startSec) {
|
||||
const x1 = toX(Math.max(seg.start, startSec))
|
||||
const x2 = toX(Math.min(seg.end, endSec))
|
||||
ctx.fillStyle = 'rgba(255,176,32,0.07)'
|
||||
ctx.fillStyle = 'rgba(255,200,97,0.07)'
|
||||
ctx.fillRect(x1, 0, Math.max(1, x2 - x1), h)
|
||||
}
|
||||
}
|
||||
@@ -233,10 +292,10 @@ export function drawBeatgrid(
|
||||
if (bt < startSec || bt > endSec) continue
|
||||
const x = toX(bt)
|
||||
const lw = downbeat ? barW : beatW
|
||||
// Dark outline so the line reads on any waveform colour, then a bright line.
|
||||
ctx.fillStyle = 'rgba(0,0,0,0.6)'
|
||||
ctx.fillRect(x - Math.floor(lw / 2) - outline, 0, lw + outline * 2, h)
|
||||
ctx.fillStyle = downbeat ? 'rgba(255,255,255,0.95)' : 'rgba(255,255,255,0.65)'
|
||||
// Translucent white with no outline: the grid should read as a ruler laid
|
||||
// over the waveform, not bars cut through it. Downbeats are clearly
|
||||
// brighter, which is what grid editing needs to see.
|
||||
ctx.fillStyle = downbeat ? 'rgba(255,255,255,0.62)' : 'rgba(255,255,255,0.26)'
|
||||
ctx.fillRect(x - Math.floor(lw / 2), 0, lw, h)
|
||||
}
|
||||
}
|
||||
@@ -248,8 +307,9 @@ export function drawBeatgrid(
|
||||
const color = active ? GRID_MARKER_ACTIVE_COLOR : GRID_MARKER_COLOR
|
||||
const lw = Math.max(2, Math.round((active ? 3 : 2) * dpr))
|
||||
const x = toX(grid.markers[i].start)
|
||||
ctx.fillStyle = 'rgba(0,0,0,0.6)'
|
||||
ctx.fillRect(x - Math.floor(lw / 2) - outline, 0, lw + outline * 2, h)
|
||||
ctx.save()
|
||||
ctx.shadowColor = color
|
||||
ctx.shadowBlur = 10 * dpr
|
||||
ctx.fillStyle = color
|
||||
ctx.fillRect(x - Math.floor(lw / 2), 0, lw, h)
|
||||
const tab = Math.round(7 * dpr)
|
||||
@@ -259,5 +319,6 @@ export function drawBeatgrid(
|
||||
ctx.lineTo(x - tab, h)
|
||||
ctx.closePath()
|
||||
ctx.fill()
|
||||
ctx.restore()
|
||||
}
|
||||
}
|
||||
@@ -21,5 +21,6 @@ export function formatBpm(bpm: number | null): string {
|
||||
*/
|
||||
export function keyColor(wheel: number | null): string | undefined {
|
||||
if (wheel == null) return undefined
|
||||
return `hsl(${((wheel % 12) / 12) * 360} 65% 62%)`
|
||||
// Light and saturated: it is drawn as text on a tint of itself, on glass.
|
||||
return `hsl(${((wheel % 12) / 12) * 360} 90% 76%)`
|
||||
}
|
||||
@@ -0,0 +1,118 @@
|
||||
// Line icons for the glass UI: one stroke weight, one grid (24), coloured by
|
||||
// `currentColor`, so an icon takes its button's text colour and hover state.
|
||||
// Emoji render in the OS's own colour and style, which clashes with glass.
|
||||
|
||||
const PATHS = {
|
||||
play: <path d="M8 5.5v13a1 1 0 0 0 1.5.86l10.5-6.5a1 1 0 0 0 0-1.72L9.5 4.64A1 1 0 0 0 8 5.5z" fill="currentColor" stroke="none" />,
|
||||
pause: (
|
||||
<>
|
||||
<rect x="6" y="5" width="4" height="14" rx="1.2" fill="currentColor" stroke="none" />
|
||||
<rect x="14" y="5" width="4" height="14" rx="1.2" fill="currentColor" stroke="none" />
|
||||
</>
|
||||
),
|
||||
trash: <path d="M4 7h16M10 11v6M14 11v6M6 7l1 12a2 2 0 0 0 2 2h6a2 2 0 0 0 2-2l1-12M9 7V4h6v3" />,
|
||||
lock: (
|
||||
<>
|
||||
<rect x="5" y="11" width="14" height="9" rx="2" />
|
||||
<path d="M8 11V8a4 4 0 0 1 8 0v3" />
|
||||
</>
|
||||
),
|
||||
unlock: (
|
||||
<>
|
||||
<rect x="5" y="11" width="14" height="9" rx="2" />
|
||||
<path d="M8 11V8a4 4 0 0 1 7.7-1.5" />
|
||||
</>
|
||||
),
|
||||
sparkle: <path d="M12 3l1.8 5.2L19 10l-5.2 1.8L12 17l-1.8-5.2L5 10l5.2-1.8zM19 16l.7 1.8 1.8.7-1.8.7L19 21l-.7-1.8-1.8-.7 1.8-.7z" strokeLinejoin="round" />,
|
||||
wave: <path d="M3 12h2M7 8v8M11 5v14M15 9v6M19 11v2" />,
|
||||
folder: <path d="M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z" strokeLinejoin="round" />,
|
||||
folderOpen: <path d="M3 7a2 2 0 0 1 2-2h4l2 2h6a2 2 0 0 1 2 2v1M3 7v10a2 2 0 0 0 2 2h12.5a2 2 0 0 0 1.9-1.4L21 12a1 1 0 0 0-1-1.3H8.5a2 2 0 0 0-1.9 1.4L4 19" strokeLinejoin="round" />,
|
||||
playlist: <path d="M8 6h13M8 12h13M8 18h13M3.5 6h.01M3.5 12h.01M3.5 18h.01" />,
|
||||
smart: <path d="M4 5h16l-6 7.5V19l-4-2v-4.5z" strokeLinejoin="round" />,
|
||||
music: (
|
||||
<>
|
||||
<path d="M9 18V6l11-2v12" />
|
||||
<circle cx="6.5" cy="18" r="2.5" />
|
||||
<circle cx="17.5" cy="16" r="2.5" />
|
||||
</>
|
||||
),
|
||||
drive: (
|
||||
<>
|
||||
<rect x="3" y="7" width="18" height="10" rx="2" />
|
||||
<path d="M7 12h.01M11 12h.01" />
|
||||
</>
|
||||
),
|
||||
export: <path d="M12 3v12M7 8l5-5 5 5M5 15v4a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2v-4" />,
|
||||
download: <path d="M12 3v12M7 10l5 5 5-5M5 19h14" />,
|
||||
settings: (
|
||||
<>
|
||||
<path d="M4 6h10M18 6h2M4 12h4M12 12h8M4 18h12" />
|
||||
<circle cx="16" cy="6" r="2" />
|
||||
<circle cx="10" cy="12" r="2" />
|
||||
<circle cx="18" cy="18" r="2" />
|
||||
</>
|
||||
),
|
||||
search: (
|
||||
<>
|
||||
<circle cx="11" cy="11" r="7" />
|
||||
<path d="M20 20l-3.5-3.5" />
|
||||
</>
|
||||
),
|
||||
close: <path d="M6 6l12 12M18 6L6 18" />,
|
||||
check: <path d="M5 12.5l4.5 4.5L19 7.5" strokeLinejoin="round" />,
|
||||
chevronRight: <path d="M9 6l6 6-6 6" />,
|
||||
chevronDown: <path d="M6 9l6 6 6-6" />,
|
||||
chevronLeft: <path d="M15 6l-6 6 6 6" />,
|
||||
chevronUp: <path d="M6 15l6-6 6 6" />,
|
||||
switch: <path d="M8 9l4-4 4 4M8 15l4 4 4-4" />,
|
||||
history: (
|
||||
<>
|
||||
<path d="M3 12a9 9 0 1 0 3-6.7L3 8" />
|
||||
<path d="M3 3v5h5M12 7v5l3 2" />
|
||||
</>
|
||||
),
|
||||
import: <path d="M12 3v12M7 10l5 5 5-5M4 15v4a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-4" />,
|
||||
link: <path d="M10 14a4 4 0 0 0 5.7 0l3-3a4 4 0 0 0-5.7-5.7l-1 1M14 10a4 4 0 0 0-5.7 0l-3 3a4 4 0 0 0 5.7 5.7l1-1" />,
|
||||
warning: <path d="M12 4l9 16H3zM12 10v4M12 17h.01" strokeLinejoin="round" />,
|
||||
loop: <path d="M17 2l3 3-3 3M4 11V9a4 4 0 0 1 4-4h12M7 22l-3-3 3-3M20 13v2a4 4 0 0 1-4 4H4" />,
|
||||
home: <path d="M4 11l8-7 8 7v8a1 1 0 0 1-1 1h-4v-6h-6v6H5a1 1 0 0 1-1-1z" strokeLinejoin="round" />,
|
||||
file: <path d="M14 3H7a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V8zM14 3v5h5" strokeLinejoin="round" />,
|
||||
desktop: (
|
||||
<>
|
||||
<rect x="3" y="4" width="18" height="12" rx="2" />
|
||||
<path d="M8 20h8M12 16v4" />
|
||||
</>
|
||||
),
|
||||
pencil: <path d="M4 20h4L19 9l-4-4L4 16zM13.5 6.5l4 4" strokeLinejoin="round" />,
|
||||
plus: <path d="M12 5v14M5 12h14" />,
|
||||
} as const
|
||||
|
||||
export type IconName = keyof typeof PATHS
|
||||
|
||||
export function Icon({
|
||||
name,
|
||||
size = 16,
|
||||
className,
|
||||
strokeWidth = 1.8,
|
||||
}: {
|
||||
name: IconName
|
||||
size?: number
|
||||
className?: string
|
||||
strokeWidth?: number
|
||||
}) {
|
||||
return (
|
||||
<svg
|
||||
width={size}
|
||||
height={size}
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
strokeWidth={strokeWidth}
|
||||
strokeLinecap="round"
|
||||
aria-hidden
|
||||
className={className}
|
||||
>
|
||||
{PATHS[name]}
|
||||
</svg>
|
||||
)
|
||||
}
|
||||
@@ -16,6 +16,7 @@ import {
|
||||
} from '@tanstack/react-table'
|
||||
import type { Track } from '../api'
|
||||
import { formatBpm, formatDuration, keyColor } from './format'
|
||||
import { cueTypeColor } from './cues'
|
||||
import { RatingStars } from '../components/RatingStars'
|
||||
|
||||
declare module '@tanstack/react-table' {
|
||||
@@ -75,7 +76,7 @@ function InlineEdit({
|
||||
}}
|
||||
onClick={(e) => e.stopPropagation()}
|
||||
onDoubleClick={(e) => e.stopPropagation()}
|
||||
className="w-full min-w-0 rounded bg-ink-800 px-1 py-0.5 text-sm text-text outline-none ring-1 ring-accent"
|
||||
className="w-full min-w-0 rounded-md bg-well px-1 py-0.5 text-sm text-text outline-none ring-1 ring-accent"
|
||||
/>
|
||||
)
|
||||
}
|
||||
@@ -134,7 +135,7 @@ export const TRACK_COLUMNS: ColumnDef<Track, any>[] = [
|
||||
<InlineEdit
|
||||
value={title}
|
||||
display={title || <span className="text-faint">Untitled</span>}
|
||||
className="w-full min-w-0 truncate font-medium text-text"
|
||||
className="w-full min-w-0 truncate font-medium text-text group-data-[active]:text-accent"
|
||||
readOnly={!canEdit(c, 'title')}
|
||||
onCommit={(v) => edit?.(r, 'title', v)}
|
||||
/>
|
||||
@@ -182,7 +183,7 @@ export const TRACK_COLUMNS: ColumnDef<Track, any>[] = [
|
||||
id: 'bpm',
|
||||
header: 'BPM',
|
||||
size: 74,
|
||||
cell: (c) => <span className="tabular-nums text-text">{formatBpm(c.getValue())}</span>,
|
||||
cell: (c) => <span className="font-mono text-xs text-text">{formatBpm(c.getValue())}</span>,
|
||||
}),
|
||||
col.accessor('key', {
|
||||
id: 'key',
|
||||
@@ -193,10 +194,11 @@ export const TRACK_COLUMNS: ColumnDef<Track, any>[] = [
|
||||
if (!k) return <span className="text-faint">—</span>
|
||||
return (
|
||||
<span
|
||||
className="rounded px-1.5 py-0.5 text-xs font-semibold"
|
||||
className="inline-block min-w-[2.1rem] rounded-md px-1.5 py-0.5 text-center font-mono text-[11px] font-semibold"
|
||||
style={{
|
||||
color: keyColor(c.row.original.key_wheel),
|
||||
background: 'color-mix(in srgb, currentColor 14%, transparent)',
|
||||
background: 'color-mix(in srgb, currentColor 16%, transparent)',
|
||||
boxShadow: 'inset 0 0 0 1px color-mix(in srgb, currentColor 32%, transparent)',
|
||||
}}
|
||||
>
|
||||
{k}
|
||||
@@ -225,7 +227,7 @@ export const TRACK_COLUMNS: ColumnDef<Track, any>[] = [
|
||||
id: 'length',
|
||||
header: 'Time',
|
||||
size: 64,
|
||||
cell: (c) => <span className="tabular-nums text-muted">{formatDuration(c.getValue())}</span>,
|
||||
cell: (c) => <span className="font-mono text-xs text-muted">{formatDuration(c.getValue())}</span>,
|
||||
}),
|
||||
col.accessor('bitrate', {
|
||||
id: 'bitrate',
|
||||
@@ -243,21 +245,38 @@ export const TRACK_COLUMNS: ColumnDef<Track, any>[] = [
|
||||
col.accessor('cue_count', {
|
||||
id: 'cue_count',
|
||||
header: 'Cues',
|
||||
size: 72,
|
||||
size: 104,
|
||||
cell: (c) => {
|
||||
const n = c.getValue()
|
||||
const markers = c.row.original.grid_marker_count
|
||||
// Gold marks a flexible (multi-tempo) grid, mint an ordinary constant one.
|
||||
const r = c.row.original
|
||||
const n = c.getValue() as number
|
||||
const markers = r.grid_marker_count
|
||||
// One lit dot per occupied hotcue slot, in the cue's colour, so a row
|
||||
// previews the track's prep without loading it. Cues that exist but are
|
||||
// not in the bank (memory cues), or not yet read (a lazily-parsed
|
||||
// device), fall back to the count so a prepped track never looks bare.
|
||||
return (
|
||||
<span className="flex items-center gap-1 tabular-nums">
|
||||
<span className={n > 0 ? 'text-text' : 'text-faint'}>{n}</span>
|
||||
{markers > 0 && (
|
||||
<span
|
||||
className={markers > 1 ? 'text-[10px] text-gold' : 'text-[10px] text-mint'}
|
||||
title={markers > 1 ? `Flexible beatgrid (${markers} markers)` : 'Beatgrid analyzed'}
|
||||
>
|
||||
⊞
|
||||
</span>
|
||||
<span
|
||||
className="flex items-center gap-1"
|
||||
title={`${n} cue${n === 1 ? '' : 's'}${
|
||||
markers > 1 ? ` · flexible beatgrid (${markers} markers)` : markers ? ' · beatgrid analyzed' : ''
|
||||
}`}
|
||||
>
|
||||
{r.hotcues.map((h) => {
|
||||
const color = h.color ?? cueTypeColor(h.type)
|
||||
return (
|
||||
<span
|
||||
key={h.slot}
|
||||
className="h-2 w-2 shrink-0 rounded-full"
|
||||
style={{ background: color, boxShadow: `0 0 6px ${color}` }}
|
||||
/>
|
||||
)
|
||||
})}
|
||||
{r.hotcues.length === 0 && (
|
||||
<span className={`font-mono text-xs ${n > 0 ? 'text-text' : 'text-faint'}`}>{n || '—'}</span>
|
||||
)}
|
||||
{markers > 1 && (
|
||||
// Gold marks a flexible (multi-tempo) grid — rare, and worth seeing.
|
||||
<span className="ml-0.5 text-[10px] text-gold">⊞</span>
|
||||
)}
|
||||
</span>
|
||||
)
|
||||
@@ -267,7 +286,7 @@ export const TRACK_COLUMNS: ColumnDef<Track, any>[] = [
|
||||
id: 'playcount',
|
||||
header: 'Plays',
|
||||
size: 68,
|
||||
cell: (c) => <span className="tabular-nums text-muted">{c.getValue() || 0}</span>,
|
||||
cell: (c) => <span className="font-mono text-xs text-muted">{c.getValue() || 0}</span>,
|
||||
}),
|
||||
col.accessor('import_date', {
|
||||
id: 'import_date',
|
||||
|
||||
@@ -1,39 +1,56 @@
|
||||
// Frequency-colored waveform analysis (Traktor "Spectrum" theme).
|
||||
// Frequency waveform analysis + painting.
|
||||
//
|
||||
// The audio is downmixed to mono and split into three frequency bands with
|
||||
// native BiquadFilters (via OfflineAudioContext — fast, off the main thread).
|
||||
// Per output column we keep each band's RMS energy plus the amplitude peak.
|
||||
// Each band is mapped to a target colour on Traktor's warm→cool ramp
|
||||
// (bass→orange, mids→violet, highs→cyan) and the three are blended by energy;
|
||||
// height = amplitude. Traktor's palette has NO green — mapping bands straight
|
||||
// to R/G/B (the naive approach) produces yellows/greens it never shows, so we
|
||||
// blend named palette colours instead. Tune the three constants below.
|
||||
// Per output column we keep each band's RMS energy, normalised to that band's
|
||||
// loudest moment in the track.
|
||||
//
|
||||
// Painting draws the three bands as LAYERS rather than blending them into one
|
||||
// colour per column: bass (orange) is drawn first and tallest, then mids
|
||||
// (violet) and highs (cyan) on top with a screen blend, so where bands overlap
|
||||
// they mix into light. A kick reads as an orange flare, a hat as a cyan tick,
|
||||
// and the structure of a track — where the bass drops out, where the highs
|
||||
// build — is visible at a glance. Still no green, matching Traktor's palette.
|
||||
|
||||
export interface WaveColumn {
|
||||
peak: number // 0..1 amplitude (column height)
|
||||
r: number // 0..1 final blended colour (already contrast-boosted)
|
||||
g: number
|
||||
b: number
|
||||
peak: number // 0..1 amplitude of the full mix
|
||||
low: number // 0..1 band energies, each normalised to its own maximum
|
||||
mid: number
|
||||
high: number
|
||||
}
|
||||
|
||||
// Band crossover choices. Independent filters, so band energies don't strictly
|
||||
// partition — that's fine, colour is normalised per column.
|
||||
// partition — that's fine, each band is normalised on its own.
|
||||
const LOW_HZ = 250
|
||||
const MID_HZ = 1200
|
||||
const MID_Q = 0.6
|
||||
const HIGH_HZ = 5000
|
||||
|
||||
// Target colour per band on Traktor's ramp (0..1 RGB). Blended by band energy.
|
||||
const LOW_COL = [1.0, 0.30, 0.15] // bass → orange-red
|
||||
const MID_COL = [0.65, 0.18, 0.95] // mids → violet / magenta
|
||||
const HIGH_COL = [0.15, 0.65, 1.0] // highs → cyan-blue
|
||||
// Each layer's colour and its height relative to the waveform's half-height.
|
||||
// Bass is the envelope; mids and highs sit inside it so all three stay visible.
|
||||
const LAYERS: { band: 'low' | 'mid' | 'high'; color: string; scale: number; blend: GlobalCompositeOperation }[] = [
|
||||
{ band: 'low', color: 'rgba(255,138,61,0.95)', scale: 0.96, blend: 'source-over' },
|
||||
{ band: 'mid', color: 'rgba(143,107,255,0.8)', scale: 0.66, blend: 'screen' },
|
||||
{ band: 'high', color: 'rgba(94,231,255,0.85)', scale: 0.46, blend: 'screen' },
|
||||
]
|
||||
|
||||
export interface PaintOptions {
|
||||
/** Bar width and the gap after it, in DEVICE pixels. A gap of 0 paints a
|
||||
* solid waveform (the overview); a gap gives the main view its bar texture. */
|
||||
bar: number
|
||||
gap: number
|
||||
}
|
||||
|
||||
/**
|
||||
* Paint a slice of the analysed columns across a canvas: source columns in the
|
||||
* fractional range [startFrac, endFrac) (of the whole track) are mapped across
|
||||
* the full canvas width, aggregating multiple columns per pixel (max peak,
|
||||
* averaged colour). Fractions outside [0,1] paint blank — used by the scrolling
|
||||
* main view so the lead-in/lead-out past the track edges stays empty.
|
||||
* the full canvas width. Fractions outside [0,1] paint blank — used by the
|
||||
* scrolling main view so the lead-in/lead-out past the track edges stays empty.
|
||||
*
|
||||
* Bars are binned in TRACK space, not screen space: bar k always covers the
|
||||
* same columns of audio, and only its x moves as the view scrolls. Binning by
|
||||
* screen pixel instead makes every bar's height flicker as the playhead
|
||||
* advances, because each frame regroups different columns under each bar.
|
||||
*/
|
||||
export function paintWave(
|
||||
ctx: CanvasRenderingContext2D,
|
||||
@@ -42,38 +59,38 @@ export function paintWave(
|
||||
h: number,
|
||||
startFrac: number,
|
||||
endFrac: number,
|
||||
opts: PaintOptions = { bar: 1, gap: 0 },
|
||||
): void {
|
||||
const n = cols.length
|
||||
if (n === 0 || w === 0 || h === 0) return
|
||||
if (n === 0 || w === 0 || h === 0 || endFrac <= startFrac) return
|
||||
const mid = h / 2
|
||||
const span = (endFrac - startFrac) * n
|
||||
for (let x = 0; x < w; x++) {
|
||||
const c0 = startFrac * n + (x / w) * span
|
||||
const c1 = startFrac * n + ((x + 1) / w) * span
|
||||
const i0 = Math.floor(c0)
|
||||
const i1 = Math.max(i0 + 1, Math.ceil(c1))
|
||||
let peak = 0
|
||||
let r = 0
|
||||
let g = 0
|
||||
let b = 0
|
||||
let count = 0
|
||||
for (let i = i0; i < i1; i++) {
|
||||
if (i < 0 || i >= n) continue
|
||||
const col = cols[i]
|
||||
if (col.peak > peak) peak = col.peak
|
||||
r += col.r
|
||||
g += col.g
|
||||
b += col.b
|
||||
count++
|
||||
const colsPerPx = ((endFrac - startFrac) * n) / w
|
||||
const step = opts.bar + opts.gap
|
||||
const colsPerBar = step * colsPerPx
|
||||
const startCol = startFrac * n
|
||||
const k0 = Math.floor(Math.max(0, startCol) / colsPerBar)
|
||||
const k1 = Math.ceil(Math.min(n, endFrac * n) / colsPerBar)
|
||||
const prevOp = ctx.globalCompositeOperation
|
||||
for (const layer of LAYERS) {
|
||||
ctx.globalCompositeOperation = layer.blend
|
||||
ctx.fillStyle = layer.color
|
||||
const reach = (mid - 1) * layer.scale
|
||||
for (let k = k0; k < k1; k++) {
|
||||
const c0 = k * colsPerBar
|
||||
const i0 = Math.max(0, Math.floor(c0))
|
||||
const i1 = Math.min(n, Math.max(i0 + 1, Math.ceil(c0 + colsPerBar)))
|
||||
let v = 0
|
||||
for (let i = i0; i < i1; i++) {
|
||||
const e = cols[i][layer.band]
|
||||
if (e > v) v = e
|
||||
}
|
||||
if (v <= 0) continue
|
||||
const x = (c0 - startCol) / colsPerPx
|
||||
const half = Math.max(0.5, v * reach)
|
||||
ctx.fillRect(x, mid - half, opts.bar, half * 2)
|
||||
}
|
||||
if (count === 0) continue // outside the track → blank pixel
|
||||
r /= count
|
||||
g /= count
|
||||
b /= count
|
||||
const half = Math.max(0.5, peak * (mid - 1))
|
||||
ctx.fillStyle = `rgb(${(r * 255) | 0},${(g * 255) | 0},${(b * 255) | 0})`
|
||||
ctx.fillRect(x, mid - half, 1, half * 2)
|
||||
}
|
||||
ctx.globalCompositeOperation = prevOp
|
||||
}
|
||||
|
||||
export interface WaveformAnalysis {
|
||||
@@ -162,32 +179,40 @@ export async function analyzeWaveform(url: string, buckets?: number): Promise<Wa
|
||||
await accumBand(midE, 'bandpass', MID_HZ, MID_Q)
|
||||
await accumBand(highE, 'highpass', HIGH_HZ)
|
||||
|
||||
// Per-band normalisation, to the band's 99.5th-percentile column rather than
|
||||
// its single loudest (one clipped transient would otherwise shrink the whole
|
||||
// band). Each band then gets an EXPANDING curve: dance music keeps its bass
|
||||
// near full scale for whole sections, so a linear (or compressing) map draws
|
||||
// a solid wall where the eye wants to see the kick pulse. The bass curve is
|
||||
// steepest, since it carries the rhythm; highs stay near linear so hats and
|
||||
// risers keep their detail.
|
||||
const rms = (e: Float64Array) => {
|
||||
const out = new Float64Array(e.length)
|
||||
for (let b = 0; b < e.length; b++) out[b] = Math.sqrt(e[b] / (cnt[b] || 1))
|
||||
return out
|
||||
}
|
||||
const ceiling = (v: Float64Array) => {
|
||||
const sorted = Float64Array.from(v).sort()
|
||||
return Math.max(1e-9, sorted[Math.floor((sorted.length - 1) * 0.995)])
|
||||
}
|
||||
const lowR = rms(lowE)
|
||||
const midR = rms(midE)
|
||||
const highR = rms(highE)
|
||||
const maxL = ceiling(lowR)
|
||||
const maxM = ceiling(midR)
|
||||
const maxH = ceiling(highR)
|
||||
let maxPeak = 1e-6
|
||||
for (let b = 0; b < buckets; b++) if (peak[b] > maxPeak) maxPeak = peak[b]
|
||||
const curve = (v: number, k: number) => Math.pow(Math.min(1, v), k)
|
||||
|
||||
const cols: WaveColumn[] = new Array(buckets)
|
||||
for (let b = 0; b < buckets; b++) {
|
||||
const n = cnt[b] || 1
|
||||
const l = Math.sqrt(lowE[b] / n)
|
||||
const m = Math.sqrt(midE[b] / n)
|
||||
const h = Math.sqrt(highE[b] / n)
|
||||
// Normalise to the dominant band so colours stay vivid (brightness is not
|
||||
// tied to loudness — amplitude is shown by height, like Traktor). Gamma
|
||||
// sharpens the separation between bands.
|
||||
const mx = Math.max(l, m, h, 1e-9)
|
||||
const wl = Math.pow(l / mx, 1.3)
|
||||
const wm = Math.pow(m / mx, 1.3)
|
||||
const wh = Math.pow(h / mx, 1.3)
|
||||
// Blend the three band palette colours by weight, then normalise to the
|
||||
// brightest channel so the colour stays vivid (height carries loudness).
|
||||
let cr = wl * LOW_COL[0] + wm * MID_COL[0] + wh * HIGH_COL[0]
|
||||
let cg = wl * LOW_COL[1] + wm * MID_COL[1] + wh * HIGH_COL[1]
|
||||
let cb = wl * LOW_COL[2] + wm * MID_COL[2] + wh * HIGH_COL[2]
|
||||
const cmax = Math.max(cr, cg, cb, 1e-9)
|
||||
cr /= cmax
|
||||
cg /= cmax
|
||||
cb /= cmax
|
||||
cols[b] = { peak: peak[b] / maxPeak, r: cr, g: cg, b: cb }
|
||||
cols[b] = {
|
||||
peak: peak[b] / maxPeak,
|
||||
low: curve(lowR[b] / maxL, 1.8),
|
||||
mid: curve(midR[b] / maxM, 1.3),
|
||||
high: curve(highR[b] / maxH, 1.05),
|
||||
}
|
||||
}
|
||||
return { cols, buffer: audio }
|
||||
}
|
||||
@@ -1,9 +1,12 @@
|
||||
import { StrictMode } from 'react'
|
||||
import { createRoot } from 'react-dom/client'
|
||||
import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
|
||||
import '@fontsource-variable/geist'
|
||||
import '@fontsource-variable/geist-mono'
|
||||
import './index.css'
|
||||
import App from './App.tsx'
|
||||
import { UpdateCheck } from './components/UpdateDialog.tsx'
|
||||
import { AmbientBackdrop } from './components/AmbientBackdrop.tsx'
|
||||
|
||||
const queryClient = new QueryClient({
|
||||
defaultOptions: {
|
||||
@@ -17,6 +20,8 @@ const queryClient = new QueryClient({
|
||||
createRoot(document.getElementById('root')!).render(
|
||||
<StrictMode>
|
||||
<QueryClientProvider client={queryClient}>
|
||||
{/* Behind everything, the picker screen included: every surface is glass over it. */}
|
||||
<AmbientBackdrop />
|
||||
<App />
|
||||
{/* Mounted beside App so the update dialog shows even on the picker screen. */}
|
||||
<UpdateCheck />
|
||||
|
||||
Reference in new issue
Block a user