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
+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)}