mirror of
https://github.com/MrPatben8/konduktor.git
synced 2026-11-27 10:22:51 +01:00
Fixed track collision bug
This commit is contained in:
1 parent
b5b0fa91fe
commit
376569ec75
7 files changed
+236
-34
No files matched your search
@@ -556,6 +556,10 @@ export interface RemapPreview {
|
||||
matched: number
|
||||
existing: number
|
||||
samples: RemapSample[]
|
||||
/** Target paths more than one track would land on. Non-zero = the rewrite
|
||||
* would be refused (two entries sharing a path corrupt the library). */
|
||||
collisions: number
|
||||
collision_samples: string[]
|
||||
}
|
||||
|
||||
/** One place a stored volume's tracks were found — a mapping the user can pick. */
|
||||
|
||||
@@ -102,7 +102,10 @@ export function PathMappingDialog({ onClose, onNotify, onError }: Props) {
|
||||
}
|
||||
}
|
||||
|
||||
const canCommit = !!from.trim() && !!to.trim()
|
||||
// The backend refuses a rewrite that would give two tracks one path; say so
|
||||
// here rather than only after the click.
|
||||
const collides = (preview?.collisions ?? 0) > 0
|
||||
const canCommit = !!from.trim() && !!to.trim() && !collides
|
||||
|
||||
return createPortal(
|
||||
<div
|
||||
@@ -191,6 +194,19 @@ export function PathMappingDialog({ onClose, onNotify, onError }: Props) {
|
||||
{preview.matched} exist at the target.
|
||||
</span>
|
||||
)}
|
||||
{collides && (
|
||||
<div className="mt-1.5 text-pink">
|
||||
{preview.collisions} target path{preview.collisions === 1 ? '' : 's'} would
|
||||
belong to more than one track, so the paths can’t be rewritten:
|
||||
<ul className="mt-1 list-disc pl-4 text-muted">
|
||||
{preview.collision_samples.map((p) => (
|
||||
<li key={p} className="truncate" title={p}>
|
||||
{p}
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
|
||||
|
||||
Reference in new issue
Block a user