more fixes web + mobile

This commit is contained in:
Thomas Demirdjian
2025-11-20 11:26:24 +01:00
parent fe9b2b9e8d
commit 70c94c97b4
32 changed files with 1214 additions and 226 deletions
+28 -1
View File
@@ -7,10 +7,34 @@ export const CREATION_STAGE_KEYS = [
"publisher",
];
const getSectionLyrics = (section) => {
if (typeof section === "string") {
return section.trim();
}
if (section && typeof section === "object") {
const value =
typeof section.lyrics === "string" ? section.lyrics.trim() : "";
return value;
}
return "";
};
const getLyricsCount = (project) => {
if (!project) return 0;
const { lyrics } = project;
return Array.isArray(lyrics) ? lyrics.length : 0;
if (Array.isArray(lyrics)) {
return lyrics.reduce(
(count, section) => (getSectionLyrics(section) ? count + 1 : count),
0,
);
}
if (lyrics && typeof lyrics === "object") {
return Object.values(lyrics).reduce(
(count, value) => (getSectionLyrics(value) ? count + 1 : count),
0,
);
}
return getSectionLyrics(lyrics) ? 1 : 0;
};
const getStageMetadata = (project) => {
@@ -73,6 +97,9 @@ const getStageLockState = (key, metadata) => {
}
return metadata.lyricsCount <= 0;
case "director":
if (metadata.hasPlaybackAsset) {
return true;
}
return !metadata.hasCover;
case "publisher":
return !metadata.hasPlaybackAsset;