filter on lyrics for bloking unwanted content, tickets fix

This commit is contained in:
Thomas Demirdjian
2025-09-08 15:48:29 +02:00
parent 987388c501
commit a3dc4f89b7
22 changed files with 1386 additions and 126 deletions
+13 -5
View File
@@ -11,8 +11,8 @@ import ChooseGenre from "./ChooseGenre";
import CustomizeVoice from "./CustomizeVoice";
import ChooseInstruments from "./ChooseInstruments";
import ChooseRhythm from "./ChooseRhythm";
import { projectsRef } from "../../config/firebase";
import { useUser } from "../../providers/UserDataProvider";
import firebase from "../../config/firebase";
import { Routes } from "../../navigation";
const { width } = Dimensions.get("window");
@@ -26,7 +26,8 @@ const ComposeSong = () => {
// Selections state
const [genres, setGenres] = useState([]);
const [voice, setVoice] = useState(null);
// voice: object keyed by category (e.g., { base: string|null, Sensibilité: string|null, Technique: string|null })
const [voice, setVoice] = useState({});
const [instruments, setInstruments] = useState([]);
const [rhythm, setRhythm] = useState(null);
@@ -35,7 +36,8 @@ const ComposeSong = () => {
case 0:
return Array.isArray(genres) && genres.length > 0;
case 1:
return !!voice;
// Must select at least one in base category
return !!(voice && typeof voice === "object" && voice.base);
case 2:
return Array.isArray(instruments) && instruments.length > 0;
case 3:
@@ -58,11 +60,15 @@ const ComposeSong = () => {
if (c) lyricsArr.push({ type: "couplet", lyrics: c });
if (r) lyricsArr.push({ type: "refrain", lyrics: r });
}
const voiceArray = Object.entries(voice || {})
.filter(([, v]) => typeof v === "string" && v.trim())
.map(([category, value]) => ({ category, value }));
return {
title: selectedProject?.title || "",
lyrics: lyricsArr,
genres: Array.isArray(genres) ? genres : [],
voice: voice || undefined,
voice: voiceArray,
instruments: Array.isArray(instruments) ? instruments : [],
tempo: rhythm || undefined,
projectId: selectedProjectId || undefined,
@@ -83,13 +89,15 @@ const ComposeSong = () => {
genres: Array.isArray(musicConfig?.genres)
? musicConfig.genres
: [],
voice: musicConfig?.voice || "",
voice: Array.isArray(musicConfig?.voice) ? musicConfig.voice : [],
instruments: Array.isArray(musicConfig?.instruments)
? musicConfig.instruments
: [],
tempo: musicConfig?.tempo || "",
},
musicStatus: null,
sunoTaskId: firebase.firestore.FieldValue.delete(),
musicUrls: firebase.firestore.FieldValue.delete(),
});
}
} catch (e) {}