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