Improve artwork edit form

This commit is contained in:
2025-12-29 21:46:01 +01:00
parent eaf822d73a
commit e1e000c8e5
7 changed files with 529 additions and 162 deletions

View File

@ -0,0 +1,24 @@
export function slugify(input: string) {
return input
.toLowerCase()
.trim()
.replace(/['"]/g, "")
.replace(/[^a-z0-9]+/g, "-")
.replace(/(^-|-$)+/g, "");
}
export function normalizeNames(items?: string[]) {
const out: string[] = [];
const seen = new Set<string>();
for (const raw of items ?? []) {
const name = raw.trim().replace(/\s+/g, " ");
if (!name) continue;
const key = name.toLowerCase();
if (seen.has(key)) continue;
seen.add(key);
out.push(name);
}
return out;
}