feat: go back to home
This commit is contained in:
+60
-13
@@ -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,18 +520,32 @@ const Home = ({ navigation, route }) => {
|
|||||||
|
|
||||||
const topBar = (
|
const topBar = (
|
||||||
<View style={styles.topBar}>
|
<View style={styles.topBar}>
|
||||||
{mobileInfoRow}
|
<Pressable
|
||||||
<ProjectDropDown
|
onPress={handleNavigateToLanding}
|
||||||
ref={projectDropdownRef}
|
accessibilityRole="button"
|
||||||
style={styles.projectDropDown}
|
style={[
|
||||||
projects={projects}
|
styles.returnLandingButton,
|
||||||
selectedProject={currentProject}
|
isWeb ? styles.returnLandingButtonWeb : null,
|
||||||
allowEmptySelection
|
]}
|
||||||
onSelectProject={handleSelectProject}
|
>
|
||||||
onModifyProject={handleModifyProject}
|
<Text style={styles.returnLandingButtonText}>
|
||||||
onCreateProject={handleStartNew}
|
Retour à l'accueil
|
||||||
formatDate={formatDate}
|
</Text>
|
||||||
/>
|
</Pressable>
|
||||||
|
<View style={styles.topBarContent}>
|
||||||
|
{mobileInfoRow}
|
||||||
|
<ProjectDropDown
|
||||||
|
ref={projectDropdownRef}
|
||||||
|
style={styles.projectDropDown}
|
||||||
|
projects={projects}
|
||||||
|
selectedProject={currentProject}
|
||||||
|
allowEmptySelection
|
||||||
|
onSelectProject={handleSelectProject}
|
||||||
|
onModifyProject={handleModifyProject}
|
||||||
|
onCreateProject={handleStartNew}
|
||||||
|
formatDate={formatDate}
|
||||||
|
/>
|
||||||
|
</View>
|
||||||
</View>
|
</View>
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -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%",
|
||||||
|
|||||||
@@ -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,9 +163,11 @@ export default function LandingPage() {
|
|||||||
/>
|
/>
|
||||||
<GradientButton
|
<GradientButton
|
||||||
title={
|
title={
|
||||||
Platform.OS === "web"
|
isAuthenticated
|
||||||
? "Je me lance dans l'aventure"
|
? "Continuer l'aventure"
|
||||||
: "Commencer"
|
: Platform.OS === "web"
|
||||||
|
? "Je me lance dans l'aventure"
|
||||||
|
: "Commencer"
|
||||||
}
|
}
|
||||||
onPress={handleLaunchAdventure}
|
onPress={handleLaunchAdventure}
|
||||||
containerStyle={styles.actionButton}
|
containerStyle={styles.actionButton}
|
||||||
|
|||||||
Reference in New Issue
Block a user