feat: go back to home

This commit is contained in:
2025-12-03 17:18:37 +01:00
parent cc7782ae4e
commit 48fd1d8816
2 changed files with 74 additions and 17 deletions
+48 -1
View File
@@ -456,6 +456,10 @@ const Home = ({ navigation, route }) => {
setCoinModalVisible(false); setCoinModalVisible(false);
}, []); }, []);
const handleNavigateToLanding = useCallback(() => {
navigate(Routes.LandingPage);
}, []);
const stageCardContainerStyle = isWeb ? styles.cardsGrid : styles.cardsStack; const stageCardContainerStyle = isWeb ? styles.cardsGrid : styles.cardsStack;
const stageCardItemStyle = isWeb const stageCardItemStyle = isWeb
? styles.webStageCard ? styles.webStageCard
@@ -516,6 +520,19 @@ const Home = ({ navigation, route }) => {
const topBar = ( const topBar = (
<View style={styles.topBar}> <View style={styles.topBar}>
<Pressable
onPress={handleNavigateToLanding}
accessibilityRole="button"
style={[
styles.returnLandingButton,
isWeb ? styles.returnLandingButtonWeb : null,
]}
>
<Text style={styles.returnLandingButtonText}>
Retour à l'accueil
</Text>
</Pressable>
<View style={styles.topBarContent}>
{mobileInfoRow} {mobileInfoRow}
<ProjectDropDown <ProjectDropDown
ref={projectDropdownRef} ref={projectDropdownRef}
@@ -529,6 +546,7 @@ const Home = ({ navigation, route }) => {
formatDate={formatDate} formatDate={formatDate}
/> />
</View> </View>
</View>
); );
const journeyContent = ( const journeyContent = (
@@ -710,11 +728,40 @@ const styles = StyleSheet.create({
flexWrap: isWeb ? "wrap" : "nowrap", flexWrap: isWeb ? "wrap" : "nowrap",
alignItems: isWeb ? "center" : "stretch", alignItems: isWeb ? "center" : "stretch",
justifyContent: isWeb ? "center" : "flex-start", justifyContent: isWeb ? "center" : "flex-start",
gap: 12, gap: isWeb ? 0 : 12,
marginTop: isWeb ? 12 : 0, marginTop: isWeb ? 12 : 0,
marginBottom: isWeb ? 4 : 16, marginBottom: isWeb ? 4 : 16,
paddingHorizontal: isWeb ? 0 : gutters, paddingHorizontal: isWeb ? 0 : gutters,
zIndex: 10, 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: { projectDropDown: {
width: isWeb ? 420 : "100%", width: isWeb ? 420 : "100%",
+12 -2
View File
@@ -29,6 +29,7 @@ export default function LandingPage() {
const [videoUrl, setVideoUrl] = useState(null); const [videoUrl, setVideoUrl] = useState(null);
const [selectedLanguage, setSelectedLanguage] = useState(null); const [selectedLanguage, setSelectedLanguage] = useState(null);
const [showFreeCreditsPopup, setShowFreeCreditsPopup] = useState(false); const [showFreeCreditsPopup, setShowFreeCreditsPopup] = useState(false);
const isAuthenticated = !!currentUID;
const handleSelectLanguage = useCallback((language) => { const handleSelectLanguage = useCallback((language) => {
setSelectedLanguage(language); setSelectedLanguage(language);
@@ -38,8 +39,15 @@ export default function LandingPage() {
}, []); }, []);
const handleLaunchAdventure = useCallback(() => { const handleLaunchAdventure = useCallback(() => {
if (isAuthenticated) {
navigation.navigate(Routes.BottomTab, {
screen: Routes.HomeStack,
params: { screen: Routes.Home },
});
return;
}
navigation.navigate(Routes.Register); navigation.navigate(Routes.Register);
}, [navigation]); }, [isAuthenticated, navigation]);
const { data: video } = useDataFromRef({ const { data: video } = useDataFromRef({
ref: videosRef.doc("fr"), ref: videosRef.doc("fr"),
@@ -155,7 +163,9 @@ export default function LandingPage() {
/> />
<GradientButton <GradientButton
title={ title={
Platform.OS === "web" isAuthenticated
? "Continuer l'aventure"
: Platform.OS === "web"
? "Je me lance dans l'aventure" ? "Je me lance dans l'aventure"
: "Commencer" : "Commencer"
} }