From 4c90ce7b6e2d544bc846f8ced9de485d75dd948b Mon Sep 17 00:00:00 2001 From: leon-morival Date: Mon, 13 Oct 2025 13:26:54 +0200 Subject: [PATCH] online videos --- src/config/firebase.js | 1 + src/screens/Home/Home.js | 12 ++++++++++-- src/screens/LandingPage.js | 18 ++++++++++++------ 3 files changed, 23 insertions(+), 8 deletions(-) diff --git a/src/config/firebase.js b/src/config/firebase.js index 780b00c..f8e86ac 100644 --- a/src/config/firebase.js +++ b/src/config/firebase.js @@ -50,6 +50,7 @@ export const projectsRef = firestore.collection("projects"); export const tasksRef = firestore.collection("tasks"); export const playlistsRef = firestore.collection("playlists"); export const chatsRef = firestore.collection("chats"); +export const videosRef = firestore.collection("videos"); export const notificationsRef = firestore.collection("notifications"); export const { arrayUnion, arrayRemove, increment, serverTimestamp } = diff --git a/src/screens/Home/Home.js b/src/screens/Home/Home.js index fe8dfd1..08080d4 100644 --- a/src/screens/Home/Home.js +++ b/src/screens/Home/Home.js @@ -7,7 +7,7 @@ import React, { } from "react"; import { Platform, StyleSheet, View } from "react-native"; import useMinuit from "react-native-minuit/src/hooks/useMinuit.js"; -import { background } from "../../assets"; +import { background, videos } from "../../assets"; import Alert from "../../components/Alert"; import BorderGradientButton from "../../components/BorderGradientButton"; import FeatureCarousel from "../../components/FeatureCarousel/FeatureCarousel"; @@ -16,7 +16,8 @@ import GradientButton from "../../components/GradientButton"; import MoreMenu from "../../components/MoreMenu"; import ProjectDropDown from "../../components/ProjectDropDown/ProjectDropDown"; import ShareBtn from "../../components/ShareBtn/ShareBtn"; -import { projectsRef, usersRef } from "../../config/firebase"; +import { projectsRef, usersRef, videosRef } from "../../config/firebase"; +import useDataFromRef from "../../hooks/useDataFromRef"; import { isWeb } from "../../hooks/useLayoutType.js"; import Page from "../../layouts/Page"; import { navigate } from "../../navigation/NavigationService"; @@ -325,6 +326,11 @@ const Home = () => { const adventureStarted = hasLocalAdventureFlag || !!currentUserData?.adventureStarted; + const { data: video } = useDataFromRef({ + ref: videosRef.doc("fr"), + simpleRef: true, + }); + const videoUrl = isWeb ? video?.landingWeb : video?.landing; return adventureStarted ? ( { }} > diff --git a/src/screens/LandingPage.js b/src/screens/LandingPage.js index 88207ee..bbe71de 100644 --- a/src/screens/LandingPage.js +++ b/src/screens/LandingPage.js @@ -1,10 +1,12 @@ +import { useNavigation } from "@react-navigation/native"; import { useCallback, useState } from "react"; import { View } from "react-native"; -import { useNavigation } from "@react-navigation/native"; import { background } from "../assets"; -import { usersRef } from "../config/firebase"; import FullscreenIntroVideo from "../components/FullscreenIntroVideo"; import GradientButton from "../components/GradientButton"; +import { usersRef, videosRef } from "../config/firebase"; +import useDataFromRef from "../hooks/useDataFromRef"; +import { isWeb } from "../hooks/useLayoutType"; import Page from "../layouts/Page"; import { Routes } from "../navigation/Routes"; import { useUser } from "../providers/UserDataProvider"; @@ -22,10 +24,9 @@ export default function LandingPage() { if (!currentUID) { return; } - await usersRef.doc(currentUID).set( - { adventureStarted: true }, - { merge: true } - ); + await usersRef + .doc(currentUID) + .set({ adventureStarted: true }, { merge: true }); }, [currentUID]); const handleVideoClose = useCallback(() => { @@ -38,6 +39,10 @@ export default function LandingPage() { navigation.navigate(Routes.Login); }); }, [navigation, persistAdventureStarted]); + const { data: video } = useDataFromRef({ + ref: videosRef.doc("fr"), + simpleRef: true, + }); return ( <> @@ -61,6 +66,7 @@ export default function LandingPage() {