online videos

This commit is contained in:
2025-10-13 13:26:54 +02:00
parent 7fdbb2344e
commit 4c90ce7b6e
3 changed files with 23 additions and 8 deletions
+1
View File
@@ -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 } =
+10 -2
View File
@@ -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 ? (
<Page
shareBtn
@@ -427,12 +433,14 @@ const Home = () => {
}}
>
<GradientButton
url={videos.landing}
title="Commencer l'aventure MusicLand"
onPress={handleStartVisit}
/>
</View>
</Page>
<FullscreenIntroVideo
url={videoUrl}
visible={isIntroVideoVisible}
onClose={handleIntroVideoClose}
/>
+12 -6
View File
@@ -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() {
</View>
</Page>
<FullscreenIntroVideo
url={isWeb ? video?.landingWeb : video?.landing}
visible={isVideoVisible}
onClose={handleVideoClose}
/>