feat: test publish to youtube
This commit is contained in:
@@ -1,6 +1,11 @@
|
||||
import { Routes } from "../navigation/Routes";
|
||||
|
||||
export const CREATION_STAGE_KEYS = ["songwriter", "beatmaker", "director"];
|
||||
export const CREATION_STAGE_KEYS = [
|
||||
"songwriter",
|
||||
"beatmaker",
|
||||
"director",
|
||||
"publisher",
|
||||
];
|
||||
|
||||
const getLyricsCount = (project) => {
|
||||
if (!project) return 0;
|
||||
@@ -16,6 +21,16 @@ const getStageMetadata = (project) => {
|
||||
const hasCoverUrl = !!project?.coverUrl;
|
||||
const hasPlaybackAsset = !!project?.playbackUrl;
|
||||
const hasPlayback = hasPlaybackAsset || hasSongUrl;
|
||||
const youtubeUrl = project?.youtubeUrl ?? null;
|
||||
const youtubeStatus = project?.youtubeStatus ?? null;
|
||||
const youtubeError = project?.youtubeError ?? null;
|
||||
const hasYoutubePublication = !!youtubeUrl;
|
||||
const isYoutubePublishing = [
|
||||
"PUBLISHING",
|
||||
"UPLOADING",
|
||||
"PROCESSING",
|
||||
"QUEUED",
|
||||
].includes(youtubeStatus);
|
||||
const musicUrls = Array.isArray(project?.musicUrls)
|
||||
? project.musicUrls.filter(Boolean)
|
||||
: [];
|
||||
@@ -38,9 +53,13 @@ const getStageMetadata = (project) => {
|
||||
musicStatus,
|
||||
coverStatus,
|
||||
playbackStatus,
|
||||
youtubeStatus,
|
||||
youtubeError,
|
||||
isMusicGenerating: musicStatus === "GENERATING",
|
||||
isCoverGenerating: coverStatus === "GENERATING",
|
||||
isPlaybackGenerating,
|
||||
hasYoutubePublication,
|
||||
isYoutubePublishing,
|
||||
};
|
||||
};
|
||||
|
||||
@@ -55,6 +74,8 @@ const getStageLockState = (key, metadata) => {
|
||||
return metadata.lyricsCount <= 0;
|
||||
case "director":
|
||||
return !metadata.hasCover;
|
||||
case "publisher":
|
||||
return !metadata.hasPlaybackAsset;
|
||||
default:
|
||||
return true;
|
||||
}
|
||||
@@ -111,6 +132,20 @@ const getStageDescription = (key, metadata) => {
|
||||
return "Modifier le playback généré";
|
||||
}
|
||||
return "Commencer la création de votre playback";
|
||||
case "publisher":
|
||||
if (!hasPlaybackAsset) {
|
||||
return "Créez un playback pour débloquer la publication";
|
||||
}
|
||||
if (metadata.isYoutubePublishing) {
|
||||
return "Publication de votre vidéo en cours";
|
||||
}
|
||||
if (metadata.youtubeError) {
|
||||
return "La publication a échoué, réessayez.";
|
||||
}
|
||||
if (metadata.hasYoutubePublication) {
|
||||
return "Votre vidéo est en ligne et prête à être partagée";
|
||||
}
|
||||
return "Publier votre vidéo sur la chaîne YouTube MusicLand";
|
||||
default:
|
||||
return "";
|
||||
}
|
||||
@@ -133,6 +168,13 @@ const getStageLockedDescription = (key, metadata) => {
|
||||
return metadata.hasPlaybackAsset
|
||||
? "Impossible de modifier le playback"
|
||||
: undefined;
|
||||
case "publisher":
|
||||
if (!metadata.hasPlaybackAsset) {
|
||||
return "Générez un playback pour débloquer la publication";
|
||||
}
|
||||
return metadata.hasYoutubePublication
|
||||
? "La vidéo est déjà publiée"
|
||||
: undefined;
|
||||
default:
|
||||
return undefined;
|
||||
}
|
||||
@@ -146,6 +188,8 @@ const getStageCompletionState = (key, metadata) => {
|
||||
return metadata.hasSongUrl || metadata.musicStatus === "GENERATED";
|
||||
case "director":
|
||||
return metadata.hasPlaybackAsset;
|
||||
case "publisher":
|
||||
return metadata.hasYoutubePublication;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
@@ -224,6 +268,15 @@ export const getStageAction = (key, project) => {
|
||||
route: Routes.Playback,
|
||||
params: project ? { project } : undefined,
|
||||
};
|
||||
case "publisher": {
|
||||
if (!project?.id) {
|
||||
return { route: Routes.PublishYoutube };
|
||||
}
|
||||
return {
|
||||
route: Routes.PublishYoutube,
|
||||
params: { projectId: project.id },
|
||||
};
|
||||
}
|
||||
default:
|
||||
return {};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user