merge
This commit is contained in:
@@ -1,16 +1,15 @@
|
||||
import FontAwesome from "@expo/vector-icons/FontAwesome";
|
||||
import { BlurView } from "expo-blur";
|
||||
import React, { useMemo } from "react";
|
||||
import { Image, Platform, Pressable, Text, View } from "react-native";
|
||||
import Page from "../layouts/Page";
|
||||
import { ai, background } from "../assets";
|
||||
import { BlurView } from "expo-blur";
|
||||
import { Palette } from "../styles";
|
||||
import { FONT_FAMILY } from "../styles/Fonts";
|
||||
import Page from "../layouts/Page";
|
||||
import { Routes } from "../navigation";
|
||||
import { navigate } from "../navigation/NavigationService";
|
||||
import { useUserData } from "../providers/UserDataProvider";
|
||||
import FontAwesome from "@expo/vector-icons/FontAwesome";
|
||||
import { Palette } from "../styles";
|
||||
import { FONT_FAMILY } from "../styles/Fonts";
|
||||
import palette from "../styles/Palette";
|
||||
import GeneratingSong from "./Studio/GeneratingSong";
|
||||
|
||||
const CREATE_DATA = [
|
||||
{
|
||||
@@ -59,14 +58,27 @@ const NewMusicOptions = ({ route }) => {
|
||||
? currentProjet.lyrics.length > 0
|
||||
: !!currentProjet?.lyrics;
|
||||
const hasCover = !!currentProjet?.coverUrl;
|
||||
console.log("current projet cover", currentProjet?.coverUrl);
|
||||
|
||||
const isLocked = (index) => {
|
||||
// 0: Songwriter, 1: Beatmaker, 2: Producer, 3: Director
|
||||
if (index === 3) return true; // Director toujours verrouillé
|
||||
if (!hasProject) return index !== 0; // seulement Songwriter
|
||||
if (hasCover) return index !== 2; // seulement Producer
|
||||
if (hasLyrics) return !(index === 0 || index === 1); // Songwriter + Beatmaker
|
||||
return index !== 0; // par défaut seulement Songwriter
|
||||
// Rules:
|
||||
// - If no project: only Songwriter (0) is available.
|
||||
// - If project exists: Songwriter (0) is always available.
|
||||
// - If lyrics exist: Beatmaker (1) becomes available.
|
||||
// - If cover exists: Producer (2) and Director (3) become available.
|
||||
if (!hasProject) return index !== 0;
|
||||
|
||||
const allowed = new Set([0]); // songwriter always allowed when project exists
|
||||
if (hasLyrics) {
|
||||
allowed.add(1);
|
||||
}
|
||||
if (hasCover) {
|
||||
allowed.add(2);
|
||||
allowed.add(3);
|
||||
}
|
||||
|
||||
return !allowed.has(index);
|
||||
};
|
||||
|
||||
const onPressOption = (index, item) => {
|
||||
@@ -90,7 +102,11 @@ const NewMusicOptions = ({ route }) => {
|
||||
navigate(Routes.PouchReady, { projectId: currentProjet.id });
|
||||
break;
|
||||
case 3:
|
||||
navigate(Routes.Playback, { projectId: currentProjet.id });
|
||||
console.log("test");
|
||||
navigate(Routes.Playback, {
|
||||
project: currentProjet,
|
||||
});
|
||||
default:
|
||||
break;
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user