From cab9e7dc280bee404a83f73960a1ab8af586d447 Mon Sep 17 00:00:00 2001 From: leon-morival Date: Mon, 20 Oct 2025 14:54:45 +0200 Subject: [PATCH] progress && remove video --- src/components/MusicLandHeader.js | 46 +++++++++++++++++++++++----- src/screens/Studio/GeneratingSong.js | 24 ++++++++++++--- src/screens/Writing/WritingLyrics.js | 16 +--------- 3 files changed, 60 insertions(+), 26 deletions(-) diff --git a/src/components/MusicLandHeader.js b/src/components/MusicLandHeader.js index 38dec44..8914014 100644 --- a/src/components/MusicLandHeader.js +++ b/src/components/MusicLandHeader.js @@ -1,5 +1,5 @@ import React from "react"; -import { Image, Pressable, Text, View } from "react-native"; +import { Image, Platform, Pressable, Text, View } from "react-native"; import { icons } from "../assets"; import { Palette, Style } from "../styles"; import { FONT_FAMILY } from "../styles/Fonts"; @@ -12,6 +12,30 @@ const MusicLandHeader = ({ progress = 1, logo = null, }) => { + const isWeb = Platform.OS === "web"; + const backButtonStyle = isWeb + ? { + ...Style.containerRow, + gap: 8, + paddingHorizontal: 12, + paddingVertical: 8, + // backgroundColor: Palette.transparentWhite, + // borderRadius: mainBorderRadius, + } + : { width: 24, height: 24, ...Style.containerCenter }; + const backIconSource = isWeb ? icons.arrowRight : icons.chevronDown; + const backIconStyle = isWeb + ? { + width: 16, + height: 16, + transform: [{ rotate: "180deg" }], + } + : { + width: 15, + height: 15, + transform: [{ rotate: "90deg" }], + }; + return ( - + + {isWeb && ( + + Retour + + )} diff --git a/src/screens/Studio/GeneratingSong.js b/src/screens/Studio/GeneratingSong.js index c3343c2..41189c5 100644 --- a/src/screens/Studio/GeneratingSong.js +++ b/src/screens/Studio/GeneratingSong.js @@ -36,6 +36,7 @@ const GeneratingSong = () => { // Progress based on 8 minutes cap or until status becomes GENERATED useEffect(() => { const totalMs = 8 * 60 * 1000; + const maxGeneratingProgress = 90; const clearTimer = () => { if (progressTimerRef.current) { global.clearInterval(progressTimerRef.current); @@ -44,6 +45,10 @@ const GeneratingSong = () => { }; const status = selectedProject?.musicStatus; + const readyUrls = Array.isArray(selectedProject?.musicUrls) + ? selectedProject.musicUrls.filter(Boolean) + : []; + const hasReadySong = readyUrls.length > 0 || !!selectedProject?.songUrl; if (status !== "GENERATING") { // Reset local start when leaving generating state @@ -51,8 +56,14 @@ const GeneratingSong = () => { } if (status === "GENERATED") { - setProgress(100); clearTimer(); + setProgress(hasReadySong ? 100 : maxGeneratingProgress); + return () => clearTimer(); + } + + if (status !== "GENERATING") { + clearTimer(); + setProgress(0); return () => clearTimer(); } @@ -75,8 +86,8 @@ const GeneratingSong = () => { } const elapsed = moment().diff(moment(startDate)); const raw = Math.floor((elapsed / totalMs) * 100); - // While status is GENERATING, block visual progress at 99% - const pct = Math.max(0, Math.min(99, raw)); + // While status is GENERATING, block visual progress at 90% + const pct = Math.max(0, Math.min(maxGeneratingProgress, raw)); setProgress(pct); }; @@ -84,7 +95,12 @@ const GeneratingSong = () => { clearTimer(); progressTimerRef.current = global.setInterval(update, 1000); return () => clearTimer(); - }, [selectedProject?.musicStatus, selectedProject?.generationStartAt]); + }, [ + selectedProject?.musicStatus, + selectedProject?.generationStartAt, + selectedProject?.musicUrls, + selectedProject?.songUrl, + ]); // Auto navigate to SongReady when generation completed useEffect(() => { diff --git a/src/screens/Writing/WritingLyrics.js b/src/screens/Writing/WritingLyrics.js index d536129..963f650 100644 --- a/src/screens/Writing/WritingLyrics.js +++ b/src/screens/Writing/WritingLyrics.js @@ -1,9 +1,8 @@ -import React, { useEffect, useState } from "react"; +import React from "react"; import { Image, StyleSheet, View } from "react-native"; import useMinuit from "react-native-minuit/src/hooks/useMinuit.js"; import { ai, background, icons } from "../../assets"; import BorderGradientButton from "../../components/BorderGradientButton"; -import FullscreenIntroVideo from "../../components/FullscreenIntroVideo"; import GradientButton from "../../components/GradientButton"; import MusicLandHeader from "../../components/MusicLandHeader"; import { isWeb } from "../../hooks/useLayoutType"; @@ -18,14 +17,6 @@ const WritingLyrics = () => { useUserData(); const { setIsLoading } = useMinuit(); - const [showIntro, setShowIntro] = useState(false); - - useEffect(() => { - if (selectedProject === null) { - setShowIntro(true); - } - }, [selectedProject]); - async function createAndNavigate({ hasLyrics = false }) { try { await setIsLoading(true); @@ -76,11 +67,6 @@ const WritingLyrics = () => { /> - setShowIntro(false)} - /> ); };