continue fix generating flow

This commit is contained in:
Thomas Demirdjian
2025-09-02 15:42:45 +02:00
parent d634c55aaa
commit 07053bc8db
10 changed files with 314 additions and 95 deletions
+9 -4
View File
@@ -174,17 +174,22 @@ const MusicDetails = () => {
}
};
const description = useMemo(() => {
// Try to build a readable text from lyrics if present
// Build a readable text from lyrics with section labels
if (Array.isArray(project?.lyrics)) {
return project.lyrics
.map((s) => (s?.lyrics || "").trim())
.map((s) => {
const body = (s?.lyrics || "").trim();
if (!body) return null;
const t = (s?.type || "").toLowerCase();
const label = t === "refrain" ? "Refrain" : "Couplet";
return `[${label}]\n${body}`;
})
.filter(Boolean)
.slice(0, 4)
.join("\n\n");
}
const c = project?.lyrics?.couplet;
const r = project?.lyrics?.refrain;
const parts = [c, r].filter(Boolean);
const parts = [c ? `[Couplet]\n${c}` : null, r ? `[Refrain]\n${r}` : null].filter(Boolean);
return parts.length ? parts.join("\n\n") : "";
}, [project]);