re choose cover and new prompt

This commit is contained in:
2026-02-24 10:54:19 +01:00
parent e608c17775
commit b5d54226b1
8 changed files with 376 additions and 128 deletions
+11
View File
@@ -217,6 +217,17 @@ const Home = ({ navigation, route }) => {
const hasSongUrl = typeof menuProject?.songUrl === 'string' && menuProject.songUrl.length > 0
if (hasSongUrl) {
items.push({
label: 'Télécharger',
onPress: () => {
projectDropdownRef.current?.close?.()
navigate(Routes.SongDownload, {
project: menuProject,
skipAdventureGate: true,
promptPurchaseConfirm: true,
})
},
})
items.push({
label: 'Jouer la musique',
onPress: () => {
+2 -2
View File
@@ -34,6 +34,7 @@ export const ChooseCoverType = () => {
const hasGeneratedOptions = Array.isArray(selectedProject?.cover?.options)
? selectedProject.cover.options.length > 0
: false
const generateCoverLabel = hasFinalCover ? 'Modifier la pochette' : 'Générer la pochette'
const hasArtistPreference = useMemo(() => {
if (currentUserData?.userName) return true
@@ -223,9 +224,8 @@ export const ChooseCoverType = () => {
onPress={handlePickUserImage}
/> */}
<GradientButton
title={hasFinalCover ? 'Pochette déjà validée' : 'Générer la pochette'}
title={generateCoverLabel}
onPress={handleGenerateCover}
disabled={hasFinalCover}
/>
</View>
</View>
+1 -1
View File
@@ -76,7 +76,7 @@ const PhotoCover = () => {
<View style={{ flex: 1, marginTop: 16 }}>
<CreateLyricsHeader
title="Ta pochette MusicLand Production"
subTitle="Le logo est automatiquement ajouté en bas à droite."
subTitle="Le texte Musicland.ai est automatiquement ajouté en bas à droite."
/>
<View style={{ flex: 1, ...Style.containerCenter }}>
<View style={{ width: '80%', position: 'relative' }}>
+39 -20
View File
@@ -33,18 +33,14 @@ import CreateLyricsHeader from '../Writing/components/CreateLyricsHeader'
import ProgressBar from '../../components/ProgressBar'
const COVER_STYLE_PRESETS = [
'Cyberpunk',
'Dessins animé',
'Dessins animé rétro',
'Portrait théâtralisé',
'Livre de coloriage',
'Shooting',
'Réaliste',
'Artistique',
'Afro',
'Grunge',
'Pop Art'
'Réaliste (style cinématographique)',
'Artistique (style peinture moderne)',
'Style Dessins',
'Style rétros',
'Style cyberpunk',
'Style Afro',
'Style grunge',
'Style pop art',
]
const COVER_PROGRESS_MAX = 98
const COVER_PROGRESS_INTERVAL_MS = 500
@@ -120,10 +116,10 @@ const PouchReady = () => {
}, [selectedProject?.coverStyle])
const generateCover = useCallback(
async (styleValue) => {
async (styleValue, { allowRegeneration = false } = {}) => {
if (!selectedProjectId) return
// We allow regeneration if isEditing is true
if (hasGeneratedOptions && !isEditing) {
// We allow regeneration if isEditing or explicitly requested
if (hasGeneratedOptions && !isEditing && !allowRegeneration) {
return
}
const trimmedStyle = String(styleValue || '').trim()
@@ -171,6 +167,18 @@ const PouchReady = () => {
generateCover(trimmedStyle)
}, [customStyle, generateCover, selectedPresetStyle, styleMode])
const handleRegenerateSameStyle = useCallback(() => {
const storedStyle =
typeof selectedProject?.coverStyle === 'string' ? selectedProject.coverStyle.trim() : ''
const fallbackStyle = styleMode === 'preset' ? selectedPresetStyle : customStyle
const trimmedStyle = (storedStyle || fallbackStyle || '').trim()
if (!trimmedStyle) {
alert('Attention', 'Merci de renseigner un style pour la pochette.', [{ text: 'OK' }])
return
}
generateCover(trimmedStyle, { allowRegeneration: true })
}, [customStyle, generateCover, selectedPresetStyle, selectedProject?.coverStyle, styleMode])
const coverPreviewUrl =
selectedProject?.cover?.result || selectedProject?.cover?.generatedBackground || null
@@ -542,15 +550,21 @@ const PouchReady = () => {
setIsPresetDropdownOpen(false)
}}
/>
<Text style={{ color: Palette.white, fontSize: 12, paddingLeft: 24, paddingTop: 8 }}>
Donne les instructions que tu veux pour créer ta pochette
<Text
style={{
color: Palette.white,
fontSize: 12,
paddingLeft: 24,
paddingTop: 8,
}}
>
(donne les instructions que tu veux pour créer ta pochette)
</Text>
</View>
{styleMode === 'custom' && (
<View style={styles.customInputWrapper}>
<TextInput
placeholder="Exemple : Collage rétro futuriste lumineux"
placeholder="Exemple : Collage rétro futuriste contrasté"
placeholderTextColor={Palette.grayMid}
value={customStyle}
onChangeText={setCustomStyle}
@@ -608,7 +622,12 @@ const PouchReady = () => {
<>
<View style={{ flexDirection: 'column', gap: 12, width: '100%' }}>
<GradientButton title={'Valider la pochette'} onPress={onValidatePicture} />
<BorderGradientButton
title="Regénérer une autre proposition"
onPress={handleRegenerateSameStyle}
disabled={isGenerating}
textStyle={{ fontSize: 13 }}
/>
<BorderGradientButton
title="Pas satisfait ? Modifier ma demande"
onPress={() => setIsEditing(true)}
+18 -1
View File
@@ -40,6 +40,8 @@ const SongDownload = ({ route }) => {
project: routeProject,
selectedOption: routeSelectedOption,
coverOptions: routeCoverOptions,
skipAdventureGate = false,
promptPurchaseConfirm = false,
} = route?.params || {}
const { selectedProject, updateProjectData, hasActiveSubscription } = useUser()
const { createSongDownloadCheckout } = useStripe()
@@ -53,7 +55,9 @@ const SongDownload = ({ route }) => {
const [showIntro, setShowIntro] = useState(null)
const [showAdventureModal, setShowAdventureModal] = useState(false)
const [showShareModal, setShowShareModal] = useState(false)
const [adventureChoice, setAdventureChoice] = useState('pending')
const [adventureChoice, setAdventureChoice] = useState(() =>
skipAdventureGate ? 'stop' : 'pending'
)
const adventureGateTriggeredRef = useRef(false)
const projectForStage = useMemo(() => {
@@ -467,6 +471,18 @@ const SongDownload = ({ route }) => {
)
return
}
if (promptPurchaseConfirm) {
Alert.alert(
'Acheter ce morceau',
'Voulez-vous acheter ce morceau pour 1,99€ ?',
[
{ text: 'Annuler', style: 'cancel' },
{ text: 'Acheter', onPress: () => startSongDownloadCheckout() },
],
{ cancelable: true }
)
return
}
startSongDownloadCheckout()
}, [
canDownloadDirectly,
@@ -474,6 +490,7 @@ const SongDownload = ({ route }) => {
handleDownload,
isCheckoutLaunching,
isDownloading,
promptPurchaseConfirm,
startSongDownloadCheckout,
])
+1 -2
View File
@@ -55,8 +55,7 @@ const ValidateCover = () => {
if (
!option ||
option?.id === selectedOptionId ||
isSelecting ||
selectedOptionId // Prevent re-selection
isSelecting
) {
return
}