Changed theme to liquid glass

This commit is contained in:
patben8 committed 2026-09-25 14:57:27 +02:00
1 parent 950352f7ec
commit 2810f24563
52 files changed
+1329 -505

No files matched your search

+52 -6
View File
@@ -427,7 +427,8 @@ Two independent apps that talk over HTTP:
- Data flow: the whole library is fetched once (`/api/tracks?limit=20000`); - Data flow: the whole library is fetched once (`/api/tracks?limit=20000`);
filtering and sorting happen **client-side** for instant interaction. Edits filtering and sorting happen **client-side** for instant interaction. Edits
apply in-memory (server holds them) and the sidebar **Save to Traktor** 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` Library column layout (visibility/order/width) persists to `userprefs.json`
via `GET`/`PATCH /api/prefs` (debounced; hydrated on launch, merged against via `GET`/`PATCH /api/prefs` (debounced; hydrated on launch, merged against
defaults so newly-added columns still appear). The prep deck's main-waveform 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 - Backend: type hints, Pydantic models for all responses, keep query logic in
`collection_service.py` (routes stay thin). `collection_service.py` (routes stay thin).
- Frontend: functional components, TanStack Query for fetching, Tailwind - Frontend: functional components, TanStack Query for fetching, Tailwind
utility classes with the `ink-*`/`accent`/`gold`/`mint`/`pink` tokens from utility classes with the `ink-*`/`well`/`accent`/`gold`/`mint`/`pink` tokens
`index.css`. Keep `api.ts` types aligned with `schemas.py`. 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 - Python 3.14 note: pin dependencies loosely enough to get prebuilt wheels
(older `pydantic-core` pins force a from-source Rust build that fails). (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 playback buffer's views). Playback and scratch also run on **separate
`AudioContext`s** — sharing one goes silent after a source has played. `AudioContext`s** — sharing one goes silent after a source has played.
- `waveform.ts` — decodes once (buffer reused by both engines, no re-decode), - `waveform.ts` — decodes once (buffer reused by both engines, no re-decode),
splits into 3 bands via `OfflineAudioContext` biquads, and colors each column splits into 3 bands via `OfflineAudioContext` biquads, and paints them as
by blending three palette targets (bass→orange, mids→violet, highs→cyan — no **three layers**, not one blended colour per column: bass (orange) first and
green, matching Traktor's Spectrum). Height = amplitude. 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 - `cues.ts` — canvas drawers for cue markers (type-colored), the active loop
band, the beatgrid (per-segment white beats/brighter downbeats, plus marker band, the beatgrid (per-segment white beats/brighter downbeats, plus marker
lines — gold for the one governing the playhead, accent otherwise, with the 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.adapter import Unsupported
from ...core.capabilities import Capabilities 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.pathmap import PathMapping, common_dir_prefix
from ...core.query import TrackIndex from ...core.query import TrackIndex
from . import capabilities as caps from . import capabilities as caps
@@ -125,7 +125,15 @@ class OneLibraryAdapter:
if track is not None: if track is not None:
track.grid_marker_count = len(result.grid_markers) track.grid_marker_count = len(result.grid_markers)
track.cue_count = len(result.cues) 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 return result
# ---- playlists ------------------------------------------------------- # ---- playlists -------------------------------------------------------
@@ -43,10 +43,10 @@ class RekordboxAdapter:
# ---- projection maintenance ----------------------------------------- # ---- projection maintenance -----------------------------------------
def _rebuild(self) -> None: def _rebuild(self) -> None:
counts = self._store.cue_counts() kinds = self._store.cue_kinds()
self._index.rebuild( 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() 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 Every mutating command must end in this — a forgotten refresh is a
silently stale projection that no byte- or row-level test would catch. 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) 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: def close(self) -> None:
"""Release the database connection. """Release the database connection.
@@ -7,7 +7,7 @@ from __future__ import annotations
import re import re
from ...core.model import CuePoint, GridMarker, Track, TrackCues from ...core.model import CuePoint, GridMarker, HotcueChip, Track, TrackCues
from . import beatgrid from . import beatgrid
from .cue_types import cue_type, role_and_slot from .cue_types import cue_type, role_and_slot
@@ -97,12 +97,14 @@ def _name_of(related) -> str | None:
return 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. """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 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 **`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 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 On the reference library the two sets agree exactly: all 22 tracks with no
BPM are precisely the 22 with no grid. 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)) key_name = _name_of(getattr(row, "Key", None))
wheel, mode = parse_key(key_name) wheel, mode = parse_key(key_name)
return Track( 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 last_played=None, # not modelled as a date in master.db
release_date=_iso_date(getattr(row, "ReleaseDate", None)), release_date=_iso_date(getattr(row, "ReleaseDate", None)),
filepath=str(getattr(row, "FolderPath", "") or "") or None, filepath=str(getattr(row, "FolderPath", "") or "") or None,
cue_count=total_cues, cue_count=len(cue_kinds),
hotcue_count=hotcues, hotcue_count=len(chips),
hotcues=chips,
grid_marker_count=1 if (_bpm(row) and getattr(row, "AnalysisDataPath", None)) else 0, grid_marker_count=1 if (_bpm(row) and getattr(row, "AnalysisDataPath", None)) else 0,
grid_locked=False, # Rekordbox has no per-track grid lock grid_locked=False, # Rekordbox has no per-track grid lock
media_kind="audio", media_kind="audio",
+12 -13
View File
@@ -171,23 +171,22 @@ class RekordboxStore:
raise NotFound(f"No track {track_id!r}") raise NotFound(f"No track {track_id!r}")
return row return row
def cue_counts(self) -> dict[str, tuple[int, int]]: def cue_kinds(self) -> dict[str, list[tuple[int | None, int | None]]]:
"""``{track_id: (total_cues, hotcue_count)}`` in one aggregate query.""" """``{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 t = self._tables
rows = self._db.session.execute( 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) .where(t.DjmdCue.rb_local_deleted == 0)
.group_by(t.DjmdCue.ContentID, t.DjmdCue.Kind)
).all() ).all()
out: dict[str, tuple[int, int]] = {} out: dict[str, list[tuple[int | None, int | None]]] = {}
for content_id, kind, n in rows: for content_id, kind, out_msec in rows:
total, hot = out.get(str(content_id), (0, 0)) out.setdefault(str(content_id), []).append((kind, out_msec))
# "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))
return out return out
def cues(self, track_id: str) -> list: def cues(self, track_id: str) -> list:
@@ -7,7 +7,7 @@ from __future__ import annotations
import re import re
from ...core.model import CuePoint, GridMarker, Track, TrackCues from ...core.model import CuePoint, GridMarker, HotcueChip, Track, TrackCues
from . import beatgrid from . import beatgrid
from .cue_types import NATIVE_TO_CUE_TYPE from .cue_types import NATIVE_TO_CUE_TYPE
@@ -83,8 +83,19 @@ def to_track(e) -> Track:
# question, two answers. # question, two answers.
markers = beatgrid.grid_markers(e) markers = beatgrid.grid_markers(e)
cues = [c for c in (e.cue_v2 or []) if getattr(c, "grid", None) is None] cues = [c for c in (e.cue_v2 or []) if getattr(c, "grid", None) is None]
hotcues = sum( # The same "is this in the bank" test as `to_track_cues`' slot, so the
1 for c in cues if c.hotcue is not None and c.hotcue >= 0 # 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) wheel, mode = parse_key(info.key if info else None)
return Track( return Track(
@@ -111,7 +122,8 @@ def to_track(e) -> Track:
release_date=iso_date(info.release_date if info else None), release_date=iso_date(info.release_date if info else None),
filepath=_display_path(loc) if loc else None, filepath=_display_path(loc) if loc else None,
cue_count=len(cues), cue_count=len(cues),
hotcue_count=hotcues, hotcue_count=len(chips),
hotcues=chips,
grid_marker_count=len(markers), grid_marker_count=len(markers),
grid_locked=bool(e.lock), grid_locked=bool(e.lock),
media_kind="stem" if getattr(e, "stems", None) is not None else "audio", media_kind="stem" if getattr(e, "stems", None) is not None else "audio",
+16
View File
@@ -16,6 +16,18 @@ from pydantic import BaseModel, ConfigDict, Field
from .capabilities import CueRole, CueType, MediaKind, PlaylistKind 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): class Track(BaseModel):
"""A single track in the library, as the app sees it.""" """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 filepath: str | None = None # human-readable OS path
cue_count: int = 0 cue_count: int = 0
hotcue_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. # 0 = no beatgrid, 1 = constant tempo, >1 = a flexible (multi-tempo) grid.
grid_marker_count: int = 0 grid_marker_count: int = 0
grid_locked: bool = False grid_locked: bool = False
+1
View File
@@ -314,6 +314,7 @@ from .core.model import ( # noqa: E402,F401
Facets, Facets,
GenreCount, GenreCount,
GridMarker, GridMarker,
HotcueChip,
PlaylistNode, PlaylistNode,
PrefixGroup, PrefixGroup,
PrefixSuggestions, PrefixSuggestions,
+20
View File
@@ -12,6 +12,8 @@
"@dnd-kit/modifiers": "^9.0.0", "@dnd-kit/modifiers": "^9.0.0",
"@dnd-kit/sortable": "^10.0.0", "@dnd-kit/sortable": "^10.0.0",
"@dnd-kit/utilities": "^3.2.2", "@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-query": "^5.101.2",
"@tanstack/react-table": "^8.21.3", "@tanstack/react-table": "^8.21.3",
"@tanstack/react-virtual": "^3.14.5", "@tanstack/react-virtual": "^3.14.5",
@@ -150,6 +152,24 @@
"tslib": "^2.4.0" "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": { "node_modules/@jridgewell/gen-mapping": {
"version": "0.3.13", "version": "0.3.13",
"resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.13.tgz", "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.13.tgz",
+2
View File
@@ -15,6 +15,8 @@
"@dnd-kit/modifiers": "^9.0.0", "@dnd-kit/modifiers": "^9.0.0",
"@dnd-kit/sortable": "^10.0.0", "@dnd-kit/sortable": "^10.0.0",
"@dnd-kit/utilities": "^3.2.2", "@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-query": "^5.101.2",
"@tanstack/react-table": "^8.21.3", "@tanstack/react-table": "^8.21.3",
"@tanstack/react-virtual": "^3.14.5", "@tanstack/react-virtual": "^3.14.5",
+22 -14
View File
@@ -24,6 +24,7 @@ import { PathMappingDialog } from './components/PathMappingDialog'
import { HistoryPanel } from './components/HistoryPanel' import { HistoryPanel } from './components/HistoryPanel'
import { PrepStrip } from './components/PrepStrip' import { PrepStrip } from './components/PrepStrip'
import { ImportDialog } from './components/ImportDialog' import { ImportDialog } from './components/ImportDialog'
import { Icon } from './lib/icons'
function applyFilters(tracks: Track[], f: Filters): Track[] { function applyFilters(tracks: Track[], f: Filters): Track[] {
const q = f.search.trim().toLowerCase() const q = f.search.trim().toLowerCase()
@@ -506,7 +507,7 @@ export default function App() {
if (collection.isLoading || (loaded && !capabilities.data)) { if (collection.isLoading || (loaded && !capabilities.data)) {
return ( 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… Loading…
</div> </div>
) )
@@ -759,7 +760,7 @@ export default function App() {
{ heading: 'Exports', empty: exportSets.data?.length ? undefined : 'No exports yet' }, { heading: 'Exports', empty: exportSets.data?.length ? undefined : 'No exports yet' },
...(exportSets.data ?? []).map((set) => ({ ...(exportSets.data ?? []).map((set) => ({
label: set.name, label: set.name,
icon: '◈', icon: <Icon name="export" size={13} />,
onClick: () => addToExport(set.id, ids), onClick: () => addToExport(set.id, ids),
})), })),
] ]
@@ -767,7 +768,9 @@ export default function App() {
return ( return (
<CapabilitiesContext.Provider value={capabilities.data!}> <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)} /> <Toast toast={toast} onClose={() => setToast(null)} />
{menu && ( {menu && (
<ContextMenu <ContextMenu
@@ -907,7 +910,7 @@ export default function App() {
/> />
</CapabilitiesContext.Provider> </CapabilitiesContext.Provider>
<div className="flex min-h-0 flex-1 overflow-hidden"> <div className="flex min-h-0 flex-1 gap-3">
<Sidebar <Sidebar
source={source} source={source}
onSelect={selectSource} onSelect={selectSource}
@@ -920,20 +923,23 @@ export default function App() {
/> />
<CapabilitiesContext.Provider value={viewCaps}> <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. */} {/* Search / filters — always visible. Columns are chosen by right-clicking the header. */}
<Toolbar <Toolbar
filters={filters} filters={filters}
onChange={setFilters} onChange={setFilters}
/> />
{(!isAll || viewingDevice) && ( {(!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 <span
className={`text-[11px] ${ className={`flex ${
viewingDevice ? 'text-gold' : viewingExport ? 'text-gold' : 'text-accent' 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>
<span className="font-semibold text-text">{viewName}</span> <span className="font-semibold text-text">{viewName}</span>
{viewingExport ? ( {viewingExport ? (
@@ -949,7 +955,7 @@ export default function App() {
: ' · live — what ships is whatever this playlist holds at export time'} : ' · live — what ships is whatever this playlist holds at export time'}
</span> </span>
<span className="ml-auto flex items-center gap-2"> <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 Export
</span> </span>
</span> </span>
@@ -962,12 +968,12 @@ export default function App() {
: `${tracks.length} tracks`} : `${tracks.length} tracks`}
</span> </span>
<span className="ml-auto flex items-center gap-2"> <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 Device · read-only
</span> </span>
<button <button
onClick={() => setImporting(true)} 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'}… Import{source.kind === 'device-playlist' ? ' this playlist' : ' everything'}…
</button> </button>
@@ -1122,6 +1128,11 @@ export default function App() {
</div> </div>
</main>
</CapabilitiesContext.Provider>
</div>
{/* A slim capsule of its own under both columns, as on the deck above. */}
<StatusBar <StatusBar
showing={filtered.length} showing={filtered.length}
total={tracks.length} total={tracks.length}
@@ -1146,9 +1157,6 @@ export default function App() {
collectionName={capabilities.data ? libraryName : null} collectionName={capabilities.data ? libraryName : null}
onChangeCollection={() => setForcePicker(true)} onChangeCollection={() => setForcePicker(true)}
/> />
</main>
</CapabilitiesContext.Provider>
</div>
</div> </div>
</CapabilitiesContext.Provider> </CapabilitiesContext.Provider>
) )
+11
View File
@@ -29,12 +29,23 @@ export interface Track {
filepath: string | null filepath: string | null
cue_count: number cue_count: number
hotcue_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. */ /** 0 = no beatgrid, 1 = constant tempo, >1 = a flexible (multi-tempo) grid. */
grid_marker_count: number grid_marker_count: number
grid_locked: boolean grid_locked: boolean
media_kind: MediaKind 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 { export interface TrackPage {
total: number total: number
offset: 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 ( return (
<div <div
aria-modal="true" 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} onClick={onClose}
> >
<div <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()} onClick={(e) => e.stopPropagation()}
> >
<div className="border-b border-line px-5 py-4"> <div className="border-b border-line px-5 py-4">
@@ -71,7 +71,7 @@ export function AnalyzeGridDialog({ total, existing, locked, onChoose, onClose }
{canSkip && ( {canSkip && (
<button <button
onClick={() => onChoose(false)} 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'} Skip {existing === 1 ? 'it' : 'them'}
</button> </button>
+3 -3
View File
@@ -152,9 +152,9 @@ export function AutoCueDialog(props: Props) {
} }
return ( 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 <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()} onClick={(e) => e.stopPropagation()}
> >
<div className="border-b border-line px-5 py-4"> <div className="border-b border-line px-5 py-4">
@@ -281,7 +281,7 @@ export function AutoCueDialog(props: Props) {
<button <button
onClick={confirm} onClick={confirm}
disabled={busy || rows === null || active === 0} 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 {busy
? props.batch ? props.batch
+7 -6
View File
@@ -1,3 +1,5 @@
import { Icon } from '../lib/icons'
/** Jump-size cycle, in beats. Fractional sizes allow fine micro-nudging. */ /** 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] export const BEAT_JUMP_SIZES = [0.25, 0.5, 1, 2, 4, 8, 16, 32]
@@ -13,9 +15,8 @@ interface Props {
} }
const BTN = const BTN =
'flex h-7 w-7 shrink-0 items-center justify-center rounded border border-line bg-ink-850 ' + 'btn-glass flex h-7 w-7 shrink-0 items-center justify-center rounded-lg ' +
'text-xs font-semibold text-text transition-colors hover:border-accent disabled:opacity-30 ' + 'font-mono text-xs font-semibold text-text disabled:opacity-30'
'disabled:hover:border-line'
/** Beats-only readout: 0.25 → "1/4", 0.5 → "1/2", else the integer. */ /** Beats-only readout: 0.25 → "1/4", 0.5 → "1/2", else the integer. */
function sizeLabel(beats: number): string { function sizeLabel(beats: number): string {
@@ -46,7 +47,7 @@ export function BeatJumpControls({ beats, onStep, onJump, disabled }: Props) {
> >
− −
</button> </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)} {sizeLabel(beats)}
</span> </span>
<button <button
@@ -64,7 +65,7 @@ export function BeatJumpControls({ beats, onStep, onJump, disabled }: Props) {
disabled={disabled} disabled={disabled}
title="Jump back (←)" title="Jump back (←)"
> >
◀ <Icon name="chevronLeft" size={14} strokeWidth={2.2} />
</button> </button>
<button <button
className={BTN} className={BTN}
@@ -72,7 +73,7 @@ export function BeatJumpControls({ beats, onStep, onJump, disabled }: Props) {
disabled={disabled} disabled={disabled}
title="Jump forward (→)" title="Jump forward (→)"
> >
▶ <Icon name="chevronRight" size={14} strokeWidth={2.2} />
</button> </button>
</div> </div>
) )
+5 -5
View File
@@ -120,8 +120,8 @@ export function CollectionPicker({ onOpened, onCancel }: Props) {
const openError = open.isError ? (open.error as Error).message : null const openError = open.isError ? (open.error as Error).message : null
return ( return (
<div className="flex h-screen w-screen items-center justify-center bg-ink-950 p-6"> <div className="flex h-screen w-screen items-center justify-center 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="glass flex h-[600px] w-full max-w-2xl flex-col overflow-hidden">
{/* Header */} {/* Header */}
<div className="flex items-center gap-3 border-b border-line px-5 py-4"> <div className="flex items-center gap-3 border-b border-line px-5 py-4">
<div className="min-w-0 flex-1"> <div className="min-w-0 flex-1">
@@ -274,7 +274,7 @@ export function CollectionPicker({ onOpened, onCancel }: Props) {
<button <button
disabled={!here || open.isPending} disabled={!here || open.isPending}
onClick={() => here && open.mutate(here)} 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'} {open.isPending ? 'Opening…' : 'Open this folder'}
</button> </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 the drive'
: `…or paste a full path to ${platform!.library_label}` : `…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 <button
disabled={!manual.trim() || open.isPending} disabled={!manual.trim() || open.isPending}
onClick={() => open.mutate(manual.trim())} 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'} {open.isPending ? 'Opening…' : 'Open'}
</button> </button>
+3 -3
View File
@@ -46,11 +46,11 @@ export function ConfirmDialog({ title, body, confirmLabel, onConfirm, onClose }:
return ( return (
<div <div
aria-modal="true" 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()} onClick={() => !busy && onClose()}
> >
<div <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()} onClick={(e) => e.stopPropagation()}
> >
<div className="border-b border-line px-5 py-4 text-[15px] font-semibold tracking-tight"> <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 <button
onClick={() => void confirm()} onClick={() => void confirm()}
disabled={busy} 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} {confirmLabel}
</button> </button>
+18 -13
View File
@@ -1,8 +1,10 @@
import type { ReactNode } from 'react'
import { useEffect, useRef, useState } 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. */ /** One row of a menu: an action, a submenu (`label ▸`), or a section heading. */
export type MenuItem = 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[] } | { label: string; submenu: MenuItem[] }
// Toggles in place and leaves the menu open, so several can be flipped in one go. // Toggles in place and leaves the menu open, so several can be flipped in one go.
| { label: string; checked: boolean; onToggle: () => void } | { label: string; checked: boolean; onToggle: () => void }
@@ -54,7 +56,10 @@ export function ContextMenu({ x, y, items, onClose }: Props) {
}, []) }, [])
return ( 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 <MenuPanel
items={items} items={items}
onClose={onClose} onClose={onClose}
@@ -96,12 +101,12 @@ function MenuPanel({
return ( return (
<> <>
<div <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} style={style}
> >
{items.map((item, i) => { {items.map((item, i) => {
if ('separator' in item) { 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) { if ('checked' in item) {
return ( return (
@@ -111,14 +116,14 @@ function MenuPanel({
aria-checked={item.checked} aria-checked={item.checked}
onMouseEnter={() => setOpen(null)} onMouseEnter={() => setOpen(null)}
onClick={item.onToggle} 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 <span
className={`flex h-3.5 w-3.5 shrink-0 items-center justify-center rounded-sm border text-[10px] leading-none ${ className={`flex h-3.5 w-3.5 shrink-0 items-center justify-center rounded border leading-none ${
item.checked ? 'border-accent bg-accent text-ink-950' : 'border-ink-600' item.checked ? 'border-accent btn-primary' : 'border-ink-600'
}`} }`}
> >
{item.checked ? '✓' : ''} {item.checked && <Icon name="check" size={10} strokeWidth={3.2} />}
</span> </span>
<span className="min-w-0 flex-1 truncate">{item.label}</span> <span className="min-w-0 flex-1 truncate">{item.label}</span>
</button> </button>
@@ -140,12 +145,12 @@ function MenuPanel({
key={i} key={i}
onMouseEnter={(e) => openSubmenu(i, e.currentTarget)} onMouseEnter={(e) => openSubmenu(i, e.currentTarget)}
onClick={(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' open?.index === i ? 'bg-ink-800 text-text' : 'text-muted'
}`} }`}
> >
<span>{item.label}</span> <span>{item.label}</span>
<span className="text-[10px] text-faint">▸</span> <Icon name="chevronRight" size={12} strokeWidth={2.4} className="text-faint" />
</button> </button>
) )
} }
@@ -158,7 +163,7 @@ function MenuPanel({
item.onClick() item.onClick()
onClose() 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 item.disabled
? 'cursor-default text-faint' ? 'cursor-default text-faint'
: item.danger : item.danger
@@ -166,10 +171,10 @@ function MenuPanel({
: 'text-muted hover:bg-ink-800 hover:text-text' : '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> <span className="min-w-0 flex-1 truncate">{item.label}</span>
{item.hint && ( {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> </button>
) )
+7 -6
View File
@@ -2,6 +2,7 @@ import { useEffect } from 'react'
import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query' import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query'
import { api, type PlaylistNode } from '../api' import { api, type PlaylistNode } from '../api'
import type { Source } from './Sidebar' import type { Source } from './Sidebar'
import { Icon } from '../lib/icons'
/** /**
* Plugged-in libraries, in the sidebar, the way rekordbox and Traktor show them. * 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 ${ 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' isOpen && source.kind === 'device'
? 'bg-accent-soft text-text' ? 'is-selected text-text'
: 'text-muted hover:bg-ink-800 hover: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}> <span className="flex-1 truncate" title={d.path}>
{d.label} {d.label}
</span> </span>
@@ -140,7 +141,7 @@ export function DevicesSection({ source, onSelect, onError, onImport }: Props) {
{viewingDevice && openPath && ( {viewingDevice && openPath && (
<button <button
onClick={onImport} 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… Import to collection…
</button> </button>
@@ -178,14 +179,14 @@ function DevicePlaylistRow({
style={{ paddingLeft: 8 + depth * 12 }} 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 ${ className={`flex w-full items-center gap-2 rounded-md py-1 pr-2 text-left text-sm transition-colors ${
selected selected
? 'bg-accent-soft text-text' ? 'is-selected text-text'
: node.selectable : node.selectable
? 'text-muted hover:bg-ink-800 hover:text-text' ? 'text-muted hover:bg-ink-800 hover:text-text'
: 'text-faint' : 'text-faint'
}`} }`}
> >
<span className="w-3 text-center text-[11px] text-faint"> <span className="flex w-4 justify-center text-faint">
{isFolder ? '▸' : '♫'} <Icon name={isFolder ? 'folder' : 'playlist'} size={14} />
</span> </span>
<span className="flex-1 truncate">{node.name}</span> <span className="flex-1 truncate">{node.name}</span>
{!isFolder && <span className="text-[10px] text-faint">{node.count}</span>} {!isFolder && <span className="text-[10px] text-faint">{node.count}</span>}
+5 -5
View File
@@ -97,11 +97,11 @@ export function EditTagsDialog({ track, onClose, onApplied, onError }: Props) {
return ( return (
<div <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} onClick={onClose}
> >
<div <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()} onClick={(e) => e.stopPropagation()}
> >
<div className="border-b border-line px-5 py-4"> <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]} value={form[key]}
onChange={(e) => setForm({ ...form, [key]: e.target.value })} onChange={(e) => setForm({ ...form, [key]: e.target.value })}
rows={2} 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 <input
value={form[key]} value={form[key]}
onChange={(e) => setForm({ ...form, [key]: e.target.value })} onChange={(e) => setForm({ ...form, [key]: e.target.value })}
list={key === 'genre' ? 'genre-suggestions' : undefined} 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> </label>
@@ -241,7 +241,7 @@ export function EditTagsDialog({ track, onClose, onApplied, onError }: Props) {
<button <button
onClick={submit} onClick={submit}
disabled={apply.isPending} 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'} {apply.isPending ? 'Applying…' : 'Apply'}
</button> </button>
+8 -8
View File
@@ -67,8 +67,8 @@ export function ExportDialog({ editing, onClose, onSaved, onError }: Props) {
onClose={() => setBrowsing(false)} onClose={() => setBrowsing(false)}
/> />
)} )}
<div aria-modal="true" className="fixed inset-0 z-50 flex items-center justify-center bg-black/60 p-4"> <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 rounded-lg border border-line bg-ink-900 shadow-xl"> <div className="w-full max-w-lg glass-overlay">
<div className="border-b border-line px-5 py-3"> <div className="border-b border-line px-5 py-3">
<h2 className="text-sm font-semibold text-text"> <h2 className="text-sm font-semibold text-text">
{editing ? `Edit “${editing.name}”` : 'New export'} {editing ? `Edit “${editing.name}”` : 'New export'}
@@ -86,7 +86,7 @@ export function ExportDialog({ editing, onClose, onSaved, onError }: Props) {
onKeyDown={(e) => { onKeyDown={(e) => {
if (e.key === 'Enter' && valid && !busy) save() 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> </div>
@@ -124,13 +124,13 @@ export function ExportDialog({ editing, onClose, onSaved, onError }: Props) {
<span <span
title={destination} title={destination}
dir="rtl" 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…'} {destination || 'Choose a folder…'}
</span> </span>
<button <button
onClick={() => setBrowsing(true)} 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… Browse…
</button> </button>
@@ -140,7 +140,7 @@ export function ExportDialog({ editing, onClose, onSaved, onError }: Props) {
every track, in your own folder structure. every track, in your own folder structure.
</div> </div>
{conflict && ( {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 “{conflict}” already exports here. Exporting replaces whatever the other one
wrote. wrote.
</div> </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"> <div className="flex justify-end gap-2 border-t border-line px-5 py-3">
<button <button
onClick={onClose} 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 Cancel
</button> </button>
<button <button
disabled={!valid || busy} disabled={!valid || busy}
onClick={save} 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'} {busy ? 'Saving…' : editing ? 'Save' : 'Create'}
</button> </button>
+12 -12
View File
@@ -101,8 +101,8 @@ export function ExportRunDialog({ set, onClose, onDone, onError }: Props) {
const blocked = p?.blocked ?? null const blocked = p?.blocked ?? null
return ( return (
<div aria-modal="true" className="fixed inset-0 z-50 flex items-center justify-center bg-black/60 p-4"> <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 rounded-lg border border-line bg-ink-900 shadow-xl"> <div className="w-full max-w-lg glass-overlay">
<div className="border-b border-line px-5 py-3"> <div className="border-b border-line px-5 py-3">
<h2 className="text-sm font-semibold text-text">Export “{set.name}”</h2> <h2 className="text-sm font-semibold text-text">Export “{set.name}”</h2>
</div> </div>
@@ -115,7 +115,7 @@ export function ExportRunDialog({ set, onClose, onDone, onError }: Props) {
<div <div
dir="rtl" dir="rtl"
title={set.destination} 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} {set.destination}
</div> </div>
@@ -143,14 +143,14 @@ export function ExportRunDialog({ set, onClose, onDone, onError }: Props) {
{/* Reported and skipped, not a failure halfway through a long {/* Reported and skipped, not a failure halfway through a long
copy. A gig stick short four tracks must never be silent. */} copy. A gig stick short four tracks must never be silent. */}
{p.missing.length > 0 && ( {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 — {p.missing.length} track{p.missing.length === 1 ? '' : 's'} will be skipped —
the audio file is not on this disk: the audio file is not on this disk:
<div className="mt-1 text-faint">{p.missing.slice(0, 4).join(', ')}</div> <div className="mt-1 text-faint">{p.missing.slice(0, 4).join(', ')}</div>
</div> </div>
)} )}
{p.replacing && ( {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. This folder already holds an export. Its files will be replaced.
</div> </div>
)} )}
@@ -162,19 +162,19 @@ export function ExportRunDialog({ set, onClose, onDone, onError }: Props) {
)} )}
{blocked === 'destination_not_empty' && ( {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 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 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. one of its own. Edit the export and choose somewhere else.
</div> </div>
)} )}
{blocked === 'nothing_to_export' && ( {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. There’s nothing to export yet — add some tracks or a playlist.
</div> </div>
)} )}
{blocked === 'unsupported_target' && ( {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. Konduktor can’t write that kind of library yet.
</div> </div>
)} )}
@@ -184,7 +184,7 @@ export function ExportRunDialog({ set, onClose, onDone, onError }: Props) {
{job && ( {job && (
<div className="space-y-3"> <div className="space-y-3">
<div className="text-text">{job.message || 'Working…'}</div> <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 <div
className={`h-full transition-[width] duration-200 ${ className={`h-full transition-[width] duration-200 ${
job.state === 'failed' ? 'bg-pink' : 'bg-accent' job.state === 'failed' ? 'bg-pink' : 'bg-accent'
@@ -225,7 +225,7 @@ export function ExportRunDialog({ set, onClose, onDone, onError }: Props) {
<> <>
<button <button
onClick={cancel} 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 Cancel export
</button> </button>
@@ -241,7 +241,7 @@ export function ExportRunDialog({ set, onClose, onDone, onError }: Props) {
<> <>
<button <button
onClick={onClose} 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'} {finished ? 'Close' : 'Cancel'}
</button> </button>
@@ -251,7 +251,7 @@ export function ExportRunDialog({ set, onClose, onDone, onError }: Props) {
starting || !p || !!blocked || p.exportable === 0 || p.enough_space === false starting || !p || !!blocked || p.exportable === 0 || p.enough_space === false
} }
onClick={start} 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()} {starting ? 'Starting…' : `Export ${p && !blocked ? p.exportable : ''}`.trim()}
</button> </button>
+13 -12
View File
@@ -4,6 +4,7 @@ import { api, type ExportSet } from '../api'
import { ExportDialog } from './ExportDialog' import { ExportDialog } from './ExportDialog'
import { ExportRunDialog } from './ExportRunDialog' import { ExportRunDialog } from './ExportRunDialog'
import type { Source } from './Sidebar' import type { Source } from './Sidebar'
import { Icon } from '../lib/icons'
/** /**
* Exports in the sidebar: each one a named, persisted slice of the library * Exports in the sidebar: each one a named, persisted slice of the library
@@ -166,21 +167,21 @@ function ExportRow({
<div> <div>
<div <div
className={`group flex w-full items-center gap-1 rounded-md pr-1 transition-colors ${ 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 <button
title={expanded ? 'Collapse' : 'Expand'} title={expanded ? 'Collapse' : 'Expand'}
onClick={() => setOpen((o) => !o)} 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>
<button <button
onClick={() => onSelect({ kind: 'export', id: set.id, name: set.name })} 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" 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}> <span className="flex-1 truncate" title={set.destination}>
{set.name} {set.name}
</span> </span>
@@ -193,14 +194,14 @@ function ExportRow({
onClick={onEdit} onClick={onEdit}
className="shrink-0 px-1 text-xs text-faint opacity-0 hover:text-text group-hover:opacity-100" 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>
<button <button
title="Delete this export" title="Delete this export"
onClick={onDelete} onClick={onDelete}
className="shrink-0 px-1 text-xs text-faint opacity-0 hover:text-pink group-hover:opacity-100" className="shrink-0 px-1 text-xs text-faint opacity-0 hover:text-pink group-hover:opacity-100"
> >
✕ <Icon name="close" size={13} />
</button> </button>
</div> </div>
@@ -212,7 +213,7 @@ function ExportRow({
<div <div
key={p.id} key={p.id}
className={`group flex items-center gap-1 rounded-md pr-1 ${ 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 <button
@@ -228,7 +229,7 @@ function ExportRow({
style={{ paddingLeft: 24 }} style={{ paddingLeft: 24 }}
className="flex min-w-0 flex-1 items-center gap-2 py-1 text-left text-sm disabled:cursor-not-allowed" 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: {/* A playlist deleted since curation is SHOWN, not dropped:
the set records the user's intent, and losing part of it the set records the user's intent, and losing part of it
silently is worse than showing something broken. */} silently is worse than showing something broken. */}
@@ -244,7 +245,7 @@ function ExportRow({
onClick={() => dropPlaylist.mutate(p.id)} onClick={() => dropPlaylist.mutate(p.id)}
className="shrink-0 px-1 text-xs text-faint opacity-0 hover:text-pink group-hover:opacity-100" className="shrink-0 px-1 text-xs text-faint opacity-0 hover:text-pink group-hover:opacity-100"
> >
✕ <Icon name="close" size={13} />
</button> </button>
</div> </div>
) )
@@ -256,11 +257,11 @@ function ExportRow({
style={{ paddingLeft: 24 }} style={{ paddingLeft: 24 }}
className={`flex w-full items-center gap-2 rounded-md py-1 pr-2 text-left text-sm transition-colors ${ 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 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' : '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="flex-1 truncate">Other</span>
<span className="shrink-0 text-[10px] tabular-nums text-faint">{data.loose}</span> <span className="shrink-0 text-[10px] tabular-nums text-faint">{data.loose}</span>
</button> </button>
@@ -287,7 +288,7 @@ function ExportRow({
<button <button
onClick={onRun} onClick={onRun}
style={{ marginLeft: 24 }} 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'}… Export {data.tracks} track{data.tracks === 1 ? '' : 's'}…
</button> </button>
+18 -17
View File
@@ -1,6 +1,7 @@
import type { ReactNode } from 'react' import type { ReactNode } from 'react'
import { useQuery } from '@tanstack/react-query' import { useQuery } from '@tanstack/react-query'
import { api, type FsListing, type FsPlace } from '../api' 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. * 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. // the sidebar's device poll: this is a shortcut list, not the thing you came for.
const PLACES_POLL_MS = 5000 const PLACES_POLL_MS = 5000
const ICONS: Record<FsPlace['kind'], string> = { const ICONS: Record<FsPlace['kind'], IconName> = {
home: '⌂', home: 'home',
music: '♫', music: 'music',
desktop: '🖥', desktop: 'desktop',
documents: '🗎', documents: 'file',
downloads: '⬇', downloads: 'download',
volume: '⬒', volume: 'drive',
library: '◈', library: 'playlist',
} }
interface Props { 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 {/* ---- Places rail. Navigates, never selects: one click here must not be
able to open a library or commit an import destination, because a able to open a library or commit an import destination, because a
sidebar does not look like something that does that. ---- */} 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) => ( {groups.map((g) => (
<div key={g.label} className="mb-2"> <div key={g.label} className="mb-2">
<div className="px-3 pb-1 text-[10px] font-semibold uppercase tracking-wider text-faint"> <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} key={p.path}
onClick={() => onNavigate(p.path)} onClick={() => onNavigate(p.path)}
title={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 active
? 'bg-accent-soft text-text' ? 'is-selected text-text'
: 'text-muted hover:bg-ink-800 hover: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> <span className="truncate">{p.name}</span>
</button> </button>
) )
@@ -115,13 +116,13 @@ export function FileBrowser({ mode, platform, path, onNavigate, onPickFile, foot
{/* ---- Path bar + listing ---- */} {/* ---- Path bar + listing ---- */}
<div className="flex min-w-0 flex-1 flex-col"> <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 <button
title="Home" title="Home"
onClick={() => data?.home && onNavigate(data.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>
<button <button
title="Up one level" title="Up one level"
@@ -149,7 +150,7 @@ export function FileBrowser({ mode, platform, path, onNavigate, onPickFile, foot
onClick={() => onNavigate(d.path)} 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" 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> <span className="truncate">{d.name}</span>
</button> </button>
))} ))}
@@ -163,7 +164,7 @@ export function FileBrowser({ mode, platform, path, onNavigate, onPickFile, foot
onClick={() => onPickFile?.(f.path)} 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" 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="truncate">{f.name}</span>
<span className="ml-auto text-[10px] uppercase tracking-wider text-faint"> <span className="ml-auto text-[10px] uppercase tracking-wider text-faint">
open open
+5 -5
View File
@@ -31,8 +31,8 @@ export function FolderPicker({ value, onChange, onClose }: Props) {
} }
return ( return (
<div aria-modal="true" className="fixed inset-0 z-[60] flex items-center justify-center bg-black/60 p-4"> <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 rounded-lg border border-line bg-ink-900 shadow-xl"> <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"> <div className="border-b border-line px-5 py-3">
<h2 className="text-sm font-semibold text-text">Choose a folder</h2> <h2 className="text-sm font-semibold text-text">Choose a folder</h2>
</div> </div>
@@ -53,7 +53,7 @@ export function FolderPicker({ value, onChange, onClose }: Props) {
onKeyDown={(e) => { onKeyDown={(e) => {
if (e.key === 'Enter' && newFolder.trim() && here) confirm() 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> </div>
} }
@@ -67,14 +67,14 @@ export function FolderPicker({ value, onChange, onClose }: Props) {
</span> </span>
<button <button
onClick={onClose} 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 Cancel
</button> </button>
<button <button
disabled={!here} disabled={!here}
onClick={confirm} 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 Use this folder
</button> </button>
+15 -13
View File
@@ -1,4 +1,5 @@
import { memo, useRef, useState } from 'react' import { memo, useRef, useState } from 'react'
import { Icon } from '../lib/icons'
interface Props { interface Props {
/** Tempo of the marker governing the playhead — what the tempo controls act /** Tempo of the marker governing the playhead — what the tempo controls act
@@ -48,9 +49,8 @@ function markerTime(t: number): string {
} }
const BTN = const BTN =
'flex flex-1 items-center justify-center rounded border border-line bg-ink-850 py-1 text-xs ' + 'btn-glass flex flex-1 items-center justify-center gap-1 rounded-lg py-1 font-mono text-[11px] ' +
'font-semibold text-text transition-colors hover:border-accent disabled:opacity-30 ' + 'font-semibold text-text disabled:opacity-30'
'disabled:hover:border-line'
/** /**
* Beatgrid / tempo panel (Traktor grid-control equivalent): editable BPM, BPM * Beatgrid / tempo panel (Traktor grid-control equivalent): editable BPM, BPM
@@ -114,7 +114,7 @@ export const GridControls = memo(function GridControls({
return ( return (
<div className="flex flex-col gap-2"> <div className="flex flex-col gap-2">
{/* BPM readout / editor */} {/* BPM readout / editor */}
<div className="text-center"> <div className="well rounded-2xl px-3 py-2 text-center">
{editing ? ( {editing ? (
<input <input
autoFocus autoFocus
@@ -125,7 +125,7 @@ export const GridControls = memo(function GridControls({
if (e.key === 'Enter') commit() if (e.key === 'Enter') commit()
if (e.key === 'Escape') setEditing(false) 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 <button
@@ -133,7 +133,7 @@ export const GridControls = memo(function GridControls({
setVal(bpm != null ? bpm.toFixed(3) : '') setVal(bpm != null ? bpm.toFixed(3) : '')
setEditing(true) 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" title="Click to type an exact BPM"
> >
{bpm != null ? bpm.toFixed(2) : '––'} {bpm != null ? bpm.toFixed(2) : '––'}
@@ -302,13 +302,14 @@ export const GridControls = memo(function GridControls({
onClick={onToggleLock} onClick={onToggleLock}
title={locked ? 'Unlock track' : 'Lock track'} title={locked ? 'Unlock track' : 'Lock track'}
className={ 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 (locked
? 'border-gold bg-gold/15 text-gold' ? '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)]'
: 'border-line bg-ink-850 text-text hover:border-accent') : 'btn-glass text-text')
} }
> >
{locked ? '🔒 Locked' : '🔓 Lock'} <Icon name={locked ? 'lock' : 'unlock'} size={13} />
{locked ? 'Locked' : 'Lock'}
</button> </button>
{/* Only a marker you are standing on can be deleted, so one that is {/* 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 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)' : 'Park the playhead on a marker to delete it (‹ › to step)'
} }
> >
🗑 Mrk <Icon name="trash" size={12} /> Mrk
</button> </button>
<button <button
className={BTN} className={BTN}
@@ -343,7 +344,7 @@ export const GridControls = memo(function GridControls({
disabled={!hasGrid} disabled={!hasGrid}
title="Delete beatgrid" title="Delete beatgrid"
> >
🗑 Grid <Icon name="trash" size={12} /> Grid
</button> </button>
</div> </div>
@@ -355,7 +356,8 @@ export const GridControls = memo(function GridControls({
disabled={analyzing} disabled={analyzing}
title="Detect BPM and first beat, then set the grid + hotcue 1 (fix octave with ÷2 / ×2)" 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> </button>
</div> </div>
</div> </div>
+3 -3
View File
@@ -80,11 +80,11 @@ export function HistoryPanel({ onClose, onNotify, onError }: Props) {
return ( return (
<div <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} onClick={onClose}
> >
<div <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()} onClick={(e) => e.stopPropagation()}
> >
<div className="border-b border-line px-5 py-4"> <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)} onClick={() => setConfirmingId(e.id)}
disabled={isCurrent} disabled={isCurrent}
title={isCurrent ? 'This is the current version' : 'Restore this version'} 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 Restore
</button> </button>
+42 -8
View File
@@ -1,5 +1,7 @@
import type { CSSProperties } from 'react'
import type { CuePoint } from '../api' 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 { interface Props {
cues: CuePoint[] cues: CuePoint[]
@@ -37,7 +39,7 @@ export function HotcueBar({
onSlotRelease, onSlotRelease,
}: Props) { }: Props) {
return ( 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) => { {Array.from({ length: slotCount }, (_, i) => i).map((slot) => {
const cue = cues.find((c) => c.role === 'hotcue' && c.slot === slot) ?? null 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 // 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)}`
: `Hotcue ${slotLabel(slot)} — click to set at playhead` : `Hotcue ${slotLabel(slot)} — click to set at playhead`
} }
style={color ? { backgroundColor: color, color: contrastText(color) } : undefined} style={color ? padStyle(color, selected) : undefined}
className={ className={
'relative flex flex-1 items-center justify-center text-sm font-semibold transition-colors ' + '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-110' : 'bg-ink-900 text-faint hover:bg-ink-800') + (color
(selected ? ' ring-2 ring-inset ring-white/80' : '') ? '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 && ( {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} {glyph}
</span> </span>
)} )}
@@ -87,3 +102,22 @@ export function HotcueBar({
</div> </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(', '),
}
}
+10 -10
View File
@@ -153,8 +153,8 @@ export function ImportDialog({ playlistId, deviceLabel, onClose, onDone, onError
onClose={() => setBrowsing(false)} onClose={() => setBrowsing(false)}
/> />
)} )}
<div aria-modal="true" className="fixed inset-0 z-50 flex items-center justify-center bg-black/60 p-4"> <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 rounded-lg border border-line bg-ink-900 shadow-xl"> <div className="w-full max-w-lg glass-overlay">
<div className="border-b border-line px-5 py-3"> <div className="border-b border-line px-5 py-3">
<h2 className="text-sm font-semibold text-text"> <h2 className="text-sm font-semibold text-text">
Import from {deviceLabel} Import from {deviceLabel}
@@ -170,14 +170,14 @@ export function ImportDialog({ playlistId, deviceLabel, onClose, onDone, onError
<div className="flex items-center gap-2"> <div className="flex items-center gap-2">
<span <span
title={baseFolder} 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" dir="rtl"
> >
{baseFolder || 'Loading…'} {baseFolder || 'Loading…'}
</span> </span>
<button <button
onClick={() => setBrowsing(true)} 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… Browse…
</button> </button>
@@ -228,7 +228,7 @@ export function ImportDialog({ playlistId, deviceLabel, onClose, onDone, onError
{/* Reported and then skipped, rather than failing the whole {/* Reported and then skipped, rather than failing the whole
import halfway through a multi-minute copy. */} import halfway through a multi-minute copy. */}
{p.missing.length > 0 && ( {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 — {p.missing.length} track{p.missing.length === 1 ? '' : 's'} will be skipped —
the audio file is not on the drive: the audio file is not on the drive:
<div className="mt-1 text-faint">{p.missing.slice(0, 4).join(', ')}</div> <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 {/* A warning, not a block: everything is imported as a new
entry, so a re-import legitimately duplicates. */} entry, so a re-import legitimately duplicates. */}
{p.duplicates.length > 0 && ( {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. {p.duplicates.length} of these look like tracks your collection already has.
They will be added again as new entries. They will be added again as new entries.
</div> </div>
@@ -255,7 +255,7 @@ export function ImportDialog({ playlistId, deviceLabel, onClose, onDone, onError
{job && ( {job && (
<div className="space-y-3"> <div className="space-y-3">
<div className="text-text">{job.message || 'Working…'}</div> <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 <div
className={`h-full transition-[width] duration-200 ${ className={`h-full transition-[width] duration-200 ${
job.state === 'failed' ? 'bg-pink' : 'bg-accent' job.state === 'failed' ? 'bg-pink' : 'bg-accent'
@@ -286,7 +286,7 @@ export function ImportDialog({ playlistId, deviceLabel, onClose, onDone, onError
<> <>
<button <button
onClick={cancel} 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 Cancel import
</button> </button>
@@ -302,7 +302,7 @@ export function ImportDialog({ playlistId, deviceLabel, onClose, onDone, onError
<> <>
<button <button
onClick={onClose} 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'} {finished ? 'Close' : 'Cancel'}
</button> </button>
@@ -312,7 +312,7 @@ export function ImportDialog({ playlistId, deviceLabel, onClose, onDone, onError
starting || !p || p.importable === 0 || p.enough_space === false starting || !p || p.importable === 0 || p.enough_space === false
} }
onClick={start} 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()} {starting ? 'Starting…' : `Import ${p?.importable ?? ''}`.trim()}
</button> </button>
+22 -12
View File
@@ -1,3 +1,5 @@
import { Icon } from '../lib/icons'
interface Props { interface Props {
hasGrid: boolean // beat-loops need a beatgrid; buttons disable without one hasGrid: boolean // beat-loops need a beatgrid; buttons disable without one
active: boolean // a loop is currently engaged 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) 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 CELL =
const IDLE = 'bg-ink-900 text-text hover:bg-ink-800' 'flex items-center justify-center rounded-lg font-mono text-xs font-semibold transition-colors select-none'
const OFF = 'disabled:opacity-30 disabled:hover:bg-ink-900' 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({ export function LoopControls({
hasGrid, hasGrid,
@@ -36,11 +42,12 @@ export function LoopControls({
}: Props) { }: Props) {
return ( return (
<div className="flex h-10 shrink-0 items-stretch gap-px border-t border-line bg-ink-950"> <div className="flex h-10 shrink-0 items-center gap-1.5 pt-2">
<span className="flex w-16 items-center justify-center bg-ink-900 text-[10px] font-semibold uppercase tracking-wider text-faint"> <span className="flex w-12 shrink-0 items-center text-[10px] font-semibold uppercase tracking-wider text-faint">
Loop Loop
</span> </span>
<div className="well flex h-full min-w-0 flex-1 items-stretch gap-0.5 rounded-xl p-[3px]">
{SIZES.map((size) => { {SIZES.map((size) => {
const isActive = active && activeBeats === size const isActive = active && activeBeats === size
return ( return (
@@ -49,32 +56,35 @@ export function LoopControls({
onClick={() => onSetLoop(size)} onClick={() => onSetLoop(size)}
disabled={!hasGrid} disabled={!hasGrid}
title={hasGrid ? `${label(size)}-beat loop` : 'No beatgrid'} 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)} {label(size)}
</button> </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 IN
</button> </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 OUT
</button> </button>
<button <button
onClick={onToggleActive} onClick={onToggleActive}
disabled={!canToggle} disabled={!canToggle}
title={active ? 'Disable loop' : 'Enable loop'} 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>
<button <button
onClick={onToggleSnap} onClick={onToggleSnap}
title="Snap to the nearest beat" title="Snap to the nearest beat"
className={`${CELL} w-16 text-[11px] uppercase tracking-wider ${ className={`${CELL} h-full w-14 font-sans text-[11px] uppercase tracking-wider ${
snap ? 'bg-accent text-ink-950' : `${IDLE} text-muted` snap ? 'is-selected text-text' : `${IDLE} text-muted`
}`} }`}
> >
Snap Snap
+10 -30
View File
@@ -1,7 +1,7 @@
import { useEffect, useRef } from 'react' import { useEffect, useRef } from 'react'
import type { CuePoint } from '../api' import type { CuePoint } from '../api'
import type { BeatGrid } from '../lib/beatgrid' 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' import { paintWave, type WaveColumn } from '../lib/waveform'
interface Props { interface Props {
@@ -79,7 +79,12 @@ export function MainWaveform({
const half = secPerView / 2 const half = secPerView / 2
const startSec = currentTime - half const startSec = currentTime - half
const endSec = 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 const timeToX = (t: number) => ((t - startSec) / secPerView) * w
// Loop band (under the grid/cues), then beatgrid, then cue markers. // 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 drawPlayhead(ctx, Math.floor(w / 2), h, dpr, true)
// 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()
} }
const drawRef = useRef(draw) const drawRef = useRef(draw)
@@ -199,7 +179,7 @@ export function MainWaveform({
onPointerDown={(e) => e.stopPropagation()} onPointerDown={(e) => e.stopPropagation()}
onClick={zoomIn} onClick={zoomIn}
disabled={secPerView <= MIN_SEC} 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" title="Zoom in"
> >
+ +
@@ -208,7 +188,7 @@ export function MainWaveform({
onPointerDown={(e) => e.stopPropagation()} onPointerDown={(e) => e.stopPropagation()}
onClick={zoomOut} onClick={zoomOut}
disabled={secPerView >= MAX_SEC} 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" title="Zoom out"
> >
− −
+3 -9
View File
@@ -1,6 +1,6 @@
import { useCallback, useEffect, useRef } from 'react' import { useCallback, useEffect, useRef } from 'react'
import type { CuePoint } from '../api' 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' import { paintWave, type WaveColumn } from '../lib/waveform'
interface Props { interface Props {
@@ -63,7 +63,7 @@ export function OverviewWaveform({
const dur = durRef.current const dur = durRef.current
if (dur > 0) { if (dur > 0) {
const px = Math.round((timeRef.current / dur) * w) 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) ctx.fillRect(0, 0, px, h)
const dpr = window.devicePixelRatio || 1 const dpr = window.devicePixelRatio || 1
const lp = loopRef.current const lp = loopRef.current
@@ -72,13 +72,7 @@ export function OverviewWaveform({
drawCues(ctx, cuesRef.current, w, h, dpr, (t) => (t / dur) * w, false) drawCues(ctx, cuesRef.current, w, h, dpr, (t) => (t / dur) * w, false)
const cp = cuePointRef.current const cp = cuePointRef.current
if (cp != null) drawCuePoint(ctx, Math.round((cp / dur) * w), h, dpr) if (cp != null) drawCuePoint(ctx, Math.round((cp / dur) * w), h, dpr)
const pw = Math.max(2, Math.round(2 * dpr)) drawPlayhead(ctx, px, h, dpr, false)
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)
} }
}, []) }, [])
@@ -2,6 +2,7 @@ import { useEffect, useRef, useState } from 'react'
import { useQuery, useQueryClient } from '@tanstack/react-query' import { useQuery, useQueryClient } from '@tanstack/react-query'
import { api, type RemapPreview } from '../api' import { api, type RemapPreview } from '../api'
import type { ToastMsg } from './Toast' import type { ToastMsg } from './Toast'
import { Icon } from '../lib/icons'
interface Props { interface Props {
onClose: () => void onClose: () => void
@@ -103,11 +104,11 @@ export function PathMappingDialog({ onClose, onNotify, onError }: Props) {
return ( return (
<div <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} onClick={onClose}
> >
<div <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()} onClick={(e) => e.stopPropagation()}
> >
<div className="border-b border-line px-5 py-4"> <div className="border-b border-line px-5 py-4">
@@ -159,7 +160,7 @@ export function PathMappingDialog({ onClose, onNotify, onError }: Props) {
/> />
<button <button
onClick={() => setBrowsing((b) => !b)} 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…'} {browsing ? 'Close' : 'Browse…'}
</button> </button>
@@ -239,7 +240,7 @@ export function PathMappingDialog({ onClose, onNotify, onError }: Props) {
<button <button
onClick={saveMapping} onClick={saveMapping}
disabled={saving} 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'} {saving ? 'Saving…' : 'Save mapping'}
</button> </button>
@@ -289,7 +290,7 @@ function FolderBrowser({
onClick={() => setDir(d.path)} 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" 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> <span className="truncate">{d.name}</span>
</button> </button>
)) ))
+63 -33
View File
@@ -14,6 +14,8 @@ import { slotLabeller, useCaps } from '../lib/capabilities'
import { CUE_TYPE_LABELS } from '../lib/cues' import { CUE_TYPE_LABELS } from '../lib/cues'
import { readOnlyShort, readOnlyNotice } from '../lib/platformCopy' import { readOnlyShort, readOnlyNotice } from '../lib/platformCopy'
import { analyzeWaveform, type WaveColumn } from '../lib/waveform' import { analyzeWaveform, type WaveColumn } from '../lib/waveform'
import { setAmbientFromArt } from '../lib/ambient'
import { Icon } from '../lib/icons'
import { ScratchEngine } from '../lib/scratchEngine' import { ScratchEngine } from '../lib/scratchEngine'
import { PlaybackEngine } from '../lib/playbackEngine' import { PlaybackEngine } from '../lib/playbackEngine'
import { AutoCueDialog, eventLabel } from './AutoCueDialog' import { AutoCueDialog, eventLabel } from './AutoCueDialog'
@@ -226,6 +228,12 @@ export function PrepStrip({
setPreviewing(false) setPreviewing(false)
}, [trackId]) }, [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 // Analyse once per track; the decoded buffer feeds both the playback and
// scratch engines (no re-decode) and both waveform views share the columns. // scratch engines (no re-decode) and both waveform views share the columns.
useEffect(() => { useEffect(() => {
@@ -970,13 +978,15 @@ export function PrepStrip({
const activeLoop = loopActive && loopRegion ? loopRegion : null const activeLoop = loopActive && loopRegion ? loopRegion : null
return ( 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 */} {/* Controls */}
<div className="flex w-72 shrink-0 flex-col gap-3 bg-ink-900 px-4 py-3"> <div className="flex w-72 shrink-0 flex-col gap-3 px-1 py-1">
<div className="min-w-0"> <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 ? ( {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'} {track.title ?? 'Untitled'}
</div> </div>
<div className="truncate text-xs text-muted" title={track.artist ?? ''}> <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. */} live. The controls themselves report the reason when pressed. */}
{readOnlyShort(caps) && ( {readOnlyShort(caps) && (
<div <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) ?? ''} title={readOnlyNotice(caps) ?? ''}
> >
{readOnlyShort(caps)} {readOnlyShort(caps)}
@@ -998,6 +1008,7 @@ export function PrepStrip({
<div className="text-xs uppercase tracking-wider text-faint">No track loaded</div> <div className="text-xs uppercase tracking-wider text-faint">No track loaded</div>
)} )}
</div> </div>
</div>
{track && ( {track && (
<GridControls <GridControls
@@ -1036,7 +1047,7 @@ export function PrepStrip({
onPointerUp={onCueRelease} onPointerUp={onCueRelease}
onPointerCancel={onCueRelease} onPointerCancel={onCueRelease}
disabled={!ready} 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)" title="Cue — set the cue point (paused), hold to preview from it, or jump back to it (playing)"
> >
CUE CUE
@@ -1045,27 +1056,18 @@ export function PrepStrip({
onClick={toggle} onClick={toggle}
disabled={!ready} disabled={!ready}
className={ 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 (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 : playing
? 'bg-mint text-ink-950 shadow-lg shadow-mint/20 hover:brightness-110' ? 'btn-primary shadow-[0_0_0_4px_color-mix(in_oklab,var(--color-accent)_22%,transparent),0_8px_24px_-4px_var(--color-accent)]'
: 'border border-line bg-ink-850 text-text hover:border-accent disabled:hover:border-line') : 'btn-glass text-text')
} }
title={playing ? 'Pause' : 'Play'} title={playing ? 'Pause' : 'Play'}
> >
{playing ? ( <Icon name={playing ? 'pause' : 'play'} size={18} />
<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>
)}
</button> </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)} {fmt(current)} / {fmt(duration)}
</div> </div>
</div> </div>
@@ -1079,18 +1081,18 @@ export function PrepStrip({
</div> </div>
{/* Waveforms + loop/hotcue controls. */} {/* 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 ? ( {!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 Load a track to prep it
</div> </div>
) : waveStatus === 'error' ? ( ) : 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. Could not load audio — file may be missing or an unsupported format.
</div> </div>
) : ( ) : (
<> <>
<div className="relative min-h-0 flex-1"> <div className="well relative min-h-0 flex-1 overflow-hidden rounded-2xl">
{showWaves ? ( {showWaves ? (
<MainWaveform <MainWaveform
cols={cols} cols={cols}
@@ -1114,7 +1116,7 @@ export function PrepStrip({
</div> </div>
)} )}
</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 && ( {showWaves && (
<OverviewWaveform <OverviewWaveform
cols={cols} cols={cols}
@@ -1142,8 +1144,8 @@ export function PrepStrip({
/> />
{/* Hotcue row: label · 8 slots · type of selected cue · delete. */} {/* 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"> <div className="flex h-12 shrink-0 items-stretch gap-1.5 pt-2">
<span className="flex w-16 items-center justify-center bg-ink-900 text-[10px] font-semibold uppercase tracking-wider text-faint"> <span className="flex w-12 shrink-0 items-center text-[10px] font-semibold uppercase tracking-wider text-faint">
Cues Cues
</span> </span>
<HotcueBar <HotcueBar
@@ -1154,7 +1156,7 @@ export function PrepStrip({
onSlotPress={onSlotPress} onSlotPress={onSlotPress}
onSlotRelease={onSlotRelease} 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' ? ( {selectedCue && selectedCue.type === 'loop' ? (
<span className="text-sm font-semibold text-mint">Loop</span> <span className="text-sm font-semibold text-mint">Loop</span>
) : pointCueTypes.length < 2 ? ( ) : pointCueTypes.length < 2 ? (
@@ -1187,17 +1189,19 @@ export function PrepStrip({
? 'Place hotcues on the track\'s drops, breakdowns and other sections' ? 'Place hotcues on the track\'s drops, breakdowns and other sections'
: 'Set a beatgrid first' : '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>
<button <button
onClick={deleteSelected} onClick={deleteSelected}
disabled={!selectedCue} disabled={!selectedCue}
title="Delete selected hotcue" 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> </button>
</div> </div>
</> </>
@@ -1217,3 +1221,29 @@ export function PrepStrip({
</div> </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>
)
}
+20 -7
View File
@@ -8,6 +8,21 @@ interface Props {
onChange?: (value: number) => void 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 // 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 // `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 // (★) 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 (!onChange) {
if (!value) return <span className="text-faint">—</span> if (!value) return <span className="text-faint">—</span>
return ( return (
<span className="whitespace-nowrap tracking-tight" title={`${value} / ${max}`}> <span className="flex items-center gap-0.5" title={`${value} / ${max}`}>
{stars.map((i) => ( {stars.map((i) => (
<span key={i} className={i <= value ? 'text-gold' : 'text-ink-600'}> <Star key={i} className={i <= value ? 'text-gold' : 'text-white/15'} />
{i <= value ? '★' : '☆'}
</span>
))} ))}
</span> </span>
) )
@@ -31,7 +44,7 @@ export function RatingStars({ value, max = 5, onChange }: Props) {
const shown = hover || value const shown = hover || value
return ( return (
<span className="whitespace-nowrap tracking-tight" title={`${value} / ${max}`}> <span className="flex items-center gap-0.5" title={`${value} / ${max}`}>
{stars.map((i) => ( {stars.map((i) => (
<button <button
key={i} key={i}
@@ -41,10 +54,10 @@ export function RatingStars({ value, max = 5, onChange }: Props) {
}} }}
onMouseEnter={() => setHover(i)} onMouseEnter={() => setHover(i)}
onMouseLeave={() => setHover(0)} 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' : ''}`} title={i === value ? 'Clear rating' : `Set ${i} star${i > 1 ? 's' : ''}`}
> >
{i <= shown ? '★' : '☆'} <Star />
</button> </button>
))} ))}
</span> </span>
+11 -11
View File
@@ -3,6 +3,7 @@ import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query'
import { api } from '../api' import { api } from '../api'
import { useCaps } from '../lib/capabilities' import { useCaps } from '../lib/capabilities'
import { overwriteWarning, readOnlyNotice, saveLabel } from '../lib/platformCopy' import { overwriteWarning, readOnlyNotice, saveLabel } from '../lib/platformCopy'
import { Icon } from '../lib/icons'
interface Props { interface Props {
onError: (msg: string) => void 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. // point: a greyed-out button with no explanation reads as a bug.
if (readOnly) { if (readOnly) {
return ( return (
<div className="flex items-stretch gap-2 border-t border-line bg-ink-900 px-3 py-3"> <div className="flex items-stretch gap-2 border-t border-line 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"> <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-ink-200">Read-only</span> <span className="font-medium text-text">Read-only</span>
<div className="mt-1">{readOnly}</div> <div className="mt-1">{readOnly}</div>
</div> </div>
{trailing} {trailing}
@@ -50,27 +51,26 @@ export function SaveBar({ onError, trailing }: Props) {
} }
return ( 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 && ( {dirty && warning && (
<div className="mb-2 rounded-md bg-gold/10 px-2 py-1.5 text-[11px] leading-snug text-gold"> <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">
⚠ {warning} <Icon name="warning" size={13} className="mt-px shrink-0" />
<span>{warning}</span>
</div> </div>
)} )}
<div className="flex items-stretch gap-2"> <div className="flex items-stretch gap-2">
<button <button
disabled={!dirty || save.isPending} disabled={!dirty || save.isPending}
onClick={() => save.mutate()} 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 ${ 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 dirty ? 'btn-primary' : 'cursor-not-allowed bg-ink-800 font-medium text-faint'
? 'bg-accent text-ink-950 hover:brightness-110'
: 'cursor-not-allowed bg-ink-800 text-faint'
}`} }`}
> >
{save.isPending ? ( {save.isPending ? (
'Saving…' 'Saving…'
) : dirty ? ( ) : 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)} {saveLabel(caps.save)}
</> </>
) : ( ) : (
+5 -5
View File
@@ -25,13 +25,13 @@ export function SettingsMenu({ onOpenPathMapping, up = false }: Props) {
}, [open]) }, [open])
const item = 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 ( return (
<div ref={ref} className="relative"> <div ref={ref} className="relative">
<button <button
onClick={() => setOpen((o) => !o)} 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" title="Settings"
aria-label="Settings" aria-label="Settings"
> >
@@ -39,10 +39,10 @@ export function SettingsMenu({ onOpenPathMapping, up = false }: Props) {
viewBox="0 0 24 24" viewBox="0 0 24 24"
fill="none" fill="none"
stroke="currentColor" stroke="currentColor"
strokeWidth="2" strokeWidth="1.8"
strokeLinecap="round" strokeLinecap="round"
strokeLinejoin="round" strokeLinejoin="round"
className="h-5 w-5" className="h-[18px] w-[18px]"
> >
<circle cx="12" cy="12" r="3" /> <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" /> <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> </button>
{open && ( {open && (
<div <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' up ? 'bottom-full mb-1' : 'mt-1'
}`} }`}
> >
+2 -2
View File
@@ -97,11 +97,11 @@ export function ShortcutsDialog({ onClose }: Props) {
return ( return (
<div <div
aria-modal="true" 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} onClick={onClose}
> >
<div <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()} onClick={(e) => e.stopPropagation()}
> >
<div className="flex items-center justify-between border-b border-line px-5 py-4"> <div className="flex items-center justify-between border-b border-line px-5 py-4">
+54 -34
View File
@@ -8,6 +8,7 @@ import { DevicesSection } from './DevicesSection'
import { ExportsSection } from './ExportsSection' import { ExportsSection } from './ExportsSection'
import { ConfirmDialog, type ConfirmRequest } from './ConfirmDialog' import { ConfirmDialog, type ConfirmRequest } from './ConfirmDialog'
import { ContextMenu, type MenuItem } from './ContextMenu' import { ContextMenu, type MenuItem } from './ContextMenu'
import { Icon, type IconName } from '../lib/icons'
/** /**
* Which view the main table is showing. * Which view the main table is showing.
@@ -74,10 +75,10 @@ function deleteRequest(node: PlaylistNode) {
} }
} }
const icons: Record<PlaylistKind, string> = { const icons: Record<PlaylistKind, IconName> = {
folder: '▸', folder: 'chevronRight',
playlist: '♫', playlist: 'playlist',
smart: '✦', smart: 'smart',
} }
/** What the sidebar is naming in place: a new node, and the folder it goes in /** 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` }} style={{ paddingLeft: `${8 + depth * 14}px` }}
> >
<span <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' draft.kind === 'folder' ? 'text-faint' : 'text-accent'
}`} }`}
> >
{icons[draft.kind]} <Icon name={icons[draft.kind]} size={draft.kind === 'folder' ? 12 : 15} />
</span> </span>
<input <input
autoFocus autoFocus
@@ -136,7 +137,7 @@ function DraftRow({
else if (e.key === 'Escape') finish(false) else if (e.key === 'Escape') finish(false)
}} }}
onBlur={() => finish(true)} 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> </div>
) )
@@ -184,8 +185,8 @@ function NodeRow({
<div> <div>
<div <div
onContextMenu={(e) => actions.onContextMenu(e, node)} onContextMenu={(e) => actions.onContextMenu(e, node)}
className={`group flex items-center gap-1 rounded-md pr-1 text-sm transition-colors ${ className={`group flex items-center gap-1 rounded-[10px] pr-1 text-sm transition-colors ${
selected ? 'bg-accent-soft text-text' : 'text-muted hover:bg-ink-800 hover:text-text' selected ? 'is-selected font-medium text-text' : 'text-muted hover:bg-ink-800 hover:text-text'
}`} }`}
> >
<button <button
@@ -199,12 +200,21 @@ function NodeRow({
style={{ paddingLeft: `${8 + depth * 14}px` }} style={{ paddingLeft: `${8 + depth * 14}px` }}
> >
<span <span
className={`w-3 shrink-0 text-center text-[11px] ${ className={`flex w-4 shrink-0 justify-center ${
isFolder ? 'text-faint' : node.kind === 'smart' ? 'text-pink' : 'text-accent' isFolder ? 'text-faint' : node.kind === 'smart' ? 'text-pink' : selected ? 'text-accent' : 'text-muted'
} ${expanded ? 'rotate-90' : ''} transition-transform`} } ${expanded ? 'rotate-90' : ''} transition-transform`}
> >
{icons[node.kind]} <Icon
name={icons[node.kind]}
size={isFolder ? 12 : 15}
strokeWidth={isFolder ? 2.4 : 1.8}
/>
</span> </span>
{isFolder && (
<span className="-ml-1 flex shrink-0 text-muted">
<Icon name={expanded ? 'folderOpen' : 'folder'} size={15} />
</span>
)}
{renaming ? ( {renaming ? (
<input <input
autoFocus autoFocus
@@ -221,7 +231,7 @@ function NodeRow({
} }
}} }}
onBlur={() => setRenamingId(null)} 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> <span className="flex-1 truncate">{node.name}</span>
@@ -239,12 +249,12 @@ function NodeRow({
<button <button
title="Add to an export" title="Add to an export"
onClick={() => setAdding((a) => !a)} 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> </button>
{adding && ( {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) => ( {exportSets.map((set) => (
<button <button
key={set.id} key={set.id}
@@ -252,9 +262,9 @@ function NodeRow({
setAdding(false) setAdding(false)
actions.onAddToExport(node, set.id) 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> <span className="truncate">{set.name}</span>
</button> </button>
))} ))}
@@ -266,23 +276,23 @@ function NodeRow({
<button <button
title="Rename" title="Rename"
onClick={startRename} 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> </button>
)} )}
{!renaming && node.can_delete && ( {!renaming && node.can_delete && (
<button <button
title={isFolder ? 'Delete folder' : 'Delete playlist'} title={isFolder ? 'Delete folder' : 'Delete playlist'}
onClick={() => actions.onDelete(node)} 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> </button>
)} )}
{!renaming && !isFolder && ( {!renaming && !isFolder && (
<span <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' : '' node.can_rename || node.can_delete ? 'group-hover:hidden' : ''
}`} }`}
> >
@@ -420,9 +430,9 @@ export function Sidebar({
const createItems = (parentId: string | null): MenuItem[] => const createItems = (parentId: string | null): MenuItem[] =>
canCreate canCreate
? [ ? [
{ label: 'New Playlist', icon: '♫', onClick: () => startDraft('playlist', parentId) }, { label: 'New Playlist', icon: <Icon name="playlist" size={13} />, onClick: () => startDraft('playlist', parentId) },
...(foldersSupported ...(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', label: 'Add to export',
submenu: exportSets.map((set) => ({ submenu: exportSets.map((set) => ({
label: set.name, label: set.name,
icon: '◈', icon: <Icon name="export" size={13} />,
onClick: () => addToExport.mutate({ node, setId: set.id }), onClick: () => addToExport.mutate({ node, setId: set.id }),
})), })),
}, },
@@ -484,7 +494,7 @@ export function Sidebar({
} }
return ( 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 {/* 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 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. nothing could summon it again, so changing library meant restarting.
@@ -492,8 +502,15 @@ export function Sidebar({
<button <button
onClick={switchLibrary} onClick={switchLibrary}
title={library ? `${library.path} — click to open a different library` : undefined} 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="min-w-0 flex-1">
<div className="truncate text-sm font-medium text-text"> <div className="truncate text-sm font-medium text-text">
{library?.display_name ?? 'No library'} {library?.display_name ?? 'No library'}
@@ -504,27 +521,29 @@ export function Sidebar({
: 'Choose one'} : 'Choose one'}
</div> </div>
</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> </span>
</button> </button>
<div className="px-2 pt-3"> <div className="px-2 pt-3">
<button <button
onClick={() => onSelect({ kind: 'all' })} 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' source.kind === 'all'
? 'bg-accent-soft text-text' ? 'is-selected font-medium text-text'
: 'text-muted hover:bg-ink-800 hover: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> <span className="flex-1">All Tracks</span>
</button> </button>
</div> </div>
<div className="mt-3 px-4"> <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 Playlists
</span> </span>
</div> </div>
@@ -569,6 +588,7 @@ export function Sidebar({
onClick={onOpenHistory} 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" 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 Collection Version History
</button> </button>
+5 -4
View File
@@ -1,3 +1,4 @@
import { Icon } from '../lib/icons'
/** A background job's progress, shown at the right of the bar. */ /** A background job's progress, shown at the right of the bar. */
export interface StatusJob { export interface StatusJob {
label: string label: string
@@ -33,7 +34,7 @@ export function StatusBar({
onChangeCollection, onChangeCollection,
}: Props) { }: Props) {
return ( 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="font-medium text-text">{sourceName}</span>
<span className="text-faint">·</span> <span className="text-faint">·</span>
{loading ? ( {loading ? (
@@ -61,9 +62,9 @@ export function StatusBar({
{job.cancelling ? 'Cancelling…' : job.label} {job.cancelling ? 'Cancelling…' : job.label}
{job.total > 0 && ` ${Math.min(job.done + 1, job.total)}/${job.total}`} {job.total > 0 && ` ${Math.min(job.done + 1, job.total)}/${job.total}`}
</span> </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 <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' job.total > 0 ? '' : 'w-1/3 animate-pulse'
}`} }`}
style={job.total > 0 ? { width: `${(job.done / job.total) * 100}%` } : undefined} 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`} 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" 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> <span className="max-w-[220px] truncate font-mono text-[11px]">{collectionName}</span>
</button> </button>
)} )}
+6 -4
View File
@@ -7,9 +7,9 @@ export interface ToastMsg {
} }
const KIND_CLS: Record<ToastMsg['kind'], string> = { const KIND_CLS: Record<ToastMsg['kind'], string> = {
error: 'border-pink/40 bg-ink-800 text-pink', error: 'bg-pink shadow-[0_0_14px_rgb(255_122_154/0.6)]',
warning: 'border-gold/40 bg-ink-800 text-gold', warning: 'bg-gold shadow-[0_0_14px_rgb(255_200_97/0.6)]',
success: 'border-mint/40 bg-ink-800 text-mint', success: 'bg-mint shadow-[0_0_14px_rgb(61_220_132/0.6)]',
} }
export function Toast({ toast, onClose }: { toast: ToastMsg | null; onClose: () => void }) { export function Toast({ toast, onClose }: { toast: ToastMsg | null; onClose: () => void }) {
@@ -23,8 +23,10 @@ export function Toast({ toast, onClose }: { toast: ToastMsg | null; onClose: ()
return ( return (
<div className="pointer-events-none fixed inset-x-0 top-4 z-50 flex justify-center"> <div className="pointer-events-none fixed inset-x-0 top-4 z-50 flex justify-center">
<div <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} {toast.text}
</div> </div>
</div> </div>
+9 -8
View File
@@ -1,6 +1,7 @@
import { useQuery } from '@tanstack/react-query' import { useQuery } from '@tanstack/react-query'
import { api } from '../api' import { api } from '../api'
import { useCaps } from '../lib/capabilities' import { useCaps } from '../lib/capabilities'
import { Icon } from '../lib/icons'
export interface Filters { export interface Filters {
search: string search: string
@@ -28,7 +29,7 @@ interface Props {
} }
const selectCls = 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({ export function Toolbar({
filters, filters,
@@ -47,16 +48,16 @@ export function Toolbar({
filters.hasCues !== 'any' filters.hasCues !== 'any'
return ( 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"> <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> </span>
<input <input
value={filters.search} value={filters.search}
onChange={(e) => set({ search: e.target.value })} onChange={(e) => set({ search: e.target.value })}
placeholder="Search artist, title, album…" 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> </div>
@@ -91,14 +92,14 @@ export function Toolbar({
value={filters.bpmMin} value={filters.bpmMin}
onChange={(e) => set({ bpmMin: e.target.value.replace(/[^\d.]/g, '') })} onChange={(e) => set({ bpmMin: e.target.value.replace(/[^\d.]/g, '') })}
placeholder="min" 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> <span className="text-xs text-faint">BPM</span>
<input <input
value={filters.bpmMax} value={filters.bpmMax}
onChange={(e) => set({ bpmMax: e.target.value.replace(/[^\d.]/g, '') })} onChange={(e) => set({ bpmMax: e.target.value.replace(/[^\d.]/g, '') })}
placeholder="max" 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> </div>
@@ -129,7 +130,7 @@ export function Toolbar({
{active && ( {active && (
<button <button
onClick={() => onChange(emptyFilters)} 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 Clear filters
</button> </button>
+3 -3
View File
@@ -148,11 +148,11 @@ export function UpdateCheck() {
return ( return (
<div <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} onClick={close}
> >
<div <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()} onClick={(e) => e.stopPropagation()}
> >
<div className="border-b border-line px-5 py-4"> <div className="border-b border-line px-5 py-4">
@@ -200,7 +200,7 @@ export function UpdateCheck() {
</button> </button>
<button <button
onClick={download} 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 Download
</button> </button>
+237 -20
View File
@@ -1,24 +1,81 @@
@import 'tailwindcss'; @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 { @theme {
--color-ink-950: #0a0b0f; --font-sans: 'Geist Variable', system-ui, -apple-system, 'Segoe UI', sans-serif;
--color-ink-900: #101218; --font-mono: 'Geist Mono Variable', ui-monospace, 'SF Mono', Menlo, monospace;
--color-ink-850: #161922;
--color-ink-800: #1c2029;
--color-ink-700: #262b37;
--color-ink-600: #333a49;
--color-line: #2a2f3b;
--color-text: #e6e9ef; --color-ink-950: #05060a;
--color-muted: #8b93a3; --color-ink-900: rgb(255 255 255 / 0.03);
--color-faint: #5a6172; --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-text: #f4f6fb;
--color-accent-soft: #2b3a5c; --color-muted: rgb(235 240 255 / 0.68);
--color-gold: #ffb020; --color-faint: rgb(235 240 255 / 0.54);
--color-mint: #34d399;
--color-pink: #f472b6; /* 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, html,
@@ -31,8 +88,7 @@ body {
margin: 0; margin: 0;
background: var(--color-ink-950); background: var(--color-ink-950);
color: var(--color-text); color: var(--color-text);
font-family: font-family: var(--font-sans);
'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
font-feature-settings: 'tnum' 1; /* tabular numbers for BPM columns */ font-feature-settings: 'tnum' 1; /* tabular numbers for BPM columns */
-webkit-font-smoothing: antialiased; -webkit-font-smoothing: antialiased;
/* An app, not a document: clicks and drags must not paint a text selection. /* An app, not a document: clicks and drags must not paint a text selection.
@@ -48,7 +104,18 @@ textarea,
user-select: text; 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-width: thin;
scrollbar-color: var(--color-ink-600) transparent; scrollbar-color: var(--color-ink-600) transparent;
@@ -64,6 +131,156 @@ textarea,
background-clip: padding-box; background-clip: padding-box;
} }
*::-webkit-scrollbar-thumb:hover { *::-webkit-scrollbar-thumb:hover {
background: var(--color-ink-700); background: rgb(255 255 255 / 0.26);
background-clip: padding-box; 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; }
}
+128
View File
@@ -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
View File
@@ -3,13 +3,13 @@ import { BEATS_PER_BAR, type BeatGrid } from './beatgrid'
// Fallback colour by cue type, used when the platform stored none. // Fallback colour by cue type, used when the platform stored none.
const TYPE_COLORS: Record<CueType, string> = { const TYPE_COLORS: Record<CueType, string> = {
cue: '#3b82f6', // blue cue: '#4d94ff', // blue
fade_in: '#ff8c2f', // orange fade_in: '#ff9a3d', // orange
fade_out: '#ff8c2f', // orange fade_out: '#ff9a3d', // orange
load: '#ffd60a', // yellow load: '#ffd23d', // yellow
loop: '#22c55e', // green loop: '#3ddc84', // green
} }
const MEMORY_COLOR = '#8b93a3' // gray const MEMORY_COLOR = '#9aa1b2' // gray
export const CUE_TYPE_LABELS: Record<CueType, string> = { export const CUE_TYPE_LABELS: Record<CueType, string> = {
cue: 'Cue', cue: 'Cue',
@@ -53,7 +53,7 @@ export function cueGlyph(cue: CuePoint): string {
return TYPE_GLYPHS[cue.type] ?? '' 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 r = parseInt(hex.slice(1, 3), 16)
const g = parseInt(hex.slice(3, 5), 16) const g = parseInt(hex.slice(3, 5), 16)
const b = parseInt(hex.slice(5, 7), 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 * 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 * device-pixel x. With `labels`, a rounded flag is drawn at the top for each
* hotcues (used on the main waveform); the overview passes labels=false. * 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( export function drawCues(
ctx: CanvasRenderingContext2D, ctx: CanvasRenderingContext2D,
@@ -85,10 +90,13 @@ export function drawCues(
slotLabel: (slot: number) => string = (slot) => String(slot + 1), slotLabel: (slot: number) => string = (slot) => String(slot + 1),
): void { ): void {
const lineW = Math.max(2, Math.round(2 * dpr)) 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 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) { for (const cue of cues) {
const color = cueColor(cue) const color = cueColor(cue)
const x = Math.round(timeToX(cue.start)) const x = Math.round(timeToX(cue.start))
@@ -97,43 +105,50 @@ export function drawCues(
if (cue.length > 0) { if (cue.length > 0) {
const x2 = Math.round(timeToX(cue.start + cue.length)) const x2 = Math.round(timeToX(cue.start + cue.length))
if (x2 > 0 && x < w) { 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) 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.save()
ctx.fillStyle = 'rgba(0,0,0,0.7)' ctx.shadowColor = color
ctx.fillRect(x - half - outline, 0, lineW + outline * 2, h) ctx.shadowBlur = 10 * dpr
ctx.fillStyle = color ctx.fillStyle = color
ctx.fillRect(x - half, 0, lineW, h) ctx.fillRect(x - half, 0, lineW, h)
ctx.restore()
if (labels) { if (labels) {
// A flag tab at the top for every cue (outlined). A banked cue carries its // A banked cue's flag carries its slot label (plus its name when it has
// slot label; one without a slot (a memory cue) gets a half-height tab, so // a meaningful one); a cue without a slot (a memory cue) gets a short,
// it still reads as a real object rather than an anonymous line. // unlabelled flag, so it still reads as a real object rather than an
// anonymous line.
const banked = cue.slot != null const banked = cue.slot != null
const tabH = banked ? flagH : Math.round(flagH / 2) const slotText = banked ? slotLabel(cue.slot!) : ''
ctx.fillStyle = 'rgba(0,0,0,0.7)' const name = cue.name && cue.name !== 'n.n.' ? cue.name : ''
ctx.fillRect(x - half - outline, 0, flagW + outline * 2, tabH + outline * 2) const text = slotText && name ? `${slotText} ${name}` : slotText
ctx.fillStyle = color const tw = text ? Math.ceil(ctx.measureText(text).width) : 0
ctx.fillRect(x - half, 0, flagW, tabH) const fw = text ? tw + pad * 2 : Math.round(8 * dpr)
if (banked) { 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.fillStyle = contrastText(color)
ctx.font = `bold ${Math.round(10 * dpr)}px system-ui, sans-serif` ctx.fillText(text, x - half + pad, inset + fh / 2 + dpr * 0.5)
ctx.textBaseline = 'top'
ctx.fillText(slotLabel(cue.slot!), x - half + Math.round(2 * dpr), Math.round(2 * dpr))
} }
} }
} }
} }
/** /**
* Draw the floating "CUE" point: a gold vertical line with a dark outline and a * Draw the floating "CUE" point: a gold vertical line with a solid downward
* solid downward triangle tab at the top, distinct from numbered hotcue flags, * triangle tab at the top, distinct from hotcue flags, the white beatgrid, and
* the white beatgrid, and the red playhead. * the red playhead.
*/ */
export function drawCuePoint( export function drawCuePoint(
ctx: CanvasRenderingContext2D, ctx: CanvasRenderingContext2D,
@@ -143,11 +158,11 @@ export function drawCuePoint(
): void { ): void {
const lw = Math.max(2, Math.round(2 * dpr)) const lw = Math.max(2, Math.round(2 * dpr))
const half = Math.floor(lw / 2) const half = Math.floor(lw / 2)
const outline = Math.max(1, Math.round(dpr)) const tab = Math.round(7 * dpr)
const tab = Math.round(8 * dpr) ctx.save()
ctx.fillStyle = 'rgba(0,0,0,0.6)' ctx.shadowColor = '#ffc861'
ctx.fillRect(x - half - outline, 0, lw + outline * 2, h) ctx.shadowBlur = 10 * dpr
ctx.fillStyle = '#ffb020' ctx.fillStyle = '#ffc861'
ctx.fillRect(x - half, 0, lw, h) ctx.fillRect(x - half, 0, lw, h)
ctx.beginPath() ctx.beginPath()
ctx.moveTo(x - tab, 0) ctx.moveTo(x - tab, 0)
@@ -155,9 +170,10 @@ export function drawCuePoint(
ctx.lineTo(x, tab) ctx.lineTo(x, tab)
ctx.closePath() ctx.closePath()
ctx.fill() 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( export function drawLoop(
ctx: CanvasRenderingContext2D, ctx: CanvasRenderingContext2D,
startX: number, startX: number,
@@ -165,18 +181,62 @@ export function drawLoop(
h: number, h: number,
dpr: number, dpr: number,
): void { ): void {
const edge = Math.max(1, Math.round(2 * dpr)) const edge = Math.max(1, Math.round(1.5 * dpr))
ctx.fillStyle = 'rgba(34,197,94,0.18)' 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.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(startX, 0, edge, h)
ctx.fillRect(endX - edge, 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 /** Grid marker line colours. Markers are structural, so they are never culled
* by the density check the way ordinary beat lines are. */ * by the density check the way ordinary beat lines are. */
export const GRID_MARKER_COLOR = '#4f8cff' // accent — an inactive marker export const GRID_MARKER_COLOR = '#9fb0ff' // periwinkle — an inactive marker
export const GRID_MARKER_ACTIVE_COLOR = '#ffb020' // gold — governs the playhead export const GRID_MARKER_ACTIVE_COLOR = '#ffc861' // gold — governs the playhead
/** /**
* Draw the beatgrid across the visible window [startSec, endSec]. * Draw the beatgrid across the visible window [startSec, endSec].
@@ -199,7 +259,6 @@ export function drawBeatgrid(
if (endSec <= startSec) return if (endSec <= startSec) return
const span = endSec - startSec const span = endSec - startSec
const toX = (t: number) => Math.round(((t - startSec) / span) * w) 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 beatW = Math.max(1, Math.round(dpr))
const barW = Math.max(2, Math.round(2 * 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) { if (seg && seg.start < endSec && seg.end > startSec) {
const x1 = toX(Math.max(seg.start, startSec)) const x1 = toX(Math.max(seg.start, startSec))
const x2 = toX(Math.min(seg.end, endSec)) 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) ctx.fillRect(x1, 0, Math.max(1, x2 - x1), h)
} }
} }
@@ -233,10 +292,10 @@ export function drawBeatgrid(
if (bt < startSec || bt > endSec) continue if (bt < startSec || bt > endSec) continue
const x = toX(bt) const x = toX(bt)
const lw = downbeat ? barW : beatW const lw = downbeat ? barW : beatW
// Dark outline so the line reads on any waveform colour, then a bright line. // Translucent white with no outline: the grid should read as a ruler laid
ctx.fillStyle = 'rgba(0,0,0,0.6)' // over the waveform, not bars cut through it. Downbeats are clearly
ctx.fillRect(x - Math.floor(lw / 2) - outline, 0, lw + outline * 2, h) // brighter, which is what grid editing needs to see.
ctx.fillStyle = downbeat ? 'rgba(255,255,255,0.95)' : 'rgba(255,255,255,0.65)' 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) 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 color = active ? GRID_MARKER_ACTIVE_COLOR : GRID_MARKER_COLOR
const lw = Math.max(2, Math.round((active ? 3 : 2) * dpr)) const lw = Math.max(2, Math.round((active ? 3 : 2) * dpr))
const x = toX(grid.markers[i].start) const x = toX(grid.markers[i].start)
ctx.fillStyle = 'rgba(0,0,0,0.6)' ctx.save()
ctx.fillRect(x - Math.floor(lw / 2) - outline, 0, lw + outline * 2, h) ctx.shadowColor = color
ctx.shadowBlur = 10 * dpr
ctx.fillStyle = color ctx.fillStyle = color
ctx.fillRect(x - Math.floor(lw / 2), 0, lw, h) ctx.fillRect(x - Math.floor(lw / 2), 0, lw, h)
const tab = Math.round(7 * dpr) const tab = Math.round(7 * dpr)
@@ -259,5 +319,6 @@ export function drawBeatgrid(
ctx.lineTo(x - tab, h) ctx.lineTo(x - tab, h)
ctx.closePath() ctx.closePath()
ctx.fill() ctx.fill()
ctx.restore()
} }
} }
+2 -1
View File
@@ -21,5 +21,6 @@ export function formatBpm(bpm: number | null): string {
*/ */
export function keyColor(wheel: number | null): string | undefined { export function keyColor(wheel: number | null): string | undefined {
if (wheel == null) return 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%)`
} }
+118
View File
@@ -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>
)
}
+37 -18
View File
@@ -16,6 +16,7 @@ import {
} from '@tanstack/react-table' } from '@tanstack/react-table'
import type { Track } from '../api' import type { Track } from '../api'
import { formatBpm, formatDuration, keyColor } from './format' import { formatBpm, formatDuration, keyColor } from './format'
import { cueTypeColor } from './cues'
import { RatingStars } from '../components/RatingStars' import { RatingStars } from '../components/RatingStars'
declare module '@tanstack/react-table' { declare module '@tanstack/react-table' {
@@ -75,7 +76,7 @@ function InlineEdit({
}} }}
onClick={(e) => e.stopPropagation()} onClick={(e) => e.stopPropagation()}
onDoubleClick={(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 <InlineEdit
value={title} value={title}
display={title || <span className="text-faint">Untitled</span>} 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')} readOnly={!canEdit(c, 'title')}
onCommit={(v) => edit?.(r, 'title', v)} onCommit={(v) => edit?.(r, 'title', v)}
/> />
@@ -182,7 +183,7 @@ export const TRACK_COLUMNS: ColumnDef<Track, any>[] = [
id: 'bpm', id: 'bpm',
header: 'BPM', header: 'BPM',
size: 74, 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', { col.accessor('key', {
id: 'key', id: 'key',
@@ -193,10 +194,11 @@ export const TRACK_COLUMNS: ColumnDef<Track, any>[] = [
if (!k) return <span className="text-faint">—</span> if (!k) return <span className="text-faint">—</span>
return ( return (
<span <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={{ style={{
color: keyColor(c.row.original.key_wheel), 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} {k}
@@ -225,7 +227,7 @@ export const TRACK_COLUMNS: ColumnDef<Track, any>[] = [
id: 'length', id: 'length',
header: 'Time', header: 'Time',
size: 64, 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', { col.accessor('bitrate', {
id: 'bitrate', id: 'bitrate',
@@ -243,21 +245,38 @@ export const TRACK_COLUMNS: ColumnDef<Track, any>[] = [
col.accessor('cue_count', { col.accessor('cue_count', {
id: 'cue_count', id: 'cue_count',
header: 'Cues', header: 'Cues',
size: 72, size: 104,
cell: (c) => { cell: (c) => {
const n = c.getValue() const r = c.row.original
const markers = c.row.original.grid_marker_count const n = c.getValue() as number
// Gold marks a flexible (multi-tempo) grid, mint an ordinary constant one. 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 ( return (
<span className="flex items-center gap-1 tabular-nums">
<span className={n > 0 ? 'text-text' : 'text-faint'}>{n}</span>
{markers > 0 && (
<span <span
className={markers > 1 ? 'text-[10px] text-gold' : 'text-[10px] text-mint'} className="flex items-center gap-1"
title={markers > 1 ? `Flexible beatgrid (${markers} markers)` : 'Beatgrid analyzed'} title={`${n} cue${n === 1 ? '' : 's'}${
markers > 1 ? ` · flexible beatgrid (${markers} markers)` : markers ? ' · beatgrid analyzed' : ''
}`}
> >
⊞ {r.hotcues.map((h) => {
</span> 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> </span>
) )
@@ -267,7 +286,7 @@ export const TRACK_COLUMNS: ColumnDef<Track, any>[] = [
id: 'playcount', id: 'playcount',
header: 'Plays', header: 'Plays',
size: 68, 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', { col.accessor('import_date', {
id: 'import_date', id: 'import_date',
+91 -66
View File
@@ -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 // The audio is downmixed to mono and split into three frequency bands with
// native BiquadFilters (via OfflineAudioContext — fast, off the main thread). // native BiquadFilters (via OfflineAudioContext — fast, off the main thread).
// Per output column we keep each band's RMS energy plus the amplitude peak. // Per output column we keep each band's RMS energy, normalised to that band's
// Each band is mapped to a target colour on Traktor's warm→cool ramp // loudest moment in the track.
// (bass→orange, mids→violet, highs→cyan) and the three are blended by energy; //
// height = amplitude. Traktor's palette has NO green — mapping bands straight // Painting draws the three bands as LAYERS rather than blending them into one
// to R/G/B (the naive approach) produces yellows/greens it never shows, so we // colour per column: bass (orange) is drawn first and tallest, then mids
// blend named palette colours instead. Tune the three constants below. // (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 { export interface WaveColumn {
peak: number // 0..1 amplitude (column height) peak: number // 0..1 amplitude of the full mix
r: number // 0..1 final blended colour (already contrast-boosted) low: number // 0..1 band energies, each normalised to its own maximum
g: number mid: number
b: number high: number
} }
// Band crossover choices. Independent filters, so band energies don't strictly // 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 LOW_HZ = 250
const MID_HZ = 1200 const MID_HZ = 1200
const MID_Q = 0.6 const MID_Q = 0.6
const HIGH_HZ = 5000 const HIGH_HZ = 5000
// Target colour per band on Traktor's ramp (0..1 RGB). Blended by band energy. // Each layer's colour and its height relative to the waveform's half-height.
const LOW_COL = [1.0, 0.30, 0.15] // bass → orange-red // Bass is the envelope; mids and highs sit inside it so all three stay visible.
const MID_COL = [0.65, 0.18, 0.95] // mids → violet / magenta const LAYERS: { band: 'low' | 'mid' | 'high'; color: string; scale: number; blend: GlobalCompositeOperation }[] = [
const HIGH_COL = [0.15, 0.65, 1.0] // highs → cyan-blue { 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 * 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 * fractional range [startFrac, endFrac) (of the whole track) are mapped across
* the full canvas width, aggregating multiple columns per pixel (max peak, * the full canvas width. Fractions outside [0,1] paint blank — used by the
* averaged colour). Fractions outside [0,1] paint blank — used by the scrolling * scrolling main view so the lead-in/lead-out past the track edges stays empty.
* 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( export function paintWave(
ctx: CanvasRenderingContext2D, ctx: CanvasRenderingContext2D,
@@ -42,39 +59,39 @@ export function paintWave(
h: number, h: number,
startFrac: number, startFrac: number,
endFrac: number, endFrac: number,
opts: PaintOptions = { bar: 1, gap: 0 },
): void { ): void {
const n = cols.length 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 mid = h / 2
const span = (endFrac - startFrac) * n const colsPerPx = ((endFrac - startFrac) * n) / w
for (let x = 0; x < w; x++) { const step = opts.bar + opts.gap
const c0 = startFrac * n + (x / w) * span const colsPerBar = step * colsPerPx
const c1 = startFrac * n + ((x + 1) / w) * span const startCol = startFrac * n
const i0 = Math.floor(c0) const k0 = Math.floor(Math.max(0, startCol) / colsPerBar)
const i1 = Math.max(i0 + 1, Math.ceil(c1)) const k1 = Math.ceil(Math.min(n, endFrac * n) / colsPerBar)
let peak = 0 const prevOp = ctx.globalCompositeOperation
let r = 0 for (const layer of LAYERS) {
let g = 0 ctx.globalCompositeOperation = layer.blend
let b = 0 ctx.fillStyle = layer.color
let count = 0 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++) { for (let i = i0; i < i1; i++) {
if (i < 0 || i >= n) continue const e = cols[i][layer.band]
const col = cols[i] if (e > v) v = e
if (col.peak > peak) peak = col.peak
r += col.r
g += col.g
b += col.b
count++
} }
if (count === 0) continue // outside the track → blank pixel if (v <= 0) continue
r /= count const x = (c0 - startCol) / colsPerPx
g /= count const half = Math.max(0.5, v * reach)
b /= count ctx.fillRect(x, mid - half, opts.bar, half * 2)
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 { export interface WaveformAnalysis {
cols: WaveColumn[] cols: WaveColumn[]
@@ -162,32 +179,40 @@ export async function analyzeWaveform(url: string, buckets?: number): Promise<Wa
await accumBand(midE, 'bandpass', MID_HZ, MID_Q) await accumBand(midE, 'bandpass', MID_HZ, MID_Q)
await accumBand(highE, 'highpass', HIGH_HZ) 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 let maxPeak = 1e-6
for (let b = 0; b < buckets; b++) if (peak[b] > maxPeak) maxPeak = peak[b] 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) const cols: WaveColumn[] = new Array(buckets)
for (let b = 0; b < buckets; b++) { for (let b = 0; b < buckets; b++) {
const n = cnt[b] || 1 cols[b] = {
const l = Math.sqrt(lowE[b] / n) peak: peak[b] / maxPeak,
const m = Math.sqrt(midE[b] / n) low: curve(lowR[b] / maxL, 1.8),
const h = Math.sqrt(highE[b] / n) mid: curve(midR[b] / maxM, 1.3),
// Normalise to the dominant band so colours stay vivid (brightness is not high: curve(highR[b] / maxH, 1.05),
// 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 }
} }
return { cols, buffer: audio } return { cols, buffer: audio }
} }
+5
View File
@@ -1,9 +1,12 @@
import { StrictMode } from 'react' import { StrictMode } from 'react'
import { createRoot } from 'react-dom/client' import { createRoot } from 'react-dom/client'
import { QueryClient, QueryClientProvider } from '@tanstack/react-query' import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
import '@fontsource-variable/geist'
import '@fontsource-variable/geist-mono'
import './index.css' import './index.css'
import App from './App.tsx' import App from './App.tsx'
import { UpdateCheck } from './components/UpdateDialog.tsx' import { UpdateCheck } from './components/UpdateDialog.tsx'
import { AmbientBackdrop } from './components/AmbientBackdrop.tsx'
const queryClient = new QueryClient({ const queryClient = new QueryClient({
defaultOptions: { defaultOptions: {
@@ -17,6 +20,8 @@ const queryClient = new QueryClient({
createRoot(document.getElementById('root')!).render( createRoot(document.getElementById('root')!).render(
<StrictMode> <StrictMode>
<QueryClientProvider client={queryClient}> <QueryClientProvider client={queryClient}>
{/* Behind everything, the picker screen included: every surface is glass over it. */}
<AmbientBackdrop />
<App /> <App />
{/* Mounted beside App so the update dialog shows even on the picker screen. */} {/* Mounted beside App so the update dialog shows even on the picker screen. */}
<UpdateCheck /> <UpdateCheck />