{/* Header */}
Select your Traktor collection
{mode === 'choose'
? 'Open automatically, resume your last one, or browse.'
: 'Choose a collection.nml file to open.'}
{mode === 'browse' && (
)}
{onCancel && (
)}
{mode === 'choose' ? (
/* ---- Chooser ---- */
auto && open.mutate(auto.path)}
/>
recent && open.mutate(recent.path)}
/>
setMode('browse')}
/>
{open.isError && (
{(open.error as Error).message}
)}
) : (
/* ---- Manual browser ---- */
<>
{/* Path bar */}
{data?.path ?? 'Loading…'}
{/* Listing */}
{listing.isLoading &&
Loading…
}
{data && data.dirs.length === 0 && data.files.length === 0 && (
No folders or .nml files here.
)}
{data?.dirs.map((d) => (
))}
{data?.files.map((f) => (
))}
{/* Manual path + errors */}
{open.isError && (
{(open.error as Error).message}
)}
setManual(e.target.value)}
onKeyDown={(e) => {
if (e.key === 'Enter' && manual.trim()) open.mutate(manual.trim())
}}
placeholder="…or paste a full path to collection.nml"
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"
/>
>
)}