fix: blur and music duration

This commit is contained in:
2025-11-04 14:10:43 +01:00
parent 47187bd6d8
commit af47934477
10 changed files with 323 additions and 81 deletions
+35 -17
View File
@@ -188,6 +188,36 @@ const CreateLyricsWithAi = () => {
}
}, [structure]);
const sanitizedCustomStructure = useMemo(() => {
if (!Array.isArray(customStructure) || customStructure.length === 0) {
return [];
}
return sanitizeStructureList(customStructure, CUSTOM_SANITIZE_OPTIONS);
}, [customStructure]);
const sanitizedParsedStructure = useMemo(() => {
if (!Array.isArray(parsedStructure) || parsedStructure.length === 0) {
return [];
}
return sanitizeStructureList(parsedStructure, CUSTOM_SANITIZE_OPTIONS);
}, [parsedStructure]);
const fallbackProjectStructure = useMemo(() => {
const raw = selectedProject?.config?.structure;
if (!Array.isArray(raw) || raw.length === 0) return [];
return sanitizeStructureList(raw, CUSTOM_SANITIZE_OPTIONS);
}, [selectedProject]);
const baseStructureForCustomizer = useMemo(() => {
if (sanitizedCustomStructure.length > 0) return sanitizedCustomStructure;
if (sanitizedParsedStructure.length > 0) return sanitizedParsedStructure;
return fallbackProjectStructure;
}, [
sanitizedCustomStructure,
sanitizedParsedStructure,
fallbackProjectStructure,
]);
const progress = useMemo(
() => 16 + selectedIndex * 9,
[selectedIndex]
@@ -200,13 +230,8 @@ const CreateLyricsWithAi = () => {
const resolvedStyle = shouldUseOtherStyle
? persistedOtherStyle || undefined
: style || undefined;
const sanitizedCustom =
Array.isArray(customStructure) && customStructure.length > 0
? sanitizeStructureList(customStructure, CUSTOM_SANITIZE_OPTIONS)
: [];
const sanitizedParsed = Array.isArray(parsedStructure)
? sanitizeStructureList(parsedStructure)
: [];
const sanitizedCustom = sanitizedCustomStructure;
const sanitizedParsed = sanitizedParsedStructure;
return {
objective: resolvedObjective,
@@ -235,9 +260,9 @@ const CreateLyricsWithAi = () => {
emotion,
style,
audience,
parsedStructure,
sanitizedParsedStructure,
rhymes,
customStructure,
sanitizedCustomStructure,
]);
const isNextDisabled = React.useMemo(() => {
@@ -358,14 +383,7 @@ const CreateLyricsWithAi = () => {
key: "customStructure",
render: () => (
<CustomizeSongStructure
baseStructure={
parsedStructure ||
(Array.isArray(customStructure)
? customStructure
: Array.isArray(selectedProject?.config?.structure)
? selectedProject.config.structure
: [])
}
baseStructure={baseStructureForCustomizer}
onChange={setCustomStructure}
/>
),