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
+13 -2
View File
@@ -33,6 +33,8 @@ const MUSIC_GENERATION_COIN_COST = 8;
const CONFIRM_MODAL_MAX_WIDTH = 540;
const FUNCTIONS_REGION = "europe-west1";
const VOICE_SECTION_TITLES = ["BASE", "SENSIBILITÉ", "TECHNIQUE"];
const FIRST_VOICE_STEP_INDEX = 1;
const OPTIONAL_VOICE_CATEGORIES = new Set(["SENSIBILITÉ", "TECHNIQUE"]);
const ComposeSong = () => {
const scrollRef = useRef(null);
@@ -115,9 +117,18 @@ const ComposeSong = () => {
if (selectedIndex === 0) {
return Array.isArray(genres) && genres.length > 0;
}
if (selectedIndex === 1) {
return !!(voice && typeof voice === "object" && voice.BASE);
const voiceStepIndex = selectedIndex - FIRST_VOICE_STEP_INDEX;
const isVoiceStep =
voiceStepIndex >= 0 && voiceStepIndex < VOICE_SECTION_TITLES.length;
if (isVoiceStep) {
const category = VOICE_SECTION_TITLES[voiceStepIndex];
if (OPTIONAL_VOICE_CATEGORIES.has(category)) {
return true;
}
return !!(voice && typeof voice === "object" && voice[category]);
}
if (selectedIndex === instrumentStepIndex) {
return Array.isArray(instruments) && instruments.length > 0;
}