diff --git a/CLAUDE.md b/CLAUDE.md index cae6573..451a77b 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -675,6 +675,17 @@ easy to break: 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. +- **Every overlay renders through `createPortal(…, document.body)`** — all + dialogs, `ContextMenu` and `Toast`. Each `.glass` panel is a stacking context + (`isolation`), so an overlay rendered INSIDE one can never rise above a + neighbouring panel, whatever its z-index: New Export (from the sidebar) sat + behind the library, and the deck's Auto Hotcues dialog behind both. One + z scale, set on the overlay's root: dialogs `z-50`, a dialog opened from a + dialog (`FolderPicker`) `z-[60]`, menus `z-[70]`, toasts `z-[80]`. A new + overlay that skips the portal will look fine when opened from `App` and 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. - **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/AnalyzeGridDialog.tsx b/frontend/src/components/AnalyzeGridDialog.tsx index 8687132..03c4ff4 100644 --- a/frontend/src/components/AnalyzeGridDialog.tsx +++ b/frontend/src/components/AnalyzeGridDialog.tsx @@ -1,3 +1,4 @@ +import { createPortal } from 'react-dom' import { useEffect } from 'react' interface Props { @@ -23,10 +24,10 @@ export function AnalyzeGridDialog({ total, existing, locked, onChoose, onClose } return () => window.removeEventListener('keydown', onKey) }, [onClose]) - return ( + return createPortal(
-
+ , + document.body, ) } diff --git a/frontend/src/components/AutoCueDialog.tsx b/frontend/src/components/AutoCueDialog.tsx index 7b66392..8206eb2 100644 --- a/frontend/src/components/AutoCueDialog.tsx +++ b/frontend/src/components/AutoCueDialog.tsx @@ -1,3 +1,4 @@ +import { createPortal } from 'react-dom' import { useEffect, useState } from 'react' import { useQuery, useQueryClient } from '@tanstack/react-query' import { @@ -151,8 +152,8 @@ export function AutoCueDialog(props: Props) { } } - return ( -
!busy && onClose()}> + return createPortal( +
!busy && onClose()}>
e.stopPropagation()} @@ -293,6 +294,7 @@ export function AutoCueDialog(props: Props) {
-
+ , + document.body, ) } diff --git a/frontend/src/components/ConfirmDialog.tsx b/frontend/src/components/ConfirmDialog.tsx index 32c0e9d..d55412d 100644 --- a/frontend/src/components/ConfirmDialog.tsx +++ b/frontend/src/components/ConfirmDialog.tsx @@ -1,3 +1,4 @@ +import { createPortal } from 'react-dom' import { useEffect, useState, type ReactNode } from 'react' export interface ConfirmRequest { @@ -43,10 +44,10 @@ export function ConfirmDialog({ title, body, confirmLabel, onConfirm, onClose }: return () => window.removeEventListener('keydown', onKey) }) - return ( + return createPortal(
!busy && onClose()} >
- + , + document.body, ) } diff --git a/frontend/src/components/ContextMenu.tsx b/frontend/src/components/ContextMenu.tsx index 3ac7cff..36bc284 100644 --- a/frontend/src/components/ContextMenu.tsx +++ b/frontend/src/components/ContextMenu.tsx @@ -1,3 +1,4 @@ +import { createPortal } from 'react-dom' import type { ReactNode } from 'react' import { useEffect, useRef, useState } from 'react' import { Icon } from '../lib/icons' @@ -55,7 +56,7 @@ export function ContextMenu({ x, y, items, onClose }: Props) { } }, []) - return ( + return createPortal( // `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. @@ -69,7 +70,8 @@ export function ContextMenu({ x, y, items, onClose }: Props) { return { top, left: Math.min(x, window.innerWidth - 180), maxHeight: window.innerHeight - top - 8 } })()} /> - + , + document.body, ) } @@ -101,7 +103,7 @@ function MenuPanel({ return ( <>
{items.map((item, i) => { diff --git a/frontend/src/components/EditTagsDialog.tsx b/frontend/src/components/EditTagsDialog.tsx index 74e7dce..76f80bf 100644 --- a/frontend/src/components/EditTagsDialog.tsx +++ b/frontend/src/components/EditTagsDialog.tsx @@ -1,3 +1,4 @@ +import { createPortal } from 'react-dom' import { useRef, useState } from 'react' import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query' import { api, type Track } from '../api' @@ -95,9 +96,9 @@ export function EditTagsDialog({ track, onClose, onApplied, onError }: Props) { apply.mutate() } - return ( + return createPortal(
-
+ , + document.body, ) } diff --git a/frontend/src/components/ExportDialog.tsx b/frontend/src/components/ExportDialog.tsx index 3f9e05f..898f1b6 100644 --- a/frontend/src/components/ExportDialog.tsx +++ b/frontend/src/components/ExportDialog.tsx @@ -1,3 +1,4 @@ +import { createPortal } from 'react-dom' import { useState } from 'react' import { useQuery } from '@tanstack/react-query' import { api, type ExportSet } from '../api' @@ -58,7 +59,7 @@ export function ExportDialog({ editing, onClose, onSaved, onError }: Props) { } } - return ( + return createPortal( <> {browsing && ( - + , + document.body, ) } diff --git a/frontend/src/components/ExportRunDialog.tsx b/frontend/src/components/ExportRunDialog.tsx index ac351a8..d563f62 100644 --- a/frontend/src/components/ExportRunDialog.tsx +++ b/frontend/src/components/ExportRunDialog.tsx @@ -1,3 +1,4 @@ +import { createPortal } from 'react-dom' import { useEffect, useRef, useState } from 'react' import { useQuery, useQueryClient } from '@tanstack/react-query' import { api, type ExportPreview, type ExportSet, type JobStatus } from '../api' @@ -100,7 +101,7 @@ export function ExportRunDialog({ set, onClose, onDone, onError }: Props) { const pct = job && job.total > 0 ? Math.min(100, (job.done / job.total) * 100) : null const blocked = p?.blocked ?? null - return ( + return createPortal(
@@ -260,6 +261,7 @@ export function ExportRunDialog({ set, onClose, onDone, onError }: Props) { )}
-
+ , + document.body, ) } diff --git a/frontend/src/components/FolderPicker.tsx b/frontend/src/components/FolderPicker.tsx index e4b4149..8c65818 100644 --- a/frontend/src/components/FolderPicker.tsx +++ b/frontend/src/components/FolderPicker.tsx @@ -1,3 +1,4 @@ +import { createPortal } from 'react-dom' import { useState } from 'react' import { FileBrowser, useFsListing } from './FileBrowser' @@ -30,7 +31,7 @@ export function FolderPicker({ value, onChange, onClose }: Props) { onClose() } - return ( + return createPortal(
@@ -80,6 +81,7 @@ export function FolderPicker({ value, onChange, onClose }: Props) {
-
+ , + document.body, ) } diff --git a/frontend/src/components/HistoryPanel.tsx b/frontend/src/components/HistoryPanel.tsx index 4902a2b..88f5da4 100644 --- a/frontend/src/components/HistoryPanel.tsx +++ b/frontend/src/components/HistoryPanel.tsx @@ -1,3 +1,4 @@ +import { createPortal } from 'react-dom' import { useState } from 'react' import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query' import { api, type HistoryEntry } from '../api' @@ -78,9 +79,9 @@ export function HistoryPanel({ onClose, onNotify, onError }: Props) { const entries = history.data ?? [] - return ( + return createPortal(
-
+ , + document.body, ) } diff --git a/frontend/src/components/ImportDialog.tsx b/frontend/src/components/ImportDialog.tsx index 40473ac..32ef0eb 100644 --- a/frontend/src/components/ImportDialog.tsx +++ b/frontend/src/components/ImportDialog.tsx @@ -1,3 +1,4 @@ +import { createPortal } from 'react-dom' import { useEffect, useRef, useState } from 'react' import { useQuery, useQueryClient } from '@tanstack/react-query' import { api, type ImportPreview, type JobStatus } from '../api' @@ -141,7 +142,7 @@ export function ImportDialog({ playlistId, deviceLabel, onClose, onDone, onError const finished = job != null && job.state !== 'running' const pct = job && job.total > 0 ? Math.min(100, (job.done / job.total) * 100) : null - return ( + return createPortal( <> {browsing && ( - + , + document.body, ) } diff --git a/frontend/src/components/PathMappingDialog.tsx b/frontend/src/components/PathMappingDialog.tsx index 59986da..8c0468e 100644 --- a/frontend/src/components/PathMappingDialog.tsx +++ b/frontend/src/components/PathMappingDialog.tsx @@ -1,3 +1,4 @@ +import { createPortal } from 'react-dom' import { useEffect, useRef, useState } from 'react' import { useQuery, useQueryClient } from '@tanstack/react-query' import { api, type RemapPreview } from '../api' @@ -102,9 +103,9 @@ export function PathMappingDialog({ onClose, onNotify, onError }: Props) { const canCommit = !!from.trim() && !!to.trim() - return ( + return createPortal(
- + , + document.body, ) } diff --git a/frontend/src/components/ShortcutsDialog.tsx b/frontend/src/components/ShortcutsDialog.tsx index b6cd15a..fd15f89 100644 --- a/frontend/src/components/ShortcutsDialog.tsx +++ b/frontend/src/components/ShortcutsDialog.tsx @@ -1,3 +1,4 @@ +import { createPortal } from 'react-dom' import { useEffect } from 'react' import { useCaps } from '../lib/capabilities' @@ -94,10 +95,10 @@ export function ShortcutsDialog({ onClose }: Props) { return () => window.removeEventListener('keydown', onKey) }, [onClose]) - return ( + return createPortal(
-
+ , + document.body, ) } diff --git a/frontend/src/components/Sidebar.tsx b/frontend/src/components/Sidebar.tsx index a343845..e9e6480 100644 --- a/frontend/src/components/Sidebar.tsx +++ b/frontend/src/components/Sidebar.tsx @@ -92,6 +92,8 @@ interface RowActions { onRename: (node: PlaylistNode, name: string) => void onDelete: (node: PlaylistNode) => void onAddToExport: (node: PlaylistNode, setId: string) => void + /** The row's export button: the export list as a menu under it. */ + onPickExport: (e: React.MouseEvent, node: PlaylistNode) => void onCommitDraft: (name: string) => void onCancelDraft: () => void } @@ -165,7 +167,6 @@ function NodeRow({ actions: RowActions }) { const [open, setOpen] = useState(true) - const [adding, setAdding] = useState(false) const renaming = renamingId === node.id const [renameDraft, setRenameDraft] = useState(node.name) const isFolder = node.kind === 'folder' @@ -245,32 +246,13 @@ function NodeRow({ library being writable: an export set is Konduktor's own curation and adding to one changes nothing in the user's library. */} {!renaming && exportSets.length > 0 && ( -
- - {adding && ( -
- {exportSets.map((set) => ( - - ))} -
- )} -
+ )} {!renaming && node.can_rename && (