more fixes web + mobile
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user