diff --git a/CLAUDE.md b/CLAUDE.md index 451a77b..4df8ba7 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -651,7 +651,12 @@ frontend at `http://localhost:5173`. - Frontend: functional components, TanStack Query for fetching, Tailwind utility classes with the `ink-*`/`well`/`accent`/`gold`/`mint`/`pink` tokens and the material classes from `index.css` (see "Theme"). Icons come from - `lib/icons.tsx`, never emoji. Keep `api.ts` types aligned with `schemas.py`. + `lib/icons.tsx`, never emoji; a platform's own mark comes from + `lib/platformIcons.tsx` (`` — single-colour marks + redrawn from each platform's app icon, masks keyed by `useId` since one page + can show a mark twice). That file is a lookup of display ASSETS by platform + id, not platform branching; an unknown id falls back to a generic mark, so a + new adapter needs no change there to appear. Keep `api.ts` types aligned with `schemas.py`. ## Theme — "dark liquid glass" @@ -686,6 +691,11 @@ easy to break: the first time a panel opens it. Small popovers anchored to a control inside a scrolling list should open the shared `ContextMenu` instead (as the playlist row's "Add to export" does) — a popover inside the list is clipped by it. +- **A `.glass` / `.glass-overlay` box must never be the element that scrolls.** + Its tint, blur and rim are pseudo-elements sized to the box, so they scroll + away with the first screenful and leave later content on bare background (the + column chooser's last items did). Give the glass frame `overflow-hidden` and + scroll an inner element — as every dialog and `ContextMenu` do. - **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 ``; diff --git a/frontend/src/components/CollectionPicker.tsx b/frontend/src/components/CollectionPicker.tsx index d0a5e04..4a28015 100644 --- a/frontend/src/components/CollectionPicker.tsx +++ b/frontend/src/components/CollectionPicker.tsx @@ -1,8 +1,10 @@ -import { useState } from 'react' +import { useState, type ReactNode } from 'react' import { useMutation, useQuery } from '@tanstack/react-query' import { api, type CollectionCandidate, type CollectionStatus, type PlatformOption } from '../api' import { FileBrowser, useFsListing } from './FileBrowser' import { browsePrompt, platformAvailability } from '../lib/platformCopy' +import { Icon } from '../lib/icons' +import { PlatformIcon } from '../lib/platformIcons' /** * Choose a library to open, in two steps: WHICH PLATFORM, then which library. @@ -35,13 +37,16 @@ function formatWhen(sec: number | null): string { function OptionCard({ icon, + lit, title, subtitle, disabled, busy, onClick, }: { - icon: string + icon: ReactNode + /** A small lit dot on the icon tile: "something is here". */ + lit?: boolean title: string subtitle: string disabled?: boolean @@ -52,14 +57,24 @@ function OptionCard({ ) } @@ -124,6 +139,11 @@ export function CollectionPicker({ onOpened, onCancel }: Props) {
{/* Header */}
+ {platform && ( + + + + )}
{platform ? `Select your ${platform.name} library` : 'Select your DJ platform'} @@ -133,23 +153,25 @@ export function CollectionPicker({ onOpened, onCancel }: Props) { {step === 'browse' && ( )} {step === 'library' && ( )} {onCancel && ( @@ -166,7 +188,8 @@ export function CollectionPicker({ onOpened, onCancel }: Props) { {platforms.data?.map((p) => ( 0 ? '●' : '○'} + icon={} + lit={p.found > 0} title={p.name} subtitle={platformAvailability(p)} onClick={() => { @@ -180,7 +203,7 @@ export function CollectionPicker({ onOpened, onCancel }: Props) { /* ---- Step 2: which library of that platform ---- */
} title="Automatic" subtitle={ auto @@ -196,7 +219,7 @@ export function CollectionPicker({ onOpened, onCancel }: Props) { onClick={() => auto && open.mutate(auto.path)} /> } title="Open last library" subtitle={ recent @@ -210,7 +233,7 @@ export function CollectionPicker({ onOpened, onCancel }: Props) { onClick={() => recent && open.mutate(recent.path)} /> } title="Find library manually" subtitle={ picksDirectory @@ -234,7 +257,7 @@ export function CollectionPicker({ onOpened, onCancel }: Props) { key={c.path} disabled={open.isPending} onClick={() => open.mutate(c.path)} - className="flex w-full items-center gap-2 rounded-md border border-line bg-ink-850 px-3 py-2 text-left text-sm text-muted hover:border-accent hover:text-text disabled:opacity-40" + className="btn-glass flex w-full items-center gap-2 rounded-xl px-3 py-2 text-left text-sm text-muted hover:text-text disabled:opacity-40" > {c.label} @@ -247,7 +270,7 @@ export function CollectionPicker({ onOpened, onCancel }: Props) { )} {openError && ( -
+
{openError}
)} @@ -286,7 +309,7 @@ export function CollectionPicker({ onOpened, onCancel }: Props) { {/* Manual path + errors */}
{openError && ( -
+
{openError}
)} diff --git a/frontend/src/components/ContextMenu.tsx b/frontend/src/components/ContextMenu.tsx index 36bc284..9dc9f28 100644 --- a/frontend/src/components/ContextMenu.tsx +++ b/frontend/src/components/ContextMenu.tsx @@ -21,6 +21,9 @@ interface Props { const SUBMENU_WIDTH = 240 const SUBMENU_MAX_HEIGHT = 288 +// A long menu (the header's column chooser lists every column) scrolls rather +// than running the height of the window. +const MENU_MAX_HEIGHT = 400 // Lightweight fixed-position menu. Closes on outside click, scroll, or Escape. export function ContextMenu({ x, y, items, onClose }: Props) { @@ -67,7 +70,11 @@ export function ContextMenu({ x, y, items, onClose }: Props) { className="min-w-[160px]" style={(() => { const top = Math.min(y, window.innerHeight - 100) - return { top, left: Math.min(x, window.innerWidth - 180), maxHeight: window.innerHeight - top - 8 } + return { + top, + left: Math.min(x, window.innerWidth - 180), + maxHeight: Math.min(MENU_MAX_HEIGHT, window.innerHeight - top - 8), + } })()} />
, @@ -102,10 +109,15 @@ function MenuPanel({ return ( <> + {/* The glass (tint, blur, rim) is painted by pseudo-elements of THIS box, + so it must not be the one that scrolls: its ::before/::after would + scroll away with the first screenful of items and leave the rest on + bare background. The frame stays put; the inner list scrolls. */}
+
{items.map((item, i) => { if ('separator' in item) { return
@@ -181,6 +193,7 @@ function MenuPanel({ ) })} +
{open && openItem && 'submenu' in openItem && ( diff --git a/frontend/src/lib/platformIcons.tsx b/frontend/src/lib/platformIcons.tsx new file mode 100644 index 0000000..bc846ca --- /dev/null +++ b/frontend/src/lib/platformIcons.tsx @@ -0,0 +1,80 @@ +// The DJ platforms' marks, for the collection picker and anywhere else a +// library's platform is named. Redrawn as geometry from each platform's app icon +// (not traced), single-colour via `currentColor` so they take the theme's text +// colour; the square app-icon backgrounds are left to whatever tile holds them. +// +// These are the platforms' trademarks, used to say which platform is which. +// +// A lookup of display ASSETS keyed by platform id — not behaviour branching on +// the platform, which components must never do. An unknown id falls back to a +// generic mark, so a new adapter shows up without touching this file. +import { useId } from 'react' +import { Icon } from './icons' + +type Mark = (props: { mask: string }) => React.ReactElement + +const MARKS: Record = { + // An outer ring around a disk cut by an X, with a hole at the centre. + traktor: ({ mask }) => ( + <> + + + + + + + + + + ), + // A cube split into three faces by a Y of spokes that meet in a ring. + rekordbox: ({ mask }) => ( + <> + + + + + + + + + + + ), + // A "C": a solid arc breaking into blades that thin toward three o'clock. + // Fewer, wider blades than the original, so they stay distinct at 16 px. + onelibrary: () => , +} + +export function PlatformIcon({ + platform, + size = 20, + className, +}: { + platform: string + size?: number + className?: string +}) { + // Masks are addressed by id, and one page can show the same mark twice. + const mask = `pm-${useId().replace(/:/g, '')}` + const Mark = MARKS[platform] + if (!Mark) return + return ( + + + + ) +}