feat: center generation text

This commit is contained in:
2026-03-04 15:30:18 +01:00
parent c340b87c68
commit 4b64e2d961
4 changed files with 65 additions and 16 deletions
+14 -6
View File
@@ -8,12 +8,12 @@ import MusicLandHeader from '../../components/MusicLandHeader'
import Page from '../../layouts/Page' import Page from '../../layouts/Page'
import { isWeb } from '../../hooks/useLayoutType' import { isWeb } from '../../hooks/useLayoutType'
import { Routes } from '../../navigation' import { Routes } from '../../navigation'
import { navigate } from '../../navigation/NavigationService' import { goBack, navigate } from '../../navigation/NavigationService'
import { useUser } from '../../providers/UserDataProvider' import { useUser } from '../../providers/UserDataProvider'
import { gutters } from '../../styles' import { gutters } from '../../styles'
const Playback = ({ route, navigation }) => { const Playback = ({ route, navigation }) => {
const { project } = route.params || {} const { project, returnToAdventureModal = false } = route.params || {}
const { videos } = useUser() const { videos } = useUser()
// const benhaiUrl = isWeb ? videos?.benhaiWeb || null : videos?.benhai; // const benhaiUrl = isWeb ? videos?.benhaiWeb || null : videos?.benhai;
const theoUrl = isWeb ? videos?.theoWeb : videos?.theo const theoUrl = isWeb ? videos?.theoWeb : videos?.theo
@@ -23,9 +23,17 @@ const Playback = ({ route, navigation }) => {
setShowIntro(null) setShowIntro(null)
} }
const handleBackPress = useCallback(() => {
if (returnToAdventureModal) {
goBack()
return
}
navigation.navigate(Routes.Home)
}, [navigation, returnToAdventureModal])
const onPressRecord = useCallback(() => { const onPressRecord = useCallback(() => {
navigate(Routes.RecordPlayback, { project }) navigate(Routes.RecordPlayback, { project, returnToAdventureModal })
}, [project]) }, [project, returnToAdventureModal])
return ( return (
<Page <Page
@@ -33,7 +41,7 @@ const Playback = ({ route, navigation }) => {
backgroundImg={isWeb ? background.playbackWeb : background.playbackMobile} backgroundImg={isWeb ? background.playbackWeb : background.playbackMobile}
> >
{/* <Image source={ai.theo} style={styles.img} resizeMode="contain" /> */} {/* <Image source={ai.theo} style={styles.img} resizeMode="contain" /> */}
<MusicLandHeader onPressBack={() => navigation.navigate(Routes.Home)} progress={25} /> <MusicLandHeader onPressBack={handleBackPress} progress={25} />
<View <View
style={{ style={{
flex: 1, flex: 1,
@@ -45,7 +53,7 @@ const Playback = ({ route, navigation }) => {
<GradientButton title="Enregistrer mon Playback" onPress={onPressRecord} /> <GradientButton title="Enregistrer mon Playback" onPress={onPressRecord} />
<BorderGradientButton <BorderGradientButton
title="Guide du Playbacker" title="Guide du Playbacker"
onPress={() => navigate(Routes.PlaybackGuide)} onPress={() => navigate(Routes.PlaybackGuide, { returnToAdventureModal })}
/> />
{/* <BorderGradientButton title="Importer une vidéo" /> */} {/* <BorderGradientButton title="Importer une vidéo" /> */}
</View> </View>
+19 -5
View File
@@ -273,6 +273,7 @@ const GeneratingSong = () => {
const progressStatus = isFailed ? 'error' : 'default' const progressStatus = isFailed ? 'error' : 'default'
const displayProgress = Math.max(0, Math.min(100, Math.round(progress || 0))) const displayProgress = Math.max(0, Math.min(100, Math.round(progress || 0)))
const progressLabel = isFailed ? 'Erreur' : `${displayProgress}%` const progressLabel = isFailed ? 'Erreur' : `${displayProgress}%`
const useSquareGeneratingCard = Platform.OS !== 'web' && !isFailed
return ( return (
<Page headerType="NONE" backgroundImg={background.studioBG2}> <Page headerType="NONE" backgroundImg={background.studioBG2}>
@@ -289,16 +290,19 @@ const GeneratingSong = () => {
/> />
<View <View
style={{ style={{
marginTop: responsiveHeight(10), marginTop: useSquareGeneratingCard ? responsiveHeight(4) : responsiveHeight(10),
gap: 16, gap: 16,
flex: 1, // Added flex: 1 to ensure full height usage flex: 1,
alignItems: useSquareGeneratingCard ? 'center' : undefined,
}} }}
> >
<BlurView <BlurView
intensity={Platform.OS !== 'ios' ? 10 : 40} intensity={Platform.OS !== 'ios' ? 10 : 40}
tint="dark" tint="dark"
style={{ style={{
flex: 1, ...(useSquareGeneratingCard
? { width: '88%', aspectRatio: 1, maxWidth: 430 }
: { flex: 1 }),
borderRadius: 16, borderRadius: 16,
overflow: 'hidden', overflow: 'hidden',
padding: 12, padding: 12,
@@ -312,12 +316,22 @@ const GeneratingSong = () => {
<BlurView <BlurView
intensity={Platform.OS !== 'ios' ? 10 : 40} intensity={Platform.OS !== 'ios' ? 10 : 40}
tint="dark" tint="dark"
style={{ flex: 1, padding: 10, paddingBottom: 20 }} style={{
flex: 1,
padding: 10,
paddingBottom: useSquareGeneratingCard ? 10 : 20,
}}
// experimentalBlurMethod={ // experimentalBlurMethod={
// Platform.OS !== "ios" ? "dimezisBlurView" : "none" // Platform.OS !== "ios" ? "dimezisBlurView" : "none"
// } // }
> >
<View style={{ flex: 1, justifyContent: 'flex-end', gap: 20 }}> <View
style={{
flex: 1,
justifyContent: useSquareGeneratingCard ? 'center' : 'flex-end',
gap: 20,
}}
>
<Text <Text
style={{ style={{
fontSize: 22, fontSize: 22,
+11 -1
View File
@@ -32,6 +32,7 @@ const CreateLyricsWithAi = () => {
const [selectedIndex, setSelectedIndex] = useState(0) const [selectedIndex, setSelectedIndex] = useState(0)
const [progress, setProgress] = useState(16) const [progress, setProgress] = useState(16)
const [parentLayout, setparentLayout] = useState(null) const [parentLayout, setparentLayout] = useState(null)
const [headerHeight, setHeaderHeight] = useState(0)
const containerWidth = windowWidth const containerWidth = windowWidth
const handleLyricsError = React.useCallback(() => { const handleLyricsError = React.useCallback(() => {
setSelectedIndex(7) setSelectedIndex(7)
@@ -352,14 +353,23 @@ const CreateLyricsWithAi = () => {
return ( return (
<Page headerType="NONE" backgroundImg={background.writingMobileBackground}> <Page headerType="NONE" backgroundImg={background.writingMobileBackground}>
<View
onLayout={(event) => {
const nextHeight = event?.nativeEvent?.layout?.height
if (typeof nextHeight === 'number' && nextHeight !== headerHeight) {
setHeaderHeight(nextHeight)
}
}}
>
<MusicLandHeader onPressBack={onPressBack} progress={progress} /> <MusicLandHeader onPressBack={onPressBack} progress={progress} />
</View>
<KeyboardAvoidingView <KeyboardAvoidingView
behavior={Platform.OS === 'ios' ? 'padding' : 'height'} behavior={Platform.OS === 'ios' ? 'padding' : 'height'}
style={{ style={{
flex: 1, flex: 1,
gap: responsiveHeight(5), gap: responsiveHeight(5),
}} }}
keyboardVerticalOffset={Platform.OS === 'ios' ? 64 : 100} keyboardVerticalOffset={headerHeight}
> >
<View <View
style={{ flex: 1, paddingBottom: ctaReservedSpace }} style={{ flex: 1, paddingBottom: ctaReservedSpace }}
+20 -3
View File
@@ -19,7 +19,7 @@ import GradientButton from '../../components/GradientButton'
import MusicLandHeader from '../../components/MusicLandHeader' import MusicLandHeader from '../../components/MusicLandHeader'
import Page from '../../layouts/Page' import Page from '../../layouts/Page'
import { Routes } from '../../navigation/Routes' import { Routes } from '../../navigation/Routes'
import { goBack, navigate } from '../../navigation/NavigationService' import { goBack, navigate, push } from '../../navigation/NavigationService'
import { useUser } from '../../providers/UserDataProvider' import { useUser } from '../../providers/UserDataProvider'
import { useStripe } from '../../providers/StripeProvider' import { useStripe } from '../../providers/StripeProvider'
import { gutters, Palette, Style } from '../../styles' import { gutters, Palette, Style } from '../../styles'
@@ -63,6 +63,7 @@ const SongDownload = ({ route }) => {
skipAdventureGate ? 'stop' : 'pending' skipAdventureGate ? 'stop' : 'pending'
) )
const adventureGateTriggeredRef = useRef(false) const adventureGateTriggeredRef = useRef(false)
const reopenAdventureModalOnFocusRef = useRef(false)
const projectForStage = useMemo(() => { const projectForStage = useMemo(() => {
if (routeProject?.id && selectedProject?.id && routeProject.id === selectedProject.id) { if (routeProject?.id && selectedProject?.id && routeProject.id === selectedProject.id) {
@@ -134,6 +135,17 @@ const SongDownload = ({ route }) => {
}, [backRoute, handleBackPress]) }, [backRoute, handleBackPress])
) )
useFocusEffect(
useCallback(() => {
if (!reopenAdventureModalOnFocusRef.current) {
return undefined
}
setShowIntro(null)
setShowAdventureModal(true)
return undefined
}, [])
)
useEffect(() => { useEffect(() => {
if (adventureGateTriggeredRef.current) { if (adventureGateTriggeredRef.current) {
return return
@@ -194,7 +206,10 @@ const SongDownload = ({ route }) => {
const nextPlaybackStage = getStageAction('director', nextProject) const nextPlaybackStage = getStageAction('director', nextProject)
const targetRoute = nextPlaybackStage?.route || Routes.Playback const targetRoute = nextPlaybackStage?.route || Routes.Playback
const params = nextPlaybackStage?.params || { project: nextProject } const params = nextPlaybackStage?.params || { project: nextProject }
navigate(targetRoute, params) push(targetRoute, {
...params,
returnToAdventureModal: true,
})
} catch (error) { } catch (error) {
console.log('[SongDownload] continue error', error?.message) console.log('[SongDownload] continue error', error?.message)
} finally { } finally {
@@ -203,8 +218,8 @@ const SongDownload = ({ route }) => {
}, [ }, [
coverOptions, coverOptions,
coverUrl, coverUrl,
navigate,
projectForStage, projectForStage,
push,
selectedOption, selectedOption,
setLoading, setLoading,
updateProjectData, updateProjectData,
@@ -216,6 +231,7 @@ const SongDownload = ({ route }) => {
}, []) }, [])
const handleContinueAdventure = useCallback(() => { const handleContinueAdventure = useCallback(() => {
reopenAdventureModalOnFocusRef.current = true
setShowAdventureModal(false) setShowAdventureModal(false)
setAdventureChoice('continue') setAdventureChoice('continue')
continueFlow() continueFlow()
@@ -526,6 +542,7 @@ const SongDownload = ({ route }) => {
}, [downloadPaymentPending, handleDownload, hasPaidDownload, isDownloading]) }, [downloadPaymentPending, handleDownload, hasPaidDownload, isDownloading])
const handleStopAdventure = useCallback(() => { const handleStopAdventure = useCallback(() => {
reopenAdventureModalOnFocusRef.current = false
setShowAdventureModal(false) setShowAdventureModal(false)
setAdventureChoice('stop') setAdventureChoice('stop')
}, []) }, [])