This commit is contained in:
2025-09-02 13:18:20 +02:00
parent 98367af0b7
commit 2a821182c5
5 changed files with 285 additions and 47 deletions
+29 -10
View File
@@ -1,14 +1,14 @@
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";
const CREATE_DATA = [
@@ -58,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) => {
@@ -80,6 +93,12 @@ const NewMusicOptions = ({ route }) => {
case 2:
navigate(Routes.Production, { action: item.type });
break;
case 3:
console.log("test");
navigate(Routes.Playback, {
action: item.type,
project: currentProjet,
});
default:
break;
}