fix list selection and other tickets
This commit is contained in:
@@ -159,6 +159,45 @@ const CreateLyricsWithAi = () => {
|
||||
customStructure,
|
||||
]);
|
||||
|
||||
const isNextDisabled = React.useMemo(() => {
|
||||
switch (selectedIndex) {
|
||||
case 0: {
|
||||
const hasObjective = typeof objective === "string" && objective.length > 0;
|
||||
const hasOther = typeof otherObjective === "string" && otherObjective.trim().length > 0;
|
||||
return !(hasObjective || hasOther);
|
||||
}
|
||||
case 1: {
|
||||
const hasContext = typeof context === "string" && context.trim().length > 0;
|
||||
return !hasContext;
|
||||
}
|
||||
case 2: {
|
||||
const hasEmotion =
|
||||
(emotion && typeof emotion === "object" && !!emotion.title) ||
|
||||
(typeof emotion === "string" && emotion.trim().length > 0);
|
||||
return !hasEmotion;
|
||||
}
|
||||
case 3: {
|
||||
const hasStyle = typeof style === "string" && style.length > 0;
|
||||
const hasOther = typeof otherStyle === "string" && otherStyle.trim().length > 0;
|
||||
return !(hasStyle || hasOther);
|
||||
}
|
||||
case 4: {
|
||||
const hasAudience = typeof audience === "string" && audience.trim().length > 0;
|
||||
return !hasAudience;
|
||||
}
|
||||
case 5: {
|
||||
const hasStructure = typeof structure === "string" && structure.length > 0;
|
||||
return !hasStructure;
|
||||
}
|
||||
case 7: {
|
||||
const hasRhymes = typeof rhymes === "string" && rhymes.length > 0;
|
||||
return !hasRhymes;
|
||||
}
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}, [selectedIndex, objective, otherObjective, context, emotion, style, otherStyle, audience, structure, rhymes]);
|
||||
|
||||
const onPressNext = async () => {
|
||||
// Si l'utilisateur a déjà des paroles et vient de finir CustomizeSongStructure (index 6),
|
||||
// sauter Rhymes et CreatingLyrics et aller directement sur Lyrics
|
||||
@@ -362,6 +401,7 @@ const CreateLyricsWithAi = () => {
|
||||
{selectedIndex !== 8 && (
|
||||
<GradientButton
|
||||
title={selectedIndex === 7 ? "Générer" : "Suivant"}
|
||||
disabled={isNextDisabled}
|
||||
onPress={onPressNext}
|
||||
/>
|
||||
)}
|
||||
|
||||
Reference in New Issue
Block a user