From 48fd1d88163f32d898e57e2160446fbd34887851 Mon Sep 17 00:00:00 2001 From: leon-morival Date: Wed, 3 Dec 2025 17:18:37 +0100 Subject: [PATCH] feat: go back to home --- src/screens/Home/Home.js | 73 +++++++++++++++++++++++++++++++------- src/screens/LandingPage.js | 18 +++++++--- 2 files changed, 74 insertions(+), 17 deletions(-) diff --git a/src/screens/Home/Home.js b/src/screens/Home/Home.js index adc7378..a0d61a1 100644 --- a/src/screens/Home/Home.js +++ b/src/screens/Home/Home.js @@ -456,6 +456,10 @@ const Home = ({ navigation, route }) => { setCoinModalVisible(false); }, []); + const handleNavigateToLanding = useCallback(() => { + navigate(Routes.LandingPage); + }, []); + const stageCardContainerStyle = isWeb ? styles.cardsGrid : styles.cardsStack; const stageCardItemStyle = isWeb ? styles.webStageCard @@ -516,18 +520,32 @@ const Home = ({ navigation, route }) => { const topBar = ( - {mobileInfoRow} - + + + Retour à l'accueil + + + + {mobileInfoRow} + + ); @@ -710,11 +728,40 @@ const styles = StyleSheet.create({ flexWrap: isWeb ? "wrap" : "nowrap", alignItems: isWeb ? "center" : "stretch", justifyContent: isWeb ? "center" : "flex-start", - gap: 12, + gap: isWeb ? 0 : 12, marginTop: isWeb ? 12 : 0, marginBottom: isWeb ? 4 : 16, paddingHorizontal: isWeb ? 0 : gutters, zIndex: 10, + position: "relative", + }, + returnLandingButton: { + paddingHorizontal: 14, + paddingVertical: 10, + borderRadius: 18, + backgroundColor: "rgba(12, 14, 18, 0.72)", + borderWidth: 1, + borderColor: "rgba(255, 255, 255, 0.1)", + alignSelf: "flex-start", + }, + returnLandingButtonWeb: { + position: "absolute", + left: 0, + top: 0, + transform: [{ translateY: -2 }], + }, + returnLandingButtonText: { + fontSize: 14, + color: Palette.white, + fontFamily: FONT_FAMILY.InterSemiBold, + }, + topBarContent: { + flex: 1, + width: "100%", + flexDirection: isWeb ? "row" : "column", + alignItems: isWeb ? "center" : "stretch", + justifyContent: isWeb ? "center" : "flex-start", + gap: 12, }, projectDropDown: { width: isWeb ? 420 : "100%", diff --git a/src/screens/LandingPage.js b/src/screens/LandingPage.js index ebe8257..7d55ec4 100644 --- a/src/screens/LandingPage.js +++ b/src/screens/LandingPage.js @@ -29,6 +29,7 @@ export default function LandingPage() { const [videoUrl, setVideoUrl] = useState(null); const [selectedLanguage, setSelectedLanguage] = useState(null); const [showFreeCreditsPopup, setShowFreeCreditsPopup] = useState(false); + const isAuthenticated = !!currentUID; const handleSelectLanguage = useCallback((language) => { setSelectedLanguage(language); @@ -38,8 +39,15 @@ export default function LandingPage() { }, []); const handleLaunchAdventure = useCallback(() => { + if (isAuthenticated) { + navigation.navigate(Routes.BottomTab, { + screen: Routes.HomeStack, + params: { screen: Routes.Home }, + }); + return; + } navigation.navigate(Routes.Register); - }, [navigation]); + }, [isAuthenticated, navigation]); const { data: video } = useDataFromRef({ ref: videosRef.doc("fr"), @@ -155,9 +163,11 @@ export default function LandingPage() { />