Added context option to multi analyze

This commit is contained in:
patben8 committed 2026-09-25 10:46:31 +02:00
1 parent b71436fad6
commit 532dc5d6ac
11 files changed
+486 -12

No files matched your search

+40 -1
View File
@@ -1,9 +1,22 @@
/** A background job's progress, shown at the right of the bar. */
export interface StatusJob {
label: string
done: number
/** 0 until the job knows its size → indeterminate bar. */
total: number
/** What it is working on right now, e.g. the current track's title. */
detail?: string
cancelling?: boolean
onCancel: () => void
}
interface Props {
showing: number
total: number
sourceName: string
/** Rows currently selected; shown only when non-zero. */
selected?: number
job?: StatusJob | null
loading?: boolean
collectionName?: string | null
onChangeCollection?: () => void
@@ -14,6 +27,7 @@ export function StatusBar({
total,
sourceName,
selected = 0,
job,
loading,
collectionName,
onChangeCollection,
@@ -41,10 +55,35 @@ export function StatusBar({
<span className="tabular-nums text-accent">{selected.toLocaleString()} selected</span>
</>
)}
{job && (
<div className="ml-auto flex min-w-0 items-center gap-2">
<span className="shrink-0 tabular-nums text-text">
{job.cancelling ? 'Cancelling…' : job.label}
{job.total > 0 && ` ${Math.min(job.done + 1, job.total)}/${job.total}`}
</span>
<span className="h-1.5 w-32 shrink-0 overflow-hidden rounded-full bg-ink-800">
<span
className={`block h-full rounded-full bg-accent transition-[width] duration-300 ${
job.total > 0 ? '' : 'w-1/3 animate-pulse'
}`}
style={job.total > 0 ? { width: `${(job.done / job.total) * 100}%` } : undefined}
/>
</span>
{job.detail && <span className="max-w-[240px] truncate text-faint">{job.detail}</span>}
<button
onClick={job.onCancel}
disabled={job.cancelling}
className="shrink-0 rounded px-1.5 text-faint hover:bg-ink-800 hover:text-pink disabled:opacity-40"
title="Cancel"
>
×
</button>
</div>
)}
{collectionName && (
<button
onClick={onChangeCollection}
className="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"
>
<span className="text-[11px]">⎘</span>